RemoteLinux: Private implementation for all exported classes.

Change-Id: Id92eb156b027a4986788141845170105b3b1d9e5
Reviewed-on: http://codereview.qt.nokia.com/2507
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-08-02 12:20:16 +02:00
parent 7efb3c35a5
commit edc776c26c
54 changed files with 741 additions and 514 deletions

View File

@@ -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>

View File

@@ -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);

View File

@@ -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?");

View File

@@ -57,6 +57,7 @@ class AbstractRemoteLinuxDeployServicePrivate;
class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployService : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(AbstractRemoteLinuxDeployService)
public:
explicit AbstractRemoteLinuxDeployService(QObject *parent);
~AbstractRemoteLinuxDeployService();

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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()

View File

@@ -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

View File

@@ -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();

View File

@@ -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

View File

@@ -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

View File

@@ -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)
{
}
LinuxDeviceConfiguration::~LinuxDeviceConfiguration() {}
SshConnectionParameters sshParameters;
QString name;
QString osType;
LinuxDeviceConfiguration::DeviceType deviceType;
PortList freePorts;
bool isDefault;
LinuxDeviceConfiguration::Id internalId;
};
} // 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

View File

@@ -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;
};

View File

@@ -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 &params)
{
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()));
}

View File

@@ -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"));

View File

@@ -56,7 +56,7 @@ protected:
void doDeviceSetup()
{
if (deviceConfiguration()->type() == LinuxDeviceConfiguration::Physical) {
if (deviceConfiguration()->deviceType() == LinuxDeviceConfiguration::Hardware) {
handleDeviceSetupDone(true);
return;
}

View File

@@ -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;
}

View File

@@ -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>

View File

@@ -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);

View File

@@ -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))

View File

@@ -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)

View File

@@ -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>

View File

@@ -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>

View File

@@ -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)) {

View File

@@ -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);

View File

@@ -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

View File

@@ -33,6 +33,8 @@
#include "linuxdeviceconfiguration.h"
#include "sshkeydeployer.h"
#include <utils/ssh/sshconnection.h>
#include <QtCore/QTimer>
#include <QtGui/QFileDialog>

View File

@@ -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>

View File

@@ -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)
{
}

View File

@@ -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:

View File

@@ -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,30 +277,29 @@ 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)
m_d->state = Inactive;
runner()->stop();
}
@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -35,8 +35,6 @@
#include <projectexplorer/deployconfiguration.h>
#include <QtGui/QWidget>
namespace RemoteLinux {
class DeployableFilesPerProFile;
class RemoteLinuxDeployConfiguration;

View File

@@ -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())

View File

@@ -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);

View File

@@ -35,7 +35,6 @@
#include "remotelinux_export.h"
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include <QtCore/QString>

View File

@@ -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;

View File

@@ -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;

View File

@@ -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()));
handleCurrentDeviceConfigChanged();
connect(m_runConfiguration, SIGNAL(isEnabledChanged(bool)),
this, SLOT(runConfigurationEnabledChange(bool)));
runConfigurationEnabledChange(m_runConfiguration->isEnabled());
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());
}
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

View File

@@ -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

View File

@@ -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))
{
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -31,6 +31,7 @@
#include "remotelinuxusedportsgatherer.h"
#include "linuxdeviceconfiguration.h"
#include "portlist.h"
#include <utils/ssh/sshremoteprocessrunner.h>

View File

@@ -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();

View File

@@ -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();
}
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;
};