diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2012-04-24 15:49:09 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2012-06-21 12:08:12 +0200 |
commit | 24314562165588b56a318b3b8a846bf5deda7c41 (patch) | |
tree | b5dcf951e76d003c2623011b0e91994e06e7e061 /src/plugins/remotelinux | |
parent | 8c77b8c9d7b25d0c89003c8c4a54e8da5bfb7edd (diff) | |
download | qt-creator-24314562165588b56a318b3b8a846bf5deda7c41.tar.gz |
Profile introduction
Introduce Profiles to store sets of values that describe a system/device.
These profiles are held by a target, getting rid of much of the information
stored in the Build-/Run-/DeployConfigurations, greatly simplifying those.
This is a squash of the wip/profile branch which has been on gerrit for a
while, rebased to current master.
Change-Id: I25956c8dd4d1962b2134bfaa8a8076ae3909460f
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src/plugins/remotelinux')
39 files changed, 313 insertions, 974 deletions
diff --git a/src/plugins/remotelinux/abstractembeddedlinuxtarget.cpp b/src/plugins/remotelinux/abstractembeddedlinuxtarget.cpp deleted file mode 100644 index dd3f4c1fbb..0000000000 --- a/src/plugins/remotelinux/abstractembeddedlinuxtarget.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ -#include "abstractembeddedlinuxtarget.h" - -#include "deploymentinfo.h" -#include "typespecificdeviceconfigurationlistmodel.h" - -#include <qt4projectmanager/qt4buildconfiguration.h> - -using namespace ProjectExplorer; -using namespace Qt4ProjectManager; - -namespace RemoteLinux { - -AbstractEmbeddedLinuxTarget::AbstractEmbeddedLinuxTarget(Qt4Project *parent, const Core::Id id) : - Qt4BaseTarget(parent, id), - m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this)), - m_deploymentInfo(new DeploymentInfo(this)), - m_deviceConfigModel(new Internal::TypeSpecificDeviceConfigurationListModel(this)) -{ -} - -IBuildConfigurationFactory *AbstractEmbeddedLinuxTarget::buildConfigurationFactory() const -{ - return m_buildConfigurationFactory; -} - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/abstractembeddedlinuxtarget.h b/src/plugins/remotelinux/abstractembeddedlinuxtarget.h deleted file mode 100644 index 4f60678d9a..0000000000 --- a/src/plugins/remotelinux/abstractembeddedlinuxtarget.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ -#ifndef ABSTRACTEMBEDDEDLINUXTARGET_H -#define ABSTRACTEMBEDDEDLINUXTARGET_H - -#include "remotelinux_export.h" - -#include <qt4projectmanager/qt4target.h> - -#include <QSharedPointer> -#include <QString> - -namespace ProjectExplorer { -class IBuildConfigurationFactory; -class IDevice; -} -namespace Qt4ProjectManager { class Qt4BuildConfigurationFactory; } - -namespace RemoteLinux { -class DeploymentInfo; -namespace Internal { class TypeSpecificDeviceConfigurationListModel; } - -class REMOTELINUX_EXPORT AbstractEmbeddedLinuxTarget : public Qt4ProjectManager::Qt4BaseTarget -{ - Q_OBJECT -public: - AbstractEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id); - - ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const; - - DeploymentInfo *deploymentInfo() const { return m_deploymentInfo; } - Internal::TypeSpecificDeviceConfigurationListModel *deviceConfigModel() const { - return m_deviceConfigModel; - } - virtual bool supportsDevice(const QSharedPointer<const ProjectExplorer::IDevice> &device) const = 0; - -signals: - void supportedDevicesChanged(); - -private: - Qt4ProjectManager::Qt4BuildConfigurationFactory * const m_buildConfigurationFactory; - DeploymentInfo * const m_deploymentInfo; - Internal::TypeSpecificDeviceConfigurationListModel * const m_deviceConfigModel; -}; - -} // namespace RemoteLinux - -#endif // ABSTRACTEMBEDDEDLINUXTARGET_H diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp index 7f84926544..a534857da2 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp @@ -34,7 +34,9 @@ #include "deployablefile.h" #include "linuxdeviceconfiguration.h" +#include <projectexplorer/target.h> #include <qt4projectmanager/qt4buildconfiguration.h> +#include <qtsupport/qtprofileinformation.h> #include <utils/qtcassert.h> #include <ssh/sshconnection.h> #include <ssh/sshconnectionmanager.h> @@ -127,23 +129,32 @@ void AbstractRemoteLinuxDeployService::saveDeploymentTimeStamp(const DeployableF { if (!d->buildConfiguration) return; - const QtSupport::BaseQtVersion * const qtVersion = d->buildConfiguration->qtVersion(); + const QtSupport::BaseQtVersion *const qtVersion + = QtSupport::QtProfileInformation::qtVersion(d->buildConfiguration->target()->profile()); + QString systemRoot; + if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(d->buildConfiguration->target()->profile())) + systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(d->buildConfiguration->target()->profile()).toString(); if (!qtVersion || !qtVersion->isValid()) return; d->lastDeployed.insert(DeployParameters(deployableFile, - deviceConfiguration()->sshParameters().host, - qtVersion->systemRoot()), QDateTime::currentDateTime()); + deviceConfiguration()->sshParameters().host, + systemRoot), + QDateTime::currentDateTime()); } bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const { if (!d->buildConfiguration) return true; - const QtSupport::BaseQtVersion * const qtVersion = d->buildConfiguration->qtVersion(); + const QtSupport::BaseQtVersion *const qtVersion + = QtSupport::QtProfileInformation::qtVersion(d->buildConfiguration->target()->profile()); if (!qtVersion || !qtVersion->isValid()) return true; + QString systemRoot; + if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(d->buildConfiguration->target()->profile())) + systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(d->buildConfiguration->target()->profile()).toString(); const QDateTime &lastDeployed = d->lastDeployed.value(DeployParameters(deployableFile, - deviceConfiguration()->sshParameters().host, qtVersion->systemRoot())); + deviceConfiguration()->sshParameters().host, systemRoot)); return !lastDeployed.isValid() || QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed; } diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp index 68a8f9fc92..4acbe663f5 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp @@ -32,9 +32,12 @@ #include "abstractremotelinuxdeploystep.h" #include "abstractremotelinuxdeployservice.h" +#include "linuxdeviceconfiguration.h" #include "remotelinuxdeployconfiguration.h" +#include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/profileinformation.h> #include <projectexplorer/target.h> #include <qt4projectmanager/qt4buildconfiguration.h> @@ -79,7 +82,8 @@ QVariantMap AbstractRemoteLinuxDeployStep::toMap() const bool AbstractRemoteLinuxDeployStep::init() { QString error; - deployService()->setDeviceConfiguration(deployConfiguration()->deviceConfiguration()); + deployService()->setDeviceConfiguration(ProjectExplorer::DeviceProfileInformation::device(target()->profile()) + .dynamicCast<const LinuxDeviceConfiguration>()); deployService()->setBuildConfiguration(qobject_cast<Qt4ProjectManager::Qt4BuildConfiguration *>(target()->activeBuildConfiguration())); const bool canDeploy = initInternal(&error); if (!canDeploy) diff --git a/src/plugins/remotelinux/deploymentinfo.cpp b/src/plugins/remotelinux/deploymentinfo.cpp index e599b754be..dddd7bf101 100644 --- a/src/plugins/remotelinux/deploymentinfo.cpp +++ b/src/plugins/remotelinux/deploymentinfo.cpp @@ -31,13 +31,15 @@ #include "deploymentinfo.h" -#include "abstractembeddedlinuxtarget.h" #include "deployablefile.h" #include "deployablefilesperprofile.h" +#include "remotelinuxdeployconfiguration.h" #include <projectexplorer/buildstep.h> +#include <projectexplorer/target.h> #include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4project.h> +#include <qtsupport/qtprofileinformation.h> #include <QList> #include <QTimer> @@ -49,20 +51,20 @@ namespace Internal { class DeploymentInfoPrivate { public: - DeploymentInfoPrivate(const AbstractEmbeddedLinuxTarget *target) : target(target) {} + DeploymentInfoPrivate(const Qt4ProjectManager::Qt4Project *p) : project(p) {} QList<DeployableFilesPerProFile *> listModels; - const AbstractEmbeddedLinuxTarget * const target; + const Qt4ProjectManager::Qt4Project *const project; QString installPrefix; }; } // namespace Internal using namespace Internal; -DeploymentInfo::DeploymentInfo(AbstractEmbeddedLinuxTarget *target, const QString &installPrefix) - : QAbstractListModel(target), d(new DeploymentInfoPrivate(target)) +DeploymentInfo::DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix) + : QAbstractListModel(project), d(new DeploymentInfoPrivate(project)) { - connect (d->target->qt4Project(), SIGNAL(proParsingDone()), SLOT(createModels())); + connect(project, SIGNAL(buildSystemEvaluated()), SLOT(createModels())); setInstallPrefix(installPrefix); } @@ -73,27 +75,30 @@ DeploymentInfo::~DeploymentInfo() void DeploymentInfo::createModels() { - if (d->target->project()->activeTarget() != d->target) + ProjectExplorer::Target *target = d->project->activeTarget(); + if (!target + || !target->activeDeployConfiguration() + || !qobject_cast<RemoteLinuxDeployConfiguration *>(target->activeDeployConfiguration())) return; - const Qt4BuildConfiguration *bc = d->target->activeQt4BuildConfiguration(); - if (!bc || !bc->qtVersion() || !bc->qtVersion()->isValid()) { + + 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->target->qt4Project()->rootQt4ProjectNode(); + const Qt4ProFileNode *const rootNode = d->project->rootQt4ProjectNode(); if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard. return; - disconnect(d->target->qt4Project(), SIGNAL(proParsingDone()), this, SLOT(createModels())); + disconnect(d->project, SIGNAL(buildSystemEvaluated()), this, SLOT(createModels())); beginResetModel(); qDeleteAll(d->listModels); d->listModels.clear(); createModels(rootNode); endResetModel(); - connect (d->target->qt4Project(), SIGNAL(proParsingDone()), SLOT(createModels())); + connect (d->project, SIGNAL(buildSystemEvaluated()), SLOT(createModels())); } void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode) diff --git a/src/plugins/remotelinux/deploymentinfo.h b/src/plugins/remotelinux/deploymentinfo.h index fffa093ac0..a7cb01bb07 100644 --- a/src/plugins/remotelinux/deploymentinfo.h +++ b/src/plugins/remotelinux/deploymentinfo.h @@ -36,10 +36,13 @@ #include <QAbstractListModel> -namespace Qt4ProjectManager { class Qt4ProFileNode; } +namespace ProjectExplorer { class Target; } +namespace Qt4ProjectManager { +class Qt4ProFileNode; +class Qt4Project; +} // namespace Qt4ProjectManager namespace RemoteLinux { -class AbstractEmbeddedLinuxTarget; class DeployableFile; class DeployableFilesPerProFile; @@ -51,7 +54,7 @@ class REMOTELINUX_EXPORT DeploymentInfo : public QAbstractListModel { Q_OBJECT public: - DeploymentInfo(AbstractEmbeddedLinuxTarget *target, const QString &installPrefix = QString()); + DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix = QString()); ~DeploymentInfo(); void setUnmodified(); diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.cpp b/src/plugins/remotelinux/deploymentsettingsassistant.cpp index 23270136a0..e87c571883 100644 --- a/src/plugins/remotelinux/deploymentsettingsassistant.cpp +++ b/src/plugins/remotelinux/deploymentsettingsassistant.cpp @@ -34,9 +34,12 @@ #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> @@ -60,14 +63,11 @@ typedef QHash<QString, ProFileUpdateSetting> UpdateSettingsMap; class DeploymentSettingsAssistantInternal { public: - DeploymentSettingsAssistantInternal(const QString &qmakeScope, const QString &installPrefix, - DeploymentInfo *deploymentInfo) - : qmakeScope(qmakeScope), installPrefix(installPrefix), deploymentInfo(deploymentInfo) + DeploymentSettingsAssistantInternal(DeploymentInfo *deploymentInfo) + : deploymentInfo(deploymentInfo) { } - const QString qmakeScope; - const QString installPrefix; DeploymentInfo * const deploymentInfo; UpdateSettingsMap updateSettings; }; @@ -76,10 +76,10 @@ public: using namespace Internal; -DeploymentSettingsAssistant::DeploymentSettingsAssistant(const QString &qmakeScope, - const QString &installPrefix, DeploymentInfo *deploymentInfo, QObject *parent) +DeploymentSettingsAssistant::DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo, + ProjectExplorer::Project *parent) : QObject(parent), - d(new DeploymentSettingsAssistantInternal(qmakeScope, installPrefix, deploymentInfo)) + d(new DeploymentSettingsAssistantInternal(deploymentInfo)) { connect(d->deploymentInfo, SIGNAL(modelReset()), SLOT(handleDeploymentInfoUpdated())); } @@ -89,23 +89,26 @@ DeploymentSettingsAssistant::~DeploymentSettingsAssistant() delete d; } -bool DeploymentSettingsAssistant::addDeployableToProFile(const DeployableFilesPerProFile *proFileInfo, - const QString &variableName, const DeployableFile &deployable) +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(proFileInfo, QStringList() << filesLine << pathLine << installsLine); + return addLinesToProFile(qmakeScope, proFileInfo, + QStringList() << filesLine << pathLine << installsLine); } -bool DeploymentSettingsAssistant::addLinesToProFile(const DeployableFilesPerProFile *proFileInfo, - const QStringList &lines) +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') + d->qmakeScope + QLatin1String(" {") + 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()); @@ -114,6 +117,24 @@ bool DeploymentSettingsAssistant::addLinesToProFile(const DeployableFilesPerProF 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) { @@ -144,11 +165,13 @@ void DeploymentSettingsAssistant::handleDeploymentInfoUpdated() foreach (const DeployableFilesPerProFile * const proFileInfo, proFilesToUpdate) { const QString remoteDirSuffix = QLatin1String(proFileInfo->projectType() == LibraryTemplate ? "/lib" : "/bin"); - const QString remoteDir = QLatin1String("target.path = ") + d->installPrefix - + QLatin1Char('/') + proFileInfo->projectName() + remoteDirSuffix; - const QStringList deployInfo = QStringList() << remoteDir - << QLatin1String("INSTALLS += target"); - addLinesToProFile(proFileInfo, deployInfo); + 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); + } } } diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.h b/src/plugins/remotelinux/deploymentsettingsassistant.h index d2912845bb..4a7ad0956d 100644 --- a/src/plugins/remotelinux/deploymentsettingsassistant.h +++ b/src/plugins/remotelinux/deploymentsettingsassistant.h @@ -36,32 +36,32 @@ #include <QObject> #include <QStringList> +namespace ProjectExplorer { class Project; } + namespace RemoteLinux { class DeployableFile; class DeployableFilesPerProFile; class DeploymentInfo; -namespace Internal { -class DeploymentSettingsAssistantInternal; -} // namespace Internal +namespace Internal { class DeploymentSettingsAssistantInternal; } class REMOTELINUX_EXPORT DeploymentSettingsAssistant : public QObject { Q_OBJECT - Q_DISABLE_COPY(DeploymentSettingsAssistant) + public: - DeploymentSettingsAssistant(const QString &qmakeScope, const QString &installPrefix, - DeploymentInfo *deploymentInfo, QObject *parent = 0); + DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo, ProjectExplorer::Project *parent); ~DeploymentSettingsAssistant(); - bool addDeployableToProFile(const DeployableFilesPerProFile *proFileInfo, - const QString &variableName, const DeployableFile &deployable); + bool addDeployableToProFile(const QString &qmakeScope, + const DeployableFilesPerProFile *proFileInfo, + const QString &variableName, const DeployableFile &deployable); private slots: void handleDeploymentInfoUpdated(); private: - bool addLinesToProFile(const DeployableFilesPerProFile *proFileInfo, const QStringList &lines); + bool addLinesToProFile(const QString &qmakeScope, const DeployableFilesPerProFile *proFileInfo, const QStringList &lines); Internal::DeploymentSettingsAssistantInternal * const d; }; diff --git a/src/plugins/remotelinux/embeddedlinuxqtversion.cpp b/src/plugins/remotelinux/embeddedlinuxqtversion.cpp index b08ee8a4f2..e6b8c17518 100644 --- a/src/plugins/remotelinux/embeddedlinuxqtversion.cpp +++ b/src/plugins/remotelinux/embeddedlinuxqtversion.cpp @@ -74,16 +74,6 @@ QList<ProjectExplorer::Abi> EmbeddedLinuxQtVersion::detectQtAbis() const return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString())); } -bool EmbeddedLinuxQtVersion::supportsTargetId(const Core::Id id) const -{ - return id == Core::Id(Constants::EMBEDDED_LINUX_TARGET_ID); -} - -QSet<Core::Id> EmbeddedLinuxQtVersion::supportedTargetIds() const -{ - return QSet<Core::Id>() << Core::Id(Constants::EMBEDDED_LINUX_TARGET_ID); -} - QString EmbeddedLinuxQtVersion::description() const { return QCoreApplication::translate("QtVersion", "Embedded Linux", "Qt Version is used for embedded Linux development"); diff --git a/src/plugins/remotelinux/embeddedlinuxqtversion.h b/src/plugins/remotelinux/embeddedlinuxqtversion.h index c7d4181676..e548acb0b2 100644 --- a/src/plugins/remotelinux/embeddedlinuxqtversion.h +++ b/src/plugins/remotelinux/embeddedlinuxqtversion.h @@ -52,9 +52,6 @@ public: QList<ProjectExplorer::Abi> detectQtAbis() const; - bool supportsTargetId(const Core::Id id) const; - QSet<Core::Id> supportedTargetIds() const; - QString description() const; QString platformName() const; diff --git a/src/plugins/remotelinux/embeddedlinuxtargetfactory.cpp b/src/plugins/remotelinux/embeddedlinuxtargetfactory.cpp deleted file mode 100644 index a9eb98b01d..0000000000 --- a/src/plugins/remotelinux/embeddedlinuxtargetfactory.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "embeddedlinuxtargetfactory.h" - -#include "remotelinuxdeployconfiguration.h" -#include "remotelinuxdeployconfigurationfactory.h" -#include "genericembeddedlinuxtarget.h" -#include "remotelinux_constants.h" - -#include <qt4projectmanager/buildconfigurationinfo.h> -#include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4projectmanagerconstants.h> - -#include <qtsupport/customexecutablerunconfiguration.h> -#include <qtsupport/qtversionmanager.h> - -#include <QIcon> - -namespace RemoteLinux { -namespace Internal { - -EmbeddedLinuxTargetFactory::EmbeddedLinuxTargetFactory(QObject *parent) : - Qt4ProjectManager::Qt4BaseTargetFactory(parent) -{ } - -EmbeddedLinuxTargetFactory::~EmbeddedLinuxTargetFactory() -{ } - -QIcon EmbeddedLinuxTargetFactory::iconForId(const Core::Id id) const -{ - if (id == Core::Id(Constants::EMBEDDED_LINUX_TARGET_ID)) - return QIcon(":/remotelinux/images/embeddedtarget.png"); - return QIcon(); -} - -QString EmbeddedLinuxTargetFactory::buildNameForId(const Core::Id id) const -{ - if (supportsTargetId(id)) - return tr("embedded"); - return QString(); -} - -QSet<QString> EmbeddedLinuxTargetFactory::targetFeatures(const Core::Id id) const -{ - Q_UNUSED(id); - QSet<QString> features; - features << Qt4ProjectManager::Constants::MOBILE_TARGETFEATURE_ID; - features << Qt4ProjectManager::Constants::SHADOWBUILD_TARGETFEATURE_ID; - - return features; -} - -QList<Core::Id> EmbeddedLinuxTargetFactory::supportedTargetIds() const -{ - return QList<Core::Id>() << Core::Id(RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID); -} - -bool EmbeddedLinuxTargetFactory::supportsTargetId(const Core::Id id) const -{ - return id == Core::Id(RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID); -} - -QString EmbeddedLinuxTargetFactory::displayNameForId(const Core::Id id) const -{ - if (id == Core::Id(RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID)) - return tr("Embedded Linux"); - return QString(); -} - -bool EmbeddedLinuxTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const -{ - return qobject_cast<Qt4ProjectManager::Qt4Project *>(parent) && supportsTargetId(ProjectExplorer::idFromMap(map)); -} - -ProjectExplorer::Target *EmbeddedLinuxTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map) -{ - Q_ASSERT(canRestore(parent, map)); - - GenericEmbeddedLinuxTarget *t = - new GenericEmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent), Core::Id()); - if (t->fromMap(map)) - return t; - - delete t; - return 0; -} - -bool EmbeddedLinuxTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const -{ - Qt4ProjectManager::Qt4Project *project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent); - if (!project) - return false; - - if (!supportsTargetId(id)) - return false; - - return QtSupport::QtVersionManager::instance()->supportsTargetId(id); -} - -ProjectExplorer::Target *EmbeddedLinuxTargetFactory::create(ProjectExplorer::Project *parent, - const Core::Id id) -{ - if (!canCreate(parent, id)) - return 0; - - QList<QtSupport::BaseQtVersion *> knownVersions = - QtSupport::QtVersionManager::instance()->versionsForTargetId(id); - QtSupport::BaseQtVersion *qtVersion = knownVersions.first(); - QtSupport::BaseQtVersion::QmakeBuildConfigs config = qtVersion->defaultBuildConfig(); - - QList<Qt4ProjectManager::BuildConfigurationInfo> infos; - infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion->uniqueId(), config, QString(), QString())); - infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion->uniqueId(), - config ^ QtSupport::BaseQtVersion::DebugBuild, - QString(), QString())); - - return create(parent, id, infos); -} - -ProjectExplorer::Target *EmbeddedLinuxTargetFactory::create(ProjectExplorer::Project *parent, - const Core::Id id, - const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos) -{ - if (!canCreate(parent, id) || infos.isEmpty()) - return 0; - - GenericEmbeddedLinuxTarget *t = new GenericEmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent), id); - - foreach (const Qt4ProjectManager::BuildConfigurationInfo &info, infos) - t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(), - info.version(), info.buildConfig, - info.additionalArguments, info.directory, info.importing); - - t->addDeployConfiguration( - t->createDeployConfiguration( - RemoteLinuxDeployConfigurationFactory::genericDeployConfigurationId())); - - t->createApplicationProFiles(false); - - if (t->runConfigurations().isEmpty()) - t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t)); - return t; -} - -} // namespace Internal -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/embeddedlinuxtargetfactory.h b/src/plugins/remotelinux/embeddedlinuxtargetfactory.h deleted file mode 100644 index 77f4d80803..0000000000 --- a/src/plugins/remotelinux/embeddedlinuxtargetfactory.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: Nokia Corporation (qt-info@nokia.com) -** -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef EMBEDDEDLINUXTARGETFACTORY_H -#define EMBEDDEDLINUXTARGETFACTORY_H - -#include <qt4projectmanager/qt4basetargetfactory.h> - -namespace RemoteLinux { -namespace Internal { - -class EmbeddedLinuxTargetFactory : public Qt4ProjectManager::Qt4BaseTargetFactory -{ - Q_OBJECT - -public: - explicit EmbeddedLinuxTargetFactory(QObject *parent = 0); - ~EmbeddedLinuxTargetFactory(); - - QIcon iconForId(const Core::Id id) const; - QString buildNameForId(const Core::Id id) const; - - QSet<QString> targetFeatures(const Core::Id id) const; - - QList<Core::Id> supportedTargetIds() const; - bool supportsTargetId(const Core::Id id) const; - - QString displayNameForId(const Core::Id id) const; - - bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const; - ProjectExplorer::Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map); - - bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const; - ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id); - ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id, - const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos); -}; - -} // namespace Internal -} // namespace RemoteLinux - -#endif // EMBEDDEDLINUXTARGETFACTORY_H diff --git a/src/plugins/remotelinux/genericembeddedlinuxtarget.cpp b/src/plugins/remotelinux/genericembeddedlinuxtarget.cpp deleted file mode 100644 index 4cd46186b8..0000000000 --- a/src/plugins/remotelinux/genericembeddedlinuxtarget.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "genericembeddedlinuxtarget.h" - -#include "remotelinux_constants.h" -#include "remotelinuxrunconfiguration.h" - -#include <projectexplorer/devicesupport/idevice.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4nodes.h> -#include <qt4projectmanager/qt4project.h> -#include <qtsupport/baseqtversion.h> -#include <qtsupport/customexecutablerunconfiguration.h> - -#include <QCoreApplication> - -namespace RemoteLinux { -namespace Internal { - -GenericEmbeddedLinuxTarget::GenericEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, - const Core::Id id) : - AbstractEmbeddedLinuxTarget(parent, id) -{ - setDisplayName(tr("Embedded Linux")); -} - -QList<ProjectExplorer::RunConfiguration *> GenericEmbeddedLinuxTarget::runConfigurationsForNode(ProjectExplorer::Node *n) -{ - QList<ProjectExplorer::RunConfiguration *> result; - foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) - if (RemoteLinuxRunConfiguration *qt4c = qobject_cast<RemoteLinuxRunConfiguration *>(rc)) - if (qt4c->proFilePath() == n->path()) - result << rc; - return result; -} - -Utils::FileName GenericEmbeddedLinuxTarget::mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const -{ - QtSupport::BaseQtVersion *version = bc->qtVersion(); - if (!version) - return Utils::FileName(); - return version->mkspec(); -} - -bool GenericEmbeddedLinuxTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const -{ - return device->type() == Core::Id(Constants::GenericLinuxOsType); -} - -void GenericEmbeddedLinuxTarget::createApplicationProFiles(bool reparse) -{ - if (!reparse) - removeUnconfiguredCustomExectutableRunConfigurations(); - - // We use the list twice - QList<Qt4ProjectManager::Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles(); - QStringList pathes; - foreach (Qt4ProjectManager::Qt4ProFileNode *pro, profiles) - pathes.append(pro->path()); - - foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) { - if (RemoteLinuxRunConfiguration *qt4rc = qobject_cast<RemoteLinuxRunConfiguration *>(rc)) - pathes.removeAll(qt4rc->proFilePath()); - } - - // Only add new runconfigurations if there are none. - foreach (const QString &path, pathes) { - RemoteLinuxRunConfiguration *qt4rc = - new RemoteLinuxRunConfiguration(this, Core::Id(RemoteLinuxRunConfiguration::Id), path); - addRunConfiguration(qt4rc); - } - - // Oh still none? Add a custom executable runconfiguration - if (runConfigurations().isEmpty()) - addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this)); -} - -} // namespace Internal -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/genericembeddedlinuxtarget.h b/src/plugins/remotelinux/genericembeddedlinuxtarget.h deleted file mode 100644 index fe84489b02..0000000000 --- a/src/plugins/remotelinux/genericembeddedlinuxtarget.h +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef EMBEDDEDLINUXTARGET_H -#define EMBEDDEDLINUXTARGET_H - -#include "abstractembeddedlinuxtarget.h" - -namespace RemoteLinux { -namespace Internal { - -class EmbeddedLinuxTargetFactory; - -class GenericEmbeddedLinuxTarget : public AbstractEmbeddedLinuxTarget -{ - Q_OBJECT - -public: - GenericEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id); - - void createApplicationProFiles(bool reparse); - QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n); - Utils::FileName mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const; - bool supportsDevice(const QSharedPointer<const ProjectExplorer::IDevice> &device) const; - -private: - friend class EmbeddedLinuxTargetFactory; -}; - -} // namespace Internal -} // namespace RemoteLinux - -#endif // EMBEDDEDLINUXTARGET_H diff --git a/src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp b/src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp index 93d7159044..1aebf376fd 100644 --- a/src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp +++ b/src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp @@ -33,13 +33,15 @@ #include "genericdirectuploadstep.h" #include "remotelinuxcheckforfreediskspacestep.h" +#include "remotelinuxdeployconfiguration.h" #include "remotelinuxdeployconfigurationfactory.h" #include "remotelinuxcustomcommanddeploymentstep.h" #include "tarpackagecreationstep.h" #include "uploadandinstalltarpackagestep.h" #include <projectexplorer/buildsteplist.h> -#include <projectexplorer/deployconfiguration.h> +#include <projectexplorer/profileinformation.h> +#include <projectexplorer/target.h> using namespace ProjectExplorer; @@ -54,8 +56,7 @@ GenericRemoteLinuxDeployStepFactory::GenericRemoteLinuxDeployStepFactory(QObject QList<Core::Id> GenericRemoteLinuxDeployStepFactory::availableCreationIds(BuildStepList *parent) const { QList<Core::Id> ids; - const DeployConfiguration * const dc = qobject_cast<DeployConfiguration *>(parent->parent()); - if (!dc || dc->id() != RemoteLinuxDeployConfigurationFactory::genericDeployConfigurationId()) + if (!qobject_cast<RemoteLinuxDeployConfiguration *>(parent->parent())) return ids; ids << TarPackageCreationStep::stepId() << UploadAndInstallTarPackageStep::stepId() << GenericDirectUploadStep::stepId() diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp index 1a192ecd5a..fd0d12b8b0 100644 --- a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp @@ -29,6 +29,7 @@ ** Nokia at qt-info@nokia.com. ** **************************************************************************/ + #include "linuxdeviceconfiguration.h" #include "genericlinuxdeviceconfigurationwidget.h" @@ -39,6 +40,9 @@ #include "remotelinux_constants.h" #include <coreplugin/id.h> + +#include <utils/portlist.h> +#include <ssh/sshconnection.h> #include <utils/qtcassert.h> namespace RemoteLinux { diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index 834306880b..b20e68f78b 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -6,8 +6,6 @@ include(../../qtcreatorplugin.pri) include(remotelinux_dependencies.pri) HEADERS += \ - genericembeddedlinuxtarget.h \ - embeddedlinuxtargetfactory.h \ embeddedlinuxqtversion.h \ embeddedlinuxqtversionfactory.h \ remotelinuxplugin.h \ @@ -56,14 +54,11 @@ HEADERS += \ startgdbserverdialog.h \ remotelinuxcustomcommanddeployservice.h \ remotelinuxcustomcommanddeploymentstep.h \ - abstractembeddedlinuxtarget.h \ genericlinuxdeviceconfigurationwidget.h \ remotelinuxcheckforfreediskspaceservice.h \ remotelinuxcheckforfreediskspacestep.h SOURCES += \ - genericembeddedlinuxtarget.cpp \ - embeddedlinuxtargetfactory.cpp \ embeddedlinuxqtversion.cpp \ embeddedlinuxqtversionfactory.cpp \ remotelinuxplugin.cpp \ @@ -109,7 +104,6 @@ SOURCES += \ startgdbserverdialog.cpp \ remotelinuxcustomcommanddeployservice.cpp \ remotelinuxcustomcommanddeploymentstep.cpp \ - abstractembeddedlinuxtarget.cpp \ genericlinuxdeviceconfigurationwidget.cpp \ remotelinuxcheckforfreediskspaceservice.cpp \ remotelinuxcheckforfreediskspacestep.cpp diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs index bad03535f8..5c6bdf04bf 100644 --- a/src/plugins/remotelinux/remotelinux.qbs +++ b/src/plugins/remotelinux/remotelinux.qbs @@ -28,10 +28,6 @@ QtcPlugin { "abstractremotelinuxdeploystep.h", "abstractuploadandinstallpackageservice.cpp", "abstractuploadandinstallpackageservice.h", - "abstractembeddedlinuxtarget.cpp", - "abstractembeddedlinuxtarget.h", - "genericembeddedlinuxtarget.cpp", - "genericembeddedlinuxtarget.h", "deployablefile.h", "deployablefilesperprofile.cpp", "deployablefilesperprofile.h", @@ -43,8 +39,6 @@ QtcPlugin { "embeddedlinuxqtversion.h", "embeddedlinuxqtversionfactory.cpp", "embeddedlinuxqtversionfactory.h", - "embeddedlinuxtargetfactory.cpp", - "embeddedlinuxtargetfactory.h", "genericdirectuploadservice.cpp", "genericdirectuploadstep.h", "genericlinuxdeviceconfigurationfactory.cpp", diff --git a/src/plugins/remotelinux/remotelinux_constants.h b/src/plugins/remotelinux/remotelinux_constants.h index dc7c90df81..ae7049f593 100644 --- a/src/plugins/remotelinux/remotelinux_constants.h +++ b/src/plugins/remotelinux/remotelinux_constants.h @@ -42,7 +42,6 @@ const char GenericDeployKeyToDeviceActionId[] = "RemoteLinux.GenericDeployKeyToD const char GenericRemoteProcessesActionId[] = "RemoteLinux.GenericRemoteProcessesAction"; const char EMBEDDED_LINUX_QT[] = "RemoteLinux.EmbeddedLinuxQt"; -const char EMBEDDED_LINUX_TARGET_ID[] = "RemoteLinux.EmbeddedLinuxTarget"; } // Constants } // RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp index f8cb42f094..5744373eea 100644 --- a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp +++ b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp @@ -35,6 +35,9 @@ #include "remotelinuxrunconfiguration.h" #include "remotelinuxusedportsgatherer.h" +#include <projectexplorer/target.h> +#include <projectexplorer/profileinformation.h> + #include <utils/portlist.h> #include <utils/qtcassert.h> #include <ssh/sshconnection.h> @@ -63,16 +66,16 @@ class AbstractRemoteLinuxApplicationRunnerPrivate { public: AbstractRemoteLinuxApplicationRunnerPrivate(const RemoteLinuxRunConfiguration *runConfig) - : devConfig(runConfig->deviceConfig()), + : devConfig(ProjectExplorer::DeviceProfileInformation::device(runConfig->target()->profile()) + .dynamicCast<const LinuxDeviceConfiguration>()), remoteExecutable(runConfig->remoteExecutableFilePath()), appArguments(runConfig->arguments()), commandPrefix(runConfig->commandPrefix()), - initialFreePorts(runConfig->freePorts()), + initialFreePorts(devConfig->freePorts()), connection(0), stopRequested(false), state(Inactive) - { - } + { } RemoteLinuxUsedPortsGatherer portsGatherer; LinuxDeviceConfiguration::ConstPtr devConfig; diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 0e75c07a25..a561bda67a 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -37,11 +37,14 @@ #include <debugger/debuggerengine.h> #include <debugger/debuggerstartparameters.h> +#include <debugger/debuggerprofileinformation.h> #include <projectexplorer/abi.h> +#include <projectexplorer/profile.h> #include <projectexplorer/project.h> #include <projectexplorer/target.h> #include <projectexplorer/toolchain.h> #include <qt4projectmanager/qt4buildconfiguration.h> +#include <qtsupport/qtprofileinformation.h> #include <utils/qtcassert.h> #include <QPointer> @@ -94,29 +97,35 @@ using namespace Internal; DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const RemoteLinuxRunConfiguration *runConfig) { DebuggerStartParameters params; - const IDevice::ConstPtr &devConf = runConfig->deviceConfig(); + const LinuxDeviceConfiguration::ConstPtr devConf + = ProjectExplorer::DeviceProfileInformation::device(runConfig->target()->profile()) + .dynamicCast<const RemoteLinux::LinuxDeviceConfiguration>(); if (runConfig->debuggerAspect()->useQmlDebugger()) { params.languages |= QmlLanguage; - params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host; + params.qmlServerAddress = devConf->sshParameters().host; params.qmlServerPort = 0; // port is selected later on } if (runConfig->debuggerAspect()->useCppDebugger()) { params.languages |= CppLanguage; params.processArgs = runConfig->arguments(); - if (runConfig->activeQt4BuildConfiguration()->qtVersion()) - params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot(); + QString systemRoot; + if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(runConfig->target()->profile())) + systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(runConfig->target()->profile()).toString(); + params.sysroot = systemRoot; params.toolChainAbi = runConfig->abi(); params.startMode = AttachToRemoteServer; params.executable = runConfig->localExecutableFilePath(); - params.debuggerCommand = runConfig->gdbCmd(); + params.debuggerCommand = Debugger::DebuggerProfileInformation::debuggerCommand(runConfig->target()->profile()).toString(); params.remoteChannel = devConf->sshParameters().host + QLatin1String(":-1"); // TODO: This functionality should be inside the debugger. - const ProjectExplorer::Abi &abi = runConfig->target() - ->activeBuildConfiguration()->toolChain()->targetAbi(); - params.remoteArchitecture = abi.toString(); - params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture - ? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu"); + ToolChain *tc = ToolChainProfileInformation::toolChain(runConfig->target()->profile()); + if (tc) { + const ProjectExplorer::Abi &abi = tc->targetAbi(); + params.remoteArchitecture = abi.toString(); + params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture + ? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu"); + } } else { params.startMode = AttachToRemoteServer; } diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp index 788777f591..91f3dc365d 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp @@ -31,109 +31,62 @@ **************************************************************************/ #include "remotelinuxdeployconfiguration.h" -#include "abstractembeddedlinuxtarget.h" #include "deploymentinfo.h" #include "remotelinuxdeployconfigurationwidget.h" #include "typespecificdeviceconfigurationlistmodel.h" #include <coreplugin/id.h> #include <projectexplorer/devicesupport/devicemanager.h> -#include <qt4projectmanager/qt4target.h> +#include <projectexplorer/target.h> +#include <qt4projectmanager/qt4project.h> using namespace ProjectExplorer; using namespace Qt4ProjectManager; -namespace RemoteLinux { -namespace Internal { namespace { -const char DeviceIdKey[] = "Qt4ProjectManager.MaemoRunConfiguration.DeviceId"; -} // anonymous namespace - -class RemoteLinuxDeployConfigurationPrivate -{ -public: - QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration; -}; +const char DEPLOYMENT_INFO_SETTING[] = "RemoteLinux.DeploymentInfo"; +} // namespace -} // namespace Internal +namespace RemoteLinux { using namespace Internal; RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id, const QString &defaultDisplayName) - : DeployConfiguration(target, id), d(new RemoteLinuxDeployConfigurationPrivate) + : DeployConfiguration(target, id) { setDefaultDisplayName(defaultDisplayName); - initialize(); + // 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, RemoteLinuxDeployConfiguration *source) - : DeployConfiguration(target, source), d(new RemoteLinuxDeployConfigurationPrivate) -{ - initialize(); -} - -RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration() -{ - delete d; -} - -void RemoteLinuxDeployConfiguration::initialize() -{ - d->deviceConfiguration = target()->deviceConfigModel()->defaultDeviceConfig(); - connect(target()->deviceConfigModel(), SIGNAL(modelReset()), - SLOT(handleDeviceConfigurationListUpdated())); -} - -void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated() -{ - setDeviceConfig(DeviceManager::instance()->deviceId(d->deviceConfiguration)); -} + : DeployConfiguration(target, source) +{ } -void RemoteLinuxDeployConfiguration::setDeviceConfig(Core::Id id) -{ - d->deviceConfiguration = target()->deviceConfigModel()->find(id); - emit deviceConfigurationListChanged(); - emit currentDeviceConfigurationChanged(); -} - -bool RemoteLinuxDeployConfiguration::fromMap(const QVariantMap &map) -{ - if (!DeployConfiguration::fromMap(map)) - return false; - const QString idString = map.value(QLatin1String(DeviceIdKey)).toString(); - setDeviceConfig(!idString.isEmpty() ? Core::Id(idString) : IDevice::invalidId()); - return true; -} - -QVariantMap RemoteLinuxDeployConfiguration::toMap() const -{ - QVariantMap map = DeployConfiguration::toMap(); - map.insert(QLatin1String(DeviceIdKey), - DeviceManager::instance()->deviceId(d->deviceConfiguration).toString()); - return map; -} - -void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index) +DeploymentInfo *RemoteLinuxDeployConfiguration::deploymentInfo() const { - const LinuxDeviceConfiguration::ConstPtr &newDevConf - = target()->deviceConfigModel()->deviceAt(index); - if (d->deviceConfiguration != newDevConf) { - d->deviceConfiguration = newDevConf; - emit currentDeviceConfigurationChanged(); - } + DeploymentInfo *info + = qobject_cast<DeploymentInfo *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>()); + return info; } -AbstractEmbeddedLinuxTarget *RemoteLinuxDeployConfiguration::target() const +QString RemoteLinuxDeployConfiguration::qmakeScope() const { - return qobject_cast<AbstractEmbeddedLinuxTarget *>(DeployConfiguration::target()); + return QLatin1String("unix"); } -DeploymentInfo *RemoteLinuxDeployConfiguration::deploymentInfo() const +QString RemoteLinuxDeployConfiguration::installPrefix() const { - return target()->deploymentInfo(); + return QString(); } DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const @@ -141,9 +94,4 @@ DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() return new RemoteLinuxDeployConfigurationWidget; } -LinuxDeviceConfiguration::ConstPtr RemoteLinuxDeployConfiguration::deviceConfiguration() const -{ - return d->deviceConfiguration; -} - } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h index b000e2023e..55ee42421d 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h @@ -29,24 +29,25 @@ ** Nokia at qt-info@nokia.com. ** **************************************************************************/ + #ifndef REMOTELINUXDEPLOYCONFIGURATION_H #define REMOTELINUXDEPLOYCONFIGURATION_H #include "linuxdeviceconfiguration.h" + #include "remotelinux_export.h" +#include <coreplugin/id.h> #include <projectexplorer/buildstep.h> #include <projectexplorer/buildsteplist.h> #include <projectexplorer/deployconfiguration.h> -#include <QSharedPointer> - namespace RemoteLinux { class AbstractEmbeddedLinuxTarget; class DeploymentInfo; namespace Internal { -class RemoteLinuxDeployConfigurationPrivate; +class RemoteLinuxDeployConfigurationFactory; class TypeSpecificDeviceConfigurationListModel; } // namespace Internal @@ -54,22 +55,16 @@ class REMOTELINUX_EXPORT RemoteLinuxDeployConfiguration : public ProjectExplorer::DeployConfiguration { Q_OBJECT - Q_DISABLE_COPY(RemoteLinuxDeployConfiguration) + public: RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id, const QString &defaultDisplayName); RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, RemoteLinuxDeployConfiguration *source); - ~RemoteLinuxDeployConfiguration(); - - bool fromMap(const QVariantMap &map); ProjectExplorer::DeployConfigurationWidget *configurationWidget() const; - void setDeviceConfiguration(int index); - AbstractEmbeddedLinuxTarget *target() const; DeploymentInfo *deploymentInfo() const; - QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const; template<class T> T *earlierBuildStep(const ProjectExplorer::BuildStep *laterBuildStep) const { @@ -83,20 +78,14 @@ public: return 0; } -protected: - QVariantMap toMap() const; + virtual QString qmakeScope() const; + virtual QString installPrefix() const; signals: - void deviceConfigurationListChanged(); - void currentDeviceConfigurationChanged(); + void packagingChanged(); private: - - void initialize(); - void setDeviceConfig(Core::Id id); - Q_SLOT void handleDeviceConfigurationListUpdated(); - - Internal::RemoteLinuxDeployConfigurationPrivate * const d; + friend class Internal::RemoteLinuxDeployConfigurationFactory; }; } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp index 7ff2c34c30..5d7590be6f 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp @@ -31,11 +31,17 @@ **************************************************************************/ #include "remotelinuxdeployconfigurationfactory.h" -#include "genericembeddedlinuxtarget.h" #include "genericdirectuploadstep.h" #include "remotelinuxcheckforfreediskspacestep.h" +#include "remotelinux_constants.h" #include "remotelinuxdeployconfiguration.h" +#include <projectexplorer/abi.h> +#include <projectexplorer/profileinformation.h> +#include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/target.h> +#include <qt4projectmanager/qt4project.h> + #include <QCoreApplication> using namespace ProjectExplorer; @@ -50,12 +56,23 @@ QString genericLinuxDisplayName() { RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory(QObject *parent) : DeployConfigurationFactory(parent) -{ } +{ setObjectName(QLatin1String("RemoteLinuxDeployConfiguration"));} QList<Core::Id> RemoteLinuxDeployConfigurationFactory::availableCreationIds(Target *parent) const { QList<Core::Id> ids; - if (qobject_cast<GenericEmbeddedLinuxTarget *>(parent)) + if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project())) + return ids; + ProjectExplorer::ToolChain *tc + = ProjectExplorer::ToolChainProfileInformation::toolChain(parent->profile()); + if (!tc || tc->targetAbi().os() != ProjectExplorer::Abi::LinuxOS) + return ids; + if (ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->profile()) + == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) + return ids; + + ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceProfileInformation::device(parent->profile()); + if (!dev.isNull() && dev->type() == Core::Id(Constants::GenericLinuxOsType)) ids << genericDeployConfigurationId(); return ids; } diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp index 818221ffcc..d5440c2a43 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp @@ -31,7 +31,6 @@ #include "remotelinuxdeployconfigurationwidget.h" #include "ui_remotelinuxdeployconfigurationwidget.h" -#include "abstractembeddedlinuxtarget.h" #include "deployablefilesperprofile.h" #include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" @@ -42,6 +41,7 @@ #include <coreplugin/id.h> #include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/target.h> #include <utils/qtcassert.h> #include <QTreeView> @@ -102,17 +102,8 @@ void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc) d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc); Q_ASSERT(d->deployConfiguration); - connect(d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)), - SLOT(showDeviceConfigurations())); connect(&d->treeView, SIGNAL(doubleClicked()), SLOT(openProjectFile())); - d->ui.deviceConfigsComboBox->setModel(d->deployConfiguration->target()->deviceConfigModel()); - connect(d->ui.deviceConfigsComboBox, SIGNAL(activated(int)), - SLOT(handleSelectedDeviceConfigurationChanged(int))); - connect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), - SLOT(handleDeviceConfigurationListChanged())); - handleDeviceConfigurationListChanged(); - d->ui.projectsComboBox->setModel(d->deployConfiguration->deploymentInfo()); connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelAboutToBeReset()), SLOT(handleModelListToBeReset())); @@ -170,32 +161,6 @@ void RemoteLinuxDeployConfigurationWidget::setModel(int row) emit currentModelChanged(proFileInfo); } -void RemoteLinuxDeployConfigurationWidget::handleSelectedDeviceConfigurationChanged(int index) -{ - disconnect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), this, - SLOT(handleDeviceConfigurationListChanged())); - d->deployConfiguration->setDeviceConfiguration(index); - connect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), - SLOT(handleDeviceConfigurationListChanged())); -} - -void RemoteLinuxDeployConfigurationWidget::handleDeviceConfigurationListChanged() -{ - const LinuxDeviceConfiguration::ConstPtr &devConf - = d->deployConfiguration->deviceConfiguration(); - const Core::Id id = DeviceManager::instance()->deviceId(devConf); - const int newIndex - = d->deployConfiguration->target()->deviceConfigModel()->indexForId(id); - d->ui.deviceConfigsComboBox->setCurrentIndex(newIndex); -} - -void RemoteLinuxDeployConfigurationWidget::showDeviceConfigurations() -{ - Core::ICore::showOptionsDialog( - QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY), - QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_PAGE_ID)); -} - void RemoteLinuxDeployConfigurationWidget::openProjectFile() { const int row = d->ui.projectsComboBox->currentIndex(); diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h index b28e7f707f..0d0036a43a 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h @@ -64,9 +64,6 @@ private slots: void handleModelListToBeReset(); void handleModelListReset(); void setModel(int row); - void handleSelectedDeviceConfigurationChanged(int index); - void handleDeviceConfigurationListChanged(); - void showDeviceConfigurations(); void openProjectFile(); private: diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui index caba98032e..2bfa1bd8a6 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui @@ -16,41 +16,10 @@ <layout class="QVBoxLayout" name="verticalLayout"> <item> <layout class="QFormLayout" name="formLayout"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Device configuration:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QComboBox" name="deviceConfigsComboBox"/> - </item> - <item> - <widget class="QLabel" name="manageDevConfsLabel"> - <property name="text"> - <string><a href="irrelevant">Manage device configurations</a></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 row="1" column="0"> <widget class="QLabel" name="installLabel"> <property name="toolTip"> <string>These show the INSTALLS settings from the project file(s).</string> @@ -60,7 +29,7 @@ </property> </widget> </item> - <item row="1" column="1"> + <item row="0" column="1"> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QComboBox" name="projectsComboBox"> diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp index 5b51621fca..97fdd7c1d6 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp @@ -34,6 +34,8 @@ #include "remotelinuxrunconfiguration.h" #include <ssh/sshremoteprocessrunner.h> +#include <projectexplorer/profileinformation.h> +#include <projectexplorer/target.h> namespace RemoteLinux { namespace Internal { @@ -42,11 +44,11 @@ RemoteLinuxEnvironmentReader::RemoteLinuxEnvironmentReader(RemoteLinuxRunConfigu QObject *parent) : QObject(parent) , m_stop(false) - , m_devConfig(config->deviceConfig()) + , m_devConfig(ProjectExplorer::DeviceProfileInformation::device(config->target()->profile())) , m_runConfig(config) , m_remoteProcessRunner(0) { - connect(config, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), + connect(config->target(), SIGNAL(profileChanged()), this, SLOT(handleCurrentDeviceConfigChanged())); } @@ -87,7 +89,7 @@ void RemoteLinuxEnvironmentReader::handleConnectionFailure() void RemoteLinuxEnvironmentReader::handleCurrentDeviceConfigChanged() { - m_devConfig = m_runConfig->deviceConfig(); + m_devConfig = ProjectExplorer::DeviceProfileInformation::device(m_runConfig->target()->profile()); if (m_remoteProcessRunner) disconnect(m_remoteProcessRunner, 0, this, 0); diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.h b/src/plugins/remotelinux/remotelinuxenvironmentreader.h index acda6147d9..d1c78dada2 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentreader.h +++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.h @@ -32,10 +32,11 @@ #ifndef REMOTELINUXENVIRONMENTREADER_H #define REMOTELINUXENVIRONMENTREADER_H +#include <projectexplorer/devicesupport/idevice.h> #include <utils/environment.h> #include <QObject> -#include <QSharedPointer> + namespace QSsh { class SshRemoteProcessRunner; @@ -74,7 +75,7 @@ private: bool m_stop; Utils::Environment m_env; - QSharedPointer<const LinuxDeviceConfiguration> m_devConfig; + ProjectExplorer::IDevice::ConstPtr m_devConfig; RemoteLinuxRunConfiguration *m_runConfig; QSsh::SshRemoteProcessRunner *m_remoteProcessRunner; }; diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index 0cf91f4fdf..f037a30768 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -33,7 +33,6 @@ #include "remotelinuxplugin.h" #include "embeddedlinuxqtversionfactory.h" -#include "embeddedlinuxtargetfactory.h" #include "deployablefile.h" #include "genericlinuxdeviceconfigurationfactory.h" #include "genericremotelinuxdeploystepfactory.h" @@ -76,7 +75,6 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments, addAutoReleasedObject(new RemoteLinuxDeployConfigurationFactory); addAutoReleasedObject(new GenericRemoteLinuxDeployStepFactory); - addAutoReleasedObject(new EmbeddedLinuxTargetFactory); addAutoReleasedObject(new EmbeddedLinuxQtVersionFactory); qRegisterMetaType<RemoteLinux::DeployableFile>("RemoteLinux::DeployableFile"); diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 50c1a714e0..a46252a62c 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -39,12 +39,12 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/session.h> +#include <projectexplorer/target.h> #include <projectexplorer/toolchain.h> #include <qtsupport/qtoutputformatter.h> #include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4nodes.h> #include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4target.h> #include <utils/portlist.h> #include <utils/qtcassert.h> @@ -70,13 +70,15 @@ const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory"; class RemoteLinuxRunConfigurationPrivate { public: - RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const Qt4BaseTarget *target) + RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const ProjectExplorer::Target *target) : proFilePath(proFilePath), baseEnvironmentType(RemoteLinuxRunConfiguration::RemoteBaseEnvironment), - validParse(target->qt4Project()->validParse(proFilePath)), - parseInProgress(target->qt4Project()->parseInProgress(proFilePath)), + 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) @@ -110,7 +112,7 @@ public: using namespace Internal; -RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, const Core::Id id, +RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, const Core::Id id, const QString &proFilePath) : RunConfiguration(parent, id), d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent)) @@ -118,7 +120,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, init(); } -RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, +RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, RemoteLinuxRunConfiguration *source) : RunConfiguration(parent, source), d(new RemoteLinuxRunConfigurationPrivate(source->d)) @@ -136,14 +138,11 @@ void RemoteLinuxRunConfiguration::init() this, SLOT(handleDeployConfigChanged())); handleDeployConfigChanged(); - Qt4Project *pro = qt4Target()->qt4Project(); + Qt4Project *pro = static_cast<Qt4Project *>(target()->project()); connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), this, SLOT(proFileUpdate(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); -} - -Qt4BaseTarget *RemoteLinuxRunConfiguration::qt4Target() const -{ - return static_cast<Qt4BaseTarget *>(target()); + connect(target(), SIGNAL(profileChanged()), + this, SLOT(handleDeployablesUpdated())); // Handles device changes, etc. } Qt4BuildConfiguration *RemoteLinuxRunConfiguration::activeQt4BuildConfiguration() const @@ -159,7 +158,7 @@ bool RemoteLinuxRunConfiguration::isEnabled() const return false; } if (!d->validParse) { - Qt4Project *project = qt4Target()->qt4Project(); + Qt4Project *project = static_cast<Qt4Project *>(target()->project()); d->disabledReason = project->disabledReasonForRunConfiguration(d->proFilePath); return false; } @@ -187,7 +186,7 @@ QWidget *RemoteLinuxRunConfiguration::createConfigurationWidget() OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const { - return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project()); + return new QtSupport::QtOutputFormatter(target()->project()); } void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress) @@ -236,8 +235,9 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map) d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString(); d->workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString(); - d->validParse = qt4Target()->qt4Project()->validParse(d->proFilePath); - d->parseInProgress = qt4Target()->qt4Project()->parseInProgress(d->proFilePath); + Qt4Project *project = static_cast<Qt4Project *>(target()->project()); + d->validParse = project->validParse(d->proFilePath); + d->parseInProgress = project->parseInProgress(d->proFilePath); setDefaultDisplayName(defaultDisplayName()); @@ -253,17 +253,6 @@ QString RemoteLinuxRunConfiguration::defaultDisplayName() return tr("Run on Remote Device"); } -LinuxDeviceConfiguration::ConstPtr RemoteLinuxRunConfiguration::deviceConfig() const -{ - return deployConfig() - ? deployConfig()->deviceConfiguration() : LinuxDeviceConfiguration::ConstPtr(); -} - -QString RemoteLinuxRunConfiguration::gdbCmd() const -{ - return activeBuildConfiguration()->toolChain()->debuggerCommand().toUserOutput(); -} - RemoteLinuxDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const { return qobject_cast<RemoteLinuxDeployConfiguration *>(target()->activeDeployConfiguration()); @@ -296,7 +285,7 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const QString RemoteLinuxRunConfiguration::localExecutableFilePath() const { - TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode() + TargetInformation ti = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode() ->targetInformation(d->proFilePath); if (!ti.valid) return QString(); @@ -317,14 +306,6 @@ QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const ? alternateRemoteExecutable() : defaultRemoteExecutableFilePath(); } -PortList RemoteLinuxRunConfiguration::freePorts() const -{ - const LinuxDeviceConfiguration::ConstPtr &devConf = deviceConfig(); - if (!devConf) - return PortList(); - return devConf->freePorts(); -} - void RemoteLinuxRunConfiguration::setArguments(const QString &args) { d->arguments = args; @@ -371,23 +352,12 @@ int RemoteLinuxRunConfiguration::portsUsedByDebuggers() const return ports; } -void RemoteLinuxRunConfiguration::updateDeviceConfigurations() -{ - emit deviceConfigurationChanged(target()); - updateEnabledState(); -} - void RemoteLinuxRunConfiguration::handleDeployConfigChanged() { RemoteLinuxDeployConfiguration * const activeDeployConf = deployConfig(); - if (activeDeployConf) { + if (activeDeployConf) connect(activeDeployConf->deploymentInfo(), SIGNAL(modelReset()), - SLOT(handleDeployablesUpdated()), Qt::UniqueConnection); - connect(activeDeployConf, SIGNAL(currentDeviceConfigurationChanged()), - SLOT(updateDeviceConfigurations()), Qt::UniqueConnection); - } - - updateDeviceConfigurations(); + SLOT(handleDeployablesUpdated()), Qt::UniqueConnection); } void RemoteLinuxRunConfiguration::handleDeployablesUpdated() diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h index e374d9c71f..1fe6d639eb 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -35,19 +35,19 @@ #include "remotelinux_export.h" +#include "linuxdeviceconfiguration.h" + #include <projectexplorer/runconfiguration.h> #include <utils/environment.h> namespace Qt4ProjectManager { class Qt4BuildConfiguration; -class Qt4BaseTarget; class Qt4ProFileNode; } // namespace Qt4ProjectManager namespace Utils { class PortList; } namespace RemoteLinux { -class LinuxDeviceConfiguration; class RemoteLinuxRunConfigurationWidget; class RemoteLinuxDeployConfiguration; @@ -71,21 +71,20 @@ public: enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml }; - RemoteLinuxRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const Core::Id id, + RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, const QString &proFilePath); bool isEnabled() const; QString disabledReason() const; QWidget *createConfigurationWidget(); Utils::OutputFormatter *createOutputFormatter() const; - Qt4ProjectManager::Qt4BaseTarget *qt4Target() const; Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const; RemoteLinuxDeployConfiguration *deployConfig() const; + LinuxDeviceConfiguration::ConstPtr device() const; virtual QString environmentPreparationCommand() const; virtual QString commandPrefix() const; - virtual Utils::PortList freePorts() const; QString localExecutableFilePath() const; QString defaultRemoteExecutableFilePath() const; @@ -98,8 +97,6 @@ public: QString alternateRemoteExecutable() const; void setUseAlternateExecutable(bool useAlternate); bool useAlternateExecutable() const; - QSharedPointer<const LinuxDeviceConfiguration> deviceConfig() const; - QString gdbCmd() const; virtual QVariantMap toMap() const; @@ -117,7 +114,6 @@ public: static const QString Id; signals: - void deviceConfigurationChanged(ProjectExplorer::Target *target); void deploySpecsChanged(); void targetInformationChanged() const; void baseEnvironmentChanged(); @@ -125,7 +121,7 @@ signals: void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff); protected: - RemoteLinuxRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, + RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, RemoteLinuxRunConfiguration *source); virtual bool fromMap(const QVariantMap &map); QString defaultDisplayName(); @@ -137,7 +133,6 @@ protected slots: private slots: void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress); - void updateDeviceConfigurations(); void handleDeployConfigChanged(); void handleDeployablesUpdated(); diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp index 921461bf23..fe0be28a81 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp @@ -31,12 +31,16 @@ **************************************************************************/ #include "remotelinuxrunconfigurationfactory.h" +#include "remotelinux_constants.h" #include "remotelinuxdeployconfigurationfactory.h" #include "remotelinuxrunconfiguration.h" #include "remotelinuxutils.h" +#include <projectexplorer/profileinformation.h> +#include <projectexplorer/target.h> #include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4target.h> +#include <qt4projectmanager/qt4nodes.h> +#include <qtsupport/customexecutablerunconfiguration.h> #include <utils/qtcassert.h> #include <QFileInfo> @@ -61,50 +65,45 @@ QString pathFromId(Core::Id id) } // namespace RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory(QObject *parent) - : IRunConfigurationFactory(parent) -{ -} + : Qt4ProjectManager::QmakeRunConfigurationFactory(parent) +{ setObjectName(QLatin1String("RemoteLinuxRunConfigurationFactory")); } RemoteLinuxRunConfigurationFactory::~RemoteLinuxRunConfigurationFactory() { } -bool RemoteLinuxRunConfigurationFactory::canCreate(Target *parent, - const Core::Id id) const +bool RemoteLinuxRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const { - if (!QString::fromUtf8(id.name()).startsWith(RemoteLinuxRunConfiguration::Id)) + if (!canHandle(parent)) return false; - return qobject_cast<Qt4BaseTarget *>(parent)->qt4Project() - ->hasApplicationProFile(pathFromId(id)); + return static_cast<Qt4Project *>(parent->project())->hasApplicationProFile(pathFromId(id)); } bool RemoteLinuxRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const { - Q_UNUSED(parent); - return QString::fromLatin1(ProjectExplorer::idFromMap(map).name()).startsWith(RemoteLinuxRunConfiguration::Id); + if (!canHandle(parent)) + return false; + return ProjectExplorer::idFromMap(map).toString().startsWith(RemoteLinuxRunConfiguration::Id); } bool RemoteLinuxRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const { const RemoteLinuxRunConfiguration * const rlrc = qobject_cast<RemoteLinuxRunConfiguration *>(source); - const QString idStr = QString::fromLatin1(source->id().name()) + QLatin1Char('.') + rlrc->proFilePath(); - return rlrc && canCreate(parent, Core::Id(idStr.toUtf8().constData())); + const QString idStr = source->id().toString() + QLatin1Char('.') + rlrc->proFilePath(); + return rlrc && canCreate(parent, Core::Id(idStr)); } QList<Core::Id> RemoteLinuxRunConfigurationFactory::availableCreationIds(Target *parent) const { QList<Core::Id> result; - const QList<DeployConfiguration *> &depConfs = parent->deployConfigurations(); - foreach (const DeployConfiguration * const dc, depConfs) { - if (dc->id() == RemoteLinuxDeployConfigurationFactory::genericDeployConfigurationId()) { - QStringList proFiles = qobject_cast<Qt4BaseTarget *>(parent)->qt4Project() - ->applicationProFilePathes(RemoteLinuxRunConfiguration::Id); - foreach (const QString &pf, proFiles) - result << Core::Id(pf); - return result; - } - } + if (!canHandle(parent)) + return result; + + QStringList proFiles = static_cast<Qt4Project *>(parent->project()) + ->applicationProFilePathes(RemoteLinuxRunConfiguration::Id); + foreach (const QString &pf, proFiles) + result << Core::Id(pf); return result; } @@ -117,15 +116,15 @@ QString RemoteLinuxRunConfigurationFactory::displayNameForId(const Core::Id id) RunConfiguration *RemoteLinuxRunConfigurationFactory::create(Target *parent, const Core::Id id) { QTC_ASSERT(canCreate(parent, id), return 0); - return new RemoteLinuxRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), id, pathFromId(id)); + return new RemoteLinuxRunConfiguration(parent, id, pathFromId(id)); } RunConfiguration *RemoteLinuxRunConfigurationFactory::restore(Target *parent, const QVariantMap &map) { QTC_ASSERT(canRestore(parent, map), return 0); - RemoteLinuxRunConfiguration *rc = new RemoteLinuxRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), - Core::Id(RemoteLinuxRunConfiguration::Id), QString()); + RemoteLinuxRunConfiguration *rc + = new RemoteLinuxRunConfiguration(parent, Core::Id(RemoteLinuxRunConfiguration::Id), QString()); if (rc->fromMap(map)) return rc; @@ -138,7 +137,28 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent, { QTC_ASSERT(canClone(parent, source), return 0); RemoteLinuxRunConfiguration *old = static_cast<RemoteLinuxRunConfiguration *>(source); - return new RemoteLinuxRunConfiguration(static_cast<Qt4BaseTarget *>(parent), old); + return new RemoteLinuxRunConfiguration(parent, old); +} + +bool RemoteLinuxRunConfigurationFactory::canHandle(Target *t) const +{ + if (!t->project()->supportsProfile(t->profile())) + return false; + if (!qobject_cast<Qt4Project *>(t->project())) + return false; + + Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(t->profile()); + return deviceType == Core::Id(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 diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h index a2704a23a1..988b76447d 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h @@ -33,11 +33,14 @@ #define REMOTELINUXRUNCONFIGURATIONFACTORY_H #include <projectexplorer/runconfiguration.h> +#include <qt4projectmanager/qmakerunconfigurationfactory.h> + +namespace ProjectExplorer { class Node; } namespace RemoteLinux { namespace Internal { -class RemoteLinuxRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory +class RemoteLinuxRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurationFactory { Q_OBJECT @@ -58,6 +61,10 @@ public: bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const; 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); }; } // namespace Internal diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp index bf30a70ff5..7ee46a0459 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp @@ -41,7 +41,6 @@ #include <projectexplorer/environmentwidget.h> #include <projectexplorer/projectexplorerconstants.h> #include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4target.h> #include <utils/detailswidget.h> #include <QCoreApplication> @@ -111,9 +110,6 @@ RemoteLinuxRunConfigurationWidget::RemoteLinuxRunConfigurationWidget(RemoteLinux addGenericWidgets(mainLayout); addEnvironmentWidgets(mainLayout); - connect(d->runConfiguration, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), - SLOT(handleCurrentDeviceConfigChanged())); - handleCurrentDeviceConfigChanged(); connect(d->runConfiguration, SIGNAL(enabledChanged()), SLOT(runConfigurationEnabledChange())); runConfigurationEnabledChange(); @@ -163,21 +159,6 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou d->genericWidgetsLayout.setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter); - QWidget * const devConfWidget = new QWidget; - QHBoxLayout * const devConfLayout = new QHBoxLayout(devConfWidget); - devConfLayout->setMargin(0); - devConfLayout->addWidget(&d->devConfLabel); - QLabel * const addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>") - .arg(QLatin1String("deviceconfig"))); - addDevConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - devConfLayout->addWidget(addDevConfLabel); - - QLabel * const debuggerConfLabel = new QLabel(tr("<a href=\"%1\">Set Debugger</a>") - .arg(QLatin1String("debugger"))); - debuggerConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - devConfLayout->addWidget(debuggerConfLabel); - - d->genericWidgetsLayout.addRow(new QLabel(tr("Device configuration:")), devConfWidget); d->localExecutableLabel.setText(d->runConfiguration->localExecutableFilePath()); d->genericWidgetsLayout.addRow(tr("Executable on host:"), &d->localExecutableLabel); d->genericWidgetsLayout.addRow(tr("Executable on device:"), &d->remoteExecutableLabel); @@ -198,10 +179,6 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou d->workingDirLineEdit.setText(d->runConfiguration->workingDirectory()); d->genericWidgetsLayout.addRow(tr("Working directory:"), &d->workingDirLineEdit); - connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this, - SLOT(showDeviceConfigurationsDialog(QString))); - connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this, - SLOT(showDeviceConfigurationsDialog(QString))); connect(&d->argsLineEdit, SIGNAL(textEdited(QString)), SLOT(argumentsEdited(QString))); connect(d->runConfiguration, SIGNAL(targetInformationChanged()), this, SLOT(updateTargetInformation())); @@ -287,23 +264,6 @@ void RemoteLinuxRunConfigurationWidget::handleWorkingDirectoryChanged() d->runConfiguration->setWorkingDirectory(d->workingDirLineEdit.text().trimmed()); } -void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link) -{ - if (link == QLatin1String("deviceconfig")) { - Core::ICore::showOptionsDialog( - QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY), - QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_PAGE_ID)); - } else if (link == QLatin1String("debugger")) { - Core::ICore::showOptionsDialog(QLatin1String("O.Debugger"), - QLatin1String("M.Gdb")); - } -} - -void RemoteLinuxRunConfigurationWidget::handleCurrentDeviceConfigChanged() -{ - d->devConfLabel.setText(RemoteLinuxUtils::deviceConfigurationName(d->runConfiguration->deviceConfig())); -} - void RemoteLinuxRunConfigurationWidget::fetchEnvironment() { disconnect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h index 840c3b54f1..1cbed48b31 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h @@ -64,9 +64,7 @@ public: private slots: void argumentsEdited(const QString &args); - void showDeviceConfigurationsDialog(const QString &link); void updateTargetInformation(); - void handleCurrentDeviceConfigChanged(); void fetchEnvironment(); void fetchEnvironmentFinished(); void fetchEnvironmentError(const QString &error); diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp index 28b40a4e87..470eb289fc 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp @@ -39,7 +39,9 @@ #include <debugger/debuggerplugin.h> #include <debugger/debuggerrunner.h> #include <debugger/debuggerstartparameters.h> +#include <projectexplorer/profileinformation.h> #include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/target.h> #include <utils/portlist.h> using namespace Debugger; @@ -63,17 +65,23 @@ bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, Ru return false; const QString idStr = QString::fromLatin1(runConfiguration->id().name()); - if (!runConfiguration->isEnabled() - || !idStr.startsWith(RemoteLinuxRunConfiguration::Id)) { + if (!runConfiguration->isEnabled() || !idStr.startsWith(RemoteLinuxRunConfiguration::Id)) return false; - } if (mode == NormalRunMode) return true; const RemoteLinuxRunConfiguration * const remoteRunConfig - = qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration); - return remoteRunConfig->portsUsedByDebuggers() <= remoteRunConfig->freePorts().count(); + = qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration); + if (mode == DebugRunMode) { + LinuxDeviceConfiguration::ConstPtr dev = + ProjectExplorer::DeviceProfileInformation::device(runConfiguration->target()->profile()) + .dynamicCast<const LinuxDeviceConfiguration>(); + if (dev.isNull()) + return false; + return remoteRunConfig->portsUsedByDebuggers() <= dev->freePorts().count(); + } + return true; } RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, RunMode mode) diff --git a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp index bf740bf56f..84aa089179 100644 --- a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp +++ b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp @@ -31,9 +31,9 @@ **************************************************************************/ #include "typespecificdeviceconfigurationlistmodel.h" -#include "abstractembeddedlinuxtarget.h" - #include <projectexplorer/devicesupport/devicemanager.h> +#include <projectexplorer/profileinformation.h> +#include <projectexplorer/target.h> #include <utils/qtcassert.h> using namespace ProjectExplorer; @@ -41,12 +41,12 @@ using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -TypeSpecificDeviceConfigurationListModel::TypeSpecificDeviceConfigurationListModel(AbstractEmbeddedLinuxTarget *target) +TypeSpecificDeviceConfigurationListModel::TypeSpecificDeviceConfigurationListModel(ProjectExplorer::Target *target) : QAbstractListModel(target) { const DeviceManager * const devConfs = DeviceManager::instance(); connect(devConfs, SIGNAL(updated()), this, SIGNAL(modelReset())); - connect(target, SIGNAL(supportedDevicesChanged()), this, SIGNAL(modelReset())); + connect(target, SIGNAL(profileChanged()), this, SIGNAL(modelReset())); } TypeSpecificDeviceConfigurationListModel::~TypeSpecificDeviceConfigurationListModel() @@ -61,7 +61,7 @@ int TypeSpecificDeviceConfigurationListModel::rowCount(const QModelIndex &parent const DeviceManager * const devConfs = DeviceManager::instance(); const int devConfsCount = devConfs->deviceCount(); for (int i = 0; i < devConfsCount; ++i) { - if (target()->supportsDevice(devConfs->deviceAt(i))) + if (deviceMatches(devConfs->deviceAt(i))) ++count; } return count; @@ -75,8 +75,8 @@ QVariant TypeSpecificDeviceConfigurationListModel::data(const QModelIndex &index const LinuxDeviceConfiguration::ConstPtr &devConf = deviceAt(index.row()); Q_ASSERT(devConf); QString displayedName = devConf->displayName(); - if (target()->supportsDevice(devConf) && DeviceManager::instance() - ->defaultDevice(devConf->type()) == devConf) { + if (deviceMatches(devConf) + && DeviceManager::instance()->defaultDevice(devConf->type()) == devConf) { displayedName = tr("%1 (default)").arg(displayedName); } return displayedName; @@ -89,7 +89,7 @@ LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::dev const int devConfsCount = devConfs->deviceCount(); for (int i = 0; i < devConfsCount; ++i) { const IDevice::ConstPtr device = devConfs->deviceAt(i); - if (target()->supportsDevice(device) && ++currentRow == idx) + if (deviceMatches(device) && ++currentRow == idx) return device.staticCast<const LinuxDeviceConfiguration>(); } QTC_CHECK(false); @@ -102,7 +102,7 @@ LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::def const int deviceCount = deviceManager->deviceCount(); for (int i = 0; i < deviceCount; ++i) { const IDevice::ConstPtr device = deviceManager->deviceAt(i); - if (target()->supportsDevice(device) + if (deviceMatches(device) && deviceManager->defaultDevice(device->type()) == device) { return device.staticCast<const LinuxDeviceConfiguration>(); } @@ -113,7 +113,7 @@ LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::def LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::find(Core::Id id) const { const IDevice::ConstPtr &devConf = DeviceManager::instance()->find(id); - if (devConf && target()->supportsDevice(devConf)) + if (deviceMatches(devConf)) return devConf.staticCast<const LinuxDeviceConfiguration>(); return defaultDeviceConfig(); } @@ -128,9 +128,17 @@ int TypeSpecificDeviceConfigurationListModel::indexForId(Core::Id id) const return -1; } -AbstractEmbeddedLinuxTarget *TypeSpecificDeviceConfigurationListModel::target() const +ProjectExplorer::Target *TypeSpecificDeviceConfigurationListModel::target() const +{ + return qobject_cast<ProjectExplorer::Target *>(QObject::parent()); +} + +bool TypeSpecificDeviceConfigurationListModel::deviceMatches(ProjectExplorer::IDevice::ConstPtr dev) const { - return qobject_cast<AbstractEmbeddedLinuxTarget *>(QObject::parent()); + if (dev.isNull()) + return false; + Core::Id typeId = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile()); + return dev->type() == typeId; } } // namespace Internal diff --git a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h index e240bcd07f..d7ad4f3e1d 100644 --- a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h +++ b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h @@ -37,15 +37,16 @@ #include <QAbstractListModel> #include <QSharedPointer> +namespace ProjectExplorer { class Target; } + namespace RemoteLinux { -class AbstractEmbeddedLinuxTarget; namespace Internal { class TypeSpecificDeviceConfigurationListModel : public QAbstractListModel { Q_OBJECT public: - explicit TypeSpecificDeviceConfigurationListModel(AbstractEmbeddedLinuxTarget *target); + explicit TypeSpecificDeviceConfigurationListModel(ProjectExplorer::Target *target); ~TypeSpecificDeviceConfigurationListModel(); virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; @@ -58,7 +59,8 @@ public: int indexForId(Core::Id id) const; private: - AbstractEmbeddedLinuxTarget * target() const; + ProjectExplorer::Target *target() const; + bool deviceMatches(ProjectExplorer::IDevice::ConstPtr dev) const; }; } // namespace Internal |