diff options
54 files changed, 740 insertions, 513 deletions
diff --git a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp index 03bac36c7a..f7dcb665a7 100644 --- a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp @@ -33,6 +33,7 @@ #include "remotelinuxqmlprofilerrunner.h" #include <extensionsystem/pluginmanager.h> #include <projectexplorer/projectexplorerconstants.h> +#include <remotelinux/portlist.h> #include <remotelinux/remotelinuxapplicationrunner.h> #include <utils/qtcassert.h> diff --git a/src/plugins/remotelinux/abstractpackagingstep.h b/src/plugins/remotelinux/abstractpackagingstep.h index 8df59d5adb..8cb3e06da0 100644 --- a/src/plugins/remotelinux/abstractpackagingstep.h +++ b/src/plugins/remotelinux/abstractpackagingstep.h @@ -45,6 +45,7 @@ class AbstractPackagingStepPrivate; class REMOTELINUX_EXPORT AbstractPackagingStep : public ProjectExplorer::BuildStep { Q_OBJECT + Q_DISABLE_COPY(AbstractPackagingStep) public: AbstractPackagingStep(ProjectExplorer::BuildStepList *bsl, const QString &id); AbstractPackagingStep(ProjectExplorer::BuildStepList *bsl, AbstractPackagingStep *other); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp index e9d106dca2..c709cd72d3 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp @@ -272,7 +272,7 @@ void AbstractRemoteLinuxDeployService::handleConnectionFailure() break; case Connecting: { QString errorMsg = tr("Could not connect to host: %1").arg(m_d->connection->errorString()); - if (deviceConfiguration()->type() == LinuxDeviceConfiguration::Emulator) + if (deviceConfiguration()->deviceType() == LinuxDeviceConfiguration::Emulator) errorMsg += tr("\nDid the emulator fail to start?"); else errorMsg += tr("\nIs the device connected and set up for network access?"); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h index 4ac73778e5..e34098420c 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h @@ -57,6 +57,7 @@ class AbstractRemoteLinuxDeployServicePrivate; class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployService : public QObject { Q_OBJECT + Q_DISABLE_COPY(AbstractRemoteLinuxDeployService) public: explicit AbstractRemoteLinuxDeployService(QObject *parent); ~AbstractRemoteLinuxDeployService(); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.h b/src/plugins/remotelinux/abstractremotelinuxdeploystep.h index 1033e278c5..648cafd98a 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.h +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.h @@ -49,6 +49,7 @@ class AbstractRemoteLinuxDeployStepPrivate; class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployStep : public ProjectExplorer::BuildStep { Q_OBJECT + Q_DISABLE_COPY(AbstractRemoteLinuxDeployStep) public: bool fromMap(const QVariantMap &map); diff --git a/src/plugins/remotelinux/deployablefilesperprofile.cpp b/src/plugins/remotelinux/deployablefilesperprofile.cpp index c649a5298b..cc273ace71 100644 --- a/src/plugins/remotelinux/deployablefilesperprofile.cpp +++ b/src/plugins/remotelinux/deployablefilesperprofile.cpp @@ -31,6 +31,8 @@ **************************************************************************/ #include "deployablefilesperprofile.h" +#include "deployablefile.h" + #include <utils/qtcassert.h> #include <QtCore/QFileInfo> @@ -39,46 +41,70 @@ using namespace Qt4ProjectManager; namespace RemoteLinux { +namespace Internal { +class DeployableFilesPerProFilePrivate +{ +public: + DeployableFilesPerProFilePrivate(const Qt4ProFileNode *proFileNode) + : projectType(proFileNode->projectType()), + proFilePath(proFileNode->path()), + projectName(proFileNode->displayName()), + targetInfo(proFileNode->targetInformation()), + installsList(proFileNode->installsList()), + projectVersion(proFileNode->projectVersion()), + config(proFileNode->variableValue(ConfigVar)), + modified(true) + { + } + + const Qt4ProjectType projectType; + const QString proFilePath; + const QString projectName; + const Qt4ProjectManager::TargetInformation targetInfo; + const Qt4ProjectManager::InstallsList installsList; + const Qt4ProjectManager::ProjectVersion projectVersion; + const QStringList config; + QList<DeployableFile> deployables; + bool modified; +}; + +} // namespace Internal + using namespace Internal; DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode, QObject *parent) - : QAbstractTableModel(parent), - m_projectType(proFileNode->projectType()), - m_proFilePath(proFileNode->path()), - m_projectName(proFileNode->displayName()), - m_targetInfo(proFileNode->targetInformation()), - m_installsList(proFileNode->installsList()), - m_projectVersion(proFileNode->projectVersion()), - m_config(proFileNode->variableValue(ConfigVar)), - m_modified(true) + : QAbstractTableModel(parent), m_d(new DeployableFilesPerProFilePrivate(proFileNode)) { - if (m_projectType == ApplicationTemplate) { - m_deployables.prepend(DeployableFile(localExecutableFilePath(), - m_installsList.targetPath)); - } else if (m_projectType == LibraryTemplate) { + if (m_d->projectType == ApplicationTemplate) { + m_d->deployables.prepend(DeployableFile(localExecutableFilePath(), + m_d->installsList.targetPath)); + } else if (m_d->projectType == LibraryTemplate) { foreach (const QString &filePath, localLibraryFilePaths()) { - m_deployables.prepend(DeployableFile(filePath, - m_installsList.targetPath)); + m_d->deployables.prepend(DeployableFile(filePath, + m_d->installsList.targetPath)); } } - foreach (const InstallsItem &elem, m_installsList.items) { + foreach (const InstallsItem &elem, m_d->installsList.items) { foreach (const QString &file, elem.files) - m_deployables << DeployableFile(file, elem.path); + m_d->deployables << DeployableFile(file, elem.path); } } -DeployableFilesPerProFile::~DeployableFilesPerProFile() {} +DeployableFilesPerProFile::~DeployableFilesPerProFile() +{ + delete m_d; +} DeployableFile DeployableFilesPerProFile::deployableAt(int row) const { Q_ASSERT(row >= 0 && row < rowCount()); - return m_deployables.at(row); + return m_d->deployables.at(row); } int DeployableFilesPerProFile::rowCount(const QModelIndex &parent) const { - return parent.isValid() ? 0 : m_deployables.count(); + return parent.isValid() ? 0 : m_d->deployables.count(); } int DeployableFilesPerProFile::columnCount(const QModelIndex &parent) const @@ -91,7 +117,7 @@ QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) con if (!index.isValid() || index.row() >= rowCount()) return QVariant(); - if (m_projectType != AuxTemplate && !hasTargetPath() && index.row() == 0 + if (m_d->projectType != AuxTemplate && !hasTargetPath() && index.row() == 0 && index.column() == 1) { if (role == Qt::DisplayRole) return tr("<no target path set>"); @@ -120,34 +146,34 @@ QVariant DeployableFilesPerProFile::headerData(int section, QString DeployableFilesPerProFile::localExecutableFilePath() const { - if (!m_targetInfo.valid || m_projectType != ApplicationTemplate) + if (!m_d->targetInfo.valid || m_d->projectType != ApplicationTemplate) return QString(); - return QDir::cleanPath(m_targetInfo.workingDir + '/' + m_targetInfo.target); + return QDir::cleanPath(m_d->targetInfo.workingDir + '/' + m_d->targetInfo.target); } QStringList DeployableFilesPerProFile::localLibraryFilePaths() const { - if (!m_targetInfo.valid || m_projectType != LibraryTemplate) + if (!m_d->targetInfo.valid || m_d->projectType != LibraryTemplate) return QStringList(); - QString basePath = m_targetInfo.workingDir + QLatin1String("/lib"); - const bool isStatic = m_config.contains(QLatin1String("static")) - || m_config.contains(QLatin1String("staticlib")); - basePath += m_targetInfo.target + QLatin1String(isStatic ? ".a" : ".so"); + QString basePath = m_d->targetInfo.workingDir + QLatin1String("/lib"); + const bool isStatic = m_d->config.contains(QLatin1String("static")) + || m_d->config.contains(QLatin1String("staticlib")); + basePath += m_d->targetInfo.target + QLatin1String(isStatic ? ".a" : ".so"); basePath = QDir::cleanPath(basePath); const QChar dot(QLatin1Char('.')); const QString filePathMajor = basePath + dot - + QString::number(m_projectVersion.major); + + QString::number(m_d->projectVersion.major); const QString filePathMinor = filePathMajor + dot - + QString::number(m_projectVersion.minor); + + QString::number(m_d->projectVersion.minor); const QString filePathPatch = filePathMinor + dot - + QString::number(m_projectVersion.patch); + + QString::number(m_d->projectVersion.patch); return QStringList() << filePathPatch << filePathMinor << filePathMajor << basePath; } QString DeployableFilesPerProFile::remoteExecutableFilePath() const { - return hasTargetPath() && m_projectType == ApplicationTemplate + return hasTargetPath() && m_d->projectType == ApplicationTemplate ? deployableAt(0).remoteDir + QLatin1Char('/') + QFileInfo(localExecutableFilePath()).fileName() : QString(); @@ -155,7 +181,18 @@ QString DeployableFilesPerProFile::remoteExecutableFilePath() const QString DeployableFilesPerProFile::projectDir() const { - return QFileInfo(m_proFilePath).dir().path(); + return QFileInfo(m_d->proFilePath).dir().path(); +} + +bool DeployableFilesPerProFile::hasTargetPath() const +{ + return !m_d->installsList.targetPath.isEmpty(); } +bool DeployableFilesPerProFile::isModified() const { return m_d->modified; } +void DeployableFilesPerProFile::setUnModified() { m_d->modified = false; } +QString DeployableFilesPerProFile::projectName() const { return m_d->projectName; } +QString DeployableFilesPerProFile::proFilePath() const { return m_d->proFilePath; } +Qt4ProjectType DeployableFilesPerProFile::projectType() const { return m_d->projectType; } +QString DeployableFilesPerProFile::applicationName() const { return m_d->targetInfo.target; } } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deployablefilesperprofile.h b/src/plugins/remotelinux/deployablefilesperprofile.h index 44812aa14e..881ac904d8 100644 --- a/src/plugins/remotelinux/deployablefilesperprofile.h +++ b/src/plugins/remotelinux/deployablefilesperprofile.h @@ -33,8 +33,6 @@ #ifndef DEPLOYABLEFILESPERPROFILE_H #define DEPLOYABLEFILESPERPROFILE_H -#include "deployablefile.h" - #include "remotelinux_export.h" #include <qt4projectmanager/qt4nodes.h> @@ -44,6 +42,11 @@ #include <QtCore/QString> namespace RemoteLinux { +class DeployableFile; + +namespace Internal { +class DeployableFilesPerProFilePrivate; +} class REMOTELINUX_EXPORT DeployableFilesPerProFile : public QAbstractTableModel { @@ -56,17 +59,17 @@ public: virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; DeployableFile deployableAt(int row) const; - bool isModified() const { return m_modified; } - void setUnModified() { m_modified = false; } + bool isModified() const; + void setUnModified(); QString localExecutableFilePath() const; QString remoteExecutableFilePath() const; - QString projectName() const { return m_projectName; } + QString projectName() const; QString projectDir() const; - QString proFilePath() const { return m_proFilePath; } - Qt4ProjectManager::Qt4ProjectType projectType() const { return m_projectType; } - bool isApplicationProject() const { return m_projectType == Qt4ProjectManager::ApplicationTemplate; } - QString applicationName() const { return m_targetInfo.target; } - bool hasTargetPath() const { return !m_installsList.targetPath.isEmpty(); } + QString proFilePath() const; + Qt4ProjectManager::Qt4ProjectType projectType() const; + bool isApplicationProject() const { return projectType() == Qt4ProjectManager::ApplicationTemplate; } + QString applicationName() const; + bool hasTargetPath() const; private: virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -77,15 +80,7 @@ private: QStringList localLibraryFilePaths() const; - const Qt4ProjectManager::Qt4ProjectType m_projectType; - const QString m_proFilePath; - const QString m_projectName; - const Qt4ProjectManager::TargetInformation m_targetInfo; - const Qt4ProjectManager::InstallsList m_installsList; - const Qt4ProjectManager::ProjectVersion m_projectVersion; - const QStringList m_config; - QList<DeployableFile> m_deployables; - bool m_modified; + Internal::DeployableFilesPerProFilePrivate * const m_d; }; } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deploymentinfo.cpp b/src/plugins/remotelinux/deploymentinfo.cpp index be54f52214..f727009088 100644 --- a/src/plugins/remotelinux/deploymentinfo.cpp +++ b/src/plugins/remotelinux/deploymentinfo.cpp @@ -39,60 +39,76 @@ #include <qt4projectmanager/qt4project.h> #include <qt4projectmanager/qt4target.h> +#include <QtCore/QList> #include <QtCore/QTimer> using namespace Qt4ProjectManager; namespace RemoteLinux { +namespace Internal { +class DeploymentInfoPrivate +{ +public: + DeploymentInfoPrivate(const Qt4BaseTarget *target) : target(target) {} + + QList<DeployableFilesPerProFile *> listModels; + const Qt4ProjectManager::Qt4BaseTarget * const target; + QTimer updateTimer; + +}; +} // namespace Internal + using namespace Internal; -DeploymentInfo::DeploymentInfo(const Qt4BaseTarget *target) - : m_target(target), m_updateTimer(new QTimer(this)) +DeploymentInfo::DeploymentInfo(const Qt4BaseTarget *target) : m_d(new DeploymentInfoPrivate(target)) { - Qt4Project * const pro = m_target->qt4Project(); + Qt4Project * const pro = m_d->target->qt4Project(); connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), - this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); - m_updateTimer->setInterval(1500); - m_updateTimer->setSingleShot(true); - connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(createModels())); + SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); + m_d->updateTimer.setInterval(1500); + m_d->updateTimer.setSingleShot(true); + connect(&m_d->updateTimer, SIGNAL(timeout()), this, SLOT(createModels())); createModels(); } -DeploymentInfo::~DeploymentInfo() {} +DeploymentInfo::~DeploymentInfo() +{ + delete m_d; +} void DeploymentInfo::startTimer(Qt4ProjectManager::Qt4ProFileNode*, bool success, bool parseInProgress) { Q_UNUSED(success) if (!parseInProgress) - m_updateTimer->start(); + m_d->updateTimer.start(); } void DeploymentInfo::createModels() { - if (m_target->project()->activeTarget() != m_target) + if (m_d->target->project()->activeTarget() != m_d->target) return; - if (!m_target->activeBuildConfiguration() || !m_target->activeBuildConfiguration()->qtVersion() - || !m_target->activeBuildConfiguration()->qtVersion()->isValid()) { + if (!m_d->target->activeBuildConfiguration() || !m_d->target->activeBuildConfiguration()->qtVersion() + || !m_d->target->activeBuildConfiguration()->qtVersion()->isValid()) { beginResetModel(); - qDeleteAll(m_listModels); - m_listModels.clear(); + qDeleteAll(m_d->listModels); + m_d->listModels.clear(); endResetModel(); return; } const Qt4ProFileNode *const rootNode - = m_target->qt4Project()->rootProjectNode(); + = m_d->target->qt4Project()->rootProjectNode(); if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard. return; - m_updateTimer->stop(); - disconnect(m_target->qt4Project(), + m_d->updateTimer.stop(); + disconnect(m_d->target->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); beginResetModel(); - qDeleteAll(m_listModels); - m_listModels.clear(); + qDeleteAll(m_d->listModels); + m_d->listModels.clear(); createModels(rootNode); endResetModel(); - connect(m_target->qt4Project(), + connect(m_d->target->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); } @@ -103,12 +119,12 @@ void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode) case ApplicationTemplate: case LibraryTemplate: case AuxTemplate: - m_listModels << new DeployableFilesPerProFile(proFileNode, this); + m_d->listModels << new DeployableFilesPerProFile(proFileNode, this); break; case SubDirsTemplate: { const QList<ProjectExplorer::ProjectNode *> &subProjects = proFileNode->subProjectNodes(); - foreach (const ProjectExplorer::ProjectNode *subProject, subProjects) { + foreach (const ProjectExplorer::ProjectNode * const subProject, subProjects) { const Qt4ProFileNode * const qt4SubProject = qobject_cast<const Qt4ProFileNode *>(subProject); if (qt4SubProject && !qt4SubProject->path() @@ -123,13 +139,13 @@ void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode) void DeploymentInfo::setUnmodified() { - foreach (DeployableFilesPerProFile *model, m_listModels) + foreach (DeployableFilesPerProFile * const model, m_d->listModels) model->setUnModified(); } bool DeploymentInfo::isModified() const { - foreach (const DeployableFilesPerProFile *model, m_listModels) { + foreach (const DeployableFilesPerProFile * const model, m_d->listModels) { if (model->isModified()) return true; } @@ -139,14 +155,14 @@ bool DeploymentInfo::isModified() const int DeploymentInfo::deployableCount() const { int count = 0; - foreach (const DeployableFilesPerProFile *model, m_listModels) + foreach (const DeployableFilesPerProFile * const model, m_d->listModels) count += model->rowCount(); return count; } DeployableFile DeploymentInfo::deployableAt(int i) const { - foreach (const DeployableFilesPerProFile *model, m_listModels) { + foreach (const DeployableFilesPerProFile * const model, m_d->listModels) { Q_ASSERT(i >= 0); if (i < model->rowCount()) return model->deployableAt(i); @@ -159,7 +175,7 @@ DeployableFile DeploymentInfo::deployableAt(int i) const QString DeploymentInfo::remoteExecutableFilePath(const QString &localExecutableFilePath) const { - foreach (const DeployableFilesPerProFile *model, m_listModels) { + foreach (const DeployableFilesPerProFile * const model, m_d->listModels) { if (model->localExecutableFilePath() == localExecutableFilePath) return model->remoteExecutableFilePath(); } @@ -176,7 +192,7 @@ QVariant DeploymentInfo::data(const QModelIndex &index, int role) const if (!index.isValid() || index.row() < 0 || index.row() >= modelCount() || index.column() != 0) return QVariant(); - const DeployableFilesPerProFile *const model = m_listModels.at(index.row()); + const DeployableFilesPerProFile * const model = m_d->listModels.at(index.row()); if (role == Qt::ForegroundRole && model->projectType() != AuxTemplate && !model->hasTargetPath()) { QBrush brush; @@ -188,4 +204,7 @@ QVariant DeploymentInfo::data(const QModelIndex &index, int role) const return QVariant(); } +int DeploymentInfo::modelCount() const { return m_d->listModels.count(); } +DeployableFilesPerProFile *DeploymentInfo::modelAt(int i) const { return m_d->listModels.at(i); } + } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deploymentinfo.h b/src/plugins/remotelinux/deploymentinfo.h index 564268d91a..54d7786372 100644 --- a/src/plugins/remotelinux/deploymentinfo.h +++ b/src/plugins/remotelinux/deploymentinfo.h @@ -35,9 +35,6 @@ #include "remotelinux_export.h" #include <QtCore/QAbstractListModel> -#include <QtCore/QList> - -QT_FORWARD_DECLARE_CLASS(QTimer) namespace Qt4ProjectManager { class Qt4BaseTarget; @@ -48,19 +45,24 @@ namespace RemoteLinux { class DeployableFile; class DeployableFilesPerProFile; +namespace Internal { +class DeploymentInfoPrivate; +} + class REMOTELINUX_EXPORT DeploymentInfo : public QAbstractListModel { Q_OBJECT public: DeploymentInfo(const Qt4ProjectManager::Qt4BaseTarget *target); ~DeploymentInfo(); + void setUnmodified(); bool isModified() const; int deployableCount() const; DeployableFile deployableAt(int i) const; QString remoteExecutableFilePath(const QString &localExecutableFilePath) const; - int modelCount() const { return m_listModels.count(); } - DeployableFilesPerProFile *modelAt(int i) const { return m_listModels.at(i); } + int modelCount() const; + DeployableFilesPerProFile *modelAt(int i) const; private slots: void startTimer(Qt4ProjectManager::Qt4ProFileNode *, bool success, bool parseInProgress); @@ -72,9 +74,7 @@ private: Q_SLOT void createModels(); void createModels(const Qt4ProjectManager::Qt4ProFileNode *proFileNode); - QList<DeployableFilesPerProFile *> m_listModels; - const Qt4ProjectManager::Qt4BaseTarget * const m_target; - QTimer *const m_updateTimer; + Internal::DeploymentInfoPrivate * const m_d; }; } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/genericdirectuploadservice.h b/src/plugins/remotelinux/genericdirectuploadservice.h index 5e6c458cfb..d522a8f352 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.h +++ b/src/plugins/remotelinux/genericdirectuploadservice.h @@ -49,7 +49,7 @@ class REMOTELINUX_EXPORT GenericDirectUploadService : public AbstractRemoteLinux { Q_OBJECT public: - GenericDirectUploadService(QObject *parent); + GenericDirectUploadService(QObject *parent = 0); void setDeployableFiles(const QList<DeployableFile> &deployableFiles); diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp index 664a1c2f97..a6b2153179 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.cpp +++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp @@ -40,6 +40,13 @@ #include <QtCore/QSharedPointer> namespace RemoteLinux { +namespace Internal { +class GenericDirectUploadStepPrivate +{ +public: + GenericDirectUploadService deployService; +}; +} // namespace Internal GenericDirectUploadStep::GenericDirectUploadStep(ProjectExplorer::BuildStepList *bsl, const QString &id) : AbstractRemoteLinuxDeployStep(bsl, id) @@ -53,6 +60,11 @@ GenericDirectUploadStep::GenericDirectUploadStep(ProjectExplorer::BuildStepList ctor(); } +GenericDirectUploadStep::~GenericDirectUploadStep() +{ + delete m_d; +} + bool GenericDirectUploadStep::isDeploymentPossible(QString *whyNot) const { QList<DeployableFile> deployableFiles; @@ -60,19 +72,19 @@ bool GenericDirectUploadStep::isDeploymentPossible(QString *whyNot) const const int deployableCount = deploymentInfo->deployableCount(); for (int i = 0; i < deployableCount; ++i) deployableFiles << deploymentInfo->deployableAt(i); - m_deployService->setDeployableFiles(deployableFiles); + m_d->deployService.setDeployableFiles(deployableFiles); return AbstractRemoteLinuxDeployStep::isDeploymentPossible(whyNot); } AbstractRemoteLinuxDeployService *GenericDirectUploadStep::deployService() const { - return m_deployService; + return &m_d->deployService; } void GenericDirectUploadStep::ctor() { setDefaultDisplayName(displayName()); - m_deployService = new GenericDirectUploadService(this); + m_d = new Internal::GenericDirectUploadStepPrivate; } QString GenericDirectUploadStep::stepId() diff --git a/src/plugins/remotelinux/genericdirectuploadstep.h b/src/plugins/remotelinux/genericdirectuploadstep.h index 22601fbe20..b7a17a2b65 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.h +++ b/src/plugins/remotelinux/genericdirectuploadstep.h @@ -36,7 +36,9 @@ #include "remotelinux_export.h" namespace RemoteLinux { -class GenericDirectUploadService; +namespace Internal { +class GenericDirectUploadStepPrivate; +} class REMOTELINUX_EXPORT GenericDirectUploadStep : public AbstractRemoteLinuxDeployStep { @@ -45,6 +47,7 @@ class REMOTELINUX_EXPORT GenericDirectUploadStep : public AbstractRemoteLinuxDep public: GenericDirectUploadStep(ProjectExplorer::BuildStepList *bsl, const QString &id); GenericDirectUploadStep(ProjectExplorer::BuildStepList *bsl, GenericDirectUploadStep *other); + ~GenericDirectUploadStep(); bool isDeploymentPossible(QString *whyNot = 0) const; @@ -56,7 +59,7 @@ private: void ctor(); - GenericDirectUploadService *m_deployService; + Internal::GenericDirectUploadStepPrivate *m_d; }; } //namespace RemoteLinux diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp index 915265ccea..48a8bd9949 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp @@ -33,6 +33,7 @@ #include "genericlinuxdeviceconfigurationwizardpages.h" #include "linuxdevicetestdialog.h" #include "linuxdevicetester.h" +#include "portlist.h" #include "remotelinux_constants.h" using namespace Utils; @@ -84,7 +85,7 @@ LinuxDeviceConfiguration::Ptr GenericLinuxDeviceConfigurationWizard::deviceConfi else sshParams.privateKeyFile = m_d->setupPage.privateKeyFilePath(); LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(m_d->setupPage.configurationName(), - QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Physical, + QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Hardware, PortList::fromString(QLatin1String("10000-10100")), sshParams); LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this); dlg.exec(); diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp index 9876010ca4..ca9fecb9dd 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp @@ -42,6 +42,12 @@ public: Ui::GenericLinuxDeviceConfigurationWizardSetupPage ui; }; +class GenericLinuxDeviceConfigurationWizardFinalPagePrivate +{ +public: + QLabel infoLabel; +}; + } // namespace Internal using namespace Utils; @@ -139,18 +145,23 @@ void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged() GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent) - : QWizardPage(parent), m_infoLabel(new QLabel(this)) + : QWizardPage(parent), m_d(new Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate) { setTitle(tr("Setup Finished")); setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - m_infoLabel->setWordWrap(true); + m_d->infoLabel.setWordWrap(true); QVBoxLayout * const layout = new QVBoxLayout(this); - layout->addWidget(m_infoLabel); + layout->addWidget(&m_d->infoLabel); +} + +GenericLinuxDeviceConfigurationWizardFinalPage::~GenericLinuxDeviceConfigurationWizardFinalPage() +{ + delete m_d; } void GenericLinuxDeviceConfigurationWizardFinalPage::initializePage() { - m_infoLabel->setText(infoText()); + m_d->infoLabel.setText(infoText()); } QString GenericLinuxDeviceConfigurationWizardFinalPage::infoText() const diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.h b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.h index 5bbc38c26f..809cd7444a 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.h +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.h @@ -37,13 +37,10 @@ #include <QtGui/QWizardPage> -QT_BEGIN_NAMESPACE -class QLabel; -QT_END_NAMESPACE - namespace RemoteLinux { namespace Internal { class GenericLinuxDeviceConfigurationWizardSetupPagePrivate; +class GenericLinuxDeviceConfigurationWizardFinalPagePrivate; } // namespace Internal class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationWizardSetupPage : public QWizardPage @@ -80,6 +77,7 @@ class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationWizardFinalPage : public Q_OBJECT public: GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent); + ~GenericLinuxDeviceConfigurationWizardFinalPage(); void initializePage(); @@ -87,7 +85,7 @@ protected: virtual QString infoText() const; private: - QLabel * const m_infoLabel; + Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate * const m_d; }; } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp index a789c5a13a..6eb0bedbb1 100644 --- a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp @@ -31,14 +31,19 @@ **************************************************************************/ #include "linuxdeviceconfiguration.h" +#include "portlist.h" #include "remotelinux_constants.h" +#include <utils/ssh/sshconnection.h> + #include <QtCore/QSettings> #include <QtGui/QDesktopServices> -typedef Utils::SshConnectionParameters::AuthenticationType AuthType; +using namespace Utils; +typedef SshConnectionParameters::AuthenticationType AuthType; namespace RemoteLinux { +namespace Internal { namespace { const QLatin1String NameKey("Name"); const QLatin1String OldOsVersionKey("OsVersion"); // Outdated, only use for upgrading. @@ -55,13 +60,36 @@ const QLatin1String TimeoutKey("Timeout"); const QLatin1String IsDefaultKey("IsDefault"); const QLatin1String InternalIdKey("InternalId"); -const AuthType DefaultAuthType(Utils::SshConnectionParameters::AuthenticationByKey); +const AuthType DefaultAuthType(SshConnectionParameters::AuthenticationByKey); const int DefaultTimeout(10); -const LinuxDeviceConfiguration::DeviceType DefaultDeviceType(LinuxDeviceConfiguration::Physical); +const LinuxDeviceConfiguration::DeviceType DefaultDeviceType(LinuxDeviceConfiguration::Hardware); } // anonymous namespace +class LinuxDeviceConfigurationPrivate +{ +public: + LinuxDeviceConfigurationPrivate(const SshConnectionParameters &sshParameters) + : sshParameters(sshParameters) + { + } + + SshConnectionParameters sshParameters; + QString name; + QString osType; + LinuxDeviceConfiguration::DeviceType deviceType; + PortList freePorts; + bool isDefault; + LinuxDeviceConfiguration::Id internalId; +}; -LinuxDeviceConfiguration::~LinuxDeviceConfiguration() {} +} // namespace Internal + +using namespace Internal; + +LinuxDeviceConfiguration::~LinuxDeviceConfiguration() +{ + delete m_d; +} LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QSettings &settings, Id &nextId) @@ -76,63 +104,66 @@ LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const ConstPtr &o LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QString &name, const QString &osType, DeviceType deviceType, const PortList &freePorts, - const Utils::SshConnectionParameters &sshParams) + const SshConnectionParameters &sshParams) { return Ptr(new LinuxDeviceConfiguration(name, osType, deviceType, freePorts, sshParams)); } LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QString &name, const QString &osType, - DeviceType deviceType, const PortList &freePorts, - const Utils::SshConnectionParameters &sshParams) - : m_sshParameters(sshParams), m_name(name), m_osType(osType), m_type(deviceType), - m_freePorts(freePorts), m_isDefault(false) + DeviceType deviceType, const PortList &freePorts, const SshConnectionParameters &sshParams) + : m_d(new LinuxDeviceConfigurationPrivate(sshParams)) { + m_d->name = name; + m_d->osType = osType; + m_d->deviceType = deviceType; + m_d->freePorts = freePorts; + m_d->isDefault = false; } -LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QSettings &settings, - Id &nextId) - : m_sshParameters(Utils::SshConnectionParameters::NoProxy), - m_name(settings.value(NameKey).toString()), - m_osType(settings.value(OsTypeKey).toString()), - m_type(static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt())), - m_isDefault(settings.value(IsDefaultKey, false).toBool()), - m_internalId(settings.value(InternalIdKey, nextId).toULongLong()) +LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QSettings &settings, Id &nextId) + : m_d(new LinuxDeviceConfigurationPrivate(SshConnectionParameters::NoProxy)) { - if (m_internalId == nextId) + m_d->name = settings.value(NameKey).toString(); + m_d->osType = settings.value(OsTypeKey).toString(); + m_d->deviceType = static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt()); + m_d->isDefault = settings.value(IsDefaultKey, false).toBool(); + m_d->internalId = settings.value(InternalIdKey, nextId).toULongLong(); + + if (m_d->internalId == nextId) ++nextId; // Convert from version < 2.3. - if (m_osType.isEmpty()) { + if (m_d->osType.isEmpty()) { const int oldOsType = settings.value(OldOsVersionKey, -1).toInt(); switch (oldOsType) { - case 0: m_osType = QLatin1String("Maemo5OsType"); break; - case 1: m_osType = QLatin1String("HarmattanOsType"); break; - case 2: m_osType = QLatin1String("MeeGoOsType"); break; - default: m_osType = QLatin1String(Constants::GenericLinuxOsType); + case 0: m_d->osType = QLatin1String("Maemo5OsType"); break; + case 1: m_d->osType = QLatin1String("HarmattanOsType"); break; + case 2: m_d->osType = QLatin1String("MeeGoOsType"); break; + default: m_d->osType = QLatin1String(Constants::GenericLinuxOsType); } } - m_freePorts = PortList::fromString(settings.value(PortsSpecKey, QLatin1String("10000-10100")).toString()); - m_sshParameters.host = settings.value(HostKey).toString(); - m_sshParameters.port = settings.value(SshPortKey, 22).toInt(); - m_sshParameters.userName = settings.value(UserNameKey).toString(); - m_sshParameters.authenticationType + m_d->freePorts = PortList::fromString(settings.value(PortsSpecKey, QLatin1String("10000-10100")).toString()); + m_d->sshParameters.host = settings.value(HostKey).toString(); + m_d->sshParameters.port = settings.value(SshPortKey, 22).toInt(); + m_d->sshParameters.userName = settings.value(UserNameKey).toString(); + m_d->sshParameters.authenticationType = static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt()); - m_sshParameters.password = settings.value(PasswordKey).toString(); - m_sshParameters.privateKeyFile + m_d->sshParameters.password = settings.value(PasswordKey).toString(); + m_d->sshParameters.privateKeyFile = settings.value(KeyFileKey, defaultPrivateKeyFilePath()).toString(); - m_sshParameters.timeout = settings.value(TimeoutKey, DefaultTimeout).toInt(); + m_d->sshParameters.timeout = settings.value(TimeoutKey, DefaultTimeout).toInt(); } LinuxDeviceConfiguration::LinuxDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &other) - : m_sshParameters(other->m_sshParameters), - m_name(other->m_name), - m_osType(other->m_osType), - m_type(other->type()), - m_freePorts(other->freePorts()), - m_isDefault(other->m_isDefault), - m_internalId(other->m_internalId) + : m_d(new LinuxDeviceConfigurationPrivate(other->m_d->sshParameters)) { + m_d->name = other->m_d->name; + m_d->osType = other->m_d->osType; + m_d->deviceType = other->deviceType(); + m_d->freePorts = other->freePorts(); + m_d->isDefault = other->m_d->isDefault; + m_d->internalId = other->m_d->internalId; } QString LinuxDeviceConfiguration::defaultPrivateKeyFilePath() @@ -148,20 +179,55 @@ QString LinuxDeviceConfiguration::defaultPublicKeyFilePath() void LinuxDeviceConfiguration::save(QSettings &settings) const { - settings.setValue(NameKey, m_name); - settings.setValue(OsTypeKey, m_osType); - settings.setValue(TypeKey, m_type); - settings.setValue(HostKey, m_sshParameters.host); - settings.setValue(SshPortKey, m_sshParameters.port); - settings.setValue(PortsSpecKey, m_freePorts.toString()); - settings.setValue(UserNameKey, m_sshParameters.userName); - settings.setValue(AuthKey, m_sshParameters.authenticationType); - settings.setValue(PasswordKey, m_sshParameters.password); - settings.setValue(KeyFileKey, m_sshParameters.privateKeyFile); - settings.setValue(TimeoutKey, m_sshParameters.timeout); - settings.setValue(IsDefaultKey, m_isDefault); - settings.setValue(InternalIdKey, m_internalId); + settings.setValue(NameKey, m_d->name); + settings.setValue(OsTypeKey, m_d->osType); + settings.setValue(TypeKey, m_d->deviceType); + settings.setValue(HostKey, m_d->sshParameters.host); + settings.setValue(SshPortKey, m_d->sshParameters.port); + settings.setValue(PortsSpecKey, m_d->freePorts.toString()); + settings.setValue(UserNameKey, m_d->sshParameters.userName); + settings.setValue(AuthKey, m_d->sshParameters.authenticationType); + settings.setValue(PasswordKey, m_d->sshParameters.password); + settings.setValue(KeyFileKey, m_d->sshParameters.privateKeyFile); + settings.setValue(TimeoutKey, m_d->sshParameters.timeout); + settings.setValue(IsDefaultKey, m_d->isDefault); + settings.setValue(InternalIdKey, m_d->internalId); } +SshConnectionParameters LinuxDeviceConfiguration::sshParameters() const +{ + return m_d->sshParameters; +} + +LinuxDeviceConfiguration::DeviceType LinuxDeviceConfiguration::deviceType() const +{ + return m_d->deviceType; +} + +LinuxDeviceConfiguration::Id LinuxDeviceConfiguration::internalId() const +{ + return m_d->internalId; +} + +void LinuxDeviceConfiguration::setSshParameters(const SshConnectionParameters &sshParameters) +{ + m_d->sshParameters = sshParameters; +} + +void LinuxDeviceConfiguration::setFreePorts(const PortList &freePorts) +{ + m_d->freePorts = freePorts; +} + +PortList LinuxDeviceConfiguration::freePorts() const { return m_d->freePorts; } +QString LinuxDeviceConfiguration::name() const { return m_d->name; } +QString LinuxDeviceConfiguration::osType() const { return m_d->osType; } +bool LinuxDeviceConfiguration::isDefault() const { return m_d->isDefault; } + +void LinuxDeviceConfiguration::setName(const QString &name) { m_d->name = name; } +void LinuxDeviceConfiguration::setInternalId(Id id) { m_d->internalId = id; } +void LinuxDeviceConfiguration::setDefault(bool isDefault) { m_d->isDefault = isDefault; } + const LinuxDeviceConfiguration::Id LinuxDeviceConfiguration::InvalidId = 0; + } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.h b/src/plugins/remotelinux/linuxdeviceconfiguration.h index a84d8442ea..7fcaf5cbee 100644 --- a/src/plugins/remotelinux/linuxdeviceconfiguration.h +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.h @@ -32,11 +32,8 @@ #ifndef LINUXDEVICECONFIGURATION_H #define LINUXDEVICECONFIGURATION_H -#include "portlist.h" #include "remotelinux_export.h" -#include <utils/ssh/sshconnection.h> - #include <QtCore/QSharedPointer> #include <QtCore/QString> #include <QtCore/QStringList> @@ -47,11 +44,17 @@ class QDialog; class QSettings; QT_END_NAMESPACE +namespace Utils { +class SshConnectionParameters; +} namespace RemoteLinux { +class PortList; + namespace Internal { +class LinuxDeviceConfigurationPrivate; class LinuxDeviceConfigurations; -} +} // namespace Internal class REMOTELINUX_EXPORT LinuxDeviceConfiguration { @@ -62,18 +65,17 @@ public: typedef quint64 Id; - enum DeviceType { Physical, Emulator }; + enum DeviceType { Hardware, Emulator }; ~LinuxDeviceConfiguration(); - PortList freePorts() const { return m_freePorts; } - Utils::SshConnectionParameters sshParameters() const { return m_sshParameters; } - QString name() const { return m_name; } - void setName(const QString &name) { m_name = name; } - QString osType() const { return m_osType; } - DeviceType type() const { return m_type; } - Id internalId() const { return m_internalId; } - bool isDefault() const { return m_isDefault; } + PortList freePorts() const; + Utils::SshConnectionParameters sshParameters() const; + QString name() const; + QString osType() const; + DeviceType deviceType() const; + Id internalId() const; + bool isDefault() const; static QString defaultPrivateKeyFilePath(); static QString defaultPublicKeyFilePath(); @@ -95,15 +97,14 @@ private: static Ptr create(const QSettings &settings, Id &nextId); static Ptr create(const ConstPtr &other); + void setName(const QString &name); + void setInternalId(Id id); + void setDefault(bool isDefault); + void setSshParameters(const Utils::SshConnectionParameters &sshParameters); + void setFreePorts(const PortList &freePorts); void save(QSettings &settings) const; - Utils::SshConnectionParameters m_sshParameters; - QString m_name; - QString m_osType; - DeviceType m_type; - PortList m_freePorts; - bool m_isDefault; - Id m_internalId; + Internal::LinuxDeviceConfigurationPrivate *m_d; }; diff --git a/src/plugins/remotelinux/linuxdeviceconfigurations.cpp b/src/plugins/remotelinux/linuxdeviceconfigurations.cpp index 5fc7d28eca..e314bd1569 100644 --- a/src/plugins/remotelinux/linuxdeviceconfigurations.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfigurations.cpp @@ -34,6 +34,7 @@ #include "remotelinuxutils.h" #include <coreplugin/icore.h> +#include <utils/qtcassert.h> #include <QtCore/QHash> #include <QtCore/QSettings> @@ -128,12 +129,12 @@ void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration: name = nameTemplate.arg(QString::number(suffix++)); while (hasConfig(name)); } - devConfig->m_name = name; + devConfig->setName(name); - devConfig->m_internalId = m_nextId++; + devConfig->setInternalId(m_nextId++); beginInsertRows(QModelIndex(), rowCount(), rowCount()); if (!defaultDeviceConfig(devConfig->osType())) - devConfig->m_isDefault = true; + devConfig->setDefault(true); m_devConfigs << devConfig; endInsertRows(); } @@ -142,14 +143,14 @@ void LinuxDeviceConfigurations::removeConfiguration(int idx) { Q_ASSERT(idx >= 0 && idx < rowCount()); beginRemoveRows(QModelIndex(), idx, idx); - const bool wasDefault = deviceAt(idx)->m_isDefault; + const bool wasDefault = deviceAt(idx)->isDefault(); const QString osType = deviceAt(idx)->osType(); m_devConfigs.removeAt(idx); endRemoveRows(); if (wasDefault) { for (int i = 0; i < m_devConfigs.count(); ++i) { if (deviceAt(i)->osType() == osType) { - m_devConfigs.at(i)->m_isDefault = true; + m_devConfigs.at(i)->setDefault(true); const QModelIndex changedIndex = index(i, 0); emit dataChanged(changedIndex, changedIndex); break; @@ -161,7 +162,7 @@ void LinuxDeviceConfigurations::removeConfiguration(int idx) void LinuxDeviceConfigurations::setConfigurationName(int i, const QString &name) { Q_ASSERT(i >= 0 && i < rowCount()); - m_devConfigs.at(i)->m_name = name; + m_devConfigs.at(i)->setName(name); const QModelIndex changedIndex = index(i, 0); emit dataChanged(changedIndex, changedIndex); } @@ -170,40 +171,39 @@ void LinuxDeviceConfigurations::setSshParameters(int i, const Utils::SshConnectionParameters ¶ms) { Q_ASSERT(i >= 0 && i < rowCount()); - m_devConfigs.at(i)->m_sshParameters = params; + m_devConfigs.at(i)->setSshParameters(params); } void LinuxDeviceConfigurations::setFreePorts(int i, const PortList &freePorts) { Q_ASSERT(i >= 0 && i < rowCount()); - m_devConfigs.at(i)->m_freePorts = freePorts; + m_devConfigs.at(i)->setFreePorts(freePorts); } void LinuxDeviceConfigurations::setDefaultDevice(int idx) { Q_ASSERT(idx >= 0 && idx < rowCount()); const LinuxDeviceConfiguration::Ptr &devConf = m_devConfigs.at(idx); - if (devConf->m_isDefault) + if (devConf->isDefault()) return; QModelIndex oldDefaultIndex; for (int i = 0; i < m_devConfigs.count(); ++i) { const LinuxDeviceConfiguration::Ptr &oldDefaultDev = m_devConfigs.at(i); - if (oldDefaultDev->m_isDefault - && oldDefaultDev->osType() == devConf->osType()) { - oldDefaultDev->m_isDefault = false; + if (oldDefaultDev->isDefault() && oldDefaultDev->osType() == devConf->osType()) { + oldDefaultDev->setDefault(false); oldDefaultIndex = index(i, 0); break; } } - Q_ASSERT(oldDefaultIndex.isValid()); + + QTC_CHECK(oldDefaultIndex.isValid()); emit dataChanged(oldDefaultIndex, oldDefaultIndex); - devConf->m_isDefault = true; + devConf->setDefault(true); const QModelIndex newDefaultIndex = index(idx, 0); emit dataChanged(newDefaultIndex, newDefaultIndex); } -LinuxDeviceConfigurations::LinuxDeviceConfigurations(QObject *parent) - : QAbstractListModel(parent) +LinuxDeviceConfigurations::LinuxDeviceConfigurations(QObject *parent) : QAbstractListModel(parent) { } @@ -249,7 +249,7 @@ LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::find(LinuxDeviceCo LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfig(const QString &osType) const { foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, m_devConfigs) { - if (devConf->m_isDefault && devConf->osType() == osType) + if (devConf->isDefault() && devConf->osType() == osType) return devConf; } return LinuxDeviceConfiguration::ConstPtr(); @@ -258,7 +258,7 @@ LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfi int LinuxDeviceConfigurations::indexForInternalId(LinuxDeviceConfiguration::Id internalId) const { for (int i = 0; i < m_devConfigs.count(); ++i) { - if (deviceAt(i)->m_internalId == internalId) + if (deviceAt(i)->internalId() == internalId) return i; } return -1; @@ -266,7 +266,7 @@ int LinuxDeviceConfigurations::indexForInternalId(LinuxDeviceConfiguration::Id i LinuxDeviceConfiguration::Id LinuxDeviceConfigurations::internalId(LinuxDeviceConfiguration::ConstPtr devConf) const { - return devConf ? devConf->m_internalId : LinuxDeviceConfiguration::InvalidId; + return devConf ? devConf->internalId() : LinuxDeviceConfiguration::InvalidId; } void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType() @@ -277,7 +277,7 @@ void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType() foreach (const LinuxDeviceConfiguration::Ptr &devConf, m_devConfigs) { if (devConf->isDefault()) { if (osTypeHasDefault.value(devConf->osType())) - devConf->m_isDefault = false; + devConf->setDefault(false); else osTypeHasDefault.insert(devConf->osType(), true); } @@ -286,7 +286,7 @@ void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType() // Step 2: Ensure there's at least one default configuration per device type. foreach (const LinuxDeviceConfiguration::Ptr &devConf, m_devConfigs) { if (!osTypeHasDefault.value(devConf->osType())) { - devConf->m_isDefault = true; + devConf->setDefault(true); osTypeHasDefault.insert(devConf->osType(), true); } } @@ -304,7 +304,7 @@ QVariant LinuxDeviceConfigurations::data(const QModelIndex &index, int role) con return QVariant(); const LinuxDeviceConfiguration::ConstPtr devConf = deviceAt(index.row()); QString name = devConf->name(); - if (devConf->m_isDefault) { + if (devConf->isDefault()) { name += QLatin1Char(' ') + tr("(default for %1)") .arg(RemoteLinuxUtils::osTypeToString(devConf->osType())); } diff --git a/src/plugins/remotelinux/linuxdeviceconfigurationssettingswidget.cpp b/src/plugins/remotelinux/linuxdeviceconfigurationssettingswidget.cpp index 3011a13a06..95d93f5200 100644 --- a/src/plugins/remotelinux/linuxdeviceconfigurationssettingswidget.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfigurationssettingswidget.cpp @@ -34,6 +34,7 @@ #include "linuxdeviceconfigurations.h" #include "linuxdevicefactoryselectiondialog.h" +#include "portlist.h" #include "remotelinuxutils.h" #include "sshkeycreationdialog.h" @@ -202,7 +203,7 @@ void LinuxDeviceConfigurationsSettingsWidget::displayCurrent() m_ui->defaultDeviceButton->setEnabled(!current->isDefault()); m_ui->osTypeValueLabel->setText(RemoteLinuxUtils::osTypeToString(current->osType())); const SshConnectionParameters &sshParams = current->sshParameters(); - if (current->type() == LinuxDeviceConfiguration::Physical) + if (current->deviceType() == LinuxDeviceConfiguration::Hardware) m_ui->deviceTypeValueLabel->setText(tr("Physical Device")); else m_ui->deviceTypeValueLabel->setText(tr("Emulator")); diff --git a/src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp b/src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp index 6815589e03..0c942c97fc 100644 --- a/src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp +++ b/src/plugins/remotelinux/maddeuploadandinstallpackagesteps.cpp @@ -56,7 +56,7 @@ protected: void doDeviceSetup() { - if (deviceConfiguration()->type() == LinuxDeviceConfiguration::Physical) { + if (deviceConfiguration()->deviceType() == LinuxDeviceConfiguration::Hardware) { handleDeviceSetupDone(true); return; } diff --git a/src/plugins/remotelinux/maemodeploybymountsteps.cpp b/src/plugins/remotelinux/maemodeploybymountsteps.cpp index 1a7265d210..342ed2e496 100644 --- a/src/plugins/remotelinux/maemodeploybymountsteps.cpp +++ b/src/plugins/remotelinux/maemodeploybymountsteps.cpp @@ -47,8 +47,8 @@ #include <remotelinux/deployablefile.h> #include <remotelinux/deploymentinfo.h> #include <remotelinux/linuxdeviceconfiguration.h> - #include <utils/qtcassert.h> +#include <utils/ssh/sshconnection.h> #include <QtCore/QFileInfo> #include <QtCore/QList> @@ -156,7 +156,7 @@ void AbstractMaemoDeployByMountService::doDeviceSetup() { QTC_ASSERT(m_state == Inactive, return); - if (deviceConfiguration()->type() == LinuxDeviceConfiguration::Physical) { + if (deviceConfiguration()->deviceType() == LinuxDeviceConfiguration::Hardware) { handleDeviceSetupDone(true); return; } diff --git a/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp b/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp index a8408201e3..0c0ab6f6cb 100644 --- a/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp +++ b/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp @@ -38,6 +38,7 @@ #include "qt4maemotarget.h" #include <qt4projectmanager/qt4nodes.h> +#include <remotelinux/deployablefile.h> #include <remotelinux/deployablefilesperprofile.h> #include <remotelinux/deploymentinfo.h> #include <remotelinux/remotelinuxdeployconfigurationwidget.h> diff --git a/src/plugins/remotelinux/maemodeviceconfigwizard.cpp b/src/plugins/remotelinux/maemodeviceconfigwizard.cpp index 2eb6f3c87f..ed4eb7d75e 100644 --- a/src/plugins/remotelinux/maemodeviceconfigwizard.cpp +++ b/src/plugins/remotelinux/maemodeviceconfigwizard.cpp @@ -69,7 +69,7 @@ QString defaultUser(const QString &osType) QString defaultHost(LinuxDeviceConfiguration::DeviceType type) { - return QLatin1String(type == LinuxDeviceConfiguration::Physical ? "192.168.2.15" : "localhost"); + return QLatin1String(type == LinuxDeviceConfiguration::Hardware ? "192.168.2.15" : "localhost"); } struct WizardData @@ -152,7 +152,7 @@ public: LinuxDeviceConfiguration::DeviceType deviceType() const { return m_ui->hwButton->isChecked() - ? LinuxDeviceConfiguration::Physical : LinuxDeviceConfiguration::Emulator; + ? LinuxDeviceConfiguration::Hardware : LinuxDeviceConfiguration::Emulator; } int sshPort() const @@ -164,7 +164,7 @@ public: private slots: void handleDeviceTypeChanged() { - const bool enable = deviceType() == LinuxDeviceConfiguration::Physical; + const bool enable = deviceType() == LinuxDeviceConfiguration::Hardware; m_ui->hostNameLabel->setEnabled(enable); m_ui->hostNameLineEdit->setEnabled(enable); m_ui->sshPortLabel->setEnabled(enable); diff --git a/src/plugins/remotelinux/maemoglobal.cpp b/src/plugins/remotelinux/maemoglobal.cpp index d65349baa9..7397503726 100644 --- a/src/plugins/remotelinux/maemoglobal.cpp +++ b/src/plugins/remotelinux/maemoglobal.cpp @@ -157,7 +157,7 @@ PortList MaemoGlobal::freePorts(const LinuxDeviceConfiguration::ConstPtr &devCon { if (!devConf || !qtVersion) return PortList(); - if (devConf->type() == LinuxDeviceConfiguration::Emulator) { + if (devConf->deviceType() == LinuxDeviceConfiguration::Emulator) { MaemoQemuRuntime rt; const int id = qtVersion->uniqueId(); if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt)) diff --git a/src/plugins/remotelinux/maemoqemumanager.cpp b/src/plugins/remotelinux/maemoqemumanager.cpp index 7228fac098..362d5e3e5d 100644 --- a/src/plugins/remotelinux/maemoqemumanager.cpp +++ b/src/plugins/remotelinux/maemoqemumanager.cpp @@ -589,7 +589,7 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target, if (qtVersion) *qtVersion = version; const LinuxDeviceConfiguration::ConstPtr &config = mrc->deviceConfig(); - return config && config->type() == LinuxDeviceConfiguration::Emulator; + return config && config->deviceType() == LinuxDeviceConfiguration::Emulator; } void MaemoQemuManager::notify(const QList<int> uniqueIds) diff --git a/src/plugins/remotelinux/maemorunconfiguration.cpp b/src/plugins/remotelinux/maemorunconfiguration.cpp index 8cb33b6b89..ecc0e5914e 100644 --- a/src/plugins/remotelinux/maemorunconfiguration.cpp +++ b/src/plugins/remotelinux/maemorunconfiguration.cpp @@ -41,6 +41,8 @@ #include <projectexplorer/project.h> #include <projectexplorer/projectexplorerconstants.h> #include <qt4projectmanager/qt4buildconfiguration.h> +#include <remotelinux/portlist.h> +#include <utils/ssh/sshconnection.h> #include <QtCore/QDir> #include <QtCore/QFileInfo> diff --git a/src/plugins/remotelinux/maemorunfactories.cpp b/src/plugins/remotelinux/maemorunfactories.cpp index d3aed36e2b..1a4c98d584 100644 --- a/src/plugins/remotelinux/maemorunfactories.cpp +++ b/src/plugins/remotelinux/maemorunfactories.cpp @@ -28,7 +28,6 @@ ** Nokia at info@qt.nokia.com. ** **************************************************************************/ - #include "maemorunfactories.h" #include "maemoconstants.h" @@ -40,6 +39,7 @@ #include "qt4maemotarget.h" #include <debugger/debuggerconstants.h> +#include <debugger/debuggerstartparameters.h> #include <debugger/debuggerplugin.h> #include <debugger/debuggerrunner.h> #include <projectexplorer/projectexplorerconstants.h> diff --git a/src/plugins/remotelinux/maemosshrunner.cpp b/src/plugins/remotelinux/maemosshrunner.cpp index 9401c88d24..86d33826d8 100644 --- a/src/plugins/remotelinux/maemosshrunner.cpp +++ b/src/plugins/remotelinux/maemosshrunner.cpp @@ -28,7 +28,6 @@ ** Nokia at info@qt.nokia.com. ** **************************************************************************/ - #include "maemosshrunner.h" #include "maemoqemumanager.h" @@ -39,6 +38,7 @@ #include <qt4projectmanager/qt4buildconfiguration.h> #include <remotelinux/linuxdeviceconfiguration.h> #include <utils/qtcassert.h> +#include <utils/ssh/sshconnection.h> using namespace Qt4ProjectManager; using namespace Utils; @@ -47,7 +47,7 @@ namespace RemoteLinux { namespace Internal { MaemoSshRunner::MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig) - : AbstractRemoteLinuxApplicationRunner(parent, runConfig), + : AbstractRemoteLinuxApplicationRunner(runConfig, parent), m_mounter(new MaemoRemoteMounter(this)), m_mountSpecs(runConfig->remoteMounts()->mountSpecs()), m_mountState(InactiveMountState) @@ -72,7 +72,7 @@ bool MaemoSshRunner::canRun(QString &whyNot) const if (!AbstractRemoteLinuxApplicationRunner::canRun(whyNot)) return false; - if (devConfig()->type() == LinuxDeviceConfiguration::Emulator + if (devConfig()->deviceType() == LinuxDeviceConfiguration::Emulator && !MaemoQemuManager::instance().qemuIsRunning()) { MaemoQemuRuntime rt; if (MaemoQemuManager::instance().runtimeForQtVersion(m_qtId, &rt)) { diff --git a/src/plugins/remotelinux/portlist.cpp b/src/plugins/remotelinux/portlist.cpp index 083d951fcb..c6cf651efd 100644 --- a/src/plugins/remotelinux/portlist.cpp +++ b/src/plugins/remotelinux/portlist.cpp @@ -31,11 +31,18 @@ **************************************************************************/ #include "portlist.h" +#include <QtCore/QList> +#include <QtCore/QPair> +#include <QtCore/QString> + #include <cctype> namespace RemoteLinux { +namespace Internal { namespace { +typedef QPair<int, int> Range; + class PortsSpecParser { struct ParseException { @@ -120,43 +127,65 @@ private: } // anonymous namespace +class PortListPrivate +{ +public: + QList<Range> ranges; +}; + +} // namespace Internal + +PortList::PortList() : m_d(new Internal::PortListPrivate) +{ +} + +PortList::PortList(const PortList &other) : m_d(new Internal::PortListPrivate(*other.m_d)) +{ +} + +PortList &PortList::operator=(const PortList &other) +{ + *m_d = *other.m_d; + return *this; +} PortList PortList::fromString(const QString &portsSpec) { - return PortsSpecParser(portsSpec).parse(); + return Internal::PortsSpecParser(portsSpec).parse(); } void PortList::addPort(int port) { addRange(port, port); } void PortList::addRange(int startPort, int endPort) { - m_ranges << Range(startPort, endPort); + m_d->ranges << Internal::Range(startPort, endPort); } -bool PortList::hasMore() const { return !m_ranges.isEmpty(); } +bool PortList::hasMore() const { return !m_d->ranges.isEmpty(); } int PortList::count() const { int n = 0; - foreach (const Range &r, m_ranges) + foreach (const Internal::Range &r, m_d->ranges) n += r.second - r.first + 1; return n; } int PortList::getNext() { - Q_ASSERT(!m_ranges.isEmpty()); - Range &firstRange = m_ranges.first(); + Q_ASSERT(!m_d->ranges.isEmpty()); + + Internal::Range &firstRange = m_d->ranges.first(); const int next = firstRange.first++; if (firstRange.first > firstRange.second) - m_ranges.removeFirst(); + m_d->ranges.removeFirst(); return next; } QString PortList::toString() const { QString stringRep; - foreach (const Range &range, m_ranges) { + foreach (const Internal::Range &range, m_d->ranges) { stringRep += QString::number(range.first); if (range.second != range.first) stringRep += QLatin1Char('-') + QString::number(range.second); diff --git a/src/plugins/remotelinux/portlist.h b/src/plugins/remotelinux/portlist.h index 60f71b82f9..f2344a3587 100644 --- a/src/plugins/remotelinux/portlist.h +++ b/src/plugins/remotelinux/portlist.h @@ -34,14 +34,20 @@ #include "remotelinux_export.h" -#include <QtCore/QPair> -#include <QtCore/QString> +QT_FORWARD_DECLARE_CLASS(QString) namespace RemoteLinux { +namespace Internal { +class PortListPrivate; +} // namespace Internal class REMOTELINUX_EXPORT PortList { public: + PortList(); + PortList(const PortList &other); + PortList &operator=(const PortList &other); + void addPort(int port); void addRange(int startPort, int endPort); bool hasMore() const; @@ -53,8 +59,7 @@ public: static QString regularExpression(); private: - typedef QPair<int, int> Range; - QList<Range> m_ranges; + Internal::PortListPrivate * const m_d; }; } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp index 303cd9a295..ce984d35e1 100644 --- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp +++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp @@ -33,6 +33,8 @@ #include "linuxdeviceconfiguration.h" #include "sshkeydeployer.h" +#include <utils/ssh/sshconnection.h> + #include <QtCore/QTimer> #include <QtGui/QFileDialog> diff --git a/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp b/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp index 422915d587..9f9498ab26 100644 --- a/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp +++ b/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp @@ -41,6 +41,7 @@ #include <projectexplorer/buildsteplist.h> #include <qt4projectmanager/qt4target.h> +#include <remotelinux/deployablefile.h> #include <remotelinux/deployablefilesperprofile.h> #include <remotelinux/deploymentinfo.h> #include <remotelinux/deploymentsettingsassistant.h> diff --git a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp index ad2288606b..e9754b8d87 100644 --- a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp +++ b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp @@ -32,6 +32,7 @@ #include "remotelinuxapplicationrunner.h" #include "linuxdeviceconfiguration.h" +#include "portlist.h" #include "remotelinuxrunconfiguration.h" #include "remotelinuxusedportsgatherer.h" @@ -93,8 +94,8 @@ public: using namespace Internal; -AbstractRemoteLinuxApplicationRunner::AbstractRemoteLinuxApplicationRunner(QObject *parent, - RemoteLinuxRunConfiguration *runConfig) +AbstractRemoteLinuxApplicationRunner::AbstractRemoteLinuxApplicationRunner(RemoteLinuxRunConfiguration *runConfig, + QObject *parent) : QObject(parent), m_d(new AbstractRemoteLinuxApplicationRunnerPrivate(runConfig)) { connect(&m_d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGathererError(QString))); @@ -441,9 +442,9 @@ void AbstractRemoteLinuxApplicationRunner::handlePostRunCleanupDone() const qint64 AbstractRemoteLinuxApplicationRunner::InvalidExitCode = std::numeric_limits<qint64>::min(); -GenericRemoteLinuxApplicationRunner::GenericRemoteLinuxApplicationRunner(QObject *parent, - RemoteLinuxRunConfiguration *runConfig) - : AbstractRemoteLinuxApplicationRunner(parent, runConfig) +GenericRemoteLinuxApplicationRunner::GenericRemoteLinuxApplicationRunner(RemoteLinuxRunConfiguration *runConfig, + QObject *parent) + : AbstractRemoteLinuxApplicationRunner(runConfig, parent) { } diff --git a/src/plugins/remotelinux/remotelinuxapplicationrunner.h b/src/plugins/remotelinux/remotelinuxapplicationrunner.h index ca09c87a2a..7683a4364a 100644 --- a/src/plugins/remotelinux/remotelinuxapplicationrunner.h +++ b/src/plugins/remotelinux/remotelinuxapplicationrunner.h @@ -28,24 +28,21 @@ ** Nokia at info@qt.nokia.com. ** **************************************************************************/ - #ifndef REMOTELINUXAPPLICATIONRUNNER_H #define REMOTELINUXAPPLICATIONRUNNER_H -#include "portlist.h" #include "remotelinux_export.h" #include <QtCore/QObject> #include <QtCore/QSharedPointer> -#include <QtCore/QStringList> namespace Utils { class SshConnection; -class SshRemoteProcess; } namespace RemoteLinux { class LinuxDeviceConfiguration; +class PortList; class RemoteLinuxRunConfiguration; class RemoteLinuxUsedPortsGatherer; @@ -58,7 +55,8 @@ class REMOTELINUX_EXPORT AbstractRemoteLinuxApplicationRunner : public QObject Q_OBJECT Q_DISABLE_COPY(AbstractRemoteLinuxApplicationRunner) public: - AbstractRemoteLinuxApplicationRunner(QObject *parent, RemoteLinuxRunConfiguration *runConfig); + AbstractRemoteLinuxApplicationRunner(RemoteLinuxRunConfiguration *runConfig, + QObject *parent = 0); ~AbstractRemoteLinuxApplicationRunner(); void start(); @@ -135,7 +133,8 @@ class REMOTELINUX_EXPORT GenericRemoteLinuxApplicationRunner : public AbstractRe { Q_OBJECT public: - GenericRemoteLinuxApplicationRunner(QObject *parent, RemoteLinuxRunConfiguration *runConfig); + GenericRemoteLinuxApplicationRunner(RemoteLinuxRunConfiguration *runConfig, + QObject *parent = 0); ~GenericRemoteLinuxApplicationRunner(); protected: diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 4f214f15ff..9668fbd618 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -28,14 +28,15 @@ ** Nokia at info@qt.nokia.com. ** **************************************************************************/ - #include "remotelinuxdebugsupport.h" #include "linuxdeviceconfiguration.h" #include "remotelinuxapplicationrunner.h" +#include "remotelinuxrunconfiguration.h" #include "remotelinuxusedportsgatherer.h" #include <debugger/debuggerengine.h> +#include <debugger/debuggerstartparameters.h> #include <projectexplorer/abi.h> #include <projectexplorer/project.h> #include <projectexplorer/target.h> @@ -43,11 +44,51 @@ #include <qt4projectmanager/qt4buildconfiguration.h> #include <utils/qtcassert.h> +#include <QtCore/QPointer> +#include <QtCore/QSharedPointer> + using namespace Utils; using namespace Debugger; using namespace ProjectExplorer; namespace RemoteLinux { +namespace Internal { +namespace { +enum State { Inactive, StartingRunner, StartingRemoteProcess, Debugging }; +} // anonymous namespace + +class AbstractRemoteLinuxDebugSupportPrivate +{ +public: + AbstractRemoteLinuxDebugSupportPrivate(RemoteLinuxRunConfiguration *runConfig, + DebuggerEngine *engine) + : engine(engine), runConfig(runConfig), deviceConfig(runConfig->deviceConfig()), + debuggingType(runConfig->debuggingType()), state(Inactive), + gdbServerPort(-1), qmlPort(-1) + { + } + + const QPointer<Debugger::DebuggerEngine> engine; + const QPointer<RemoteLinuxRunConfiguration> runConfig; + const LinuxDeviceConfiguration::ConstPtr deviceConfig; + const RemoteLinuxRunConfiguration::DebuggingType debuggingType; + + QByteArray gdbserverOutput; + State state; + int gdbServerPort; + int qmlPort; +}; + +class RemoteLinuxDebugSupportPrivate +{ +public: + RemoteLinuxDebugSupportPrivate(RemoteLinuxRunConfiguration *runConfig) : runner(runConfig) {} + + GenericRemoteLinuxApplicationRunner runner; +}; + +} // namespace Internal + using namespace Internal; DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const RemoteLinuxRunConfiguration *runConfig) @@ -93,31 +134,30 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R return params; } -AbstractRemoteLinuxDebugSupport::AbstractRemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig, DebuggerEngine *engine) - : QObject(engine), m_engine(engine), m_runConfig(runConfig), - m_deviceConfig(m_runConfig->deviceConfig()), - m_debuggingType(runConfig->debuggingType()), - m_state(Inactive), m_gdbServerPort(-1), m_qmlPort(-1) +AbstractRemoteLinuxDebugSupport::AbstractRemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig, + DebuggerEngine *engine) + : QObject(engine), m_d(new AbstractRemoteLinuxDebugSupportPrivate(runConfig, engine)) { - connect(m_engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested())); + connect(m_d->engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested())); } AbstractRemoteLinuxDebugSupport::~AbstractRemoteLinuxDebugSupport() { - setState(Inactive); + setFinished(); + delete m_d; } void AbstractRemoteLinuxDebugSupport::showMessage(const QString &msg, int channel) { - if (m_engine) - m_engine->showMessage(msg, channel); + if (m_d->engine) + m_d->engine->showMessage(msg, channel); } void AbstractRemoteLinuxDebugSupport::handleAdapterSetupRequested() { - QTC_ASSERT(m_state == Inactive, return); + QTC_ASSERT(m_d->state == Inactive, return); - setState(StartingRunner); + m_d->state = StartingRunner; showMessage(tr("Preparing remote side ...\n"), AppStuff); disconnect(runner(), 0, this, 0); connect(runner(), SIGNAL(error(QString)), this, SLOT(handleSshError(QString))); @@ -128,52 +168,52 @@ void AbstractRemoteLinuxDebugSupport::handleAdapterSetupRequested() void AbstractRemoteLinuxDebugSupport::handleSshError(const QString &error) { - if (m_state == Debugging) { + if (m_d->state == Debugging) { showMessage(error, AppError); - if (m_engine) - m_engine->notifyInferiorIll(); - } else if (m_state != Inactive) { + if (m_d->engine) + m_d->engine->notifyInferiorIll(); + } else if (m_d->state != Inactive) { handleAdapterSetupFailed(error); } } void AbstractRemoteLinuxDebugSupport::startExecution() { - if (m_state == Inactive) + if (m_d->state == Inactive) return; - QTC_ASSERT(m_state == StartingRunner, return); + QTC_ASSERT(m_d->state == StartingRunner, return); - if (m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { - if (!setPort(m_gdbServerPort)) + if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { + if (!setPort(m_d->gdbServerPort)) return; } - if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { - if (!setPort(m_qmlPort)) + if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { + if (!setPort(m_d->qmlPort)) return; } - setState(StartingRemoteProcess); - m_gdbserverOutput.clear(); + m_d->state = StartingRemoteProcess; + m_d->gdbserverOutput.clear(); connect(runner(), SIGNAL(remoteErrorOutput(QByteArray)), this, SLOT(handleRemoteErrorOutput(QByteArray))); connect(runner(), SIGNAL(remoteOutput(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); - if (m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) { + if (m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) { connect(runner(), SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); } const QString &remoteExe = runner()->remoteExecutable(); QString args = runner()->arguments(); - if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { + if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { args += QString(QLatin1String(" -qmljsdebugger=port:%1,block")) - .arg(m_qmlPort); + .arg(m_d->qmlPort); } - const QString remoteCommandLine = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly + const QString remoteCommandLine = m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly ? QString::fromLocal8Bit("%1 %2 %3").arg(runner()->commandPrefix()).arg(remoteExe).arg(args) : QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4").arg(runner()->commandPrefix()) - .arg(m_gdbServerPort).arg(remoteExe).arg(args); + .arg(m_d->gdbServerPort).arg(remoteExe).arg(args); connect(runner(), SIGNAL(remoteProcessFinished(qint64)), SLOT(handleRemoteProcessFinished(qint64))); runner()->startExecution(remoteCommandLine.toUtf8()); @@ -181,51 +221,51 @@ void AbstractRemoteLinuxDebugSupport::startExecution() void AbstractRemoteLinuxDebugSupport::handleRemoteProcessFinished(qint64 exitCode) { - if (!m_engine || m_state == Inactive) + if (!m_d->engine || m_d->state == Inactive) return; - if (m_state == Debugging) { + if (m_d->state == Debugging) { // The QML engine does not realize on its own that the application has finished. - if (m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) - m_engine->quitDebugger(); + if (m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) + m_d->engine->quitDebugger(); else if (exitCode != 0) - m_engine->notifyInferiorIll(); + m_d->engine->notifyInferiorIll(); } else { - const QString errorMsg = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly + const QString errorMsg = m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly ? tr("Remote application failed with exit code %1.").arg(exitCode) : tr("The gdbserver process closed unexpectedly."); - m_engine->handleRemoteSetupFailed(errorMsg); + m_d->engine->handleRemoteSetupFailed(errorMsg); } } void AbstractRemoteLinuxDebugSupport::handleDebuggingFinished() { - setState(Inactive); + setFinished(); } void AbstractRemoteLinuxDebugSupport::handleRemoteOutput(const QByteArray &output) { - QTC_ASSERT(m_state == Inactive || m_state == Debugging, return); + QTC_ASSERT(m_d->state == Inactive || m_d->state == Debugging, return); showMessage(QString::fromUtf8(output), AppOutput); } void AbstractRemoteLinuxDebugSupport::handleRemoteErrorOutput(const QByteArray &output) { - QTC_ASSERT(m_state == Inactive || m_state == StartingRemoteProcess || m_state == Debugging, + QTC_ASSERT(m_d->state == Inactive || m_d->state == StartingRemoteProcess || m_d->state == Debugging, return); - if (!m_engine) + if (!m_d->engine) return; showMessage(QString::fromUtf8(output), AppOutput); - if (m_state == StartingRemoteProcess - && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { - m_gdbserverOutput += output; - if (m_gdbserverOutput.contains("Listening on port")) { + if (m_d->state == StartingRemoteProcess + && m_d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { + m_d->gdbserverOutput += output; + if (m_d->gdbserverOutput.contains("Listening on port")) { handleAdapterSetupDone(); - m_gdbserverOutput.clear(); + m_d->gdbserverOutput.clear(); } } } @@ -237,31 +277,30 @@ void AbstractRemoteLinuxDebugSupport::handleProgressReport(const QString &progre void AbstractRemoteLinuxDebugSupport::handleAdapterSetupFailed(const QString &error) { - setState(Inactive); - m_engine->handleRemoteSetupFailed(tr("Initial setup failed: %1").arg(error)); + setFinished(); + m_d->engine->handleRemoteSetupFailed(tr("Initial setup failed: %1").arg(error)); } void AbstractRemoteLinuxDebugSupport::handleAdapterSetupDone() { - setState(Debugging); - m_engine->handleRemoteSetupDone(m_gdbServerPort, m_qmlPort); + m_d->state = Debugging; + m_d->engine->handleRemoteSetupDone(m_d->gdbServerPort, m_d->qmlPort); } void AbstractRemoteLinuxDebugSupport::handleRemoteProcessStarted() { - Q_ASSERT(m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly); - QTC_ASSERT(m_state == StartingRemoteProcess, return); + Q_ASSERT(m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly); + QTC_ASSERT(m_d->state == StartingRemoteProcess, return); handleAdapterSetupDone(); } -void AbstractRemoteLinuxDebugSupport::setState(State newState) +void AbstractRemoteLinuxDebugSupport::setFinished() { - if (m_state == newState) + if (m_d->state == Inactive) return; - m_state = newState; - if (m_state == Inactive) - runner()->stop(); + m_d->state = Inactive; + runner()->stop(); } bool AbstractRemoteLinuxDebugSupport::setPort(int &port) @@ -278,12 +317,18 @@ bool AbstractRemoteLinuxDebugSupport::setPort(int &port) RemoteLinuxDebugSupport::RemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig, DebuggerEngine *engine) : AbstractRemoteLinuxDebugSupport(runConfig, engine), - m_runner(new GenericRemoteLinuxApplicationRunner(this, runConfig)) + m_d(new RemoteLinuxDebugSupportPrivate(runConfig)) { } RemoteLinuxDebugSupport::~RemoteLinuxDebugSupport() { + delete m_d; +} + +AbstractRemoteLinuxApplicationRunner *RemoteLinuxDebugSupport::runner() const +{ + return &m_d->runner; } } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.h b/src/plugins/remotelinux/remotelinuxdebugsupport.h index 824e6045d2..521bcd0f24 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.h +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.h @@ -33,16 +33,12 @@ #define REMOTELINUXDEBUGSUPPORT_H #include "remotelinux_export.h" -#include "remotelinuxrunconfiguration.h" - -#include <debugger/debuggerstartparameters.h> #include <QtCore/QObject> -#include <QtCore/QPointer> -#include <QtCore/QSharedPointer> namespace Debugger { class DebuggerEngine; +class DebuggerStartParameters; } namespace ProjectExplorer { class RunControl; } @@ -51,9 +47,15 @@ class LinuxDeviceConfiguration; class RemoteLinuxRunConfiguration; class AbstractRemoteLinuxApplicationRunner; +namespace Internal { +class AbstractRemoteLinuxDebugSupportPrivate; +class RemoteLinuxDebugSupportPrivate; +} // namespace Internal + class REMOTELINUX_EXPORT AbstractRemoteLinuxDebugSupport : public QObject { Q_OBJECT + Q_DISABLE_COPY(AbstractRemoteLinuxDebugSupport) public: static Debugger::DebuggerStartParameters startParameters(const RemoteLinuxRunConfiguration *runConfig); @@ -72,25 +74,16 @@ private slots: void handleRemoteProcessFinished(qint64 exitCode); private: - enum State { Inactive, StartingRunner, StartingRemoteProcess, Debugging }; virtual AbstractRemoteLinuxApplicationRunner *runner() const=0; void handleAdapterSetupFailed(const QString &error); void handleAdapterSetupDone(); - void setState(State newState); + void setFinished(); bool setPort(int &port); void showMessage(const QString &msg, int channel); - const QPointer<Debugger::DebuggerEngine> m_engine; - const QPointer<RemoteLinuxRunConfiguration> m_runConfig; - const QSharedPointer<const LinuxDeviceConfiguration> m_deviceConfig; - const RemoteLinuxRunConfiguration::DebuggingType m_debuggingType; - - QByteArray m_gdbserverOutput; - State m_state; - int m_gdbServerPort; - int m_qmlPort; + Internal::AbstractRemoteLinuxDebugSupportPrivate * const m_d; }; @@ -102,9 +95,9 @@ public: ~RemoteLinuxDebugSupport(); private: - AbstractRemoteLinuxApplicationRunner *runner() const { return m_runner; } + AbstractRemoteLinuxApplicationRunner *runner() const; - AbstractRemoteLinuxApplicationRunner * const m_runner; + Internal::RemoteLinuxDebugSupportPrivate * const m_d; }; } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h index 3b96a43ced..3c75e5d747 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h @@ -53,6 +53,7 @@ class REMOTELINUX_EXPORT RemoteLinuxDeployConfiguration : public ProjectExplorer::DeployConfiguration { Q_OBJECT + Q_DISABLE_COPY(RemoteLinuxDeployConfiguration) public: RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, const QString &id, const QString &defaultDisplayName, const QString &supportedOsType); diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h index 4a4e6dbf57..9290a6ea8a 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h @@ -35,8 +35,6 @@ #include <projectexplorer/deployconfiguration.h> -#include <QtGui/QWidget> - namespace RemoteLinux { class DeployableFilesPerProFile; class RemoteLinuxDeployConfiguration; diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp index b40f494e4f..ab6bdc7fc6 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp @@ -38,7 +38,8 @@ namespace RemoteLinux { namespace Internal { -RemoteLinuxEnvironmentReader::RemoteLinuxEnvironmentReader(QObject *parent, RemoteLinuxRunConfiguration *config) +RemoteLinuxEnvironmentReader::RemoteLinuxEnvironmentReader(RemoteLinuxRunConfiguration *config, + QObject *parent) : QObject(parent) , m_stop(false) , m_devConfig(config->deviceConfig()) diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.h b/src/plugins/remotelinux/remotelinuxenvironmentreader.h index d99814d8d0..ca26b537f8 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentreader.h +++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.h @@ -51,7 +51,7 @@ class RemoteLinuxEnvironmentReader : public QObject { Q_OBJECT public: - RemoteLinuxEnvironmentReader(QObject *parent, RemoteLinuxRunConfiguration *config); + RemoteLinuxEnvironmentReader(RemoteLinuxRunConfiguration *config, QObject *parent = 0); ~RemoteLinuxEnvironmentReader(); void start(const QString &environmentSetupCommand); diff --git a/src/plugins/remotelinux/remotelinuxpackageinstaller.h b/src/plugins/remotelinux/remotelinuxpackageinstaller.h index 8f8e33aadf..bf91202dce 100644 --- a/src/plugins/remotelinux/remotelinuxpackageinstaller.h +++ b/src/plugins/remotelinux/remotelinuxpackageinstaller.h @@ -35,7 +35,6 @@ #include "remotelinux_export.h" #include <QtCore/QObject> - #include <QtCore/QSharedPointer> #include <QtCore/QString> diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 831994270e..e7bc1d2621 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -34,15 +34,13 @@ #include "deploymentinfo.h" #include "linuxdeviceconfiguration.h" -#include "maemoqtversion.h" -#include "maemotoolchain.h" -#include "qt4maemotarget.h" +#include "portlist.h" #include "remotelinuxdeployconfiguration.h" #include "remotelinuxrunconfigurationwidget.h" #include <projectexplorer/projectexplorer.h> #include <projectexplorer/session.h> - +#include <projectexplorer/toolchain.h> #include <qtsupport/qtoutputformatter.h> #include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4nodes.h> @@ -50,9 +48,6 @@ #include <qt4projectmanager/qt4target.h> #include <utils/qtcassert.h> -#include <utils/qtcprocess.h> - -#include <QtCore/QStringBuilder> using namespace ProjectExplorer; using namespace Qt4ProjectManager; diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h index ea249616da..020df997ea 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -33,27 +33,20 @@ #ifndef REMOTELINUXRUNCONFIGURATION_H #define REMOTELINUXRUNCONFIGURATION_H -#include "portlist.h" #include "remotelinux_export.h" -#include <utils/environment.h> - #include <projectexplorer/runconfiguration.h> - -#include <QtCore/QDateTime> -#include <QtCore/QStringList> - -QT_FORWARD_DECLARE_CLASS(QWidget) +#include <utils/environment.h> namespace Qt4ProjectManager { class Qt4BuildConfiguration; -class Qt4Project; class Qt4BaseTarget; class Qt4ProFileNode; } // namespace Qt4ProjectManager namespace RemoteLinux { class LinuxDeviceConfiguration; +class PortList; class RemoteLinuxRunConfigurationWidget; class RemoteLinuxDeployConfiguration; @@ -65,6 +58,7 @@ class RemoteLinuxRunConfigurationFactory; class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public ProjectExplorer::RunConfiguration { Q_OBJECT + Q_DISABLE_COPY(RemoteLinuxRunConfiguration) friend class Internal::RemoteLinuxRunConfigurationFactory; friend class RemoteLinuxRunConfigurationWidget; diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp index 346df27615..ac20f34803 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp @@ -60,194 +60,214 @@ using namespace Qt4ProjectManager; namespace RemoteLinux { +namespace Internal { namespace { const QString FetchEnvButtonText = QCoreApplication::translate("RemoteLinux::RemoteLinuxRunConfigurationWidget", "Fetch Device Environment"); } // anonymous namespace +class RemoteLinuxRunConfigurationWidgetPrivate +{ +public: + RemoteLinuxRunConfigurationWidgetPrivate(RemoteLinuxRunConfiguration *runConfig) + : runConfiguration(runConfig), deviceEnvReader(runConfiguration), ignoreChange(false) + { + } + + RemoteLinuxRunConfiguration * const runConfiguration; + RemoteLinuxEnvironmentReader deviceEnvReader; + bool ignoreChange; + + QWidget topWidget; + QLabel disabledIcon; + QLabel disabledReason; + QLineEdit argsLineEdit; + QLabel localExecutableLabel; + QLabel remoteExecutableLabel; + QLabel devConfLabel; + QLabel debuggingLanguagesLabel; + QRadioButton debugCppOnlyButton; + QRadioButton debugQmlOnlyButton; + QRadioButton debugCppAndQmlButton; + QPushButton fetchEnvButton; + QComboBox baseEnvironmentComboBox; + ProjectExplorer::EnvironmentWidget *environmentWidget; +}; + +} // namespace Internal + using namespace Internal; RemoteLinuxRunConfigurationWidget::RemoteLinuxRunConfigurationWidget(RemoteLinuxRunConfiguration *runConfiguration, QWidget *parent) - : QWidget(parent), - m_runConfiguration(runConfiguration), - m_ignoreChange(false), - m_deviceEnvReader(new RemoteLinuxEnvironmentReader(this, runConfiguration)) + : QWidget(parent), m_d(new RemoteLinuxRunConfigurationWidgetPrivate(runConfiguration)) { QVBoxLayout *topLayout = new QVBoxLayout(this); topLayout->setMargin(0); addDisabledLabel(topLayout); - topWidget = new QWidget; - topLayout->addWidget(topWidget); - QVBoxLayout *mainLayout = new QVBoxLayout(topWidget); + topLayout->addWidget(&m_d->topWidget); + QVBoxLayout *mainLayout = new QVBoxLayout(&m_d->topWidget); mainLayout->setMargin(0); addGenericWidgets(mainLayout); addEnvironmentWidgets(mainLayout); - connect(m_runConfiguration, - SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), - this, SLOT(handleCurrentDeviceConfigChanged())); + + connect(m_d->runConfiguration, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), + SLOT(handleCurrentDeviceConfigChanged())); handleCurrentDeviceConfigChanged(); + connect(m_d->runConfiguration, SIGNAL(isEnabledChanged(bool)), + SLOT(runConfigurationEnabledChange(bool))); + runConfigurationEnabledChange(m_d->runConfiguration->isEnabled()); +} - connect(m_runConfiguration, SIGNAL(isEnabledChanged(bool)), - this, SLOT(runConfigurationEnabledChange(bool))); - runConfigurationEnabledChange(m_runConfiguration->isEnabled()); +RemoteLinuxRunConfigurationWidget::~RemoteLinuxRunConfigurationWidget() +{ + delete m_d; } void RemoteLinuxRunConfigurationWidget::addDisabledLabel(QVBoxLayout *topLayout) { - QHBoxLayout *hl = new QHBoxLayout; + QHBoxLayout * const hl = new QHBoxLayout; hl->addStretch(); - m_disabledIcon = new QLabel(this); - m_disabledIcon->setPixmap(QPixmap(QString::fromUtf8(":/projectexplorer/images/compile_warning.png"))); - hl->addWidget(m_disabledIcon); - m_disabledReason = new QLabel(this); - m_disabledReason->setVisible(false); - hl->addWidget(m_disabledReason); + m_d->disabledIcon.setPixmap(QPixmap(QString::fromUtf8(":/projectexplorer/images/compile_warning.png"))); + hl->addWidget(&m_d->disabledIcon); + m_d->disabledReason.setVisible(false); + hl->addWidget(&m_d->disabledReason); hl->addStretch(); topLayout->addLayout(hl); } void RemoteLinuxRunConfigurationWidget::suppressQmlDebuggingOptions() { - m_debuggingLanguagesLabel->hide(); - m_debugCppOnlyButton->hide(); - m_debugQmlOnlyButton->hide(); - m_debugCppAndQmlButton->hide(); + m_d->debuggingLanguagesLabel.hide(); + m_d->debugCppOnlyButton.hide(); + m_d->debugQmlOnlyButton.hide(); + m_d->debugCppAndQmlButton.hide(); } void RemoteLinuxRunConfigurationWidget::runConfigurationEnabledChange(bool enabled) -{ topWidget->setEnabled(enabled); - m_disabledIcon->setVisible(!enabled); - m_disabledReason->setVisible(!enabled); - m_disabledReason->setText(m_runConfiguration->disabledReason()); +{ + m_d->topWidget.setEnabled(enabled); + m_d->disabledIcon.setVisible(!enabled); + m_d->disabledReason.setVisible(!enabled); + m_d->disabledReason.setText(m_d->runConfiguration->disabledReason()); } void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout) { - QFormLayout *formLayout = new QFormLayout; + QFormLayout * const formLayout = new QFormLayout; mainLayout->addLayout(formLayout); formLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter); - QWidget *devConfWidget = new QWidget; - QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget); - m_devConfLabel = new QLabel; + QWidget * const devConfWidget = new QWidget; + QHBoxLayout * const devConfLayout = new QHBoxLayout(devConfWidget); devConfLayout->setMargin(0); - devConfLayout->addWidget(m_devConfLabel); - QLabel *addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>") + devConfLayout->addWidget(&m_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 *debuggerConfLabel = new QLabel(tr("<a href=\"%1\">Set Debugger</a>") + QLabel * const debuggerConfLabel = new QLabel(tr("<a href=\"%1\">Set Debugger</a>") .arg(QLatin1String("debugger"))); debuggerConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); devConfLayout->addWidget(debuggerConfLabel); formLayout->addRow(new QLabel(tr("Device configuration:")), devConfWidget); - m_localExecutableLabel - = new QLabel(m_runConfiguration->localExecutableFilePath()); - formLayout->addRow(tr("Executable on host:"), m_localExecutableLabel); - m_remoteExecutableLabel = new QLabel; - formLayout->addRow(tr("Executable on device:"), m_remoteExecutableLabel); - m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments()); - formLayout->addRow(tr("Arguments:"), m_argsLineEdit); + m_d->localExecutableLabel.setText(m_d->runConfiguration->localExecutableFilePath()); + formLayout->addRow(tr("Executable on host:"), &m_d->localExecutableLabel); + formLayout->addRow(tr("Executable on device:"), &m_d->remoteExecutableLabel); + m_d->argsLineEdit.setText(m_d->runConfiguration->arguments()); + formLayout->addRow(tr("Arguments:"), &m_d->argsLineEdit); QHBoxLayout * const debugButtonsLayout = new QHBoxLayout; - m_debugCppOnlyButton = new QRadioButton(tr("C++ only")); - m_debugQmlOnlyButton = new QRadioButton(tr("QML only")); - m_debugCppAndQmlButton = new QRadioButton(tr("C++ and QML")); - m_debuggingLanguagesLabel = new QLabel(tr("Debugging type:")); + m_d->debugCppOnlyButton.setText(tr("C++ only")); + m_d->debugQmlOnlyButton.setText(tr("QML only")); + m_d->debugCppAndQmlButton.setText(tr("C++ and QML")); + m_d->debuggingLanguagesLabel.setText(tr("Debugging type:")); QButtonGroup * const buttonGroup = new QButtonGroup; - buttonGroup->addButton(m_debugCppOnlyButton); - buttonGroup->addButton(m_debugQmlOnlyButton); - buttonGroup->addButton(m_debugCppAndQmlButton); - debugButtonsLayout->addWidget(m_debugCppOnlyButton); - debugButtonsLayout->addWidget(m_debugQmlOnlyButton); - debugButtonsLayout->addWidget(m_debugCppAndQmlButton); + buttonGroup->addButton(&m_d->debugCppOnlyButton); + buttonGroup->addButton(&m_d->debugQmlOnlyButton); + buttonGroup->addButton(&m_d->debugCppAndQmlButton); + debugButtonsLayout->addWidget(&m_d->debugCppOnlyButton); + debugButtonsLayout->addWidget(&m_d->debugQmlOnlyButton); + debugButtonsLayout->addWidget(&m_d->debugCppAndQmlButton); debugButtonsLayout->addStretch(1); - formLayout->addRow(m_debuggingLanguagesLabel, debugButtonsLayout); - if (m_runConfiguration->useCppDebugger()) { - if (m_runConfiguration->useQmlDebugger()) - m_debugCppAndQmlButton->setChecked(true); + formLayout->addRow(&m_d->debuggingLanguagesLabel, debugButtonsLayout); + if (m_d->runConfiguration->useCppDebugger()) { + if (m_d->runConfiguration->useQmlDebugger()) + m_d->debugCppAndQmlButton.setChecked(true); else - m_debugCppOnlyButton->setChecked(true); + m_d->debugCppOnlyButton.setChecked(true); } else { - m_debugQmlOnlyButton->setChecked(true); + m_d->debugQmlOnlyButton.setChecked(true); } connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this, SLOT(showDeviceConfigurationsDialog(QString))); connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this, SLOT(showDeviceConfigurationsDialog(QString))); - connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this, - SLOT(argumentsEdited(QString))); - connect(m_debugCppOnlyButton, SIGNAL(toggled(bool)), this, - SLOT(handleDebuggingTypeChanged())); - connect(m_debugQmlOnlyButton, SIGNAL(toggled(bool)), this, - SLOT(handleDebuggingTypeChanged())); - connect(m_debugCppAndQmlButton, SIGNAL(toggled(bool)), this, - SLOT(handleDebuggingTypeChanged())); - connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this, + connect(&m_d->argsLineEdit, SIGNAL(textEdited(QString)), SLOT(argumentsEdited(QString))); + connect(&m_d->debugCppOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged())); + connect(&m_d->debugQmlOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged())); + connect(&m_d->debugCppAndQmlButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged())); + connect(m_d->runConfiguration, SIGNAL(targetInformationChanged()), this, SLOT(updateTargetInformation())); - connect(m_runConfiguration, SIGNAL(deploySpecsChanged()), SLOT(handleDeploySpecsChanged())); + connect(m_d->runConfiguration, SIGNAL(deploySpecsChanged()), SLOT(handleDeploySpecsChanged())); handleDeploySpecsChanged(); } void RemoteLinuxRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout) { - QWidget *baseEnvironmentWidget = new QWidget; - QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget); + QWidget * const baseEnvironmentWidget = new QWidget; + QHBoxLayout * const baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget); baseEnvironmentLayout->setMargin(0); - QLabel *label = new QLabel(tr("Base environment for this run configuration:"), this); + QLabel * const label = new QLabel(tr("Base environment for this run configuration:"), this); baseEnvironmentLayout->addWidget(label); - m_baseEnvironmentComboBox = new QComboBox(this); - m_baseEnvironmentComboBox->addItems(QStringList() << tr("Clean Environment") + m_d->baseEnvironmentComboBox.addItems(QStringList() << tr("Clean Environment") << tr("System Environment")); - m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentType()); - baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox); + m_d->baseEnvironmentComboBox.setCurrentIndex(m_d->runConfiguration->baseEnvironmentType()); + baseEnvironmentLayout->addWidget(&m_d->baseEnvironmentComboBox); - m_fetchEnv = new QPushButton(FetchEnvButtonText); - baseEnvironmentLayout->addWidget(m_fetchEnv); + m_d->fetchEnvButton.setText(FetchEnvButtonText); + baseEnvironmentLayout->addWidget(&m_d->fetchEnvButton); baseEnvironmentLayout->addStretch(10); - m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget); - m_environmentWidget->setBaseEnvironment(m_deviceEnvReader->deviceEnvironment()); - m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); - m_environmentWidget->setUserChanges(m_runConfiguration->userEnvironmentChanges()); - mainLayout->addWidget(m_environmentWidget); + m_d->environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget); + m_d->environmentWidget->setBaseEnvironment(m_d->deviceEnvReader.deviceEnvironment()); + m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText()); + m_d->environmentWidget->setUserChanges(m_d->runConfiguration->userEnvironmentChanges()); + mainLayout->addWidget(m_d->environmentWidget); - connect(m_environmentWidget, SIGNAL(userChangesChanged()), this, - SLOT(userChangesEdited())); - connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)), + connect(m_d->environmentWidget, SIGNAL(userChangesChanged()), SLOT(userChangesEdited())); + connect(&m_d->baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(baseEnvironmentSelected(int))); - connect(m_runConfiguration, SIGNAL(baseEnvironmentChanged()), + connect(m_d->runConfiguration, SIGNAL(baseEnvironmentChanged()), this, SLOT(baseEnvironmentChanged())); - connect(m_runConfiguration, SIGNAL(systemEnvironmentChanged()), + connect(m_d->runConfiguration, SIGNAL(systemEnvironmentChanged()), this, SLOT(systemEnvironmentChanged())); - connect(m_runConfiguration, + connect(m_d->runConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)), - this, SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>))); - connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); - connect(m_deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished())); - connect(m_deviceEnvReader, SIGNAL(error(QString)), this, - SLOT(fetchEnvironmentError(QString))); + SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>))); + connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); + connect(&m_d->deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished())); + connect(&m_d->deviceEnvReader, SIGNAL(error(QString)), SLOT(fetchEnvironmentError(QString))); } void RemoteLinuxRunConfigurationWidget::argumentsEdited(const QString &text) { - m_runConfiguration->setArguments(text); + m_d->runConfiguration->setArguments(text); } void RemoteLinuxRunConfigurationWidget::updateTargetInformation() { - m_localExecutableLabel - ->setText(QDir::toNativeSeparators(m_runConfiguration->localExecutableFilePath())); + m_d->localExecutableLabel + .setText(QDir::toNativeSeparators(m_d->runConfiguration->localExecutableFilePath())); } void RemoteLinuxRunConfigurationWidget::handleDeploySpecsChanged() { - m_remoteExecutableLabel->setText(m_runConfiguration->remoteExecutableFilePath()); + m_d->remoteExecutableLabel.setText(m_d->runConfiguration->remoteExecutableFilePath()); } void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link) @@ -263,83 +283,81 @@ void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QSt void RemoteLinuxRunConfigurationWidget::handleCurrentDeviceConfigChanged() { - m_devConfLabel->setText(RemoteLinuxUtils::deviceConfigurationName(m_runConfiguration->deviceConfig())); + m_d->devConfLabel.setText(RemoteLinuxUtils::deviceConfigurationName(m_d->runConfiguration->deviceConfig())); } void RemoteLinuxRunConfigurationWidget::fetchEnvironment() { - disconnect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); - connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment())); - m_fetchEnv->setText(tr("Cancel Fetch Operation")); - m_deviceEnvReader->start(m_runConfiguration->environmentPreparationCommand()); + disconnect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); + connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment())); + m_d->fetchEnvButton.setText(tr("Cancel Fetch Operation")); + m_d->deviceEnvReader.start(m_d->runConfiguration->environmentPreparationCommand()); } void RemoteLinuxRunConfigurationWidget::stopFetchEnvironment() { - m_deviceEnvReader->stop(); + m_d->deviceEnvReader.stop(); fetchEnvironmentFinished(); } void RemoteLinuxRunConfigurationWidget::fetchEnvironmentFinished() { - disconnect(m_fetchEnv, SIGNAL(clicked()), this, - SLOT(stopFetchEnvironment())); - connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); - m_fetchEnv->setText(FetchEnvButtonText); - m_runConfiguration->setSystemEnvironment(m_deviceEnvReader->deviceEnvironment()); + disconnect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment())); + connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); + m_d->fetchEnvButton.setText(FetchEnvButtonText); + m_d->runConfiguration->setSystemEnvironment(m_d->deviceEnvReader.deviceEnvironment()); } void RemoteLinuxRunConfigurationWidget::fetchEnvironmentError(const QString &error) { - QMessageBox::warning(this, tr("Device error"), + QMessageBox::warning(this, tr("Device Error"), tr("Fetching environment failed: %1").arg(error)); } void RemoteLinuxRunConfigurationWidget::userChangesEdited() { - m_ignoreChange = true; - m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges()); - m_ignoreChange = false; + m_d->ignoreChange = true; + m_d->runConfiguration->setUserEnvironmentChanges(m_d->environmentWidget->userChanges()); + m_d->ignoreChange = false; } void RemoteLinuxRunConfigurationWidget::baseEnvironmentSelected(int index) { - m_ignoreChange = true; - m_runConfiguration->setBaseEnvironmentType(RemoteLinuxRunConfiguration::BaseEnvironmentType(index)); - - m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment()); - m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); - m_ignoreChange = false; + m_d->ignoreChange = true; + m_d->runConfiguration->setBaseEnvironmentType(RemoteLinuxRunConfiguration::BaseEnvironmentType(index)); + m_d->environmentWidget->setBaseEnvironment(m_d->runConfiguration->baseEnvironment()); + m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText()); + m_d->ignoreChange = false; } void RemoteLinuxRunConfigurationWidget::baseEnvironmentChanged() { - if (m_ignoreChange) + if (m_d->ignoreChange) return; - m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentType()); - m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment()); - m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); + m_d->baseEnvironmentComboBox.setCurrentIndex(m_d->runConfiguration->baseEnvironmentType()); + m_d->environmentWidget->setBaseEnvironment(m_d->runConfiguration->baseEnvironment()); + m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText()); } void RemoteLinuxRunConfigurationWidget::systemEnvironmentChanged() { - m_environmentWidget->setBaseEnvironment(m_runConfiguration->systemEnvironment()); + m_d->environmentWidget->setBaseEnvironment(m_d->runConfiguration->systemEnvironment()); } void RemoteLinuxRunConfigurationWidget::userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges) { - if (m_ignoreChange) + if (m_d->ignoreChange) return; - m_environmentWidget->setUserChanges(userChanges); + m_d->environmentWidget->setUserChanges(userChanges); } void RemoteLinuxRunConfigurationWidget::handleDebuggingTypeChanged() { - m_runConfiguration->setUseCppDebugger(m_debugCppOnlyButton->isChecked() - || m_debugCppAndQmlButton->isChecked()); - m_runConfiguration->setUseQmlDebugger(m_debugQmlOnlyButton->isChecked() - || m_debugCppAndQmlButton->isChecked()); + m_d->runConfiguration->setUseCppDebugger(m_d->debugCppOnlyButton.isChecked() + || m_d->debugCppAndQmlButton.isChecked()); + m_d->runConfiguration->setUseQmlDebugger(m_d->debugQmlOnlyButton.isChecked() + || m_d->debugCppAndQmlButton.isChecked()); } } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h index 551c0de8ef..4b57535298 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h @@ -37,22 +37,17 @@ #include <QtGui/QWidget> QT_BEGIN_NAMESPACE -class QComboBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; class QVBoxLayout; QT_END_NAMESPACE -namespace ProjectExplorer { class EnvironmentWidget; } -namespace Qt4ProjectManager { class Qt4BuildConfiguration; } namespace Utils { class EnvironmentItem; } namespace RemoteLinux { class RemoteLinuxRunConfiguration; -namespace Internal { class RemoteLinuxEnvironmentReader; } +namespace Internal { +class RemoteLinuxRunConfigurationWidgetPrivate; +} // namespace Internal class REMOTELINUX_EXPORT RemoteLinuxRunConfigurationWidget : public QWidget { @@ -60,6 +55,7 @@ class REMOTELINUX_EXPORT RemoteLinuxRunConfigurationWidget : public QWidget public: explicit RemoteLinuxRunConfigurationWidget(RemoteLinuxRunConfiguration *runConfiguration, QWidget *parent = 0); + ~RemoteLinuxRunConfigurationWidget(); void addDisabledLabel(QVBoxLayout *topLayout); void suppressQmlDebuggingOptions(); @@ -86,24 +82,7 @@ private: void addGenericWidgets(QVBoxLayout *mainLayout); void addEnvironmentWidgets(QVBoxLayout *mainLayout); - RemoteLinuxRunConfiguration *m_runConfiguration; - QWidget *topWidget; - QLabel *m_disabledIcon; - QLabel *m_disabledReason; - QLineEdit *m_argsLineEdit; - QLabel *m_localExecutableLabel; - QLabel *m_remoteExecutableLabel; - QLabel *m_devConfLabel; - QLabel *m_debuggingLanguagesLabel; - QRadioButton *m_debugCppOnlyButton; - QRadioButton *m_debugQmlOnlyButton; - QRadioButton *m_debugCppAndQmlButton; - - bool m_ignoreChange; - QPushButton *m_fetchEnv; - QComboBox *m_baseEnvironmentComboBox; - Internal::RemoteLinuxEnvironmentReader *m_deviceEnvReader; - ProjectExplorer::EnvironmentWidget *m_environmentWidget; + Internal::RemoteLinuxRunConfigurationWidgetPrivate * const m_d; }; } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxruncontrol.cpp b/src/plugins/remotelinux/remotelinuxruncontrol.cpp index c37fbe9f6f..2935a369aa 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrol.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrol.cpp @@ -37,6 +37,7 @@ #include <projectexplorer/projectexplorerconstants.h> #include <utils/qtcassert.h> +#include <QtCore/QString> #include <QtGui/QMessageBox> using namespace ProjectExplorer; @@ -147,7 +148,7 @@ void AbstractRemoteLinuxRunControl::setFinished() RemoteLinuxRunControl::RemoteLinuxRunControl(ProjectExplorer::RunConfiguration *runConfig) : AbstractRemoteLinuxRunControl(runConfig), - m_runner(new GenericRemoteLinuxApplicationRunner(this, qobject_cast<RemoteLinuxRunConfiguration *>(runConfig))) + m_runner(new GenericRemoteLinuxApplicationRunner(qobject_cast<RemoteLinuxRunConfiguration *>(runConfig), this)) { } diff --git a/src/plugins/remotelinux/remotelinuxruncontrol.h b/src/plugins/remotelinux/remotelinuxruncontrol.h index fa333d7bd0..73a9553f30 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrol.h +++ b/src/plugins/remotelinux/remotelinuxruncontrol.h @@ -36,7 +36,7 @@ #include <projectexplorer/runconfiguration.h> -#include <QtCore/QString> +QT_FORWARD_DECLARE_CLASS(QString) namespace RemoteLinux { class AbstractRemoteLinuxApplicationRunner; @@ -44,6 +44,7 @@ class AbstractRemoteLinuxApplicationRunner; class REMOTELINUX_EXPORT AbstractRemoteLinuxRunControl : public ProjectExplorer::RunControl { Q_OBJECT + Q_DISABLE_COPY(AbstractRemoteLinuxRunControl) public: explicit AbstractRemoteLinuxRunControl(ProjectExplorer::RunConfiguration *runConfig); virtual ~AbstractRemoteLinuxRunControl(); @@ -65,7 +66,6 @@ private slots: void handleProgressReport(const QString &progressString); private: - void setFinished(); void handleError(const QString &errString); diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp index 66092cf57a..cf41978ba0 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp @@ -31,6 +31,7 @@ #include "remotelinuxruncontrolfactory.h" +#include "portlist.h" #include "remotelinuxdebugsupport.h" #include "remotelinuxrunconfiguration.h" #include "remotelinuxruncontrol.h" @@ -38,6 +39,7 @@ #include <debugger/debuggerconstants.h> #include <debugger/debuggerplugin.h> #include <debugger/debuggerrunner.h> +#include <debugger/debuggerstartparameters.h> #include <projectexplorer/projectexplorerconstants.h> using namespace Debugger; diff --git a/src/plugins/remotelinux/remotelinuxusedportsgatherer.cpp b/src/plugins/remotelinux/remotelinuxusedportsgatherer.cpp index 22f95c6889..c824a1542b 100644 --- a/src/plugins/remotelinux/remotelinuxusedportsgatherer.cpp +++ b/src/plugins/remotelinux/remotelinuxusedportsgatherer.cpp @@ -31,6 +31,7 @@ #include "remotelinuxusedportsgatherer.h" #include "linuxdeviceconfiguration.h" +#include "portlist.h" #include <utils/ssh/sshremoteprocessrunner.h> diff --git a/src/plugins/remotelinux/remotelinuxusedportsgatherer.h b/src/plugins/remotelinux/remotelinuxusedportsgatherer.h index 2bf42d09c9..e4bf30d4d1 100644 --- a/src/plugins/remotelinux/remotelinuxusedportsgatherer.h +++ b/src/plugins/remotelinux/remotelinuxusedportsgatherer.h @@ -54,6 +54,7 @@ class RemoteLinuxUsedPortsGathererPrivate; class REMOTELINUX_EXPORT RemoteLinuxUsedPortsGatherer : public QObject { Q_OBJECT + Q_DISABLE_COPY(RemoteLinuxUsedPortsGatherer) public: explicit RemoteLinuxUsedPortsGatherer(QObject *parent = 0); ~RemoteLinuxUsedPortsGatherer(); diff --git a/src/plugins/remotelinux/sshkeydeployer.cpp b/src/plugins/remotelinux/sshkeydeployer.cpp index 85dcdc0cd0..7eff2b8af9 100644 --- a/src/plugins/remotelinux/sshkeydeployer.cpp +++ b/src/plugins/remotelinux/sshkeydeployer.cpp @@ -34,25 +34,37 @@ #include <utils/fileutils.h> #include <QtCore/QFile> +#include <QtCore/QSharedPointer> using namespace Utils; namespace RemoteLinux { +namespace Internal { -SshKeyDeployer::SshKeyDeployer(QObject *parent) : QObject(parent) +class SshKeyDeployerPrivate +{ +public: + SshRemoteProcessRunner::Ptr deployProcess; +}; + +} // namespace Internal + +SshKeyDeployer::SshKeyDeployer(QObject *parent) + : QObject(parent), m_d(new Internal::SshKeyDeployerPrivate) { } SshKeyDeployer::~SshKeyDeployer() { cleanup(); + delete m_d; } void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams, const QString &keyFilePath) { cleanup(); - m_deployProcess = SshRemoteProcessRunner::create(sshParams); + m_d->deployProcess = SshRemoteProcessRunner::create(sshParams); Utils::FileReader reader; if (!reader.fetch(keyFilePath)) { @@ -60,21 +72,21 @@ void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams, return; } - connect(m_deployProcess.data(), SIGNAL(connectionError(Utils::SshError)), this, + connect(m_d->deployProcess.data(), SIGNAL(connectionError(Utils::SshError)), this, SLOT(handleConnectionFailure())); - connect(m_deployProcess.data(), SIGNAL(processClosed(int)), this, + connect(m_d->deployProcess.data(), SIGNAL(processClosed(int)), this, SLOT(handleKeyUploadFinished(int))); const QByteArray command = "test -d .ssh " "|| mkdir .ssh && chmod 0700 .ssh && echo '" + reader.data() + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys"; - m_deployProcess->run(command); + m_d->deployProcess->run(command); } void SshKeyDeployer::handleConnectionFailure() { - if (!m_deployProcess) + if (!m_d->deployProcess) return; - const QString errorMsg = m_deployProcess->connection()->errorString(); + const QString errorMsg = m_d->deployProcess->connection()->errorString(); cleanup(); emit error(tr("Connection failed: %1").arg(errorMsg)); } @@ -85,11 +97,11 @@ void SshKeyDeployer::handleKeyUploadFinished(int exitStatus) || exitStatus == SshRemoteProcess::KilledBySignal || exitStatus == SshRemoteProcess::ExitedNormally); - if (!m_deployProcess) + if (!m_d->deployProcess) return; - const int exitCode = m_deployProcess->process()->exitCode(); - const QString errorMsg = m_deployProcess->process()->errorString(); + const int exitCode = m_d->deployProcess->process()->exitCode(); + const QString errorMsg = m_d->deployProcess->process()->errorString(); cleanup(); if (exitStatus == SshRemoteProcess::ExitedNormally && exitCode == 0) emit finishedSuccessfully(); @@ -104,9 +116,9 @@ void SshKeyDeployer::stopDeployment() void SshKeyDeployer::cleanup() { - if (m_deployProcess) { - disconnect(m_deployProcess.data(), 0, this, 0); - m_deployProcess.clear(); + if (m_d->deployProcess) { + disconnect(m_d->deployProcess.data(), 0, this, 0); + m_d->deployProcess.clear(); } } diff --git a/src/plugins/remotelinux/sshkeydeployer.h b/src/plugins/remotelinux/sshkeydeployer.h index fad133fff4..97834b2cdf 100644 --- a/src/plugins/remotelinux/sshkeydeployer.h +++ b/src/plugins/remotelinux/sshkeydeployer.h @@ -34,18 +34,20 @@ #include "remotelinux_export.h" #include <QtCore/QObject> -#include <QtCore/QSharedPointer> namespace Utils { class SshConnectionParameters; -class SshRemoteProcessRunner; } namespace RemoteLinux { +namespace Internal { +class SshKeyDeployerPrivate; +} class REMOTELINUX_EXPORT SshKeyDeployer : public QObject { Q_OBJECT + Q_DISABLE_COPY(SshKeyDeployer) public: explicit SshKeyDeployer(QObject *parent = 0); ~SshKeyDeployer(); @@ -65,7 +67,7 @@ private slots: private: void cleanup(); - QSharedPointer<Utils::SshRemoteProcessRunner> m_deployProcess; + Internal::SshKeyDeployerPrivate * const m_d; }; } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp b/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp index b933f1b8ad..dee0db5c9d 100644 --- a/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp +++ b/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp @@ -41,13 +41,10 @@ using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -class UploadAndInstallTarPackageActionPrivate +class UploadAndInstallTarPackageServicePrivate { public: - UploadAndInstallTarPackageActionPrivate() : installer(new RemoteLinuxTarPackageInstaller) { } - ~UploadAndInstallTarPackageActionPrivate() { delete installer; } - - RemoteLinuxTarPackageInstaller * const installer; + RemoteLinuxTarPackageInstaller installer; }; } // namespace Internal @@ -55,7 +52,7 @@ using namespace Internal; UploadAndInstallTarPackageService::UploadAndInstallTarPackageService(QObject *parent) : AbstractUploadAndInstallPackageService(parent), - m_d(new UploadAndInstallTarPackageActionPrivate) + m_d(new UploadAndInstallTarPackageServicePrivate) { } @@ -66,7 +63,7 @@ UploadAndInstallTarPackageService::~UploadAndInstallTarPackageService() AbstractRemoteLinuxPackageInstaller *UploadAndInstallTarPackageService::packageInstaller() const { - return m_d->installer; + return &m_d->installer; } diff --git a/src/plugins/remotelinux/uploadandinstalltarpackagestep.h b/src/plugins/remotelinux/uploadandinstalltarpackagestep.h index 1da5bbcf16..41c6294434 100644 --- a/src/plugins/remotelinux/uploadandinstalltarpackagestep.h +++ b/src/plugins/remotelinux/uploadandinstalltarpackagestep.h @@ -39,7 +39,7 @@ namespace RemoteLinux { class AbstractRemoteLinuxPackageInstaller; namespace Internal { -class UploadAndInstallTarPackageActionPrivate; +class UploadAndInstallTarPackageServicePrivate; } class REMOTELINUX_EXPORT UploadAndInstallTarPackageService : public AbstractUploadAndInstallPackageService @@ -53,7 +53,7 @@ public: private: AbstractRemoteLinuxPackageInstaller *packageInstaller() const; - Internal::UploadAndInstallTarPackageActionPrivate *m_d; + Internal::UploadAndInstallTarPackageServicePrivate *m_d; }; |