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;
DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode,
QObject *parent)
const QString &installPrefix, QObject *parent)
: QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode))
{
if (d->projectType == ApplicationTemplate) {
@@ -90,6 +90,12 @@ DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFi
foreach (const QString &file, elem.files)
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()
@@ -133,7 +139,7 @@ QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) con
if (index.column() == 0 && role == Qt::DisplayRole)
return QDir::toNativeSeparators(d.localFilePath);
if (role == Qt::DisplayRole || role == Qt::EditRole)
return d.remoteDir;
return QDir::cleanPath(d.remoteDir);
return QVariant();
}

View File

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

View File

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

View File

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