RemoteLinux: Introduce installation prefix to deployment information.

Now if some platform interprets deploy paths in project files relative
to some base directory, it can make this visible to users.

Change-Id: Ie9098e57b05f19568131e33df43a0b0f5f5888a3
Reviewed-by: Alessandro Portale <alessandro.portale@nokia.com>
This commit is contained in:
Christian Kandeler
2012-03-14 17:41:24 +01:00
parent b4ea013864
commit 0cfff86753
4 changed files with 22 additions and 9 deletions

View File

@@ -74,7 +74,7 @@ public:
using namespace Internal; using namespace Internal;
DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode, DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode,
QObject *parent) const QString &installPrefix, QObject *parent)
: QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode)) : QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode))
{ {
if (d->projectType == ApplicationTemplate) { if (d->projectType == ApplicationTemplate) {
@@ -90,6 +90,12 @@ DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFi
foreach (const QString &file, elem.files) foreach (const QString &file, elem.files)
d->deployables << DeployableFile(file, elem.path); d->deployables << DeployableFile(file, elem.path);
} }
for (int i = 0; i < d->deployables.count(); ++i) {
QString &remoteDir = d->deployables[i].remoteDir;
if (QFileInfo(remoteDir).isRelative())
remoteDir.prepend(installPrefix + QLatin1Char('/'));
}
} }
DeployableFilesPerProFile::~DeployableFilesPerProFile() DeployableFilesPerProFile::~DeployableFilesPerProFile()
@@ -133,7 +139,7 @@ QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) con
if (index.column() == 0 && role == Qt::DisplayRole) if (index.column() == 0 && role == Qt::DisplayRole)
return QDir::toNativeSeparators(d.localFilePath); return QDir::toNativeSeparators(d.localFilePath);
if (role == Qt::DisplayRole || role == Qt::EditRole) if (role == Qt::DisplayRole || role == Qt::EditRole)
return d.remoteDir; return QDir::cleanPath(d.remoteDir);
return QVariant(); return QVariant();
} }

View File

@@ -53,7 +53,7 @@ class REMOTELINUX_EXPORT DeployableFilesPerProFile : public QAbstractTableModel
Q_OBJECT Q_OBJECT
public: public:
DeployableFilesPerProFile(const Qt4ProjectManager::Qt4ProFileNode *proFileNode, DeployableFilesPerProFile(const Qt4ProjectManager::Qt4ProFileNode *proFileNode,
QObject *parent); const QString &installPrefix, QObject *parent);
~DeployableFilesPerProFile(); ~DeployableFilesPerProFile();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;

View File

@@ -53,17 +53,17 @@ public:
QList<DeployableFilesPerProFile *> listModels; QList<DeployableFilesPerProFile *> listModels;
const AbstractEmbeddedLinuxTarget * const target; const AbstractEmbeddedLinuxTarget * const target;
QString installPrefix;
}; };
} // namespace Internal } // namespace Internal
using namespace Internal; using namespace Internal;
DeploymentInfo::DeploymentInfo(AbstractEmbeddedLinuxTarget *target) : DeploymentInfo::DeploymentInfo(AbstractEmbeddedLinuxTarget *target, const QString &installPrefix)
QAbstractListModel(target), : QAbstractListModel(target), d(new DeploymentInfoPrivate(target))
d(new DeploymentInfoPrivate(target))
{ {
connect (d->target->qt4Project(), SIGNAL(proParsingDone()), SLOT(createModels())); connect (d->target->qt4Project(), SIGNAL(proParsingDone()), SLOT(createModels()));
createModels(); setInstallPrefix(installPrefix);
} }
DeploymentInfo::~DeploymentInfo() DeploymentInfo::~DeploymentInfo()
@@ -102,7 +102,7 @@ void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode)
case ApplicationTemplate: case ApplicationTemplate:
case LibraryTemplate: case LibraryTemplate:
case AuxTemplate: case AuxTemplate:
d->listModels << new DeployableFilesPerProFile(proFileNode, this); d->listModels << new DeployableFilesPerProFile(proFileNode, d->installPrefix, this);
break; break;
case SubDirsTemplate: { case SubDirsTemplate: {
const QList<Qt4PriFileNode *> &subProjects = proFileNode->subProjectNodesExact(); const QList<Qt4PriFileNode *> &subProjects = proFileNode->subProjectNodesExact();
@@ -133,6 +133,12 @@ bool DeploymentInfo::isModified() const
return false; return false;
} }
void DeploymentInfo::setInstallPrefix(const QString &installPrefix)
{
d->installPrefix = installPrefix;
createModels();
}
int DeploymentInfo::deployableCount() const int DeploymentInfo::deployableCount() const
{ {
int count = 0; int count = 0;

View File

@@ -51,11 +51,12 @@ class REMOTELINUX_EXPORT DeploymentInfo : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
public: public:
DeploymentInfo(AbstractEmbeddedLinuxTarget *target); DeploymentInfo(AbstractEmbeddedLinuxTarget *target, const QString &installPrefix = QString());
~DeploymentInfo(); ~DeploymentInfo();
void setUnmodified(); void setUnmodified();
bool isModified() const; bool isModified() const;
void setInstallPrefix(const QString &installPrefix);
int deployableCount() const; int deployableCount() const;
DeployableFile deployableAt(int i) const; DeployableFile deployableAt(int i) const;
QString remoteExecutableFilePath(const QString &localExecutableFilePath) const; QString remoteExecutableFilePath(const QString &localExecutableFilePath) const;