diff options
Diffstat (limited to 'src/plugins/remotelinux')
38 files changed, 260 insertions, 1593 deletions
diff --git a/src/plugins/remotelinux/RemoteLinux.pluginspec.in b/src/plugins/remotelinux/RemoteLinux.pluginspec.in index 8cf3bcec70..84270a6269 100644 --- a/src/plugins/remotelinux/RemoteLinux.pluginspec.in +++ b/src/plugins/remotelinux/RemoteLinux.pluginspec.in @@ -17,6 +17,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General <dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/> <dependency name=\"Debugger\" version=\"$$QTCREATOR_VERSION\"/> <dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/> - <dependency name=\"Qt4ProjectManager\" version=\"$$QTCREATOR_VERSION\"/> + <dependency name=\"QtSupport\" version=\"$$QTCREATOR_VERSION\"/> </dependencyList> </plugin> diff --git a/src/plugins/remotelinux/abstractpackagingstep.cpp b/src/plugins/remotelinux/abstractpackagingstep.cpp index 05a4056631..f002f6988b 100644 --- a/src/plugins/remotelinux/abstractpackagingstep.cpp +++ b/src/plugins/remotelinux/abstractpackagingstep.cpp @@ -28,12 +28,12 @@ **************************************************************************/ #include "abstractpackagingstep.h" -#include "deployablefile.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" #include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/deploymentdata.h> #include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> #include <projectexplorer/task.h> #include <utils/fileutils.h> @@ -54,6 +54,7 @@ public: BuildConfiguration *currentBuildConfiguration; QString cachedPackageFilePath; QString cachedPackageDirectory; + bool deploymentDataModified; }; } // namespace Internal @@ -77,8 +78,10 @@ void AbstractPackagingStep::ctor() SLOT(handleBuildConfigurationChanged())); handleBuildConfigurationChanged(); - connect(this, SIGNAL(unmodifyDeploymentInfo()), - this, SLOT(setDeploymentInfoUnmodified())); + connect(project(), SIGNAL(buildSystemEvaluated()), SLOT(setDeploymentDataModified())); + setDeploymentDataModified(); + + connect(this, SIGNAL(unmodifyDeploymentData()), this, SLOT(setDeploymentDataUnmodified())); } AbstractPackagingStep::~AbstractPackagingStep() @@ -128,16 +131,16 @@ RemoteLinuxDeployConfiguration *AbstractPackagingStep::deployConfiguration() con bool AbstractPackagingStep::isPackagingNeeded() const { - const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo(); QFileInfo packageInfo(packageFilePath()); - if (!packageInfo.exists() || deploymentInfo->isModified()) + if (!packageInfo.exists() || d->deploymentDataModified) return true; - const int deployableCount = deploymentInfo->deployableCount(); - for (int i = 0; i < deployableCount; ++i) { - if (Utils::FileUtils::isFileNewerThan(deploymentInfo->deployableAt(i).localFilePath, - packageInfo.lastModified())) + const DeploymentData &dd = target()->deploymentData(); + for (int i = 0; i < dd.fileCount(); ++i) { + if (Utils::FileUtils::isFileNewerThan(dd.fileAt(i).localFilePath().toString(), + packageInfo.lastModified())) { return true; + } } return false; @@ -158,13 +161,18 @@ void AbstractPackagingStep::setPackagingStarted() void AbstractPackagingStep::setPackagingFinished(bool success) { if (success) - emit unmodifyDeploymentInfo(); + emit unmodifyDeploymentData(); } // called in gui thread -void AbstractPackagingStep::setDeploymentInfoUnmodified() +void AbstractPackagingStep::setDeploymentDataUnmodified() +{ + d->deploymentDataModified = false; +} + +void AbstractPackagingStep::setDeploymentDataModified() { - deployConfiguration()->deploymentInfo()->setUnmodified(); + d->deploymentDataModified = true; } void AbstractPackagingStep::raiseError(const QString &errorMessage) diff --git a/src/plugins/remotelinux/abstractpackagingstep.h b/src/plugins/remotelinux/abstractpackagingstep.h index cdb09dd9c2..0fcd759b52 100644 --- a/src/plugins/remotelinux/abstractpackagingstep.h +++ b/src/plugins/remotelinux/abstractpackagingstep.h @@ -35,11 +35,8 @@ namespace RemoteLinux { class RemoteLinuxDeployConfiguration; -class DeploymentInfo; -namespace Internal { -class AbstractPackagingStepPrivate; -} +namespace Internal { class AbstractPackagingStepPrivate; } class REMOTELINUX_EXPORT AbstractPackagingStep : public ProjectExplorer::BuildStep { @@ -56,7 +53,7 @@ public: signals: void packageFilePathChanged(); - void unmodifyDeploymentInfo(); + void unmodifyDeploymentData(); protected: void setPackagingStarted(); @@ -71,7 +68,8 @@ protected: private slots: void handleBuildConfigurationChanged(); - void setDeploymentInfoUnmodified(); + void setDeploymentDataUnmodified(); + void setDeploymentDataModified(); private: virtual QString packageFileName() const = 0; diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp index e0b3640f89..978ba516cd 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp @@ -30,9 +30,8 @@ #include "abstractremotelinuxdeployservice.h" -#include "deployablefile.h" - #include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/deployablefile.h> #include <projectexplorer/target.h> #include <qtsupport/qtprofileinformation.h> #include <utils/qtcassert.h> @@ -160,7 +159,7 @@ bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const Deplo const QDateTime &lastDeployed = d->lastDeployed.value(DeployParameters(deployableFile, deviceConfiguration()->sshParameters().host, systemRoot)); return !lastDeployed.isValid() - || QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed; + || deployableFile.localFilePath().toFileInfo().lastModified() > lastDeployed; } void AbstractRemoteLinuxDeployService::setBuildConfiguration(BuildConfiguration *bc) @@ -236,8 +235,8 @@ QVariantMap AbstractRemoteLinuxDeployService::exportDeployTimes() const QVariantList timeList; typedef QHash<DeployParameters, QDateTime>::ConstIterator DepIt; for (DepIt it = d->lastDeployed.begin(); it != d->lastDeployed.end(); ++it) { - fileList << it.key().file.localFilePath; - remotePathList << it.key().file.remoteDir; + fileList << it.key().file.localFilePath().toString(); + remotePathList << it.key().file.remoteDirectory(); hostList << it.key().host; sysrootList << it.key().sysroot; timeList << it.value(); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h index 0060db5df7..0cae51e586 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h @@ -42,16 +42,12 @@ namespace QSsh { class SshConnection; } namespace ProjectExplorer { class BuildConfiguration; +class DeployableFile; class Profile; } namespace RemoteLinux { -class DeployableFile; -class DeploymentInfo; - -namespace Internal { -class AbstractRemoteLinuxDeployServicePrivate; -} +namespace Internal { class AbstractRemoteLinuxDeployServicePrivate; } class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployService : public QObject { @@ -83,8 +79,8 @@ protected: ProjectExplorer::IDevice::ConstPtr deviceConfiguration() const; QSsh::SshConnection *connection() const; - void saveDeploymentTimeStamp(const DeployableFile &deployableFile); - bool hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const; + void saveDeploymentTimeStamp(const ProjectExplorer::DeployableFile &deployableFile); + bool hasChangedSinceLastDeployment(const ProjectExplorer::DeployableFile &deployableFile) const; void handleDeviceSetupDone(bool success); void handleDeploymentDone(); diff --git a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp index 9683622d56..07a58d35a8 100644 --- a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp +++ b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp @@ -30,16 +30,18 @@ #include "abstractuploadandinstallpackageservice.h" -#include "deployablefile.h" #include "packageuploader.h" #include "remotelinuxpackageinstaller.h" +#include <projectexplorer/deployablefile.h> #include <utils/qtcassert.h> #include <ssh/sshconnection.h> #include <QFileInfo> #include <QString> +using namespace ProjectExplorer; + namespace RemoteLinux { namespace Internal { namespace { diff --git a/src/plugins/remotelinux/deployablefile.h b/src/plugins/remotelinux/deployablefile.h deleted file mode 100644 index ed4041d4f7..0000000000 --- a/src/plugins/remotelinux/deployablefile.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#ifndef DEPLOYABLEFILE_H -#define DEPLOYABLEFILE_H - -#include "remotelinux_export.h" - -#include <QFileInfo> -#include <QHash> -#include <QString> - -namespace RemoteLinux { - -class REMOTELINUX_EXPORT DeployableFile -{ -public: - DeployableFile() {} - - DeployableFile(const QString &localFilePath, const QString &remoteDir) - : localFilePath(localFilePath), remoteDir(remoteDir) {} - - bool operator==(const DeployableFile &other) const - { - return localFilePath == other.localFilePath - && remoteDir == other.remoteDir; - } - - QString remoteFilePath() const { - return remoteDir + QLatin1Char('/') + QFileInfo(localFilePath).fileName(); - } - - QString localFilePath; - QString remoteDir; -}; - -inline uint qHash(const DeployableFile &d) -{ - return qHash(qMakePair(d.localFilePath, d.remoteDir)); -} - -} // namespace RemoteLinux - -#endif // DEPLOYABLEFILE_H diff --git a/src/plugins/remotelinux/deployablefilesperprofile.cpp b/src/plugins/remotelinux/deployablefilesperprofile.cpp deleted file mode 100644 index a7b930c974..0000000000 --- a/src/plugins/remotelinux/deployablefilesperprofile.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ -#include "deployablefilesperprofile.h" - -#include "deployablefile.h" - -#include <utils/qtcassert.h> - -#include <QFileInfo> -#include <QDir> -#include <QBrush> - -using namespace Qt4ProjectManager; - -namespace RemoteLinux { -namespace Internal { -class DeployableFilesPerProFilePrivate -{ -public: - DeployableFilesPerProFilePrivate(const Qt4ProFileNode *proFileNode) - : projectType(proFileNode->projectType()), - proFilePath(proFileNode->path()), - projectName(proFileNode->displayName()), - targetInfo(proFileNode->targetInformation()), - installsList(proFileNode->installsList()), - projectVersion(proFileNode->projectVersion()), - config(proFileNode->variableValue(ConfigVar)), - modified(true) - { - } - - const Qt4ProjectType projectType; - const QString proFilePath; - const QString projectName; - const Qt4ProjectManager::TargetInformation targetInfo; - const Qt4ProjectManager::InstallsList installsList; - const Qt4ProjectManager::ProjectVersion projectVersion; - const QStringList config; - QList<DeployableFile> deployables; - bool modified; -}; - -} // namespace Internal - -using namespace Internal; - -DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode, - const QString &installPrefix, QObject *parent) - : QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode)) -{ - if (hasTargetPath()) { - if (d->projectType == ApplicationTemplate) { - d->deployables.prepend(DeployableFile(localExecutableFilePath(), - d->installsList.targetPath)); - } else if (d->projectType == LibraryTemplate) { - foreach (const QString &filePath, localLibraryFilePaths()) { - d->deployables.prepend(DeployableFile(filePath, - d->installsList.targetPath)); - } - } - } - - foreach (const InstallsItem &elem, d->installsList.items) { - foreach (const QString &file, elem.files) - d->deployables << DeployableFile(file, elem.path); - } - - if (!installPrefix.isEmpty()) { - for (int i = 0; i < d->deployables.count(); ++i) - d->deployables[i].remoteDir.prepend(installPrefix + QLatin1Char('/')); - } -} - -DeployableFilesPerProFile::~DeployableFilesPerProFile() -{ - delete d; -} - -DeployableFile DeployableFilesPerProFile::deployableAt(int row) const -{ - Q_ASSERT(row >= 0 && row < rowCount()); - return d->deployables.at(row); -} - -int DeployableFilesPerProFile::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : d->deployables.count(); -} - -int DeployableFilesPerProFile::columnCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : 2; -} - -QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= rowCount()) - return QVariant(); - - const DeployableFile &d = deployableAt(index.row()); - if (index.column() == 0 && role == Qt::DisplayRole) - return QDir::toNativeSeparators(d.localFilePath); - if (role == Qt::DisplayRole) - return QDir::cleanPath(d.remoteDir); - return QVariant(); -} - -QVariant DeployableFilesPerProFile::headerData(int section, - Qt::Orientation orientation, int role) const -{ - if (orientation == Qt::Vertical || role != Qt::DisplayRole) - return QVariant(); - return section == 0 ? tr("Local File Path") : tr("Remote Directory"); -} - -QString DeployableFilesPerProFile::localExecutableFilePath() const -{ - if (!d->targetInfo.valid || d->projectType != ApplicationTemplate) - return QString(); - return QDir::cleanPath(d->targetInfo.workingDir + '/' + d->targetInfo.target); -} - -QStringList DeployableFilesPerProFile::localLibraryFilePaths() const -{ - QStringList list; - - if (!d->targetInfo.valid || d->projectType != LibraryTemplate) - return list; - QString basePath = d->targetInfo.workingDir + QLatin1String("/lib"); - const bool isStatic = d->config.contains(QLatin1String("static")) - || d->config.contains(QLatin1String("staticlib")); - basePath += d->targetInfo.target + QLatin1String(isStatic ? ".a" : ".so"); - basePath = QDir::cleanPath(basePath); - if (!isStatic && !d->config.contains(QLatin1String("plugin"))) { - const QChar dot(QLatin1Char('.')); - const QString filePathMajor = basePath + dot - + QString::number(d->projectVersion.major); - const QString filePathMinor = filePathMajor + dot - + QString::number(d->projectVersion.minor); - const QString filePathPatch = filePathMinor + dot - + QString::number(d->projectVersion.patch); - list << filePathPatch << filePathMinor << filePathMajor; - } - return list << basePath; -} - -QString DeployableFilesPerProFile::remoteExecutableFilePath() const -{ - return hasTargetPath() && d->projectType == ApplicationTemplate - ? deployableAt(0).remoteDir + QLatin1Char('/') - + QFileInfo(localExecutableFilePath()).fileName() - : QString(); -} - -QString DeployableFilesPerProFile::projectDir() const -{ - return QFileInfo(d->proFilePath).dir().path(); -} - -bool DeployableFilesPerProFile::hasTargetPath() const -{ - return !d->installsList.targetPath.isEmpty(); -} - -bool DeployableFilesPerProFile::isModified() const { return d->modified; } -void DeployableFilesPerProFile::setUnModified() { d->modified = false; } -QString DeployableFilesPerProFile::projectName() const { return d->projectName; } -QString DeployableFilesPerProFile::proFilePath() const { return d->proFilePath; } -Qt4ProjectType DeployableFilesPerProFile::projectType() const { return d->projectType; } -QString DeployableFilesPerProFile::applicationName() const { return d->targetInfo.target; } - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deployablefilesperprofile.h b/src/plugins/remotelinux/deployablefilesperprofile.h deleted file mode 100644 index d2c8210eb7..0000000000 --- a/src/plugins/remotelinux/deployablefilesperprofile.h +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#ifndef DEPLOYABLEFILESPERPROFILE_H -#define DEPLOYABLEFILESPERPROFILE_H - -#include "remotelinux_export.h" - -#include <qt4projectmanager/qt4nodes.h> - -#include <QAbstractTableModel> -#include <QList> -#include <QString> - -namespace RemoteLinux { -class DeployableFile; - -namespace Internal { -class DeployableFilesPerProFilePrivate; -} - -class REMOTELINUX_EXPORT DeployableFilesPerProFile : public QAbstractTableModel -{ - Q_OBJECT -public: - DeployableFilesPerProFile(const Qt4ProjectManager::Qt4ProFileNode *proFileNode, - const QString &installPrefix, QObject *parent); - ~DeployableFilesPerProFile(); - - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - - DeployableFile deployableAt(int row) const; - bool isModified() const; - void setUnModified(); - QString localExecutableFilePath() const; - QString remoteExecutableFilePath() const; - QString projectName() const; - QString projectDir() const; - QString proFilePath() const; - Qt4ProjectManager::Qt4ProjectType projectType() const; - bool isApplicationProject() const { return projectType() == Qt4ProjectManager::ApplicationTemplate; } - QString applicationName() const; - bool hasTargetPath() const; - -private: - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex &index, - int role = Qt::DisplayRole) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - - QStringList localLibraryFilePaths() const; - - Internal::DeployableFilesPerProFilePrivate * const d; -}; - -} // namespace RemoteLinux - -#endif // DEPLOYABLEFILESPERPROFILE_H diff --git a/src/plugins/remotelinux/deploymentinfo.cpp b/src/plugins/remotelinux/deploymentinfo.cpp deleted file mode 100644 index 7c69ef89fa..0000000000 --- a/src/plugins/remotelinux/deploymentinfo.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#include "deploymentinfo.h" - -#include "deployablefile.h" -#include "deployablefilesperprofile.h" -#include "remotelinuxdeployconfiguration.h" - -#include <projectexplorer/buildstep.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> -#include <qtsupport/qtprofileinformation.h> - -#include <QList> -#include <QTimer> - -using namespace Qt4ProjectManager; - -namespace RemoteLinux { -namespace Internal { -class DeploymentInfoPrivate -{ -public: - DeploymentInfoPrivate(const Qt4ProjectManager::Qt4Project *p) : project(p) {} - - QList<DeployableFilesPerProFile *> listModels; - const Qt4ProjectManager::Qt4Project *const project; - QString installPrefix; -}; -} // namespace Internal - -using namespace Internal; - -DeploymentInfo::DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix) - : QAbstractListModel(project), d(new DeploymentInfoPrivate(project)) -{ - connect(project, SIGNAL(buildSystemEvaluated()), SLOT(createModels())); - setInstallPrefix(installPrefix); -} - -DeploymentInfo::~DeploymentInfo() -{ - delete d; -} - -void DeploymentInfo::createModels() -{ - ProjectExplorer::Target *target = d->project->activeTarget(); - if (!target - || !target->activeDeployConfiguration() - || !qobject_cast<RemoteLinuxDeployConfiguration *>(target->activeDeployConfiguration())) - return; - - QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile()); - if (!version || !version->isValid()) { - beginResetModel(); - qDeleteAll(d->listModels); - d->listModels.clear(); - endResetModel(); - return; - } - const Qt4ProFileNode *const rootNode = d->project->rootQt4ProjectNode(); - if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard. - return; - disconnect(d->project, SIGNAL(buildSystemEvaluated()), this, SLOT(createModels())); - beginResetModel(); - qDeleteAll(d->listModels); - d->listModels.clear(); - createModels(rootNode); - endResetModel(); - connect (d->project, SIGNAL(buildSystemEvaluated()), SLOT(createModels())); -} - -void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode) -{ - switch (proFileNode->projectType()) { - case ApplicationTemplate: - case LibraryTemplate: - case AuxTemplate: - d->listModels << new DeployableFilesPerProFile(proFileNode, d->installPrefix, this); - break; - case SubDirsTemplate: { - const QList<Qt4PriFileNode *> &subProjects = proFileNode->subProjectNodesExact(); - foreach (const ProjectExplorer::ProjectNode * const subProject, subProjects) { - const Qt4ProFileNode * const qt4SubProject - = qobject_cast<const Qt4ProFileNode *>(subProject); - if (!qt4SubProject) - continue; - if (qt4SubProject->path().endsWith(QLatin1String(".pri"))) - continue; - if (!proFileNode->isSubProjectDeployable(subProject->path())) - continue; - createModels(qt4SubProject); - } - } - default: - break; - } -} - -void DeploymentInfo::setUnmodified() -{ - foreach (DeployableFilesPerProFile * const model, d->listModels) - model->setUnModified(); -} - -bool DeploymentInfo::isModified() const -{ - foreach (const DeployableFilesPerProFile * const model, d->listModels) { - if (model->isModified()) - return true; - } - return false; -} - -void DeploymentInfo::setInstallPrefix(const QString &installPrefix) -{ - d->installPrefix = installPrefix; - createModels(); -} - -int DeploymentInfo::deployableCount() const -{ - int count = 0; - foreach (const DeployableFilesPerProFile * const model, d->listModels) - count += model->rowCount(); - return count; -} - -DeployableFile DeploymentInfo::deployableAt(int i) const -{ - foreach (const DeployableFilesPerProFile * const model, d->listModels) { - Q_ASSERT(i >= 0); - if (i < model->rowCount()) - return model->deployableAt(i); - i -= model->rowCount(); - } - - Q_ASSERT(!"Invalid deployable number"); - return DeployableFile(QString(), QString()); -} - -QString DeploymentInfo::remoteExecutableFilePath(const QString &localExecutableFilePath) const -{ - foreach (const DeployableFilesPerProFile * const model, d->listModels) { - if (model->localExecutableFilePath() == localExecutableFilePath) - return model->remoteExecutableFilePath(); - } - return QString(); -} - -int DeploymentInfo::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : modelCount(); -} - -QVariant DeploymentInfo::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() < 0 || index.row() >= modelCount() - || index.column() != 0) - return QVariant(); - const DeployableFilesPerProFile * const model = d->listModels.at(index.row()); - if (role == Qt::ForegroundRole && model->projectType() != AuxTemplate - && !model->hasTargetPath()) { - QBrush brush; - brush.setColor(Qt::red); - return brush; - } - if (role == Qt::DisplayRole) - return QFileInfo(model->proFilePath()).fileName(); - return QVariant(); -} - -int DeploymentInfo::modelCount() const { return d->listModels.count(); } -DeployableFilesPerProFile *DeploymentInfo::modelAt(int i) const { return d->listModels.at(i); } - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deploymentinfo.h b/src/plugins/remotelinux/deploymentinfo.h deleted file mode 100644 index db8bf35d0a..0000000000 --- a/src/plugins/remotelinux/deploymentinfo.h +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#ifndef DEPLOYMENTINFO_H -#define DEPLOYMENTINFO_H - -#include "remotelinux_export.h" - -#include <QAbstractListModel> - -namespace ProjectExplorer { class Target; } -namespace Qt4ProjectManager { -class Qt4ProFileNode; -class Qt4Project; -} // namespace Qt4ProjectManager - -namespace RemoteLinux { -class DeployableFile; -class DeployableFilesPerProFile; - -namespace Internal { -class DeploymentInfoPrivate; -} - -class REMOTELINUX_EXPORT DeploymentInfo : public QAbstractListModel -{ - Q_OBJECT -public: - DeploymentInfo(Qt4ProjectManager::Qt4Project *project, 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; - int modelCount() const; - DeployableFilesPerProFile *modelAt(int i) const; - -private slots: - void createModels(); - -private: - virtual int rowCount(const QModelIndex &parent) const; - virtual QVariant data(const QModelIndex &index, int role) const; - - void createModels(const Qt4ProjectManager::Qt4ProFileNode *proFileNode); - - Internal::DeploymentInfoPrivate * const d; -}; - -} // namespace RemoteLinux - -#endif // DEPLOYMENTINFO_H diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.cpp b/src/plugins/remotelinux/deploymentsettingsassistant.cpp deleted file mode 100644 index d8518cd376..0000000000 --- a/src/plugins/remotelinux/deploymentsettingsassistant.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ -#include "deploymentsettingsassistant.h" - -#include "deploymentinfo.h" -#include "deployablefile.h" -#include "deployablefilesperprofile.h" -#include "profilesupdatedialog.h" -#include "remotelinuxdeployconfiguration.h" - -#include <coreplugin/documentmanager.h> -#include <coreplugin/icore.h> -#include <projectexplorer/project.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4nodes.h> -#include <utils/fileutils.h> -#include <utils/qtcassert.h> - -#include <QDir> -#include <QHash> -#include <QString> - -using namespace Qt4ProjectManager; - -namespace RemoteLinux { -namespace Internal { -namespace { - -enum ProFileUpdateSetting { UpdateProFile, DontUpdateProFile }; -typedef QHash<QString, ProFileUpdateSetting> UpdateSettingsMap; - -} // anonymous namespace - -class DeploymentSettingsAssistantInternal -{ -public: - DeploymentSettingsAssistantInternal(DeploymentInfo *deploymentInfo) - : deploymentInfo(deploymentInfo) - { - } - - DeploymentInfo * const deploymentInfo; - UpdateSettingsMap updateSettings; -}; - -} // namespace Internal - -using namespace Internal; - -DeploymentSettingsAssistant::DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo, - ProjectExplorer::Project *parent) - : QObject(parent), - d(new DeploymentSettingsAssistantInternal(deploymentInfo)) -{ - connect(d->deploymentInfo, SIGNAL(modelReset()), SLOT(handleDeploymentInfoUpdated())); -} - -DeploymentSettingsAssistant::~DeploymentSettingsAssistant() -{ - delete d; -} - -bool DeploymentSettingsAssistant::addDeployableToProFile(const QString &qmakeScope, - const DeployableFilesPerProFile *proFileInfo, const QString &variableName, - const DeployableFile &deployable) -{ - const QString filesLine = variableName + QLatin1String(".files = ") - + QDir(proFileInfo->projectDir()).relativeFilePath(deployable.localFilePath); - const QString pathLine = variableName + QLatin1String(".path = ") + deployable.remoteDir; - const QString installsLine = QLatin1String("INSTALLS += ") + variableName; - return addLinesToProFile(qmakeScope, proFileInfo, - QStringList() << filesLine << pathLine << installsLine); -} - -bool DeploymentSettingsAssistant::addLinesToProFile(const QString &qmakeScope, - const DeployableFilesPerProFile *proFileInfo, - const QStringList &lines) -{ - Core::FileChangeBlocker update(proFileInfo->proFilePath()); - - const QString separator = QLatin1String("\n "); - const QString proFileString = QLatin1Char('\n') + qmakeScope + QLatin1String(" {") - + separator + lines.join(separator) + QLatin1String("\n}\n"); - Utils::FileSaver saver(proFileInfo->proFilePath(), QIODevice::Append); - saver.write(proFileString.toLocal8Bit()); - return saver.finalize(Core::ICore::mainWindow()); -} - -void DeploymentSettingsAssistant::handleDeploymentInfoUpdated() -{ - ProjectExplorer::Project *project = static_cast<ProjectExplorer::Project *>(parent()); - QStringList scopes; - QStringList pathes; - foreach (ProjectExplorer::Target *target, project->targets()) { - foreach (ProjectExplorer::DeployConfiguration *dc, target->deployConfigurations()) { - RemoteLinuxDeployConfiguration *rldc = qobject_cast<RemoteLinuxDeployConfiguration *>(dc); - if (!rldc) - continue; - const QString scope = rldc->qmakeScope(); - if (!scopes.contains(scope)) { - scopes.append(scope); - pathes.append(rldc->installPrefix()); - } - } - } - if (scopes.isEmpty()) - return; - - QList<DeployableFilesPerProFile *> proFilesToAskAbout; - QList<DeployableFilesPerProFile *> proFilesToUpdate; - for (int i = 0; i < d->deploymentInfo->modelCount(); ++i) { - DeployableFilesPerProFile * const proFileInfo = d->deploymentInfo->modelAt(i); - if (proFileInfo->projectType() != AuxTemplate && !proFileInfo->hasTargetPath()) { - const UpdateSettingsMap::ConstIterator it - = d->updateSettings.find(proFileInfo->proFilePath()); - if (it == d->updateSettings.constEnd()) - proFilesToAskAbout << proFileInfo; - else if (it.value() == UpdateProFile) - proFilesToUpdate << proFileInfo; - } - } - - if (!proFilesToAskAbout.isEmpty()) { - ProFilesUpdateDialog dialog(proFilesToAskAbout); - dialog.exec(); - const QList<ProFilesUpdateDialog::UpdateSetting> &settings = dialog.getUpdateSettings(); - foreach (const ProFilesUpdateDialog::UpdateSetting &setting, settings) { - const ProFileUpdateSetting updateSetting = setting.second - ? UpdateProFile : DontUpdateProFile; - d->updateSettings.insert(setting.first->proFilePath(), updateSetting); - if (updateSetting == UpdateProFile) - proFilesToUpdate << setting.first; - } - } - - foreach (const DeployableFilesPerProFile * const proFileInfo, proFilesToUpdate) { - const QString remoteDirSuffix = QLatin1String(proFileInfo->projectType() == LibraryTemplate - ? "/lib" : "/bin"); - for (int i = 0; i < scopes.count(); ++i) { - const QString remoteDir = QLatin1String("target.path = ") + pathes.at(i) - + QLatin1Char('/') + proFileInfo->projectName() + remoteDirSuffix; - const QStringList deployInfo = QStringList() << remoteDir - << QLatin1String("INSTALLS += target"); - addLinesToProFile(scopes.at(i), proFileInfo, deployInfo); - } - } -} - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.h b/src/plugins/remotelinux/deploymentsettingsassistant.h deleted file mode 100644 index 63775e946a..0000000000 --- a/src/plugins/remotelinux/deploymentsettingsassistant.h +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ -#ifndef DEPLOYMENTSETTINGSASSISTANT_H -#define DEPLOYMENTSETTINGSASSISTANT_H - -#include "remotelinux_export.h" - -#include <QObject> -#include <QStringList> - -namespace ProjectExplorer { class Project; } - -namespace RemoteLinux { -class DeployableFile; -class DeployableFilesPerProFile; -class DeploymentInfo; - -namespace Internal { class DeploymentSettingsAssistantInternal; } - -class REMOTELINUX_EXPORT DeploymentSettingsAssistant : public QObject -{ - Q_OBJECT - -public: - DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo, ProjectExplorer::Project *parent); - ~DeploymentSettingsAssistant(); - - bool addDeployableToProFile(const QString &qmakeScope, - const DeployableFilesPerProFile *proFileInfo, - const QString &variableName, const DeployableFile &deployable); - -private slots: - void handleDeploymentInfoUpdated(); - -private: - bool addLinesToProFile(const QString &qmakeScope, const DeployableFilesPerProFile *proFileInfo, const QStringList &lines); - - Internal::DeploymentSettingsAssistantInternal * const d; -}; - -} // namespace RemoteLinux - -#endif // DEPLOYMENTSETTINGSASSISTANT_H diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index 1024d19191..01c9a2efd0 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -29,8 +29,7 @@ **************************************************************************/ #include "genericdirectuploadservice.h" -#include "deployablefile.h" - +#include <projectexplorer/deployablefile.h> #include <utils/qtcassert.h> #include <ssh/sftpchannel.h> #include <ssh/sshconnection.h> @@ -41,6 +40,7 @@ #include <QList> #include <QString> +using namespace ProjectExplorer; using namespace QSsh; namespace RemoteLinux { @@ -163,8 +163,9 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con const DeployableFile df = d->filesToUpload.takeFirst(); if (!errorMsg.isEmpty()) { QString errorString = tr("Upload of file '%1' failed. The server said: '%2'.") - .arg(QDir::toNativeSeparators(df.localFilePath), errorMsg); - if (errorMsg == QLatin1String("Failure") && df.remoteDir.contains(QLatin1String("/bin"))) { + .arg(df.localFilePath().toUserOutput(), errorMsg); + if (errorMsg == QLatin1String("Failure") + && df.remoteDirectory().contains(QLatin1String("/bin"))) { errorString += QLatin1Char(' ') + tr("If '%1' is currently running " "on the remote host, you might need to stop it first.").arg(df.remoteFilePath()); } @@ -175,7 +176,7 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con saveDeploymentTimeStamp(df); // Terrible hack for Windows. - if (df.remoteDir.contains(QLatin1String("bin"))) { + if (df.remoteDirectory().contains(QLatin1String("bin"))) { const QString command = QLatin1String("chmod a+x ") + df.remoteFilePath(); connection()->createRemoteProcess(command.toUtf8())->start(); } @@ -194,7 +195,7 @@ void GenericDirectUploadService::handleLnFinished(int exitStatus) } const DeployableFile df = d->filesToUpload.takeFirst(); - const QString nativePath = QDir::toNativeSeparators(df.localFilePath); + const QString nativePath = df.localFilePath().toUserOutput(); if (exitStatus != SshRemoteProcess::NormalExit || d->lnProc->exitCode() != 0) { emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath)); setFinished(); @@ -216,8 +217,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) } const DeployableFile &df = d->filesToUpload.first(); - QFileInfo fi(df.localFilePath); - const QString nativePath = QDir::toNativeSeparators(df.localFilePath); + QFileInfo fi = df.localFilePath().toFileInfo(); + const QString nativePath = df.localFilePath().toUserOutput(); if (exitStatus != SshRemoteProcess::NormalExit || d->mkdirProc->exitCode() != 0) { emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath)); setFinished(); @@ -227,7 +228,7 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) d->filesToUpload.removeFirst(); uploadNextFile(); } else { - const QString remoteFilePath = df.remoteDir + QLatin1Char('/') + fi.fileName(); + const QString remoteFilePath = df.remoteDirectory() + QLatin1Char('/') + fi.fileName(); if (fi.isSymLink()) { const QString target = fi.dir().relativeFilePath(fi.symLinkTarget()); // see QTBUG-5817. const QString command = QLatin1String("ln -sf ") + target + QLatin1Char(' ') @@ -240,8 +241,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) connect(d->lnProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData())); d->lnProc->start(); } else { - const SftpJobId job = d->uploader->uploadFile(df.localFilePath, remoteFilePath, - SftpOverwriteExisting); + const SftpJobId job = d->uploader->uploadFile(df.localFilePath().toString(), + remoteFilePath, SftpOverwriteExisting); if (job == SftpInvalidJob) { emit errorMessage(tr("Failed to upload file '%1': " "Could not open for reading.").arg(nativePath)); @@ -276,16 +277,16 @@ void GenericDirectUploadService::stopDeployment() void GenericDirectUploadService::checkDeploymentNeeded(const DeployableFile &deployable) const { - QFileInfo fileInfo(deployable.localFilePath); + QFileInfo fileInfo = deployable.localFilePath().toFileInfo(); if (fileInfo.isDir()) { - const QStringList files = QDir(deployable.localFilePath) + const QStringList files = QDir(deployable.localFilePath().toString()) .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); if (files.isEmpty() && (!d->incremental || hasChangedSinceLastDeployment(deployable))) d->filesToUpload << deployable; foreach (const QString &fileName, files) { - const QString localFilePath = deployable.localFilePath + const QString localFilePath = deployable.localFilePath().toString() + QLatin1Char('/') + fileName; - const QString remoteDir = deployable.remoteDir + QLatin1Char('/') + const QString remoteDir = deployable.remoteDirectory() + QLatin1Char('/') + fileInfo.fileName(); checkDeploymentNeeded(DeployableFile(localFilePath, remoteDir)); } @@ -318,16 +319,16 @@ void GenericDirectUploadService::uploadNextFile() } const DeployableFile &df = d->filesToUpload.first(); - QString dirToCreate = df.remoteDir; + QString dirToCreate = df.remoteDirectory(); if (dirToCreate.isEmpty()) { emit warningMessage(tr("Warning: No remote path set for local file '%1'. Skipping upload.") - .arg(QDir::toNativeSeparators(df.localFilePath))); + .arg(df.localFilePath().toUserOutput())); d->filesToUpload.takeFirst(); uploadNextFile(); return; } - QFileInfo fi(df.localFilePath); + QFileInfo fi = df.localFilePath().toFileInfo(); if (fi.isDir()) dirToCreate += QLatin1Char('/') + fi.fileName(); const QString command = QLatin1String("mkdir -p ") + dirToCreate; @@ -336,7 +337,7 @@ void GenericDirectUploadService::uploadNextFile() connect(d->mkdirProc.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdOutData())); connect(d->mkdirProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData())); emit progressMessage(tr("Uploading file '%1'...") - .arg(QDir::toNativeSeparators(df.localFilePath))); + .arg(df.localFilePath().toUserOutput())); d->mkdirProc->start(); } diff --git a/src/plugins/remotelinux/genericdirectuploadservice.h b/src/plugins/remotelinux/genericdirectuploadservice.h index e268b856c4..55d07287ae 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.h +++ b/src/plugins/remotelinux/genericdirectuploadservice.h @@ -39,8 +39,9 @@ QT_FORWARD_DECLARE_CLASS(QString) +namespace ProjectExplorer { class DeployableFile; } + namespace RemoteLinux { -class DeployableFile; namespace Internal { class GenericDirectUploadServicePrivate; } class REMOTELINUX_EXPORT GenericDirectUploadService : public AbstractRemoteLinuxDeployService @@ -50,7 +51,7 @@ public: GenericDirectUploadService(QObject *parent = 0); ~GenericDirectUploadService(); - void setDeployableFiles(const QList<DeployableFile> &deployableFiles); + void setDeployableFiles(const QList<ProjectExplorer::DeployableFile> &deployableFiles); void setIncrementalDeployment(bool incremental); protected: @@ -72,7 +73,7 @@ private slots: void handleStdErrData(); private: - void checkDeploymentNeeded(const DeployableFile &file) const; + void checkDeploymentNeeded(const ProjectExplorer::DeployableFile &file) const; void setFinished(); void uploadNextFile(); diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp index 6a4c6cf9f3..7aa0b0c08c 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.cpp +++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp @@ -29,11 +29,12 @@ **************************************************************************/ #include "genericdirectuploadstep.h" -#include "deployablefile.h" -#include "deploymentinfo.h" #include "genericdirectuploadservice.h" #include "remotelinuxdeployconfiguration.h" +#include <projectexplorer/deploymentdata.h> +#include <projectexplorer/target.h> + #include <QCheckBox> #include <QVBoxLayout> #include <QList> @@ -109,12 +110,7 @@ BuildStepConfigWidget *GenericDirectUploadStep::createConfigWidget() bool GenericDirectUploadStep::initInternal(QString *error) { - QList<DeployableFile> deployableFiles; - const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo(); - const int deployableCount = deploymentInfo->deployableCount(); - for (int i = 0; i < deployableCount; ++i) - deployableFiles << deploymentInfo->deployableAt(i); - deployService()->setDeployableFiles(deployableFiles); + deployService()->setDeployableFiles(target()->deploymentData().allFiles()); deployService()->setIncrementalDeployment(incrementalDeployment()); return deployService()->isDeploymentPossible(error); } diff --git a/src/plugins/remotelinux/profilesupdatedialog.cpp b/src/plugins/remotelinux/profilesupdatedialog.cpp deleted file mode 100644 index 8a6e25a780..0000000000 --- a/src/plugins/remotelinux/profilesupdatedialog.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ -#include "profilesupdatedialog.h" -#include "ui_profilesupdatedialog.h" - -#include "deployablefilesperprofile.h" - -#include <qt4projectmanager/qt4nodes.h> - -#include <QDir> -#include <QTableWidgetItem> - -namespace RemoteLinux { -namespace Internal { - -ProFilesUpdateDialog::ProFilesUpdateDialog(const QList<DeployableFilesPerProFile *> &models, - QWidget *parent) - : QDialog(parent), - m_models(models), - ui(new Ui::ProFilesUpdateDialog) -{ - ui->setupUi(this); - ui->tableWidget->setRowCount(models.count()); - ui->tableWidget->setHorizontalHeaderItem(0, - new QTableWidgetItem(tr("Updateable Project Files"))); - for (int row = 0; row < models.count(); ++row) { - QTableWidgetItem *const item - = new QTableWidgetItem(QDir::toNativeSeparators(models.at(row)->proFilePath())); - item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - item->setCheckState(Qt::Unchecked); - ui->tableWidget->setItem(row, 0, item); - } - ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); - ui->tableWidget->resizeRowsToContents(); - connect(ui->checkAllButton, SIGNAL(clicked()), this, SLOT(checkAll())); - connect(ui->uncheckAllButton, SIGNAL(clicked()), this, SLOT(uncheckAll())); -} - -ProFilesUpdateDialog::~ProFilesUpdateDialog() -{ - delete ui; -} - -void ProFilesUpdateDialog::checkAll() -{ - setCheckStateForAll(Qt::Checked); -} - -void ProFilesUpdateDialog::uncheckAll() -{ - setCheckStateForAll(Qt::Unchecked); -} - -void ProFilesUpdateDialog::setCheckStateForAll(Qt::CheckState checkState) -{ - for (int row = 0; row < ui->tableWidget->rowCount(); ++row) { - ui->tableWidget->item(row, 0)->setCheckState(checkState); - } -} - -QList<ProFilesUpdateDialog::UpdateSetting> ProFilesUpdateDialog::getUpdateSettings() const -{ - QList<UpdateSetting> settings; - for (int row = 0; row < m_models.count(); ++row) { - const bool doUpdate = result() != Rejected - && ui->tableWidget->item(row, 0)->checkState() == Qt::Checked; - settings << UpdateSetting(m_models.at(row), doUpdate); - } - return settings; -} - -} // namespace RemoteLinux -} // namespace Internal diff --git a/src/plugins/remotelinux/profilesupdatedialog.ui b/src/plugins/remotelinux/profilesupdatedialog.ui deleted file mode 100644 index 7885a3f418..0000000000 --- a/src/plugins/remotelinux/profilesupdatedialog.ui +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>RemoteLinux::Internal::ProFilesUpdateDialog</class> - <widget class="QDialog" name="RemoteLinux::Internal::ProFilesUpdateDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>659</width> - <height>494</height> - </rect> - </property> - <property name="windowTitle"> - <string>Maemo Deployment Issue</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="infoLabel"> - <property name="text"> - <string>The project files listed below do not contain deployment information, which means the respective targets cannot be deployed to and/or run on a device. Qt Creator will add the missing information to these files if you check the respective rows below.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="checkAllButton"> - <property name="text"> - <string>&Check all</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="uncheckAllButton"> - <property name="text"> - <string>&Uncheck All</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QTableWidget" name="tableWidget"> - <property name="showGrid"> - <bool>false</bool> - </property> - <property name="columnCount"> - <number>1</number> - </property> - <attribute name="horizontalHeaderDefaultSectionSize"> - <number>200</number> - </attribute> - <attribute name="horizontalHeaderStretchLastSection"> - <bool>true</bool> - </attribute> - <attribute name="verticalHeaderVisible"> - <bool>false</bool> - </attribute> - <column/> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>RemoteLinux::Internal::ProFilesUpdateDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>248</x> - <y>254</y> - </hint> - <hint type="destinationlabel"> - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>RemoteLinux::Internal::ProFilesUpdateDialog</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>316</x> - <y>260</y> - </hint> - <hint type="destinationlabel"> - <x>286</x> - <y>274</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index 6059ce60ab..aaa4162a03 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -21,9 +21,6 @@ HEADERS += \ remotelinuxruncontrolfactory.h \ remotelinuxdebugsupport.h \ genericlinuxdeviceconfigurationwizardpages.h \ - deployablefile.h \ - deployablefilesperprofile.h \ - deploymentinfo.h \ abstractremotelinuxdeploystep.h \ genericdirectuploadstep.h \ uploadandinstalltarpackagestep.h \ @@ -44,14 +41,13 @@ HEADERS += \ sshkeydeployer.h \ typespecificdeviceconfigurationlistmodel.h \ remotelinuxutils.h \ - deploymentsettingsassistant.h \ remotelinuxdeployconfigurationwidget.h \ - profilesupdatedialog.h \ remotelinuxcustomcommanddeployservice.h \ remotelinuxcustomcommanddeploymentstep.h \ genericlinuxdeviceconfigurationwidget.h \ remotelinuxcheckforfreediskspaceservice.h \ - remotelinuxcheckforfreediskspacestep.h + remotelinuxcheckforfreediskspacestep.h \ + remotelinuxdeploymentdatamodel.h SOURCES += \ embeddedlinuxqtversion.cpp \ @@ -68,8 +64,6 @@ SOURCES += \ remotelinuxruncontrolfactory.cpp \ remotelinuxdebugsupport.cpp \ genericlinuxdeviceconfigurationwizardpages.cpp \ - deployablefilesperprofile.cpp \ - deploymentinfo.cpp \ abstractremotelinuxdeploystep.cpp \ genericdirectuploadstep.cpp \ uploadandinstalltarpackagestep.cpp \ @@ -89,20 +83,18 @@ SOURCES += \ sshkeydeployer.cpp \ typespecificdeviceconfigurationlistmodel.cpp \ remotelinuxutils.cpp \ - deploymentsettingsassistant.cpp \ remotelinuxdeployconfigurationwidget.cpp \ - profilesupdatedialog.cpp \ remotelinuxcustomcommanddeployservice.cpp \ remotelinuxcustomcommanddeploymentstep.cpp \ genericlinuxdeviceconfigurationwidget.cpp \ remotelinuxcheckforfreediskspaceservice.cpp \ - remotelinuxcheckforfreediskspacestep.cpp + remotelinuxcheckforfreediskspacestep.cpp \ + remotelinuxdeploymentdatamodel.cpp FORMS += \ genericlinuxdeviceconfigurationwizardsetuppage.ui \ linuxdevicetestdialog.ui \ remotelinuxdeployconfigurationwidget.ui \ - profilesupdatedialog.ui \ genericlinuxdeviceconfigurationwidget.ui \ remotelinuxcheckforfreediskspacestepwidget.ui diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs index 221172e322..3bb4c43ef5 100644 --- a/src/plugins/remotelinux/remotelinux.qbs +++ b/src/plugins/remotelinux/remotelinux.qbs @@ -9,7 +9,6 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "Debugger" } Depends { name: "ProjectExplorer" } - Depends { name: "Qt4ProjectManager" } Depends { name: "QtSupport" } Depends { name: "QtcSsh" } @@ -28,13 +27,6 @@ QtcPlugin { "abstractremotelinuxdeploystep.h", "abstractuploadandinstallpackageservice.cpp", "abstractuploadandinstallpackageservice.h", - "deployablefile.h", - "deployablefilesperprofile.cpp", - "deployablefilesperprofile.h", - "deploymentinfo.cpp", - "deploymentinfo.h", - "deploymentsettingsassistant.cpp", - "deploymentsettingsassistant.h", "embeddedlinuxqtversion.cpp", "embeddedlinuxqtversion.h", "embeddedlinuxqtversionfactory.cpp", @@ -93,9 +85,6 @@ QtcPlugin { "linuxdevicetestdialog.ui", "packageuploader.cpp", "packageuploader.h", - "profilesupdatedialog.cpp", - "profilesupdatedialog.h", - "profilesupdatedialog.ui", "remotelinuxdeployconfigurationwidget.ui", "remotelinuxenvironmentreader.cpp", "remotelinuxenvironmentreader.h", @@ -117,6 +106,8 @@ QtcPlugin { "remotelinuxcheckforfreediskspacestep.h", "remotelinuxcheckforfreediskspacestep.cpp", "remotelinuxcheckforfreediskspacestepwidget.ui", + "remotelinuxdeploymentdatamodel.h", + "remotelinuxdeploymentdatamodel.cpp", "images/embeddedtarget.png" ] diff --git a/src/plugins/remotelinux/remotelinux_dependencies.pri b/src/plugins/remotelinux/remotelinux_dependencies.pri index c2940f9362..697ec645a1 100644 --- a/src/plugins/remotelinux/remotelinux_dependencies.pri +++ b/src/plugins/remotelinux/remotelinux_dependencies.pri @@ -1,4 +1,4 @@ include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/debugger/debugger.pri) include(../../plugins/projectexplorer/projectexplorer.pri) -include(../../plugins/qt4projectmanager/qt4projectmanager.pri) +include(../../plugins/qtsupport/qtsupport.pri) diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp index 7de56a9c2a..54b0573057 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp @@ -29,21 +29,12 @@ **************************************************************************/ #include "remotelinuxdeployconfiguration.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfigurationwidget.h" -#include "typespecificdeviceconfigurationlistmodel.h" -#include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/project.h> #include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> using namespace ProjectExplorer; -using namespace Qt4ProjectManager; - -namespace { -const char DEPLOYMENT_INFO_SETTING[] = "RemoteLinux.DeploymentInfo"; -} // namespace namespace RemoteLinux { @@ -54,15 +45,6 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer:: : DeployConfiguration(target, id) { setDefaultDisplayName(defaultDisplayName); - - // Make sure we have deploymentInfo, but create it only once: - DeploymentInfo *info - = qobject_cast<DeploymentInfo *>(target->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>()); - if (!info) { - info = new DeploymentInfo(static_cast<Qt4ProjectManager::Qt4Project *>(target->project())); - QVariant data = QVariant::fromValue(static_cast<QObject *>(info)); - target->project()->setNamedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING), data); - } } RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, @@ -70,23 +52,6 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer:: : DeployConfiguration(target, source) { } -DeploymentInfo *RemoteLinuxDeployConfiguration::deploymentInfo() const -{ - DeploymentInfo *info - = qobject_cast<DeploymentInfo *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>()); - return info; -} - -QString RemoteLinuxDeployConfiguration::qmakeScope() const -{ - return QLatin1String("unix"); -} - -QString RemoteLinuxDeployConfiguration::installPrefix() const -{ - return QString(); -} - DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const { return new RemoteLinuxDeployConfigurationWidget; diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h index 4ba7e42be9..119d2c8d7f 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h @@ -39,9 +39,6 @@ #include <projectexplorer/devicesupport/idevice.h> namespace RemoteLinux { -class AbstractEmbeddedLinuxTarget; -class DeploymentInfo; - namespace Internal { class RemoteLinuxDeployConfigurationFactory; } class REMOTELINUX_EXPORT RemoteLinuxDeployConfiguration @@ -57,8 +54,6 @@ public: ProjectExplorer::DeployConfigurationWidget *configurationWidget() const; - DeploymentInfo *deploymentInfo() const; - template<class T> T *earlierBuildStep(const ProjectExplorer::BuildStep *laterBuildStep) const { const QList<ProjectExplorer::BuildStep *> &buildSteps = stepList()->steps(); @@ -71,9 +66,6 @@ public: return 0; } - virtual QString qmakeScope() const; - virtual QString installPrefix() const; - signals: void packagingChanged(); diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp index ee917462af..3656bc17ed 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp @@ -37,8 +37,8 @@ #include <projectexplorer/abi.h> #include <projectexplorer/profileinformation.h> #include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> #include <QCoreApplication> @@ -59,8 +59,6 @@ RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory(QOb QList<Core::Id> RemoteLinuxDeployConfigurationFactory::availableCreationIds(Target *parent) const { QList<Core::Id> ids; - if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project())) - return ids; if (!parent->project()->supportsProfile(parent->profile())) return ids; ProjectExplorer::ToolChain *tc diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp index f7afcc2cb4..d5c951c529 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp @@ -29,51 +29,24 @@ #include "remotelinuxdeployconfigurationwidget.h" #include "ui_remotelinuxdeployconfigurationwidget.h" -#include "deployablefilesperprofile.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" -#include "typespecificdeviceconfigurationlistmodel.h" +#include "remotelinuxdeploymentdatamodel.h" -#include <coreplugin/editormanager/editormanager.h> -#include <coreplugin/icore.h> -#include <coreplugin/id.h> -#include <projectexplorer/devicesupport/devicemanager.h> -#include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> #include <utils/qtcassert.h> -#include <QTreeView> - using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -namespace { -class MyTreeView : public QTreeView -{ - Q_OBJECT -public: - MyTreeView(QWidget *parent = 0) : QTreeView(parent) {} - -signals: - void doubleClicked(); - -private: - void mouseDoubleClickEvent(QMouseEvent *event) - { - emit doubleClicked(); - QTreeView::mouseDoubleClickEvent(event); - } -}; - -} // anonymous namespace class RemoteLinuxDeployConfigurationWidgetPrivate { public: Ui::RemoteLinuxDeployConfigurationWidget ui; - MyTreeView treeView; RemoteLinuxDeployConfiguration *deployConfiguration; + RemoteLinuxDeploymentDataModel deploymentDataModel; }; } // namespace Internal @@ -84,10 +57,10 @@ RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(QWidg DeployConfigurationWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate) { d->ui.setupUi(this); - d->treeView.setTextElideMode(Qt::ElideMiddle); - d->treeView.setWordWrap(false); - d->treeView.setUniformRowHeights(true); - layout()->addWidget(&d->treeView); + d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle); + d->ui.deploymentDataView->setWordWrap(false); + d->ui.deploymentDataView->setUniformRowHeights(true); + d->ui.deploymentDataView->setModel(&d->deploymentDataModel); } RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget() @@ -98,78 +71,17 @@ RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget() void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc) { d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc); - Q_ASSERT(d->deployConfiguration); + QTC_ASSERT(d->deployConfiguration, return); - connect(&d->treeView, SIGNAL(doubleClicked()), SLOT(openProjectFile())); - - d->ui.projectsComboBox->setModel(d->deployConfiguration->deploymentInfo()); - connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelAboutToBeReset()), - SLOT(handleModelListToBeReset())); - - // Queued connection because of race condition with combo box's reaction - // to modelReset(). - connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelReset()), - SLOT(handleModelListReset()), Qt::QueuedConnection); - - connect(d->ui.projectsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModel(int))); - handleModelListReset(); + connect(dc->target()->project(), SIGNAL(buildSystemEvaluated()), + SLOT(updateDeploymentDataModel())); + updateDeploymentDataModel(); } -RemoteLinuxDeployConfiguration *RemoteLinuxDeployConfigurationWidget::deployConfiguration() const +void RemoteLinuxDeployConfigurationWidget::updateDeploymentDataModel() { - return d->deployConfiguration; -} - -DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel() const -{ - const int modelRow = d->ui.projectsComboBox->currentIndex(); - if (modelRow == -1) - return 0; - return d->deployConfiguration->deploymentInfo()->modelAt(modelRow); -} - -void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset() -{ - d->treeView.setModel(0); -} - -void RemoteLinuxDeployConfigurationWidget::handleModelListReset() -{ - QTC_ASSERT(d->deployConfiguration->deploymentInfo()->modelCount() - == d->ui.projectsComboBox->count(), return); - - if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) { - d->treeView.setToolTip(tr("Double-click to edit the project file")); - if (d->ui.projectsComboBox->currentIndex() == -1) - d->ui.projectsComboBox->setCurrentIndex(0); - else - setModel(d->ui.projectsComboBox->currentIndex()); - } else { - d->treeView.setToolTip(QString()); - } -} - -void RemoteLinuxDeployConfigurationWidget::setModel(int row) -{ - DeployableFilesPerProFile * const proFileInfo = row == -1 - ? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row); - d->treeView.setModel(proFileInfo); - if (proFileInfo) - d->treeView.resizeColumnToContents(0); - emit currentModelChanged(proFileInfo); -} - -void RemoteLinuxDeployConfigurationWidget::openProjectFile() -{ - const int row = d->ui.projectsComboBox->currentIndex(); - if (row == -1) - return; - const DeployableFilesPerProFile * const proFileInfo = - d->deployConfiguration->deploymentInfo()->modelAt(row); - Core::EditorManager::openEditor(proFileInfo->proFilePath(), Core::Id(), - Core::EditorManager::ModeSwitch); + d->deploymentDataModel.setDeploymentData(d->deployConfiguration->target()->deploymentData()); + d->ui.deploymentDataView->resizeColumnToContents(0); } } // namespace RemoteLinux - -#include "remotelinuxdeployconfigurationwidget.moc" diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h index a8b1cac985..64f8dd145a 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h @@ -34,9 +34,6 @@ #include <projectexplorer/deployconfiguration.h> namespace RemoteLinux { -class DeployableFilesPerProFile; -class RemoteLinuxDeployConfiguration; - namespace Internal { class RemoteLinuxDeployConfigurationWidgetPrivate; } // namespace Internal @@ -52,17 +49,8 @@ public: void init(ProjectExplorer::DeployConfiguration *dc); - RemoteLinuxDeployConfiguration *deployConfiguration() const; - DeployableFilesPerProFile *currentModel() const; - -signals: - void currentModelChanged(const RemoteLinux::DeployableFilesPerProFile *proFileInfo); - private slots: - void handleModelListToBeReset(); - void handleModelListReset(); - void setModel(int row); - void openProjectFile(); + void updateDeploymentDataModel(); private: Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d; diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui index 2bfa1bd8a6..fb765741e9 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui @@ -15,45 +15,14 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Files to deploy:</string> </property> - <item row="0" column="0"> - <widget class="QLabel" name="installLabel"> - <property name="toolTip"> - <string>These show the INSTALLS settings from the project file(s).</string> - </property> - <property name="text"> - <string>Files to install for subproject:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QComboBox" name="projectsComboBox"> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> + </widget> + </item> + <item> + <widget class="QTreeView" name="deploymentDataView"/> </item> </layout> </widget> diff --git a/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp new file mode 100644 index 0000000000..ea78d795b7 --- /dev/null +++ b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp @@ -0,0 +1,81 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: http://www.qt-project.org/ +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +**************************************************************************/ +#include "remotelinuxdeploymentdatamodel.h" + +#include <QDir> + +using namespace ProjectExplorer; + +namespace RemoteLinux { + +RemoteLinuxDeploymentDataModel::RemoteLinuxDeploymentDataModel(QObject *parent) + : QAbstractTableModel(parent) +{ +} + +void RemoteLinuxDeploymentDataModel::setDeploymentData(const DeploymentData &deploymentData) +{ + beginResetModel(); + m_deploymentData = deploymentData; + endResetModel(); +} + +int RemoteLinuxDeploymentDataModel::rowCount(const QModelIndex &parent) const +{ + return parent.isValid() ? 0 : m_deploymentData.fileCount(); +} + +int RemoteLinuxDeploymentDataModel::columnCount(const QModelIndex &parent) const +{ + return parent.isValid() ? 0 : 2; +} + +QVariant RemoteLinuxDeploymentDataModel::headerData(int section, Qt::Orientation orientation, + int role) const +{ + if (orientation == Qt::Vertical || role != Qt::DisplayRole) + return QVariant(); + return section == 0 ? tr("Local File Path") : tr("Remote Directory"); +} + +QVariant RemoteLinuxDeploymentDataModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || index.row() >= rowCount() || index.column() >= columnCount()) + return QVariant(); + + const DeployableFile &d = m_deploymentData.fileAt(index.row()); + if (index.column() == 0 && role == Qt::DisplayRole) + return d.localFilePath().toUserOutput(); + if (role == Qt::DisplayRole) + return d.remoteDirectory(); + return QVariant(); +} + +} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/profilesupdatedialog.h b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h index d02480805b..c708bdc45e 100644 --- a/src/plugins/remotelinux/profilesupdatedialog.h +++ b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h @@ -27,43 +27,32 @@ ** ** **************************************************************************/ +#ifndef REMOTELINUXDEPLOYMENTDATAMODEL_H +#define REMOTELINUXDEPLOYMENTDATAMODEL_H -#ifndef PROFILESUPDATEDIALOG_H -#define PROFILESUPDATEDIALOG_H +#include <projectexplorer/deploymentdata.h> -#include <QList> -#include <QPair> -#include <QString> -#include <QDialog> +#include <QAbstractTableModel> namespace RemoteLinux { -class DeployableFilesPerProFile; -namespace Internal { -namespace Ui { class ProFilesUpdateDialog; } - -class ProFilesUpdateDialog : public QDialog +class RemoteLinuxDeploymentDataModel : public QAbstractTableModel { Q_OBJECT - public: - typedef QPair<DeployableFilesPerProFile *, bool> UpdateSetting; + explicit RemoteLinuxDeploymentDataModel(QObject *parent = 0); - explicit ProFilesUpdateDialog(const QList<DeployableFilesPerProFile *> &models, - QWidget *parent = 0); - ~ProFilesUpdateDialog(); - QList<UpdateSetting> getUpdateSettings() const; + void setDeploymentData(const ProjectExplorer::DeploymentData &deploymentData); private: - Q_SLOT void checkAll(); - Q_SLOT void uncheckAll(); - void setCheckStateForAll(Qt::CheckState checkState); + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - const QList<DeployableFilesPerProFile *> m_models; - Ui::ProFilesUpdateDialog *ui; + ProjectExplorer::DeploymentData m_deploymentData; }; } // namespace RemoteLinux -} // namespace Internal -#endif // PROFILESUPDATEDIALOG_H +#endif // REMOTELINUXDEPLOYMENTDATAMODEL_H diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index 42e291aaa3..280757163d 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -31,10 +31,8 @@ #include "remotelinuxplugin.h" #include "embeddedlinuxqtversionfactory.h" -#include "deployablefile.h" #include "genericlinuxdeviceconfigurationfactory.h" #include "genericremotelinuxdeploystepfactory.h" -#include "qt4projectmanager/qt4projectmanagerconstants.h" #include "remotelinuxdeployconfigurationfactory.h" #include "remotelinuxrunconfigurationfactory.h" #include "remotelinuxruncontrolfactory.h" @@ -72,8 +70,6 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments, addAutoReleasedObject(new EmbeddedLinuxQtVersionFactory); - qRegisterMetaType<RemoteLinux::DeployableFile>("RemoteLinux::DeployableFile"); - return true; } diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 33b311d3c7..07650bfc0e 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -30,23 +30,21 @@ #include "remotelinuxrunconfiguration.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" #include "remotelinuxrunconfigurationwidget.h" -#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/buildtargetinfo.h> +#include <projectexplorer/deploymentdata.h> +#include <projectexplorer/project.h> #include <projectexplorer/session.h> #include <projectexplorer/target.h> #include <projectexplorer/toolchain.h> #include <qtsupport/qtoutputformatter.h> -#include <qt4projectmanager/qt4nodes.h> -#include <qt4projectmanager/qt4project.h> #include <utils/portlist.h> #include <utils/qtcassert.h> using namespace ProjectExplorer; -using namespace Qt4ProjectManager; using namespace QSsh; using namespace Utils; @@ -66,38 +64,32 @@ const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory"; class RemoteLinuxRunConfigurationPrivate { public: - RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const ProjectExplorer::Target *target) - : proFilePath(proFilePath), + RemoteLinuxRunConfigurationPrivate(const QString &projectFilePath) + : projectFilePath(projectFilePath), baseEnvironmentType(RemoteLinuxRunConfiguration::RemoteBaseEnvironment), - validParse(false), - parseInProgress(true), useAlternateRemoteExecutable(false) { - validParse = static_cast<Qt4Project *>(target->project())->validParse(proFilePath); - parseInProgress = static_cast<Qt4Project *>(target->project())->parseInProgress(proFilePath); } RemoteLinuxRunConfigurationPrivate(const RemoteLinuxRunConfigurationPrivate *other) - : proFilePath(other->proFilePath), gdbPath(other->gdbPath), arguments(other->arguments), + : projectFilePath(other->projectFilePath), + gdbPath(other->gdbPath), + arguments(other->arguments), baseEnvironmentType(other->baseEnvironmentType), remoteEnvironment(other->remoteEnvironment), userEnvironmentChanges(other->userEnvironmentChanges), - validParse(other->validParse), - parseInProgress(other->parseInProgress), useAlternateRemoteExecutable(other->useAlternateRemoteExecutable), alternateRemoteExecutable(other->alternateRemoteExecutable), workingDirectory(other->workingDirectory) { } - QString proFilePath; + QString projectFilePath; QString gdbPath; QString arguments; RemoteLinuxRunConfiguration::BaseEnvironmentType baseEnvironmentType; Environment remoteEnvironment; QList<EnvironmentItem> userEnvironmentChanges; - bool validParse; - bool parseInProgress; QString disabledReason; bool useAlternateRemoteExecutable; QString alternateRemoteExecutable; @@ -111,7 +103,7 @@ using namespace Internal; RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, const Core::Id id, const QString &proFilePath) : RunConfiguration(parent, id), - d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent)) + d(new RemoteLinuxRunConfigurationPrivate(proFilePath)) { init(); } @@ -134,34 +126,14 @@ void RemoteLinuxRunConfiguration::init() setDefaultDisplayName(defaultDisplayName()); debuggerAspect()->suppressQmlDebuggingSpinbox(); - connect(target(), - SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)), - this, SLOT(handleDeployConfigChanged())); - handleDeployConfigChanged(); - Project *pro = target()->project(); - connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), - this, SLOT(proFileUpdate(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); + connect(pro, SIGNAL(buildSystemEvaluated()), SLOT(handleBuildSystemDataUpdated())); connect(target(), SIGNAL(profileChanged()), - this, SLOT(handleDeployablesUpdated())); // Handles device changes, etc. + this, SLOT(handleBuildSystemDataUpdated())); // Handles device changes, etc. } bool RemoteLinuxRunConfiguration::isEnabled() const { - if (d->parseInProgress) { - d->disabledReason = tr("The .pro file '%1' is being parsed.") - .arg(QFileInfo(d->proFilePath).fileName()); - return false; - } - if (!d->validParse) { - Qt4Project *project = static_cast<Qt4Project *>(target()->project()); - d->disabledReason = project->disabledReasonForRunConfiguration(d->proFilePath); - return false; - } - if (!activeBuildConfiguration()) { - d->disabledReason = tr("No active build configuration."); - return false; - } if (remoteExecutableFilePath().isEmpty()) { d->disabledReason = tr("Don't know what to run."); return false; @@ -185,26 +157,12 @@ OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const return new QtSupport::QtOutputFormatter(target()->project()); } -void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress) -{ - if (d->proFilePath == pro->path()) { - bool enabled = isEnabled(); - QString reason = disabledReason(); - d->validParse = success; - d->parseInProgress = parseInProgress; - if (enabled != isEnabled() || reason != disabledReason()) - updateEnabledState(); - if (!parseInProgress) - emit targetInformationChanged(); - } -} - QVariantMap RemoteLinuxRunConfiguration::toMap() const { QVariantMap map(RunConfiguration::toMap()); map.insert(QLatin1String(ArgumentsKey), d->arguments); const QDir dir = QDir(target()->project()->projectDirectory()); - map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->proFilePath)); + map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->projectFilePath)); map.insert(QLatin1String(BaseEnvironmentBaseKey), d->baseEnvironmentType); map.insert(QLatin1String(UserEnvironmentChangesKey), EnvironmentItem::toStringList(d->userEnvironmentChanges)); @@ -221,7 +179,8 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map) d->arguments = map.value(QLatin1String(ArgumentsKey)).toString(); const QDir dir = QDir(target()->project()->projectDirectory()); - d->proFilePath = QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString())); + d->projectFilePath + = QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString())); d->userEnvironmentChanges = EnvironmentItem::fromStringList(map.value(QLatin1String(UserEnvironmentChangesKey)) .toStringList()); @@ -231,10 +190,6 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map) d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString(); d->workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString(); - Qt4Project *project = static_cast<Qt4Project *>(target()->project()); - d->validParse = project->validParse(d->proFilePath); - d->parseInProgress = project->parseInProgress(d->proFilePath); - setDefaultDisplayName(defaultDisplayName()); return true; @@ -242,18 +197,13 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map) QString RemoteLinuxRunConfiguration::defaultDisplayName() { - if (!d->proFilePath.isEmpty()) + if (!d->projectFilePath.isEmpty()) //: %1 is the name of a project which is being run on remote Linux - return tr("%1 (on Remote Device)").arg(QFileInfo(d->proFilePath).completeBaseName()); + return tr("%1 (on Remote Device)").arg(QFileInfo(d->projectFilePath).completeBaseName()); //: Remote Linux run configuration default display name return tr("Run on Remote Device"); } -RemoteLinuxDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const -{ - return qobject_cast<RemoteLinuxDeployConfiguration *>(target()->activeDeployConfiguration()); -} - QString RemoteLinuxRunConfiguration::arguments() const { return d->arguments; @@ -281,19 +231,14 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const QString RemoteLinuxRunConfiguration::localExecutableFilePath() const { - TargetInformation ti = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode() - ->targetInformation(d->proFilePath); - if (!ti.valid) - return QString(); - - return QDir::cleanPath(ti.workingDir + QLatin1Char('/') + ti.target); + return target()->applicationTargets() + .targetForProject(Utils::FileName::fromString(d->projectFilePath)).toString(); } QString RemoteLinuxRunConfiguration::defaultRemoteExecutableFilePath() const { - return deployConfig() - ? deployConfig()->deploymentInfo()->remoteExecutableFilePath(localExecutableFilePath()) - : QString(); + return target()->deploymentData().deployableForLocalFile(localExecutableFilePath()) + .remoteFilePath(); } QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const @@ -348,17 +293,10 @@ int RemoteLinuxRunConfiguration::portsUsedByDebuggers() const return ports; } -void RemoteLinuxRunConfiguration::handleDeployConfigChanged() -{ - RemoteLinuxDeployConfiguration * const activeDeployConf = deployConfig(); - if (activeDeployConf) - connect(activeDeployConf->deploymentInfo(), SIGNAL(modelReset()), - SLOT(handleDeployablesUpdated()), Qt::UniqueConnection); -} - -void RemoteLinuxRunConfiguration::handleDeployablesUpdated() +void RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated() { emit deploySpecsChanged(); + emit targetInformationChanged(); updateEnabledState(); } @@ -433,9 +371,9 @@ void RemoteLinuxRunConfiguration::setRemoteEnvironment(const Environment &enviro } } -QString RemoteLinuxRunConfiguration::proFilePath() const +QString RemoteLinuxRunConfiguration::projectFilePath() const { - return d->proFilePath; + return d->projectFilePath; } void RemoteLinuxRunConfiguration::setDisabledReason(const QString &reason) const diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h index ee869a62de..074907f346 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -36,10 +36,6 @@ #include <projectexplorer/runconfiguration.h> #include <utils/environment.h> -namespace Qt4ProjectManager { -class Qt4ProFileNode; -} // namespace Qt4ProjectManager - namespace Utils { class PortList; } namespace RemoteLinux { @@ -67,7 +63,7 @@ public: enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml }; RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, - const QString &proFilePath); + const QString &projectFilePath); ~RemoteLinuxRunConfiguration(); bool isEnabled() const; @@ -75,8 +71,6 @@ public: QWidget *createConfigurationWidget(); Utils::OutputFormatter *createOutputFormatter() const; - RemoteLinuxDeployConfiguration *deployConfig() const; - virtual QString environmentPreparationCommand() const; virtual QString commandPrefix() const; @@ -103,7 +97,7 @@ public: int portsUsedByDebuggers() const; - QString proFilePath() const; + QString projectFilePath() const; static const QString IdPrefix; @@ -126,9 +120,7 @@ protected slots: void updateEnabledState() { emit enabledChanged(); } private slots: - void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress); - void handleDeployConfigChanged(); - void handleDeployablesUpdated(); + void handleBuildSystemDataUpdated(); private: void init(); diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp index 782e7fd451..bc4ee72bfa 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp @@ -30,14 +30,12 @@ #include "remotelinuxrunconfigurationfactory.h" #include "remotelinux_constants.h" -#include "remotelinuxdeployconfigurationfactory.h" #include "remotelinuxrunconfiguration.h" +#include <projectexplorer/buildtargetinfo.h> #include <projectexplorer/profileinformation.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4nodes.h> -#include <qtsupport/customexecutablerunconfiguration.h> #include <utils/qtcassert.h> #include <QFileInfo> @@ -45,7 +43,6 @@ #include <QStringList> using namespace ProjectExplorer; -using namespace Qt4ProjectManager; namespace RemoteLinux { namespace Internal { @@ -62,8 +59,10 @@ QString pathFromId(Core::Id id) } // namespace RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory(QObject *parent) - : Qt4ProjectManager::QmakeRunConfigurationFactory(parent) -{ setObjectName(QLatin1String("RemoteLinuxRunConfigurationFactory")); } + : IRunConfigurationFactory(parent) +{ + setObjectName(QLatin1String("RemoteLinuxRunConfigurationFactory")); +} RemoteLinuxRunConfigurationFactory::~RemoteLinuxRunConfigurationFactory() { @@ -73,14 +72,14 @@ bool RemoteLinuxRunConfigurationFactory::canCreate(Target *parent, const Core::I { if (!canHandle(parent)) return false; - return static_cast<Qt4Project *>(parent->project())->hasApplicationProFile(pathFromId(id)); + return !parent->applicationTargets().targetForProject(pathFromId(id)).isEmpty(); } bool RemoteLinuxRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const { if (!canHandle(parent)) return false; - return ProjectExplorer::idFromMap(map).toString().startsWith(RemoteLinuxRunConfiguration::IdPrefix); + return idFromMap(map).toString().startsWith(RemoteLinuxRunConfiguration::IdPrefix); } bool RemoteLinuxRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const @@ -96,10 +95,8 @@ QList<Core::Id> RemoteLinuxRunConfigurationFactory::availableCreationIds(Target if (!canHandle(parent)) return result; - QStringList proFiles = static_cast<Qt4Project *>(parent->project()) - ->applicationProFilePathes(RemoteLinuxRunConfiguration::IdPrefix); - foreach (const QString &pf, proFiles) - result << Core::Id(pf); + foreach (const BuildTargetInfo &bti, parent->applicationTargets().list) + result << (Core::Id(RemoteLinuxRunConfiguration::IdPrefix + bti.projectFilePath.toString())); return result; } @@ -119,8 +116,8 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::restore(Target *parent, const QVariantMap &map) { QTC_ASSERT(canRestore(parent, map), return 0); - RemoteLinuxRunConfiguration *rc - = new RemoteLinuxRunConfiguration(parent, Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString()); + RemoteLinuxRunConfiguration *rc = new RemoteLinuxRunConfiguration(parent, + Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString()); if (rc->fromMap(map)) return rc; @@ -136,26 +133,13 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent, return new RemoteLinuxRunConfiguration(parent, old); } -bool RemoteLinuxRunConfigurationFactory::canHandle(Target *t) const +bool RemoteLinuxRunConfigurationFactory::canHandle(const Target *target) const { - if (!t->project()->supportsProfile(t->profile())) + if (!target->project()->supportsProfile(target->profile())) return false; - if (!qobject_cast<Qt4Project *>(t->project())) - return false; - - Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(t->profile()); + const Core::Id deviceType = DeviceTypeProfileInformation::deviceTypeId(target->profile()); return deviceType == RemoteLinux::Constants::GenericLinuxOsType; } -QList<RunConfiguration *> RemoteLinuxRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n) -{ - QList<ProjectExplorer::RunConfiguration *> result; - foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) - if (RemoteLinuxRunConfiguration *qt4c = qobject_cast<RemoteLinuxRunConfiguration *>(rc)) - if (qt4c->proFilePath() == n->path()) - result << rc; - return result; -} - } // namespace Internal } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h index b126aa6a53..de3c965c37 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h @@ -31,14 +31,11 @@ #define REMOTELINUXRUNCONFIGURATIONFACTORY_H #include <projectexplorer/runconfiguration.h> -#include <qt4projectmanager/qmakerunconfigurationfactory.h> - -namespace ProjectExplorer { class Node; } namespace RemoteLinux { namespace Internal { -class RemoteLinuxRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurationFactory +class RemoteLinuxRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory { Q_OBJECT @@ -60,9 +57,8 @@ public: ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); - bool canHandle(ProjectExplorer::Target *t) const; - QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, - ProjectExplorer::Node *n); +private: + bool canHandle(const ProjectExplorer::Target *target) const; }; } // namespace Internal diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp index 8cc6c45283..4b6e6317f9 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp @@ -230,13 +230,23 @@ void RemoteLinuxRunConfigurationWidget::argumentsEdited(const QString &text) void RemoteLinuxRunConfigurationWidget::updateTargetInformation() { - d->localExecutableLabel - .setText(QDir::toNativeSeparators(d->runConfiguration->localExecutableFilePath())); + setLabelText(d->localExecutableLabel, + QDir::toNativeSeparators(d->runConfiguration->localExecutableFilePath()), + tr("Unknown")); } void RemoteLinuxRunConfigurationWidget::handleDeploySpecsChanged() { - d->remoteExecutableLabel.setText(d->runConfiguration->defaultRemoteExecutableFilePath()); + setLabelText(d->remoteExecutableLabel, d->runConfiguration->defaultRemoteExecutableFilePath(), + tr("Remote path not set")); +} + +void RemoteLinuxRunConfigurationWidget::setLabelText(QLabel &label, const QString ®ularText, + const QString &errorText) +{ + const QString errorMessage = QLatin1String("<font color=\"red\">") + errorText + + QLatin1String("</font>"); + label.setText(regularText.isEmpty() ? errorMessage : regularText); } void RemoteLinuxRunConfigurationWidget::handleUseAlternateCommandChanged() diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h index d0874a668a..6493d22404 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h @@ -35,6 +35,7 @@ #include <QWidget> QT_BEGIN_NAMESPACE +class QLabel; class QVBoxLayout; QT_END_NAMESPACE @@ -80,6 +81,7 @@ private slots: private: void addGenericWidgets(QVBoxLayout *mainLayout); void addEnvironmentWidgets(QVBoxLayout *mainLayout); + void setLabelText(QLabel &label, const QString ®ularText, const QString &errorText); Internal::RemoteLinuxRunConfigurationWidgetPrivate * const d; }; diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp index f649fa7272..1151c551ea 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.cpp +++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp @@ -28,10 +28,9 @@ **************************************************************************/ #include "tarpackagecreationstep.h" -#include "deployablefile.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" +#include <projectexplorer/deploymentdata.h> #include <projectexplorer/project.h> #include <projectexplorer/target.h> @@ -112,13 +111,8 @@ bool TarPackageCreationStep::init() if (!AbstractPackagingStep::init()) return false; m_packagingNeeded = isPackagingNeeded(); - if (!m_packagingNeeded) - return true; - - const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo(); - for (int i = 0; i < deploymentInfo->deployableCount(); ++i) - m_files.append(deploymentInfo->deployableAt(i)); - + if (m_packagingNeeded) + m_files = target()->deploymentData().allFiles(); return true; } @@ -152,13 +146,13 @@ bool TarPackageCreationStep::doPackage(QFutureInterface<bool> &fi) } foreach (const DeployableFile &d, m_files) { - if (d.remoteDir.isEmpty()) { + if (d.remoteDirectory().isEmpty()) { emit addOutput(tr("No remote path specified for file '%1', skipping.") - .arg(QDir::toNativeSeparators(d.localFilePath)), ErrorMessageOutput); + .arg(d.localFilePath().toUserOutput()), ErrorMessageOutput); continue; } - QFileInfo fileInfo(d.localFilePath); - if (!appendFile(tarFile, fileInfo, d.remoteDir + QLatin1Char('/') + QFileInfo fileInfo = d.localFilePath().toFileInfo(); + if (!appendFile(tarFile, fileInfo, d.remoteDirectory() + QLatin1Char('/') + fileInfo.fileName(), fi)) { return false; } diff --git a/src/plugins/remotelinux/tarpackagecreationstep.h b/src/plugins/remotelinux/tarpackagecreationstep.h index d6cbbabe72..bdc30aa1c8 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.h +++ b/src/plugins/remotelinux/tarpackagecreationstep.h @@ -31,7 +31,8 @@ #include "abstractpackagingstep.h" #include "remotelinux_export.h" -#include "deployablefile.h" + +#include <projectexplorer/deployablefile.h> QT_BEGIN_NAMESPACE class QFile; @@ -65,7 +66,7 @@ private: const QString &remoteFilePath); bool m_packagingNeeded; - QList<DeployableFile> m_files; + QList<ProjectExplorer::DeployableFile> m_files; }; } // namespace RemoteLinux |