Coding style: Pure virtual functions, private implementation pointers.

Change-Id: I293f8dbd4e467e866bab381841659a07e32b9d90
Reviewed-on: http://codereview.qt-project.org/4948
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Christian Kandeler
2011-09-15 09:10:10 +02:00
committed by hjk
parent 63e8b9075b
commit 8801c76a8e
64 changed files with 932 additions and 932 deletions

View File

@@ -58,7 +58,7 @@ struct AbstractSftpOperation
AbstractSftpOperation(SftpJobId jobId); AbstractSftpOperation(SftpJobId jobId);
virtual ~AbstractSftpOperation(); virtual ~AbstractSftpOperation();
virtual Type type() const=0; virtual Type type() const = 0;
virtual SftpOutgoingPacket &initialPacket(SftpOutgoingPacket &packet)=0; virtual SftpOutgoingPacket &initialPacket(SftpOutgoingPacket &packet)=0;
const SftpJobId jobId; const SftpJobId jobId;

View File

@@ -75,15 +75,15 @@ private:
SshAbstractCryptoFacility(const SshAbstractCryptoFacility &); SshAbstractCryptoFacility(const SshAbstractCryptoFacility &);
SshAbstractCryptoFacility &operator=(const SshAbstractCryptoFacility &); SshAbstractCryptoFacility &operator=(const SshAbstractCryptoFacility &);
virtual QByteArray cryptAlgoName(const SshKeyExchange &kex) const=0; virtual QByteArray cryptAlgoName(const SshKeyExchange &kex) const = 0;
virtual QByteArray hMacAlgoName(const SshKeyExchange &kex) const=0; virtual QByteArray hMacAlgoName(const SshKeyExchange &kex) const = 0;
virtual Botan::BlockCipherMode *makeCipherMode(Botan::BlockCipher *cipher, virtual Botan::BlockCipherMode *makeCipherMode(Botan::BlockCipher *cipher,
Botan::BlockCipherModePaddingMethod *paddingMethod, Botan::BlockCipherModePaddingMethod *paddingMethod,
const Botan::InitializationVector &iv, const Botan::InitializationVector &iv,
const Botan::SymmetricKey &key)=0; const Botan::SymmetricKey &key)=0;
virtual char ivChar() const=0; virtual char ivChar() const = 0;
virtual char keyChar() const=0; virtual char keyChar() const = 0;
virtual char macChar() const=0; virtual char macChar() const = 0;
QByteArray generateHash(const SshKeyExchange &kex, char c, quint32 length); QByteArray generateHash(const SshKeyExchange &kex, char c, quint32 length);
void checkInvariant() const; void checkInvariant() const;

View File

@@ -120,8 +120,8 @@ public:
protected: protected:
AbstractSshPacket(); AbstractSshPacket();
virtual quint32 cipherBlockSize() const=0; virtual quint32 cipherBlockSize() const = 0;
virtual quint32 macLength() const=0; virtual quint32 macLength() const = 0;
virtual void calculateLength() const; virtual void calculateLength() const;
quint32 length() const; quint32 length() const;

View File

@@ -67,19 +67,19 @@ public:
A short, one-line description of the type of wizard that this A short, one-line description of the type of wizard that this
factory can create. factory can create.
*/ */
virtual QString displayName() const=0; virtual QString displayName() const = 0;
/*! /*!
A longer description explaining the exact purpose of the wizard A longer description explaining the exact purpose of the wizard
created by this factory. created by this factory.
*/ */
virtual QString description() const=0; virtual QString description() const = 0;
/*! /*!
Returns true iff the type of wizard that this factory can create Returns true iff the type of wizard that this factory can create
is available for the given project. is available for the given project.
*/ */
virtual bool canCreateWizard(const Project *project) const=0; virtual bool canCreateWizard(const Project *project) const = 0;
/*! /*!
Creates a wizard that can publish the given project. Creates a wizard that can publish the given project.
@@ -88,7 +88,7 @@ public:
\return The newly created publishing wizard \return The newly created publishing wizard
\sa canCreateWizard() \sa canCreateWizard()
*/ */
virtual QWizard *createWizard(const Project *project) const=0; virtual QWizard *createWizard(const Project *project) const = 0;
protected: protected:
IPublishingWizardFactory(QObject *parent = 0) : QObject(parent) {} IPublishingWizardFactory(QObject *parent = 0) : QObject(parent) {}

View File

@@ -48,7 +48,7 @@ public:
const QString &file); const QString &file);
virtual ~Exception(); virtual ~Exception();
virtual QString type() const=0; virtual QString type() const = 0;
virtual QString description() const; virtual QString description() const;
int line() const; int line() const;

View File

@@ -174,12 +174,12 @@ private:
QByteArray generateProFile(QString *errorMessage) const; QByteArray generateProFile(QString *errorMessage) const;
virtual QByteArray generateFileExtended(int fileType, virtual QByteArray generateFileExtended(int fileType,
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const=0; bool *versionAndCheckSum, QString *comment, QString *errorMessage) const = 0;
virtual QString pathExtended(int fileType) const=0; virtual QString pathExtended(int fileType) const = 0;
virtual QString originsRoot() const=0; virtual QString originsRoot() const = 0;
virtual QString mainWindowClassName() const=0; virtual QString mainWindowClassName() const = 0;
virtual int stubVersionMinor() const=0; virtual int stubVersionMinor() const = 0;
virtual bool adaptCurrentMainCppTemplateLine(QString &line) const=0; virtual bool adaptCurrentMainCppTemplateLine(QString &line) const = 0;
virtual void handleCurrentProFileTemplateLine(const QString &line, virtual void handleCurrentProFileTemplateLine(const QString &line,
QTextStream &proFileTemplate, QTextStream &proFile, QTextStream &proFileTemplate, QTextStream &proFile,
bool &commentOutNextLine) const = 0; bool &commentOutNextLine) const = 0;

View File

@@ -121,12 +121,12 @@ private:
virtual bool postGenerateFiles(const QWizard *w, virtual bool postGenerateFiles(const QWizard *w,
const Core::GeneratedFiles &l, QString *errorMessage); const Core::GeneratedFiles &l, QString *errorMessage);
virtual AbstractMobileApp *app() const=0; virtual AbstractMobileApp *app() const = 0;
virtual AbstractMobileAppWizardDialog *wizardDialog() const=0; virtual AbstractMobileAppWizardDialog *wizardDialog() const = 0;
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent) const=0; virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent) const = 0;
virtual void projectPathChanged(const QString &path) const=0; virtual void projectPathChanged(const QString &path) const = 0;
virtual void prepareGenerateFiles(const QWizard *wizard, virtual void prepareGenerateFiles(const QWizard *wizard,
QString *errorMessage) const=0; QString *errorMessage) const = 0;
}; };
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -71,7 +71,7 @@ private slots:
void handleBuildConfigurationChanged(); void handleBuildConfigurationChanged();
private: private:
virtual QString packageFileName() const=0; virtual QString packageFileName() const = 0;
void ctor(); void ctor();

View File

@@ -81,39 +81,39 @@ public:
using namespace Internal; using namespace Internal;
AbstractRemoteLinuxDeployService::AbstractRemoteLinuxDeployService(QObject *parent) AbstractRemoteLinuxDeployService::AbstractRemoteLinuxDeployService(QObject *parent)
: QObject(parent), m_d(new AbstractRemoteLinuxDeployServicePrivate) : QObject(parent), d(new AbstractRemoteLinuxDeployServicePrivate)
{ {
} }
AbstractRemoteLinuxDeployService::~AbstractRemoteLinuxDeployService() AbstractRemoteLinuxDeployService::~AbstractRemoteLinuxDeployService()
{ {
delete m_d; delete d;
} }
const Qt4BuildConfiguration *AbstractRemoteLinuxDeployService::qt4BuildConfiguration() const const Qt4BuildConfiguration *AbstractRemoteLinuxDeployService::qt4BuildConfiguration() const
{ {
return m_d->buildConfiguration; return d->buildConfiguration;
} }
LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxDeployService::deviceConfiguration() const LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxDeployService::deviceConfiguration() const
{ {
return m_d->deviceConfiguration; return d->deviceConfiguration;
} }
SshConnection::Ptr AbstractRemoteLinuxDeployService::connection() const SshConnection::Ptr AbstractRemoteLinuxDeployService::connection() const
{ {
return m_d->connection; return d->connection;
} }
void AbstractRemoteLinuxDeployService::saveDeploymentTimeStamp(const DeployableFile &deployableFile) void AbstractRemoteLinuxDeployService::saveDeploymentTimeStamp(const DeployableFile &deployableFile)
{ {
m_d->lastDeployed.insert(DeployablePerHost(deployableFile, d->lastDeployed.insert(DeployablePerHost(deployableFile,
deviceConfiguration()->sshParameters().host), QDateTime::currentDateTime()); deviceConfiguration()->sshParameters().host), QDateTime::currentDateTime());
} }
bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const
{ {
const QDateTime &lastDeployed = m_d->lastDeployed.value(DeployablePerHost(deployableFile, const QDateTime &lastDeployed = d->lastDeployed.value(DeployablePerHost(deployableFile,
deviceConfiguration()->sshParameters().host)); deviceConfiguration()->sshParameters().host));
return !lastDeployed.isValid() return !lastDeployed.isValid()
|| QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed; || QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed;
@@ -121,17 +121,17 @@ bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const Deplo
void AbstractRemoteLinuxDeployService::setDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &deviceConfiguration) void AbstractRemoteLinuxDeployService::setDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &deviceConfiguration)
{ {
m_d->deviceConfiguration = deviceConfiguration; d->deviceConfiguration = deviceConfiguration;
} }
void AbstractRemoteLinuxDeployService::setBuildConfiguration(Qt4BuildConfiguration *bc) void AbstractRemoteLinuxDeployService::setBuildConfiguration(Qt4BuildConfiguration *bc)
{ {
m_d->buildConfiguration = bc; d->buildConfiguration = bc;
} }
void AbstractRemoteLinuxDeployService::start() void AbstractRemoteLinuxDeployService::start()
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
QString errorMsg; QString errorMsg;
if (!isDeploymentPossible(&errorMsg)) { if (!isDeploymentPossible(&errorMsg)) {
@@ -146,27 +146,27 @@ void AbstractRemoteLinuxDeployService::start()
return; return;
} }
m_d->state = SettingUpDevice; d->state = SettingUpDevice;
doDeviceSetup(); doDeviceSetup();
} }
void AbstractRemoteLinuxDeployService::stop() void AbstractRemoteLinuxDeployService::stop()
{ {
if (m_d->stopRequested) if (d->stopRequested)
return; return;
switch (m_d->state) { switch (d->state) {
case Inactive: case Inactive:
break; break;
case SettingUpDevice: case SettingUpDevice:
m_d->stopRequested = true; d->stopRequested = true;
stopDeviceSetup(); stopDeviceSetup();
break; break;
case Connecting: case Connecting:
setFinished(); setFinished();
break; break;
case Deploying: case Deploying:
m_d->stopRequested = true; d->stopRequested = true;
stopDeployment(); stopDeployment();
break; break;
} }
@@ -190,7 +190,7 @@ QVariantMap AbstractRemoteLinuxDeployService::exportDeployTimes() const
QVariantList remotePathList; QVariantList remotePathList;
QVariantList timeList; QVariantList timeList;
typedef QHash<DeployablePerHost, QDateTime>::ConstIterator DepIt; typedef QHash<DeployablePerHost, QDateTime>::ConstIterator DepIt;
for (DepIt it = m_d->lastDeployed.begin(); it != m_d->lastDeployed.end(); ++it) { for (DepIt it = d->lastDeployed.begin(); it != d->lastDeployed.end(); ++it) {
fileList << it.key().first.localFilePath; fileList << it.key().first.localFilePath;
remotePathList << it.key().first.remoteDir; remotePathList << it.key().first.remoteDir;
hostList << it.key().second; hostList << it.key().second;
@@ -214,64 +214,64 @@ void AbstractRemoteLinuxDeployService::importDeployTimes(const QVariantMap &map)
= qMin(qMin(hostList.size(), fileList.size()), = qMin(qMin(hostList.size(), fileList.size()),
qMin(remotePathList.size(), timeList.size())); qMin(remotePathList.size(), timeList.size()));
for (int i = 0; i < elemCount; ++i) { for (int i = 0; i < elemCount; ++i) {
const DeployableFile d(fileList.at(i).toString(), remotePathList.at(i).toString()); const DeployableFile df(fileList.at(i).toString(), remotePathList.at(i).toString());
m_d->lastDeployed.insert(DeployablePerHost(d, hostList.at(i).toString()), d->lastDeployed.insert(DeployablePerHost(df, hostList.at(i).toString()),
timeList.at(i).toDateTime()); timeList.at(i).toDateTime());
} }
} }
void AbstractRemoteLinuxDeployService::handleDeviceSetupDone(bool success) void AbstractRemoteLinuxDeployService::handleDeviceSetupDone(bool success)
{ {
QTC_ASSERT(m_d->state == SettingUpDevice, return); QTC_ASSERT(d->state == SettingUpDevice, return);
if (!success || m_d->stopRequested) { if (!success || d->stopRequested) {
setFinished(); setFinished();
return; return;
} }
m_d->state = Connecting; d->state = Connecting;
m_d->connection = SshConnectionManager::instance().acquireConnection(m_d->deviceConfiguration->sshParameters()); d->connection = SshConnectionManager::instance().acquireConnection(d->deviceConfiguration->sshParameters());
connect(m_d->connection.data(), SIGNAL(error(Utils::SshError)), connect(d->connection.data(), SIGNAL(error(Utils::SshError)),
SLOT(handleConnectionFailure())); SLOT(handleConnectionFailure()));
if (m_d->connection->state() == SshConnection::Connected) { if (d->connection->state() == SshConnection::Connected) {
handleConnected(); handleConnected();
} else { } else {
connect(m_d->connection.data(), SIGNAL(connected()), SLOT(handleConnected())); connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
emit progressMessage(tr("Connecting to device...")); emit progressMessage(tr("Connecting to device..."));
if (m_d->connection->state() == SshConnection::Unconnected) if (d->connection->state() == SshConnection::Unconnected)
m_d->connection->connectToHost(); d->connection->connectToHost();
} }
} }
void AbstractRemoteLinuxDeployService::handleDeploymentDone() void AbstractRemoteLinuxDeployService::handleDeploymentDone()
{ {
QTC_ASSERT(m_d->state == Deploying, return); QTC_ASSERT(d->state == Deploying, return);
setFinished(); setFinished();
} }
void AbstractRemoteLinuxDeployService::handleConnected() void AbstractRemoteLinuxDeployService::handleConnected()
{ {
QTC_ASSERT(m_d->state == Connecting, return); QTC_ASSERT(d->state == Connecting, return);
if (m_d->stopRequested) { if (d->stopRequested) {
setFinished(); setFinished();
return; return;
} }
m_d->state = Deploying; d->state = Deploying;
doDeploy(); doDeploy();
} }
void AbstractRemoteLinuxDeployService::handleConnectionFailure() void AbstractRemoteLinuxDeployService::handleConnectionFailure()
{ {
switch (m_d->state) { switch (d->state) {
case Inactive: case Inactive:
case SettingUpDevice: case SettingUpDevice:
qWarning("%s: Unexpected state %d.", Q_FUNC_INFO, m_d->state); qWarning("%s: Unexpected state %d.", Q_FUNC_INFO, d->state);
break; break;
case Connecting: { case Connecting: {
QString errorMsg = tr("Could not connect to host: %1").arg(m_d->connection->errorString()); QString errorMsg = tr("Could not connect to host: %1").arg(d->connection->errorString());
if (deviceConfiguration()->deviceType() == LinuxDeviceConfiguration::Emulator) if (deviceConfiguration()->deviceType() == LinuxDeviceConfiguration::Emulator)
errorMsg += tr("\nDid the emulator fail to start?"); errorMsg += tr("\nDid the emulator fail to start?");
else else
@@ -281,20 +281,20 @@ void AbstractRemoteLinuxDeployService::handleConnectionFailure()
break; break;
} }
case Deploying: case Deploying:
emit errorMessage(tr("Connection error: %1").arg(m_d->connection->errorString())); emit errorMessage(tr("Connection error: %1").arg(d->connection->errorString()));
stopDeployment(); stopDeployment();
} }
} }
void AbstractRemoteLinuxDeployService::setFinished() void AbstractRemoteLinuxDeployService::setFinished()
{ {
m_d->state = Inactive; d->state = Inactive;
if (m_d->connection) { if (d->connection) {
disconnect(m_d->connection.data(), 0, this, 0); disconnect(d->connection.data(), 0, this, 0);
SshConnectionManager::instance().releaseConnection(m_d->connection); SshConnectionManager::instance().releaseConnection(d->connection);
m_d->connection = SshConnection::Ptr(); d->connection = SshConnection::Ptr();
} }
m_d->stopRequested = false; d->stopRequested = false;
emit finished(); emit finished();
} }

View File

@@ -96,7 +96,7 @@ private slots:
private: private:
Q_SIGNAL void finished(); Q_SIGNAL void finished();
virtual bool isDeploymentNecessary() const=0; virtual bool isDeploymentNecessary() const = 0;
// Should do things needed *before* connecting. Call handleDeviceSetupDone() afterwards. // Should do things needed *before* connecting. Call handleDeviceSetupDone() afterwards.
virtual void doDeviceSetup()=0; virtual void doDeviceSetup()=0;
@@ -107,7 +107,7 @@ private:
void setFinished(); void setFinished();
Internal::AbstractRemoteLinuxDeployServicePrivate * const m_d; Internal::AbstractRemoteLinuxDeployServicePrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -61,7 +61,7 @@ public:
ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
RemoteLinuxDeployConfiguration *deployConfiguration() const; RemoteLinuxDeployConfiguration *deployConfiguration() const;
virtual AbstractRemoteLinuxDeployService *deployService() const=0; virtual AbstractRemoteLinuxDeployService *deployService() const = 0;
virtual bool isDeploymentPossible(QString *whyNot = 0) const; virtual bool isDeploymentPossible(QString *whyNot = 0) const;
protected: protected:

View File

@@ -68,23 +68,23 @@ using namespace Internal;
AbstractUploadAndInstallPackageService::AbstractUploadAndInstallPackageService(QObject *parent) AbstractUploadAndInstallPackageService::AbstractUploadAndInstallPackageService(QObject *parent)
: AbstractRemoteLinuxDeployService(parent), : AbstractRemoteLinuxDeployService(parent),
m_d(new AbstractUploadAndInstallPackageServicePrivate) d(new AbstractUploadAndInstallPackageServicePrivate)
{ {
} }
AbstractUploadAndInstallPackageService::~AbstractUploadAndInstallPackageService() AbstractUploadAndInstallPackageService::~AbstractUploadAndInstallPackageService()
{ {
delete m_d; delete d;
} }
void AbstractUploadAndInstallPackageService::setPackageFilePath(const QString &filePath) void AbstractUploadAndInstallPackageService::setPackageFilePath(const QString &filePath)
{ {
m_d->packageFilePath = filePath; d->packageFilePath = filePath;
} }
QString AbstractUploadAndInstallPackageService::packageFilePath() const QString AbstractUploadAndInstallPackageService::packageFilePath() const
{ {
return m_d->packageFilePath; return d->packageFilePath;
} }
QString AbstractUploadAndInstallPackageService::uploadDir() const QString AbstractUploadAndInstallPackageService::uploadDir() const
@@ -99,38 +99,38 @@ bool AbstractUploadAndInstallPackageService::isDeploymentNecessary() const
void AbstractUploadAndInstallPackageService::doDeviceSetup() void AbstractUploadAndInstallPackageService::doDeviceSetup()
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
handleDeviceSetupDone(true); handleDeviceSetupDone(true);
} }
void AbstractUploadAndInstallPackageService::stopDeviceSetup() void AbstractUploadAndInstallPackageService::stopDeviceSetup()
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
handleDeviceSetupDone(false); handleDeviceSetupDone(false);
} }
void AbstractUploadAndInstallPackageService::doDeploy() void AbstractUploadAndInstallPackageService::doDeploy()
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
m_d->state = Uploading; d->state = Uploading;
const QString fileName = QFileInfo(packageFilePath()).fileName(); const QString fileName = QFileInfo(packageFilePath()).fileName();
const QString remoteFilePath = uploadDir() + QLatin1Char('/') + fileName; const QString remoteFilePath = uploadDir() + QLatin1Char('/') + fileName;
connect(m_d->uploader, SIGNAL(progress(QString)), SIGNAL(progressMessage(QString))); connect(d->uploader, SIGNAL(progress(QString)), SIGNAL(progressMessage(QString)));
connect(m_d->uploader, SIGNAL(uploadFinished(QString)), SLOT(handleUploadFinished(QString))); connect(d->uploader, SIGNAL(uploadFinished(QString)), SLOT(handleUploadFinished(QString)));
m_d->uploader->uploadPackage(connection(), packageFilePath(), remoteFilePath); d->uploader->uploadPackage(connection(), packageFilePath(), remoteFilePath);
} }
void AbstractUploadAndInstallPackageService::stopDeployment() void AbstractUploadAndInstallPackageService::stopDeployment()
{ {
switch (m_d->state) { switch (d->state) {
case Inactive: case Inactive:
qWarning("%s: Unexpected state 'Inactive'.", Q_FUNC_INFO); qWarning("%s: Unexpected state 'Inactive'.", Q_FUNC_INFO);
break; break;
case Uploading: case Uploading:
m_d->uploader->cancelUpload(); d->uploader->cancelUpload();
setFinished(); setFinished();
break; break;
case Installing: case Installing:
@@ -142,7 +142,7 @@ void AbstractUploadAndInstallPackageService::stopDeployment()
void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString &errorMsg) void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString &errorMsg)
{ {
QTC_ASSERT(m_d->state == Uploading, return); QTC_ASSERT(d->state == Uploading, return);
if (!errorMsg.isEmpty()) { if (!errorMsg.isEmpty()) {
emit errorMessage(errorMsg); emit errorMessage(errorMsg);
@@ -153,7 +153,7 @@ void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString
emit progressMessage(tr("Successfully uploaded package file.")); emit progressMessage(tr("Successfully uploaded package file."));
const QString remoteFilePath = uploadDir() + QLatin1Char('/') const QString remoteFilePath = uploadDir() + QLatin1Char('/')
+ QFileInfo(packageFilePath()).fileName(); + QFileInfo(packageFilePath()).fileName();
m_d->state = Installing; d->state = Installing;
emit progressMessage(tr("Installing package to device...")); emit progressMessage(tr("Installing package to device..."));
connect(packageInstaller(), SIGNAL(stdoutData(QString)), SIGNAL(stdOutData(QString))); connect(packageInstaller(), SIGNAL(stdoutData(QString)), SIGNAL(stdOutData(QString)));
connect(packageInstaller(), SIGNAL(stderrData(QString)), SIGNAL(stdErrData(QString))); connect(packageInstaller(), SIGNAL(stderrData(QString)), SIGNAL(stdErrData(QString)));
@@ -164,7 +164,7 @@ void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString
void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QString &errorMsg) void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QString &errorMsg)
{ {
QTC_ASSERT(m_d->state == Installing, return); QTC_ASSERT(d->state == Installing, return);
if (errorMsg.isEmpty()) { if (errorMsg.isEmpty()) {
saveDeploymentTimeStamp(DeployableFile(packageFilePath(), QString())); saveDeploymentTimeStamp(DeployableFile(packageFilePath(), QString()));
@@ -177,8 +177,8 @@ void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QS
void AbstractUploadAndInstallPackageService::setFinished() void AbstractUploadAndInstallPackageService::setFinished()
{ {
m_d->state = Inactive; d->state = Inactive;
disconnect(m_d->uploader, 0, this, 0); disconnect(d->uploader, 0, this, 0);
disconnect(packageInstaller(), 0, this, 0); disconnect(packageInstaller(), 0, this, 0);
handleDeploymentDone(); handleDeploymentDone();
} }

View File

@@ -60,7 +60,7 @@ private slots:
void handleInstallationFinished(const QString &errorMsg); void handleInstallationFinished(const QString &errorMsg);
private: private:
virtual AbstractRemoteLinuxPackageInstaller *packageInstaller() const=0; virtual AbstractRemoteLinuxPackageInstaller *packageInstaller() const = 0;
virtual QString uploadDir() const; // Defaults to remote user's home directory. virtual QString uploadDir() const; // Defaults to remote user's home directory.
bool isDeploymentNecessary() const; bool isDeploymentNecessary() const;
@@ -71,7 +71,7 @@ private:
void setFinished(); void setFinished();
Internal::AbstractUploadAndInstallPackageServicePrivate * const m_d; Internal::AbstractUploadAndInstallPackageServicePrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -75,37 +75,37 @@ using namespace Internal;
DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode, DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode,
QObject *parent) QObject *parent)
: QAbstractTableModel(parent), m_d(new DeployableFilesPerProFilePrivate(proFileNode)) : QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode))
{ {
if (m_d->projectType == ApplicationTemplate) { if (d->projectType == ApplicationTemplate) {
m_d->deployables.prepend(DeployableFile(localExecutableFilePath(), d->deployables.prepend(DeployableFile(localExecutableFilePath(),
m_d->installsList.targetPath)); d->installsList.targetPath));
} else if (m_d->projectType == LibraryTemplate) { } else if (d->projectType == LibraryTemplate) {
foreach (const QString &filePath, localLibraryFilePaths()) { foreach (const QString &filePath, localLibraryFilePaths()) {
m_d->deployables.prepend(DeployableFile(filePath, d->deployables.prepend(DeployableFile(filePath,
m_d->installsList.targetPath)); d->installsList.targetPath));
} }
} }
foreach (const InstallsItem &elem, m_d->installsList.items) { foreach (const InstallsItem &elem, d->installsList.items) {
foreach (const QString &file, elem.files) foreach (const QString &file, elem.files)
m_d->deployables << DeployableFile(file, elem.path); d->deployables << DeployableFile(file, elem.path);
} }
} }
DeployableFilesPerProFile::~DeployableFilesPerProFile() DeployableFilesPerProFile::~DeployableFilesPerProFile()
{ {
delete m_d; delete d;
} }
DeployableFile DeployableFilesPerProFile::deployableAt(int row) const DeployableFile DeployableFilesPerProFile::deployableAt(int row) const
{ {
Q_ASSERT(row >= 0 && row < rowCount()); Q_ASSERT(row >= 0 && row < rowCount());
return m_d->deployables.at(row); return d->deployables.at(row);
} }
int DeployableFilesPerProFile::rowCount(const QModelIndex &parent) const int DeployableFilesPerProFile::rowCount(const QModelIndex &parent) const
{ {
return parent.isValid() ? 0 : m_d->deployables.count(); return parent.isValid() ? 0 : d->deployables.count();
} }
int DeployableFilesPerProFile::columnCount(const QModelIndex &parent) const int DeployableFilesPerProFile::columnCount(const QModelIndex &parent) const
@@ -118,7 +118,7 @@ QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) con
if (!index.isValid() || index.row() >= rowCount()) if (!index.isValid() || index.row() >= rowCount())
return QVariant(); return QVariant();
if (m_d->projectType != AuxTemplate && !hasTargetPath() && index.row() == 0 if (d->projectType != AuxTemplate && !hasTargetPath() && index.row() == 0
&& index.column() == 1) { && index.column() == 1) {
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
return tr("<no target path set>"); return tr("<no target path set>");
@@ -147,34 +147,34 @@ QVariant DeployableFilesPerProFile::headerData(int section,
QString DeployableFilesPerProFile::localExecutableFilePath() const QString DeployableFilesPerProFile::localExecutableFilePath() const
{ {
if (!m_d->targetInfo.valid || m_d->projectType != ApplicationTemplate) if (!d->targetInfo.valid || d->projectType != ApplicationTemplate)
return QString(); return QString();
return QDir::cleanPath(m_d->targetInfo.workingDir + '/' + m_d->targetInfo.target); return QDir::cleanPath(d->targetInfo.workingDir + '/' + d->targetInfo.target);
} }
QStringList DeployableFilesPerProFile::localLibraryFilePaths() const QStringList DeployableFilesPerProFile::localLibraryFilePaths() const
{ {
if (!m_d->targetInfo.valid || m_d->projectType != LibraryTemplate) if (!d->targetInfo.valid || d->projectType != LibraryTemplate)
return QStringList(); return QStringList();
QString basePath = m_d->targetInfo.workingDir + QLatin1String("/lib"); QString basePath = d->targetInfo.workingDir + QLatin1String("/lib");
const bool isStatic = m_d->config.contains(QLatin1String("static")) const bool isStatic = d->config.contains(QLatin1String("static"))
|| m_d->config.contains(QLatin1String("staticlib")); || d->config.contains(QLatin1String("staticlib"));
basePath += m_d->targetInfo.target + QLatin1String(isStatic ? ".a" : ".so"); basePath += d->targetInfo.target + QLatin1String(isStatic ? ".a" : ".so");
basePath = QDir::cleanPath(basePath); basePath = QDir::cleanPath(basePath);
const QChar dot(QLatin1Char('.')); const QChar dot(QLatin1Char('.'));
const QString filePathMajor = basePath + dot const QString filePathMajor = basePath + dot
+ QString::number(m_d->projectVersion.major); + QString::number(d->projectVersion.major);
const QString filePathMinor = filePathMajor + dot const QString filePathMinor = filePathMajor + dot
+ QString::number(m_d->projectVersion.minor); + QString::number(d->projectVersion.minor);
const QString filePathPatch = filePathMinor + dot const QString filePathPatch = filePathMinor + dot
+ QString::number(m_d->projectVersion.patch); + QString::number(d->projectVersion.patch);
return QStringList() << filePathPatch << filePathMinor << filePathMajor return QStringList() << filePathPatch << filePathMinor << filePathMajor
<< basePath; << basePath;
} }
QString DeployableFilesPerProFile::remoteExecutableFilePath() const QString DeployableFilesPerProFile::remoteExecutableFilePath() const
{ {
return hasTargetPath() && m_d->projectType == ApplicationTemplate return hasTargetPath() && d->projectType == ApplicationTemplate
? deployableAt(0).remoteDir + QLatin1Char('/') ? deployableAt(0).remoteDir + QLatin1Char('/')
+ QFileInfo(localExecutableFilePath()).fileName() + QFileInfo(localExecutableFilePath()).fileName()
: QString(); : QString();
@@ -182,18 +182,18 @@ QString DeployableFilesPerProFile::remoteExecutableFilePath() const
QString DeployableFilesPerProFile::projectDir() const QString DeployableFilesPerProFile::projectDir() const
{ {
return QFileInfo(m_d->proFilePath).dir().path(); return QFileInfo(d->proFilePath).dir().path();
} }
bool DeployableFilesPerProFile::hasTargetPath() const bool DeployableFilesPerProFile::hasTargetPath() const
{ {
return !m_d->installsList.targetPath.isEmpty(); return !d->installsList.targetPath.isEmpty();
} }
bool DeployableFilesPerProFile::isModified() const { return m_d->modified; } bool DeployableFilesPerProFile::isModified() const { return d->modified; }
void DeployableFilesPerProFile::setUnModified() { m_d->modified = false; } void DeployableFilesPerProFile::setUnModified() { d->modified = false; }
QString DeployableFilesPerProFile::projectName() const { return m_d->projectName; } QString DeployableFilesPerProFile::projectName() const { return d->projectName; }
QString DeployableFilesPerProFile::proFilePath() const { return m_d->proFilePath; } QString DeployableFilesPerProFile::proFilePath() const { return d->proFilePath; }
Qt4ProjectType DeployableFilesPerProFile::projectType() const { return m_d->projectType; } Qt4ProjectType DeployableFilesPerProFile::projectType() const { return d->projectType; }
QString DeployableFilesPerProFile::applicationName() const { return m_d->targetInfo.target; } QString DeployableFilesPerProFile::applicationName() const { return d->targetInfo.target; }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -80,7 +80,7 @@ private:
QStringList localLibraryFilePaths() const; QStringList localLibraryFilePaths() const;
Internal::DeployableFilesPerProFilePrivate * const m_d; Internal::DeployableFilesPerProFilePrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -60,55 +60,55 @@ public:
using namespace Internal; using namespace Internal;
DeploymentInfo::DeploymentInfo(const Qt4BaseTarget *target) : m_d(new DeploymentInfoPrivate(target)) DeploymentInfo::DeploymentInfo(const Qt4BaseTarget *target) : d(new DeploymentInfoPrivate(target))
{ {
Qt4Project * const pro = m_d->target->qt4Project(); Qt4Project * const pro = d->target->qt4Project();
connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
m_d->updateTimer.setInterval(1500); d->updateTimer.setInterval(1500);
m_d->updateTimer.setSingleShot(true); d->updateTimer.setSingleShot(true);
connect(&m_d->updateTimer, SIGNAL(timeout()), this, SLOT(createModels())); connect(&d->updateTimer, SIGNAL(timeout()), this, SLOT(createModels()));
createModels(); createModels();
} }
DeploymentInfo::~DeploymentInfo() DeploymentInfo::~DeploymentInfo()
{ {
delete m_d; delete d;
} }
void DeploymentInfo::startTimer(Qt4ProjectManager::Qt4ProFileNode*, bool success, bool parseInProgress) void DeploymentInfo::startTimer(Qt4ProjectManager::Qt4ProFileNode*, bool success, bool parseInProgress)
{ {
Q_UNUSED(success) Q_UNUSED(success)
if (!parseInProgress) if (!parseInProgress)
m_d->updateTimer.start(); d->updateTimer.start();
} }
void DeploymentInfo::createModels() void DeploymentInfo::createModels()
{ {
if (m_d->target->project()->activeTarget() != m_d->target) if (d->target->project()->activeTarget() != d->target)
return; return;
const Qt4BuildConfiguration *bc = m_d->target->activeQt4BuildConfiguration(); const Qt4BuildConfiguration *bc = d->target->activeQt4BuildConfiguration();
if (!bc || !bc->qtVersion() || !bc->qtVersion()->isValid()) { if (!bc || !bc->qtVersion() || !bc->qtVersion()->isValid()) {
beginResetModel(); beginResetModel();
qDeleteAll(m_d->listModels); qDeleteAll(d->listModels);
m_d->listModels.clear(); d->listModels.clear();
endResetModel(); endResetModel();
return; return;
} }
const Qt4ProFileNode *const rootNode const Qt4ProFileNode *const rootNode
= m_d->target->qt4Project()->rootQt4ProjectNode(); = d->target->qt4Project()->rootQt4ProjectNode();
if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard. if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard.
return; return;
m_d->updateTimer.stop(); d->updateTimer.stop();
disconnect(m_d->target->qt4Project(), disconnect(d->target->qt4Project(),
SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
beginResetModel(); beginResetModel();
qDeleteAll(m_d->listModels); qDeleteAll(d->listModels);
m_d->listModels.clear(); d->listModels.clear();
createModels(rootNode); createModels(rootNode);
endResetModel(); endResetModel();
connect(m_d->target->qt4Project(), connect(d->target->qt4Project(),
SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
} }
@@ -119,7 +119,7 @@ void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode)
case ApplicationTemplate: case ApplicationTemplate:
case LibraryTemplate: case LibraryTemplate:
case AuxTemplate: case AuxTemplate:
m_d->listModels << new DeployableFilesPerProFile(proFileNode, this); d->listModels << new DeployableFilesPerProFile(proFileNode, this);
break; break;
case SubDirsTemplate: { case SubDirsTemplate: {
const QList<Qt4PriFileNode *> &subProjects = proFileNode->subProjectNodesExact(); const QList<Qt4PriFileNode *> &subProjects = proFileNode->subProjectNodesExact();
@@ -137,13 +137,13 @@ void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode)
void DeploymentInfo::setUnmodified() void DeploymentInfo::setUnmodified()
{ {
foreach (DeployableFilesPerProFile * const model, m_d->listModels) foreach (DeployableFilesPerProFile * const model, d->listModels)
model->setUnModified(); model->setUnModified();
} }
bool DeploymentInfo::isModified() const bool DeploymentInfo::isModified() const
{ {
foreach (const DeployableFilesPerProFile * const model, m_d->listModels) { foreach (const DeployableFilesPerProFile * const model, d->listModels) {
if (model->isModified()) if (model->isModified())
return true; return true;
} }
@@ -153,14 +153,14 @@ bool DeploymentInfo::isModified() const
int DeploymentInfo::deployableCount() const int DeploymentInfo::deployableCount() const
{ {
int count = 0; int count = 0;
foreach (const DeployableFilesPerProFile * const model, m_d->listModels) foreach (const DeployableFilesPerProFile * const model, d->listModels)
count += model->rowCount(); count += model->rowCount();
return count; return count;
} }
DeployableFile DeploymentInfo::deployableAt(int i) const DeployableFile DeploymentInfo::deployableAt(int i) const
{ {
foreach (const DeployableFilesPerProFile * const model, m_d->listModels) { foreach (const DeployableFilesPerProFile * const model, d->listModels) {
Q_ASSERT(i >= 0); Q_ASSERT(i >= 0);
if (i < model->rowCount()) if (i < model->rowCount())
return model->deployableAt(i); return model->deployableAt(i);
@@ -173,7 +173,7 @@ DeployableFile DeploymentInfo::deployableAt(int i) const
QString DeploymentInfo::remoteExecutableFilePath(const QString &localExecutableFilePath) const QString DeploymentInfo::remoteExecutableFilePath(const QString &localExecutableFilePath) const
{ {
foreach (const DeployableFilesPerProFile * const model, m_d->listModels) { foreach (const DeployableFilesPerProFile * const model, d->listModels) {
if (model->localExecutableFilePath() == localExecutableFilePath) if (model->localExecutableFilePath() == localExecutableFilePath)
return model->remoteExecutableFilePath(); return model->remoteExecutableFilePath();
} }
@@ -190,7 +190,7 @@ QVariant DeploymentInfo::data(const QModelIndex &index, int role) const
if (!index.isValid() || index.row() < 0 || index.row() >= modelCount() if (!index.isValid() || index.row() < 0 || index.row() >= modelCount()
|| index.column() != 0) || index.column() != 0)
return QVariant(); return QVariant();
const DeployableFilesPerProFile * const model = m_d->listModels.at(index.row()); const DeployableFilesPerProFile * const model = d->listModels.at(index.row());
if (role == Qt::ForegroundRole && model->projectType() != AuxTemplate if (role == Qt::ForegroundRole && model->projectType() != AuxTemplate
&& !model->hasTargetPath()) { && !model->hasTargetPath()) {
QBrush brush; QBrush brush;
@@ -202,7 +202,7 @@ QVariant DeploymentInfo::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
} }
int DeploymentInfo::modelCount() const { return m_d->listModels.count(); } int DeploymentInfo::modelCount() const { return d->listModels.count(); }
DeployableFilesPerProFile *DeploymentInfo::modelAt(int i) const { return m_d->listModels.at(i); } DeployableFilesPerProFile *DeploymentInfo::modelAt(int i) const { return d->listModels.at(i); }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -74,7 +74,7 @@ private:
Q_SLOT void createModels(); Q_SLOT void createModels();
void createModels(const Qt4ProjectManager::Qt4ProFileNode *proFileNode); void createModels(const Qt4ProjectManager::Qt4ProFileNode *proFileNode);
Internal::DeploymentInfoPrivate * const m_d; Internal::DeploymentInfoPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -80,14 +80,14 @@ DeploymentSettingsAssistant::DeploymentSettingsAssistant(const QString &qmakeSco
const QString &installPrefix, const QSharedPointer<DeploymentInfo> &deploymentInfo, const QString &installPrefix, const QSharedPointer<DeploymentInfo> &deploymentInfo,
QObject *parent) QObject *parent)
: QObject(parent), : QObject(parent),
m_d(new DeploymentSettingsAssistantInternal(qmakeScope, installPrefix, deploymentInfo)) d(new DeploymentSettingsAssistantInternal(qmakeScope, installPrefix, deploymentInfo))
{ {
connect(m_d->deploymentInfo.data(), SIGNAL(modelReset()), SLOT(handleDeploymentInfoUpdated())); connect(d->deploymentInfo.data(), SIGNAL(modelReset()), SLOT(handleDeploymentInfoUpdated()));
} }
DeploymentSettingsAssistant::~DeploymentSettingsAssistant() DeploymentSettingsAssistant::~DeploymentSettingsAssistant()
{ {
delete m_d; delete d;
} }
bool DeploymentSettingsAssistant::addDeployableToProFile(const DeployableFilesPerProFile *proFileInfo, bool DeploymentSettingsAssistant::addDeployableToProFile(const DeployableFilesPerProFile *proFileInfo,
@@ -106,7 +106,7 @@ bool DeploymentSettingsAssistant::addLinesToProFile(const DeployableFilesPerProF
Core::FileChangeBlocker update(proFileInfo->proFilePath()); Core::FileChangeBlocker update(proFileInfo->proFilePath());
const QString separator = QLatin1String("\n "); const QString separator = QLatin1String("\n ");
const QString proFileString = QLatin1Char('\n') + m_d->qmakeScope + QLatin1String(" {") const QString proFileString = QLatin1Char('\n') + d->qmakeScope + QLatin1String(" {")
+ separator + lines.join(separator) + QLatin1String("\n}\n"); + separator + lines.join(separator) + QLatin1String("\n}\n");
Utils::FileSaver saver(proFileInfo->proFilePath(), QIODevice::Append); Utils::FileSaver saver(proFileInfo->proFilePath(), QIODevice::Append);
saver.write(proFileString.toLocal8Bit()); saver.write(proFileString.toLocal8Bit());
@@ -117,12 +117,12 @@ void DeploymentSettingsAssistant::handleDeploymentInfoUpdated()
{ {
QList<DeployableFilesPerProFile *> proFilesToAskAbout; QList<DeployableFilesPerProFile *> proFilesToAskAbout;
QList<DeployableFilesPerProFile *> proFilesToUpdate; QList<DeployableFilesPerProFile *> proFilesToUpdate;
for (int i = 0; i < m_d->deploymentInfo->modelCount(); ++i) { for (int i = 0; i < d->deploymentInfo->modelCount(); ++i) {
DeployableFilesPerProFile * const proFileInfo = m_d->deploymentInfo->modelAt(i); DeployableFilesPerProFile * const proFileInfo = d->deploymentInfo->modelAt(i);
if (proFileInfo->projectType() != AuxTemplate && !proFileInfo->hasTargetPath()) { if (proFileInfo->projectType() != AuxTemplate && !proFileInfo->hasTargetPath()) {
const UpdateSettingsMap::ConstIterator it const UpdateSettingsMap::ConstIterator it
= m_d->updateSettings.find(proFileInfo->proFilePath()); = d->updateSettings.find(proFileInfo->proFilePath());
if (it == m_d->updateSettings.constEnd()) if (it == d->updateSettings.constEnd())
proFilesToAskAbout << proFileInfo; proFilesToAskAbout << proFileInfo;
else if (it.value() == UpdateProFile) else if (it.value() == UpdateProFile)
proFilesToUpdate << proFileInfo; proFilesToUpdate << proFileInfo;
@@ -136,7 +136,7 @@ void DeploymentSettingsAssistant::handleDeploymentInfoUpdated()
foreach (const ProFilesUpdateDialog::UpdateSetting &setting, settings) { foreach (const ProFilesUpdateDialog::UpdateSetting &setting, settings) {
const ProFileUpdateSetting updateSetting = setting.second const ProFileUpdateSetting updateSetting = setting.second
? UpdateProFile : DontUpdateProFile; ? UpdateProFile : DontUpdateProFile;
m_d->updateSettings.insert(setting.first->proFilePath(), updateSetting); d->updateSettings.insert(setting.first->proFilePath(), updateSetting);
if (updateSetting == UpdateProFile) if (updateSetting == UpdateProFile)
proFilesToUpdate << setting.first; proFilesToUpdate << setting.first;
} }
@@ -145,7 +145,7 @@ void DeploymentSettingsAssistant::handleDeploymentInfoUpdated()
foreach (const DeployableFilesPerProFile * const proFileInfo, proFilesToUpdate) { foreach (const DeployableFilesPerProFile * const proFileInfo, proFilesToUpdate) {
const QString remoteDirSuffix = QLatin1String(proFileInfo->projectType() == LibraryTemplate const QString remoteDirSuffix = QLatin1String(proFileInfo->projectType() == LibraryTemplate
? "/lib" : "/bin"); ? "/lib" : "/bin");
const QString remoteDir = QLatin1String("target.path = ") + m_d->installPrefix const QString remoteDir = QLatin1String("target.path = ") + d->installPrefix
+ QLatin1Char('/') + proFileInfo->projectName() + remoteDirSuffix; + QLatin1Char('/') + proFileInfo->projectName() + remoteDirSuffix;
const QStringList deployInfo = QStringList() << remoteDir const QStringList deployInfo = QStringList() << remoteDir
<< QLatin1String("INSTALLS += target"); << QLatin1String("INSTALLS += target");

View File

@@ -64,7 +64,7 @@ private slots:
private: private:
bool addLinesToProFile(const DeployableFilesPerProFile *proFileInfo, const QStringList &lines); bool addLinesToProFile(const DeployableFilesPerProFile *proFileInfo, const QStringList &lines);
Internal::DeploymentSettingsAssistantInternal * const m_d; Internal::DeploymentSettingsAssistantInternal * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -72,74 +72,74 @@ public:
using namespace Internal; using namespace Internal;
GenericDirectUploadService::GenericDirectUploadService(QObject *parent) GenericDirectUploadService::GenericDirectUploadService(QObject *parent)
: AbstractRemoteLinuxDeployService(parent), m_d(new GenericDirectUploadServicePrivate) : AbstractRemoteLinuxDeployService(parent), d(new GenericDirectUploadServicePrivate)
{ {
} }
void GenericDirectUploadService::setDeployableFiles(const QList<DeployableFile> &deployableFiles) void GenericDirectUploadService::setDeployableFiles(const QList<DeployableFile> &deployableFiles)
{ {
m_d->deployableFiles = deployableFiles; d->deployableFiles = deployableFiles;
} }
void GenericDirectUploadService::setIncrementalDeployment(bool incremental) void GenericDirectUploadService::setIncrementalDeployment(bool incremental)
{ {
m_d->incremental = incremental; d->incremental = incremental;
} }
bool GenericDirectUploadService::isDeploymentNecessary() const bool GenericDirectUploadService::isDeploymentNecessary() const
{ {
m_d->filesToUpload.clear(); d->filesToUpload.clear();
for (int i = 0; i < m_d->deployableFiles.count(); ++i) for (int i = 0; i < d->deployableFiles.count(); ++i)
checkDeploymentNeeded(m_d->deployableFiles.at(i)); checkDeploymentNeeded(d->deployableFiles.at(i));
return !m_d->filesToUpload.isEmpty(); return !d->filesToUpload.isEmpty();
} }
void GenericDirectUploadService::doDeviceSetup() void GenericDirectUploadService::doDeviceSetup()
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
handleDeviceSetupDone(true); handleDeviceSetupDone(true);
} }
void GenericDirectUploadService::stopDeviceSetup() void GenericDirectUploadService::stopDeviceSetup()
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
handleDeviceSetupDone(false); handleDeviceSetupDone(false);
} }
void GenericDirectUploadService::doDeploy() void GenericDirectUploadService::doDeploy()
{ {
QTC_ASSERT(m_d->state == Inactive, setFinished(); return); QTC_ASSERT(d->state == Inactive, setFinished(); return);
m_d->uploader = connection()->createSftpChannel(); d->uploader = connection()->createSftpChannel();
connect(m_d->uploader.data(), SIGNAL(initialized()), SLOT(handleSftpInitialized())); connect(d->uploader.data(), SIGNAL(initialized()), SLOT(handleSftpInitialized()));
connect(m_d->uploader.data(), SIGNAL(initializationFailed(QString)), connect(d->uploader.data(), SIGNAL(initializationFailed(QString)),
SLOT(handleSftpInitializationFailed(QString))); SLOT(handleSftpInitializationFailed(QString)));
m_d->uploader->initialize(); d->uploader->initialize();
m_d->state = InitializingSftp; d->state = InitializingSftp;
} }
void GenericDirectUploadService::handleSftpInitialized() void GenericDirectUploadService::handleSftpInitialized()
{ {
QTC_ASSERT(m_d->state == InitializingSftp, setFinished(); return); QTC_ASSERT(d->state == InitializingSftp, setFinished(); return);
if (m_d->stopRequested) { if (d->stopRequested) {
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
return; return;
} }
Q_ASSERT(!m_d->filesToUpload.isEmpty()); Q_ASSERT(!d->filesToUpload.isEmpty());
connect(m_d->uploader.data(), SIGNAL(finished(Utils::SftpJobId, QString)), connect(d->uploader.data(), SIGNAL(finished(Utils::SftpJobId, QString)),
SLOT(handleUploadFinished(Utils::SftpJobId,QString))); SLOT(handleUploadFinished(Utils::SftpJobId,QString)));
m_d->state = Uploading; d->state = Uploading;
uploadNextFile(); uploadNextFile();
} }
void GenericDirectUploadService::handleSftpInitializationFailed(const QString &message) void GenericDirectUploadService::handleSftpInitializationFailed(const QString &message)
{ {
QTC_ASSERT(m_d->state == InitializingSftp, setFinished(); return); QTC_ASSERT(d->state == InitializingSftp, setFinished(); return);
emit errorMessage(tr("SFTP initialization failed: %1").arg(message)); emit errorMessage(tr("SFTP initialization failed: %1").arg(message));
setFinished(); setFinished();
@@ -150,26 +150,26 @@ void GenericDirectUploadService::handleUploadFinished(Utils::SftpJobId jobId, co
{ {
Q_UNUSED(jobId); Q_UNUSED(jobId);
QTC_ASSERT(m_d->state == Uploading, setFinished(); return); QTC_ASSERT(d->state == Uploading, setFinished(); return);
if (m_d->stopRequested) { if (d->stopRequested) {
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
} }
const DeployableFile d = m_d->filesToUpload.takeFirst(); const DeployableFile df = d->filesToUpload.takeFirst();
if (!errorMsg.isEmpty()) { if (!errorMsg.isEmpty()) {
emit errorMessage(tr("Upload of file '%1' failed: %2") emit errorMessage(tr("Upload of file '%1' failed: %2")
.arg(QDir::toNativeSeparators(d.localFilePath), errorMsg)); .arg(QDir::toNativeSeparators(df.localFilePath), errorMsg));
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
} else { } else {
saveDeploymentTimeStamp(d); saveDeploymentTimeStamp(df);
// Terrible hack for Windows. // Terrible hack for Windows.
if (d.remoteDir.contains(QLatin1String("bin"))) { if (df.remoteDir.contains(QLatin1String("bin"))) {
const QString remoteFilePath = d.remoteDir + QLatin1Char('/') const QString remoteFilePath = df.remoteDir + QLatin1Char('/')
+ QFileInfo(d.localFilePath).fileName(); + QFileInfo(df.localFilePath).fileName();
const QString command = QLatin1String("chmod a+x ") + remoteFilePath; const QString command = QLatin1String("chmod a+x ") + remoteFilePath;
connection()->createRemoteProcess(command.toUtf8())->start(); connection()->createRemoteProcess(command.toUtf8())->start();
} }
@@ -180,63 +180,63 @@ void GenericDirectUploadService::handleUploadFinished(Utils::SftpJobId jobId, co
void GenericDirectUploadService::handleLnFinished(int exitStatus) void GenericDirectUploadService::handleLnFinished(int exitStatus)
{ {
QTC_ASSERT(m_d->state == Uploading, setFinished(); return); QTC_ASSERT(d->state == Uploading, setFinished(); return);
if (m_d->stopRequested) { if (d->stopRequested) {
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
} }
const DeployableFile d = m_d->filesToUpload.takeFirst(); const DeployableFile df = d->filesToUpload.takeFirst();
const QString nativePath = QDir::toNativeSeparators(d.localFilePath); const QString nativePath = QDir::toNativeSeparators(df.localFilePath);
if (exitStatus != SshRemoteProcess::ExitedNormally || m_d->lnProc->exitCode() != 0) { if (exitStatus != SshRemoteProcess::ExitedNormally || d->lnProc->exitCode() != 0) {
emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath)); emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath));
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
return; return;
} else { } else {
saveDeploymentTimeStamp(d); saveDeploymentTimeStamp(df);
uploadNextFile(); uploadNextFile();
} }
} }
void GenericDirectUploadService::handleMkdirFinished(int exitStatus) void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
{ {
QTC_ASSERT(m_d->state == Uploading, setFinished(); return); QTC_ASSERT(d->state == Uploading, setFinished(); return);
if (m_d->stopRequested) { if (d->stopRequested) {
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
} }
const DeployableFile &d = m_d->filesToUpload.first(); const DeployableFile &df = d->filesToUpload.first();
QFileInfo fi(d.localFilePath); QFileInfo fi(df.localFilePath);
const QString nativePath = QDir::toNativeSeparators(d.localFilePath); const QString nativePath = QDir::toNativeSeparators(df.localFilePath);
if (exitStatus != SshRemoteProcess::ExitedNormally || m_d->mkdirProc->exitCode() != 0) { if (exitStatus != SshRemoteProcess::ExitedNormally || d->mkdirProc->exitCode() != 0) {
emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath)); emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath));
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
} else if (fi.isDir()) { } else if (fi.isDir()) {
saveDeploymentTimeStamp(d); saveDeploymentTimeStamp(df);
m_d->filesToUpload.removeFirst(); d->filesToUpload.removeFirst();
uploadNextFile(); uploadNextFile();
} else { } else {
const QString remoteFilePath = d.remoteDir + QLatin1Char('/') + fi.fileName(); const QString remoteFilePath = df.remoteDir + QLatin1Char('/') + fi.fileName();
if (fi.isSymLink()) { if (fi.isSymLink()) {
const QString target = fi.dir().relativeFilePath(fi.symLinkTarget()); // see QTBUG-5817. const QString target = fi.dir().relativeFilePath(fi.symLinkTarget()); // see QTBUG-5817.
const QString command = QLatin1String("ln -vsf ") + target + QLatin1Char(' ') const QString command = QLatin1String("ln -vsf ") + target + QLatin1Char(' ')
+ remoteFilePath; + remoteFilePath;
// See comment in SftpChannel::createLink as to why we can't use it. // See comment in SftpChannel::createLink as to why we can't use it.
m_d->lnProc = connection()->createRemoteProcess(command.toUtf8()); d->lnProc = connection()->createRemoteProcess(command.toUtf8());
connect(m_d->lnProc.data(), SIGNAL(closed(int)), SLOT(handleLnFinished(int))); connect(d->lnProc.data(), SIGNAL(closed(int)), SLOT(handleLnFinished(int)));
connect(m_d->lnProc.data(), SIGNAL(outputAvailable(QByteArray)), connect(d->lnProc.data(), SIGNAL(outputAvailable(QByteArray)),
SLOT(handleStdOutData(QByteArray))); SLOT(handleStdOutData(QByteArray)));
connect(m_d->lnProc.data(), SIGNAL(errorOutputAvailable(QByteArray)), connect(d->lnProc.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SLOT(handleStdErrData(QByteArray))); SLOT(handleStdErrData(QByteArray)));
m_d->lnProc->start(); d->lnProc->start();
} else { } else {
const SftpJobId job = m_d->uploader->uploadFile(d.localFilePath, remoteFilePath, const SftpJobId job = d->uploader->uploadFile(df.localFilePath, remoteFilePath,
SftpOverwriteExisting); SftpOverwriteExisting);
if (job == SftpInvalidJob) { if (job == SftpInvalidJob) {
emit errorMessage(tr("Failed to upload file '%1': " emit errorMessage(tr("Failed to upload file '%1': "
@@ -260,7 +260,7 @@ void GenericDirectUploadService::handleStdErrData(const QByteArray &data)
void GenericDirectUploadService::stopDeployment() void GenericDirectUploadService::stopDeployment()
{ {
QTC_ASSERT(m_d->state == InitializingSftp || m_d->state == Uploading, setFinished(); return); QTC_ASSERT(d->state == InitializingSftp || d->state == Uploading, setFinished(); return);
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
@@ -272,8 +272,8 @@ void GenericDirectUploadService::checkDeploymentNeeded(const DeployableFile &dep
if (fileInfo.isDir()) { if (fileInfo.isDir()) {
const QStringList files = QDir(deployable.localFilePath) const QStringList files = QDir(deployable.localFilePath)
.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
if (files.isEmpty() && (!m_d->incremental || hasChangedSinceLastDeployment(deployable))) if (files.isEmpty() && (!d->incremental || hasChangedSinceLastDeployment(deployable)))
m_d->filesToUpload << deployable; d->filesToUpload << deployable;
foreach (const QString &fileName, files) { foreach (const QString &fileName, files) {
const QString localFilePath = deployable.localFilePath const QString localFilePath = deployable.localFilePath
+ QLatin1Char('/') + fileName; + QLatin1Char('/') + fileName;
@@ -281,49 +281,49 @@ void GenericDirectUploadService::checkDeploymentNeeded(const DeployableFile &dep
+ fileInfo.fileName(); + fileInfo.fileName();
checkDeploymentNeeded(DeployableFile(localFilePath, remoteDir)); checkDeploymentNeeded(DeployableFile(localFilePath, remoteDir));
} }
} else if (!m_d->incremental || hasChangedSinceLastDeployment(deployable)) { } else if (!d->incremental || hasChangedSinceLastDeployment(deployable)) {
m_d->filesToUpload << deployable; d->filesToUpload << deployable;
} }
} }
void GenericDirectUploadService::setFinished() void GenericDirectUploadService::setFinished()
{ {
m_d->stopRequested = false; d->stopRequested = false;
m_d->state = Inactive; d->state = Inactive;
if (m_d->mkdirProc) if (d->mkdirProc)
disconnect(m_d->mkdirProc.data(), 0, this, 0); disconnect(d->mkdirProc.data(), 0, this, 0);
if (m_d->lnProc) if (d->lnProc)
disconnect(m_d->lnProc.data(), 0, this, 0); disconnect(d->lnProc.data(), 0, this, 0);
if (m_d->uploader) { if (d->uploader) {
disconnect(m_d->uploader.data(), 0, this, 0); disconnect(d->uploader.data(), 0, this, 0);
m_d->uploader->closeChannel(); d->uploader->closeChannel();
} }
} }
void GenericDirectUploadService::uploadNextFile() void GenericDirectUploadService::uploadNextFile()
{ {
if (m_d->filesToUpload.isEmpty()) { if (d->filesToUpload.isEmpty()) {
emit progressMessage(tr("All files successfully deployed.")); emit progressMessage(tr("All files successfully deployed."));
setFinished(); setFinished();
handleDeploymentDone(); handleDeploymentDone();
return; return;
} }
const DeployableFile &d = m_d->filesToUpload.first(); const DeployableFile &df = d->filesToUpload.first();
QString dirToCreate = d.remoteDir; QString dirToCreate = df.remoteDir;
QFileInfo fi(d.localFilePath); QFileInfo fi(df.localFilePath);
if (fi.isDir()) if (fi.isDir())
dirToCreate += QLatin1Char('/') + fi.fileName(); dirToCreate += QLatin1Char('/') + fi.fileName();
const QString command = QLatin1String("mkdir -p ") + dirToCreate; const QString command = QLatin1String("mkdir -p ") + dirToCreate;
m_d->mkdirProc = connection()->createRemoteProcess(command.toUtf8()); d->mkdirProc = connection()->createRemoteProcess(command.toUtf8());
connect(m_d->mkdirProc.data(), SIGNAL(closed(int)), SLOT(handleMkdirFinished(int))); connect(d->mkdirProc.data(), SIGNAL(closed(int)), SLOT(handleMkdirFinished(int)));
connect(m_d->mkdirProc.data(), SIGNAL(outputAvailable(QByteArray)), connect(d->mkdirProc.data(), SIGNAL(outputAvailable(QByteArray)),
SLOT(handleStdOutData(QByteArray))); SLOT(handleStdOutData(QByteArray)));
connect(m_d->mkdirProc.data(), SIGNAL(errorOutputAvailable(QByteArray)), connect(d->mkdirProc.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SLOT(handleStdErrData(QByteArray))); SLOT(handleStdErrData(QByteArray)));
emit progressMessage(tr("Uploading file '%1'...") emit progressMessage(tr("Uploading file '%1'...")
.arg(QDir::toNativeSeparators(d.localFilePath))); .arg(QDir::toNativeSeparators(df.localFilePath)));
m_d->mkdirProc->start(); d->mkdirProc->start();
} }
} //namespace RemoteLinux } //namespace RemoteLinux

View File

@@ -76,7 +76,7 @@ private:
void setFinished(); void setFinished();
void uploadNextFile(); void uploadNextFile();
Internal::GenericDirectUploadServicePrivate * const m_d; Internal::GenericDirectUploadServicePrivate * const d;
}; };
} //namespace RemoteLinux } //namespace RemoteLinux

View File

@@ -59,32 +59,32 @@ public:
GenericLinuxDeviceConfigurationWizard::GenericLinuxDeviceConfigurationWizard(QWidget *parent) GenericLinuxDeviceConfigurationWizard::GenericLinuxDeviceConfigurationWizard(QWidget *parent)
: ILinuxDeviceConfigurationWizard(parent), : ILinuxDeviceConfigurationWizard(parent),
m_d(new Internal::GenericLinuxDeviceConfigurationWizardPrivate(this)) d(new Internal::GenericLinuxDeviceConfigurationWizardPrivate(this))
{ {
setWindowTitle(tr("New Generic Linux Device Configuration Setup")); setWindowTitle(tr("New Generic Linux Device Configuration Setup"));
setPage(Internal::SetupPageId, &m_d->setupPage); setPage(Internal::SetupPageId, &d->setupPage);
setPage(Internal::FinalPageId, &m_d->finalPage); setPage(Internal::FinalPageId, &d->finalPage);
m_d->finalPage.setCommitPage(true); d->finalPage.setCommitPage(true);
} }
GenericLinuxDeviceConfigurationWizard::~GenericLinuxDeviceConfigurationWizard() GenericLinuxDeviceConfigurationWizard::~GenericLinuxDeviceConfigurationWizard()
{ {
delete m_d; delete d;
} }
LinuxDeviceConfiguration::Ptr GenericLinuxDeviceConfigurationWizard::deviceConfiguration() LinuxDeviceConfiguration::Ptr GenericLinuxDeviceConfigurationWizard::deviceConfiguration()
{ {
Utils::SshConnectionParameters sshParams(SshConnectionParameters::NoProxy); Utils::SshConnectionParameters sshParams(SshConnectionParameters::NoProxy);
sshParams.host = m_d->setupPage.hostName(); sshParams.host = d->setupPage.hostName();
sshParams.userName = m_d->setupPage.userName(); sshParams.userName = d->setupPage.userName();
sshParams.port = 22; sshParams.port = 22;
sshParams.timeout = 10; sshParams.timeout = 10;
sshParams.authenticationType = m_d->setupPage.authenticationType(); sshParams.authenticationType = d->setupPage.authenticationType();
if (sshParams.authenticationType == SshConnectionParameters::AuthenticationByPassword) if (sshParams.authenticationType == SshConnectionParameters::AuthenticationByPassword)
sshParams.password = m_d->setupPage.password(); sshParams.password = d->setupPage.password();
else else
sshParams.privateKeyFile = m_d->setupPage.privateKeyFilePath(); sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(m_d->setupPage.configurationName(), LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(d->setupPage.configurationName(),
QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Hardware, QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Hardware,
PortList::fromString(QLatin1String("10000-10100")), sshParams); PortList::fromString(QLatin1String("10000-10100")), sshParams);
LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this); LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this);

View File

@@ -50,7 +50,7 @@ public:
LinuxDeviceConfiguration::Ptr deviceConfiguration(); LinuxDeviceConfiguration::Ptr deviceConfiguration();
private: private:
Internal::GenericLinuxDeviceConfigurationWizardPrivate * const m_d; Internal::GenericLinuxDeviceConfigurationWizardPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -53,32 +53,32 @@ public:
using namespace Utils; using namespace Utils;
GenericLinuxDeviceConfigurationWizardSetupPage::GenericLinuxDeviceConfigurationWizardSetupPage(QWidget *parent) : GenericLinuxDeviceConfigurationWizardSetupPage::GenericLinuxDeviceConfigurationWizardSetupPage(QWidget *parent) :
QWizardPage(parent), m_d(new Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate) QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate)
{ {
m_d->ui.setupUi(this); d->ui.setupUi(this);
setTitle(tr("Connection Data")); setTitle(tr("Connection Data"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color) setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_d->ui.privateKeyPathChooser->setExpectedKind(PathChooser::File); d->ui.privateKeyPathChooser->setExpectedKind(PathChooser::File);
connect(m_d->ui.nameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged())); connect(d->ui.nameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
connect(m_d->ui.hostNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged())); connect(d->ui.hostNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
connect(m_d->ui.userNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged())); connect(d->ui.userNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
connect(m_d->ui.privateKeyPathChooser, SIGNAL(validChanged()), SIGNAL(completeChanged())); connect(d->ui.privateKeyPathChooser, SIGNAL(validChanged()), SIGNAL(completeChanged()));
connect(m_d->ui.passwordButton, SIGNAL(toggled(bool)), SLOT(handleAuthTypeChanged())); connect(d->ui.passwordButton, SIGNAL(toggled(bool)), SLOT(handleAuthTypeChanged()));
} }
GenericLinuxDeviceConfigurationWizardSetupPage::~GenericLinuxDeviceConfigurationWizardSetupPage() GenericLinuxDeviceConfigurationWizardSetupPage::~GenericLinuxDeviceConfigurationWizardSetupPage()
{ {
delete m_d; delete d;
} }
void GenericLinuxDeviceConfigurationWizardSetupPage::initializePage() void GenericLinuxDeviceConfigurationWizardSetupPage::initializePage()
{ {
m_d->ui.nameLineEdit->setText(QLatin1String("(New Configuration)")); d->ui.nameLineEdit->setText(QLatin1String("(New Configuration)"));
m_d->ui.hostNameLineEdit->setText(defaultHostName()); d->ui.hostNameLineEdit->setText(defaultHostName());
m_d->ui.userNameLineEdit->setText(defaultUserName()); d->ui.userNameLineEdit->setText(defaultUserName());
m_d->ui.passwordButton->setChecked(true); d->ui.passwordButton->setChecked(true);
m_d->ui.passwordLineEdit->setText(defaultPassWord()); d->ui.passwordLineEdit->setText(defaultPassWord());
m_d->ui.privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath()); d->ui.privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
handleAuthTypeChanged(); handleAuthTypeChanged();
} }
@@ -86,39 +86,39 @@ bool GenericLinuxDeviceConfigurationWizardSetupPage::isComplete() const
{ {
return !configurationName().isEmpty() && !hostName().isEmpty() && !userName().isEmpty() return !configurationName().isEmpty() && !hostName().isEmpty() && !userName().isEmpty()
&& (authenticationType() == SshConnectionParameters::AuthenticationByPassword && (authenticationType() == SshConnectionParameters::AuthenticationByPassword
|| m_d->ui.privateKeyPathChooser->isValid()); || d->ui.privateKeyPathChooser->isValid());
} }
QString GenericLinuxDeviceConfigurationWizardSetupPage::configurationName() const QString GenericLinuxDeviceConfigurationWizardSetupPage::configurationName() const
{ {
return m_d->ui.nameLineEdit->text().trimmed(); return d->ui.nameLineEdit->text().trimmed();
} }
QString GenericLinuxDeviceConfigurationWizardSetupPage::hostName() const QString GenericLinuxDeviceConfigurationWizardSetupPage::hostName() const
{ {
return m_d->ui.hostNameLineEdit->text().trimmed(); return d->ui.hostNameLineEdit->text().trimmed();
} }
QString GenericLinuxDeviceConfigurationWizardSetupPage::userName() const QString GenericLinuxDeviceConfigurationWizardSetupPage::userName() const
{ {
return m_d->ui.userNameLineEdit->text().trimmed(); return d->ui.userNameLineEdit->text().trimmed();
} }
SshConnectionParameters::AuthenticationType GenericLinuxDeviceConfigurationWizardSetupPage::authenticationType() const SshConnectionParameters::AuthenticationType GenericLinuxDeviceConfigurationWizardSetupPage::authenticationType() const
{ {
return m_d->ui.passwordButton->isChecked() return d->ui.passwordButton->isChecked()
? SshConnectionParameters::AuthenticationByPassword ? SshConnectionParameters::AuthenticationByPassword
: SshConnectionParameters::AuthenticationByKey; : SshConnectionParameters::AuthenticationByKey;
} }
QString GenericLinuxDeviceConfigurationWizardSetupPage::password() const QString GenericLinuxDeviceConfigurationWizardSetupPage::password() const
{ {
return m_d->ui.passwordLineEdit->text(); return d->ui.passwordLineEdit->text();
} }
QString GenericLinuxDeviceConfigurationWizardSetupPage::privateKeyFilePath() const QString GenericLinuxDeviceConfigurationWizardSetupPage::privateKeyFilePath() const
{ {
return m_d->ui.privateKeyPathChooser->path(); return d->ui.privateKeyPathChooser->path();
} }
QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultHostName() const QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultHostName() const
@@ -138,30 +138,30 @@ QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultPassWord() const
void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged() void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged()
{ {
m_d->ui.passwordLineEdit->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByPassword); d->ui.passwordLineEdit->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByPassword);
m_d->ui.privateKeyPathChooser->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByKey); d->ui.privateKeyPathChooser->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByKey);
emit completeChanged(); emit completeChanged();
} }
GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent) GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent)
: QWizardPage(parent), m_d(new Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate) : QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate)
{ {
setTitle(tr("Setup Finished")); setTitle(tr("Setup Finished"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color) setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_d->infoLabel.setWordWrap(true); d->infoLabel.setWordWrap(true);
QVBoxLayout * const layout = new QVBoxLayout(this); QVBoxLayout * const layout = new QVBoxLayout(this);
layout->addWidget(&m_d->infoLabel); layout->addWidget(&d->infoLabel);
} }
GenericLinuxDeviceConfigurationWizardFinalPage::~GenericLinuxDeviceConfigurationWizardFinalPage() GenericLinuxDeviceConfigurationWizardFinalPage::~GenericLinuxDeviceConfigurationWizardFinalPage()
{ {
delete m_d; delete d;
} }
void GenericLinuxDeviceConfigurationWizardFinalPage::initializePage() void GenericLinuxDeviceConfigurationWizardFinalPage::initializePage()
{ {
m_d->infoLabel.setText(infoText()); d->infoLabel.setText(infoText());
} }
QString GenericLinuxDeviceConfigurationWizardFinalPage::infoText() const QString GenericLinuxDeviceConfigurationWizardFinalPage::infoText() const

View File

@@ -68,7 +68,7 @@ public:
private: private:
Q_SLOT void handleAuthTypeChanged(); Q_SLOT void handleAuthTypeChanged();
Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate * const m_d; Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate * const d;
}; };
@@ -85,7 +85,7 @@ protected:
virtual QString infoText() const; virtual QString infoText() const;
private: private:
Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate * const m_d; Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -151,36 +151,36 @@ public:
/*! /*!
A short, one-line description of what kind of device this factory supports. A short, one-line description of what kind of device this factory supports.
*/ */
virtual QString displayName() const=0; virtual QString displayName() const = 0;
/*! /*!
A wizard that can create the types of device configuration this factory supports. A wizard that can create the types of device configuration this factory supports.
*/ */
virtual ILinuxDeviceConfigurationWizard *createWizard(QWidget *parent = 0) const=0; virtual ILinuxDeviceConfigurationWizard *createWizard(QWidget *parent = 0) const = 0;
/*! /*!
Returns true iff this factory supports the given device type. Returns true iff this factory supports the given device type.
*/ */
virtual bool supportsOsType(const QString &osType) const=0; virtual bool supportsOsType(const QString &osType) const = 0;
/*! /*!
Returns a human-readable string for the given OS type, if this factory supports that type. Returns a human-readable string for the given OS type, if this factory supports that type.
*/ */
virtual QString displayNameForOsType(const QString &osType) const=0; virtual QString displayNameForOsType(const QString &osType) const = 0;
/*! /*!
Returns a list of ids representing actions that can be run on device configurations Returns a list of ids representing actions that can be run on device configurations
that this factory supports. These actions will be available in the "Linux Devices" that this factory supports. These actions will be available in the "Linux Devices"
options page. options page.
*/ */
virtual QStringList supportedDeviceActionIds() const=0; virtual QStringList supportedDeviceActionIds() const = 0;
/*! /*!
A human-readable string for the given id. Will be displayed on a button which, when clicked, A human-readable string for the given id. Will be displayed on a button which, when clicked,
will start the respective action. will start the respective action.
*/ */
virtual QString displayNameForActionId(const QString &actionId) const=0; virtual QString displayNameForActionId(const QString &actionId) const = 0;
/*! /*!
True iff the user should be allowed to edit the device configurations created by this True iff the user should be allowed to edit the device configurations created by this
@@ -195,7 +195,7 @@ public:
block the UI. block the UI.
*/ */
virtual QDialog *createDeviceAction(const QString &actionId, virtual QDialog *createDeviceAction(const QString &actionId,
const LinuxDeviceConfiguration::ConstPtr &deviceConfig, QWidget *parent = 0) const=0; const LinuxDeviceConfiguration::ConstPtr &deviceConfig, QWidget *parent = 0) const = 0;
protected: protected:
ILinuxDeviceConfigurationFactory(QObject *parent) : QObject(parent) {} ILinuxDeviceConfigurationFactory(QObject *parent) : QObject(parent) {}

View File

@@ -112,25 +112,25 @@ void LinuxDeviceConfigurations::copy(const LinuxDeviceConfigurations *source,
LinuxDeviceConfigurations *target, bool deep) LinuxDeviceConfigurations *target, bool deep)
{ {
if (deep) { if (deep) {
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, source->m_d->devConfigs) foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, source->d->devConfigs)
target->m_d->devConfigs << LinuxDeviceConfiguration::create(devConf); target->d->devConfigs << LinuxDeviceConfiguration::create(devConf);
} else { } else {
target->m_d->devConfigs = source->m_d->devConfigs; target->d->devConfigs = source->d->devConfigs;
} }
target->m_d->defaultSshKeyFilePath = source->m_d->defaultSshKeyFilePath; target->d->defaultSshKeyFilePath = source->d->defaultSshKeyFilePath;
target->m_d->nextId = source->m_d->nextId; target->d->nextId = source->d->nextId;
} }
void LinuxDeviceConfigurations::save() void LinuxDeviceConfigurations::save()
{ {
QSettings *settings = Core::ICore::instance()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(SettingsGroup); settings->beginGroup(SettingsGroup);
settings->setValue(IdCounterKey, m_d->nextId); settings->setValue(IdCounterKey, d->nextId);
settings->setValue(DefaultKeyFilePathKey, m_d->defaultSshKeyFilePath); settings->setValue(DefaultKeyFilePathKey, d->defaultSshKeyFilePath);
settings->beginWriteArray(ConfigListKey, m_d->devConfigs.count()); settings->beginWriteArray(ConfigListKey, d->devConfigs.count());
int skippedCount = 0; int skippedCount = 0;
for (int i = 0; i < m_d->devConfigs.count(); ++i) { for (int i = 0; i < d->devConfigs.count(); ++i) {
const LinuxDeviceConfiguration::ConstPtr &devConf = m_d->devConfigs.at(i); const LinuxDeviceConfiguration::ConstPtr &devConf = d->devConfigs.at(i);
if (devConf->isAutoDetected()) { if (devConf->isAutoDetected()) {
++skippedCount; ++skippedCount;
} else { } else {
@@ -157,11 +157,11 @@ void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration:
} }
devConfig->setName(name); devConfig->setName(name);
devConfig->setInternalId(m_d->nextId++); devConfig->setInternalId(d->nextId++);
beginInsertRows(QModelIndex(), rowCount(), rowCount()); beginInsertRows(QModelIndex(), rowCount(), rowCount());
if (!defaultDeviceConfig(devConfig->osType())) if (!defaultDeviceConfig(devConfig->osType()))
devConfig->setDefault(true); devConfig->setDefault(true);
m_d->devConfigs << devConfig; d->devConfigs << devConfig;
endInsertRows(); endInsertRows();
} }
@@ -173,12 +173,12 @@ void LinuxDeviceConfigurations::removeConfiguration(int idx)
beginRemoveRows(QModelIndex(), idx, idx); beginRemoveRows(QModelIndex(), idx, idx);
const bool wasDefault = deviceAt(idx)->isDefault(); const bool wasDefault = deviceAt(idx)->isDefault();
const QString osType = deviceAt(idx)->osType(); const QString osType = deviceAt(idx)->osType();
m_d->devConfigs.removeAt(idx); d->devConfigs.removeAt(idx);
endRemoveRows(); endRemoveRows();
if (wasDefault) { if (wasDefault) {
for (int i = 0; i < m_d->devConfigs.count(); ++i) { for (int i = 0; i < d->devConfigs.count(); ++i) {
if (deviceAt(i)->osType() == osType) { if (deviceAt(i)->osType() == osType) {
m_d->devConfigs.at(i)->setDefault(true); d->devConfigs.at(i)->setDefault(true);
const QModelIndex changedIndex = index(i, 0); const QModelIndex changedIndex = index(i, 0);
emit dataChanged(changedIndex, changedIndex); emit dataChanged(changedIndex, changedIndex);
break; break;
@@ -191,12 +191,12 @@ void LinuxDeviceConfigurations::setDefaultSshKeyFilePath(const QString &path)
{ {
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return); QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
m_d->defaultSshKeyFilePath = path; d->defaultSshKeyFilePath = path;
} }
QString LinuxDeviceConfigurations::defaultSshKeyFilePath() const QString LinuxDeviceConfigurations::defaultSshKeyFilePath() const
{ {
return m_d->defaultSshKeyFilePath; return d->defaultSshKeyFilePath;
} }
void LinuxDeviceConfigurations::setConfigurationName(int i, const QString &name) void LinuxDeviceConfigurations::setConfigurationName(int i, const QString &name)
@@ -204,7 +204,7 @@ void LinuxDeviceConfigurations::setConfigurationName(int i, const QString &name)
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return); QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
Q_ASSERT(i >= 0 && i < rowCount()); Q_ASSERT(i >= 0 && i < rowCount());
m_d->devConfigs.at(i)->setName(name); d->devConfigs.at(i)->setName(name);
const QModelIndex changedIndex = index(i, 0); const QModelIndex changedIndex = index(i, 0);
emit dataChanged(changedIndex, changedIndex); emit dataChanged(changedIndex, changedIndex);
} }
@@ -215,7 +215,7 @@ void LinuxDeviceConfigurations::setSshParameters(int i,
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return); QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
Q_ASSERT(i >= 0 && i < rowCount()); Q_ASSERT(i >= 0 && i < rowCount());
m_d->devConfigs.at(i)->setSshParameters(params); d->devConfigs.at(i)->setSshParameters(params);
} }
void LinuxDeviceConfigurations::setFreePorts(int i, const PortList &freePorts) void LinuxDeviceConfigurations::setFreePorts(int i, const PortList &freePorts)
@@ -223,7 +223,7 @@ void LinuxDeviceConfigurations::setFreePorts(int i, const PortList &freePorts)
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return); QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
Q_ASSERT(i >= 0 && i < rowCount()); Q_ASSERT(i >= 0 && i < rowCount());
m_d->devConfigs.at(i)->setFreePorts(freePorts); d->devConfigs.at(i)->setFreePorts(freePorts);
} }
void LinuxDeviceConfigurations::setDefaultDevice(int idx) void LinuxDeviceConfigurations::setDefaultDevice(int idx)
@@ -231,12 +231,12 @@ void LinuxDeviceConfigurations::setDefaultDevice(int idx)
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return); QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
Q_ASSERT(idx >= 0 && idx < rowCount()); Q_ASSERT(idx >= 0 && idx < rowCount());
const LinuxDeviceConfiguration::Ptr &devConf = m_d->devConfigs.at(idx); const LinuxDeviceConfiguration::Ptr &devConf = d->devConfigs.at(idx);
if (devConf->isDefault()) if (devConf->isDefault())
return; return;
QModelIndex oldDefaultIndex; QModelIndex oldDefaultIndex;
for (int i = 0; i < m_d->devConfigs.count(); ++i) { for (int i = 0; i < d->devConfigs.count(); ++i) {
const LinuxDeviceConfiguration::Ptr &oldDefaultDev = m_d->devConfigs.at(i); const LinuxDeviceConfiguration::Ptr &oldDefaultDev = d->devConfigs.at(i);
if (oldDefaultDev->isDefault() && oldDefaultDev->osType() == devConf->osType()) { if (oldDefaultDev->isDefault() && oldDefaultDev->osType() == devConf->osType()) {
oldDefaultDev->setDefault(false); oldDefaultDev->setDefault(false);
oldDefaultIndex = index(i, 0); oldDefaultIndex = index(i, 0);
@@ -252,28 +252,28 @@ void LinuxDeviceConfigurations::setDefaultDevice(int idx)
} }
LinuxDeviceConfigurations::LinuxDeviceConfigurations(QObject *parent) LinuxDeviceConfigurations::LinuxDeviceConfigurations(QObject *parent)
: QAbstractListModel(parent), m_d(new LinuxDeviceConfigurationsPrivate) : QAbstractListModel(parent), d(new LinuxDeviceConfigurationsPrivate)
{ {
} }
LinuxDeviceConfigurations::~LinuxDeviceConfigurations() LinuxDeviceConfigurations::~LinuxDeviceConfigurations()
{ {
delete m_d; delete d;
} }
void LinuxDeviceConfigurations::load() void LinuxDeviceConfigurations::load()
{ {
QSettings *settings = Core::ICore::instance()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(SettingsGroup); settings->beginGroup(SettingsGroup);
m_d->nextId = settings->value(IdCounterKey, 1).toULongLong(); d->nextId = settings->value(IdCounterKey, 1).toULongLong();
m_d->defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey, d->defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey,
LinuxDeviceConfiguration::defaultPrivateKeyFilePath()).toString(); LinuxDeviceConfiguration::defaultPrivateKeyFilePath()).toString();
int count = settings->beginReadArray(ConfigListKey); int count = settings->beginReadArray(ConfigListKey);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
settings->setArrayIndex(i); settings->setArrayIndex(i);
LinuxDeviceConfiguration::Ptr devConf LinuxDeviceConfiguration::Ptr devConf
= LinuxDeviceConfiguration::create(*settings, m_d->nextId); = LinuxDeviceConfiguration::create(*settings, d->nextId);
m_d->devConfigs << devConf; d->devConfigs << devConf;
} }
settings->endArray(); settings->endArray();
settings->endGroup(); settings->endGroup();
@@ -283,15 +283,15 @@ void LinuxDeviceConfigurations::load()
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::deviceAt(int idx) const LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::deviceAt(int idx) const
{ {
Q_ASSERT(idx >= 0 && idx < rowCount()); Q_ASSERT(idx >= 0 && idx < rowCount());
return m_d->devConfigs.at(idx); return d->devConfigs.at(idx);
} }
bool LinuxDeviceConfigurations::hasConfig(const QString &name) const bool LinuxDeviceConfigurations::hasConfig(const QString &name) const
{ {
QList<LinuxDeviceConfiguration::Ptr>::ConstIterator resultIt = QList<LinuxDeviceConfiguration::Ptr>::ConstIterator resultIt =
std::find_if(m_d->devConfigs.constBegin(), m_d->devConfigs.constEnd(), std::find_if(d->devConfigs.constBegin(), d->devConfigs.constEnd(),
DevConfNameMatcher(name)); DevConfNameMatcher(name));
return resultIt != m_d->devConfigs.constEnd(); return resultIt != d->devConfigs.constEnd();
} }
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::find(LinuxDeviceConfiguration::Id id) const LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::find(LinuxDeviceConfiguration::Id id) const
@@ -302,7 +302,7 @@ LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::find(LinuxDeviceCo
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfig(const QString &osType) const LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfig(const QString &osType) const
{ {
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, m_d->devConfigs) { foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, d->devConfigs) {
if (devConf->isDefault() && devConf->osType() == osType) if (devConf->isDefault() && devConf->osType() == osType)
return devConf; return devConf;
} }
@@ -311,7 +311,7 @@ LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfi
int LinuxDeviceConfigurations::indexForInternalId(LinuxDeviceConfiguration::Id internalId) const int LinuxDeviceConfigurations::indexForInternalId(LinuxDeviceConfiguration::Id internalId) const
{ {
for (int i = 0; i < m_d->devConfigs.count(); ++i) { for (int i = 0; i < d->devConfigs.count(); ++i) {
if (deviceAt(i)->internalId() == internalId) if (deviceAt(i)->internalId() == internalId)
return i; return i;
} }
@@ -328,7 +328,7 @@ void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType()
QHash<QString, bool> osTypeHasDefault; QHash<QString, bool> osTypeHasDefault;
// Step 1: Ensure there's at most one default configuration per device type. // Step 1: Ensure there's at most one default configuration per device type.
foreach (const LinuxDeviceConfiguration::Ptr &devConf, m_d->devConfigs) { foreach (const LinuxDeviceConfiguration::Ptr &devConf, d->devConfigs) {
if (devConf->isDefault()) { if (devConf->isDefault()) {
if (osTypeHasDefault.value(devConf->osType())) if (osTypeHasDefault.value(devConf->osType()))
devConf->setDefault(false); devConf->setDefault(false);
@@ -338,7 +338,7 @@ void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType()
} }
// Step 2: Ensure there's at least one default configuration per device type. // Step 2: Ensure there's at least one default configuration per device type.
foreach (const LinuxDeviceConfiguration::Ptr &devConf, m_d->devConfigs) { foreach (const LinuxDeviceConfiguration::Ptr &devConf, d->devConfigs) {
if (!osTypeHasDefault.value(devConf->osType())) { if (!osTypeHasDefault.value(devConf->osType())) {
devConf->setDefault(true); devConf->setDefault(true);
osTypeHasDefault.insert(devConf->osType(), true); osTypeHasDefault.insert(devConf->osType(), true);
@@ -349,7 +349,7 @@ void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType()
int LinuxDeviceConfigurations::rowCount(const QModelIndex &parent) const int LinuxDeviceConfigurations::rowCount(const QModelIndex &parent) const
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
return m_d->devConfigs.count(); return d->devConfigs.count();
} }
QVariant LinuxDeviceConfigurations::data(const QModelIndex &index, int role) const QVariant LinuxDeviceConfigurations::data(const QModelIndex &index, int role) const

View File

@@ -88,7 +88,7 @@ private:
LinuxDeviceConfigurations *target, bool deep); LinuxDeviceConfigurations *target, bool deep);
void ensureOneDefaultConfigurationPerOsType(); void ensureOneDefaultConfigurationPerOsType();
Internal::LinuxDeviceConfigurationsPrivate * const m_d; Internal::LinuxDeviceConfigurationsPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -58,27 +58,27 @@ using namespace Internal;
LinuxDeviceTestDialog::LinuxDeviceTestDialog(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration, LinuxDeviceTestDialog::LinuxDeviceTestDialog(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration,
AbstractLinuxDeviceTester *deviceTester, QWidget *parent) AbstractLinuxDeviceTester *deviceTester, QWidget *parent)
: QDialog(parent), m_d(new LinuxDeviceTestDialogPrivate(deviceTester)) : QDialog(parent), d(new LinuxDeviceTestDialogPrivate(deviceTester))
{ {
m_d->ui.setupUi(this); d->ui.setupUi(this);
m_d->deviceTester->setParent(this); d->deviceTester->setParent(this);
connect(m_d->deviceTester, SIGNAL(progressMessage(QString)), SLOT(handleProgressMessage(QString))); connect(d->deviceTester, SIGNAL(progressMessage(QString)), SLOT(handleProgressMessage(QString)));
connect(m_d->deviceTester, SIGNAL(errorMessage(QString)), SLOT(handleErrorMessage(QString))); connect(d->deviceTester, SIGNAL(errorMessage(QString)), SLOT(handleErrorMessage(QString)));
connect(m_d->deviceTester, SIGNAL(finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)), connect(d->deviceTester, SIGNAL(finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)),
SLOT(handleTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult))); SLOT(handleTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)));
m_d->deviceTester->testDevice(deviceConfiguration); d->deviceTester->testDevice(deviceConfiguration);
} }
LinuxDeviceTestDialog::~LinuxDeviceTestDialog() LinuxDeviceTestDialog::~LinuxDeviceTestDialog()
{ {
delete m_d; delete d;
} }
void LinuxDeviceTestDialog::reject() void LinuxDeviceTestDialog::reject()
{ {
if (!m_d->finished) if (!d->finished)
m_d->deviceTester->stopTest(); d->deviceTester->stopTest();
QDialog::reject(); QDialog::reject();
} }
@@ -94,8 +94,8 @@ void LinuxDeviceTestDialog::handleErrorMessage(const QString &message)
void LinuxDeviceTestDialog::handleTestFinished(AbstractLinuxDeviceTester::TestResult result) void LinuxDeviceTestDialog::handleTestFinished(AbstractLinuxDeviceTester::TestResult result)
{ {
m_d->finished = true; d->finished = true;
m_d->ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close")); d->ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
if (result == AbstractLinuxDeviceTester::TestSuccess) if (result == AbstractLinuxDeviceTester::TestSuccess)
addText(tr("Device test finished successfully."), QLatin1String("blue"), true); addText(tr("Device test finished successfully."), QLatin1String("blue"), true);
@@ -105,13 +105,13 @@ void LinuxDeviceTestDialog::handleTestFinished(AbstractLinuxDeviceTester::TestRe
void LinuxDeviceTestDialog::addText(const QString &text, const QString &color, bool bold) void LinuxDeviceTestDialog::addText(const QString &text, const QString &color, bool bold)
{ {
QTextCharFormat format = m_d->ui.textEdit->currentCharFormat(); QTextCharFormat format = d->ui.textEdit->currentCharFormat();
format.setForeground(QBrush(QColor(color))); format.setForeground(QBrush(QColor(color)));
QFont font = format.font(); QFont font = format.font();
font.setBold(bold); font.setBold(bold);
format.setFont(font); format.setFont(font);
m_d->ui.textEdit->setCurrentCharFormat(format); d->ui.textEdit->setCurrentCharFormat(format);
m_d->ui.textEdit->appendPlainText(text); d->ui.textEdit->appendPlainText(text);
} }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -62,7 +62,7 @@ private slots:
private: private:
void addText(const QString &text, const QString &color, bool bold); void addText(const QString &text, const QString &color, bool bold);
Internal::LinuxDeviceTestDialogPrivate * const m_d; Internal::LinuxDeviceTestDialogPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -72,43 +72,43 @@ AbstractLinuxDeviceTester::AbstractLinuxDeviceTester(QObject *parent) : QObject(
GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent) GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent)
: AbstractLinuxDeviceTester(parent), m_d(new GenericLinuxDeviceTesterPrivate) : AbstractLinuxDeviceTester(parent), d(new GenericLinuxDeviceTesterPrivate)
{ {
} }
GenericLinuxDeviceTester::~GenericLinuxDeviceTester() GenericLinuxDeviceTester::~GenericLinuxDeviceTester()
{ {
delete m_d; delete d;
} }
void GenericLinuxDeviceTester::testDevice(const LinuxDeviceConfiguration::ConstPtr &deviceConfiguration) void GenericLinuxDeviceTester::testDevice(const LinuxDeviceConfiguration::ConstPtr &deviceConfiguration)
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
m_d->deviceConfiguration = deviceConfiguration; d->deviceConfiguration = deviceConfiguration;
m_d->connection = SshConnection::create(deviceConfiguration->sshParameters()); d->connection = SshConnection::create(deviceConfiguration->sshParameters());
connect(m_d->connection.data(), SIGNAL(connected()), SLOT(handleConnected())); connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
connect(m_d->connection.data(), SIGNAL(error(Utils::SshError)), connect(d->connection.data(), SIGNAL(error(Utils::SshError)),
SLOT(handleConnectionFailure())); SLOT(handleConnectionFailure()));
emit progressMessage(tr("Connecting to host...")); emit progressMessage(tr("Connecting to host..."));
m_d->state = Connecting; d->state = Connecting;
m_d->connection->connectToHost(); d->connection->connectToHost();
} }
void GenericLinuxDeviceTester::stopTest() void GenericLinuxDeviceTester::stopTest()
{ {
QTC_ASSERT(m_d->state != Inactive, return); QTC_ASSERT(d->state != Inactive, return);
switch (m_d->state) { switch (d->state) {
case Connecting: case Connecting:
m_d->connection->disconnectFromHost(); d->connection->disconnectFromHost();
break; break;
case TestingPorts: case TestingPorts:
m_d->portsGatherer.stop(); d->portsGatherer.stop();
break; break;
case RunningUname: case RunningUname:
m_d->process->closeChannel(); d->process->closeChannel();
break; break;
case Inactive: case Inactive:
break; break;
@@ -119,71 +119,71 @@ void GenericLinuxDeviceTester::stopTest()
SshConnection::Ptr GenericLinuxDeviceTester::connection() const SshConnection::Ptr GenericLinuxDeviceTester::connection() const
{ {
return m_d->connection; return d->connection;
} }
void GenericLinuxDeviceTester::handleConnected() void GenericLinuxDeviceTester::handleConnected()
{ {
QTC_ASSERT(m_d->state == Connecting, return); QTC_ASSERT(d->state == Connecting, return);
m_d->process = m_d->connection->createRemoteProcess("uname -rsm"); d->process = d->connection->createRemoteProcess("uname -rsm");
connect(m_d->process.data(), SIGNAL(outputAvailable(QByteArray)), connect(d->process.data(), SIGNAL(outputAvailable(QByteArray)),
SLOT(handleRemoteStdOut(QByteArray))); SLOT(handleRemoteStdOut(QByteArray)));
connect(m_d->process.data(), SIGNAL(errorOutputAvailable(QByteArray)), connect(d->process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SLOT(handleRemoteStdErr(QByteArray))); SLOT(handleRemoteStdErr(QByteArray)));
connect(m_d->process.data(), SIGNAL(closed(int)), SLOT(handleProcessFinished(int))); connect(d->process.data(), SIGNAL(closed(int)), SLOT(handleProcessFinished(int)));
emit progressMessage("Checking kernel version..."); emit progressMessage("Checking kernel version...");
m_d->state = RunningUname; d->state = RunningUname;
m_d->process->start(); d->process->start();
} }
void GenericLinuxDeviceTester::handleConnectionFailure() void GenericLinuxDeviceTester::handleConnectionFailure()
{ {
QTC_ASSERT(m_d->state != Inactive, return); QTC_ASSERT(d->state != Inactive, return);
emit errorMessage(tr("SSH connection failure: %1\n").arg(m_d->connection->errorString())); emit errorMessage(tr("SSH connection failure: %1\n").arg(d->connection->errorString()));
setFinished(TestFailure); setFinished(TestFailure);
} }
void GenericLinuxDeviceTester::handleRemoteStdOut(const QByteArray &data) void GenericLinuxDeviceTester::handleRemoteStdOut(const QByteArray &data)
{ {
QTC_ASSERT(m_d->state == RunningUname, return); QTC_ASSERT(d->state == RunningUname, return);
m_d->remoteStdout += data; d->remoteStdout += data;
} }
void GenericLinuxDeviceTester::handleRemoteStdErr(const QByteArray &data) void GenericLinuxDeviceTester::handleRemoteStdErr(const QByteArray &data)
{ {
QTC_ASSERT(m_d->state == RunningUname, return); QTC_ASSERT(d->state == RunningUname, return);
m_d->remoteStderr += data; d->remoteStderr += data;
} }
void GenericLinuxDeviceTester::handleProcessFinished(int exitStatus) void GenericLinuxDeviceTester::handleProcessFinished(int exitStatus)
{ {
QTC_ASSERT(m_d->state == RunningUname, return); QTC_ASSERT(d->state == RunningUname, return);
if (exitStatus != SshRemoteProcess::ExitedNormally || m_d->process->exitCode() != 0) { if (exitStatus != SshRemoteProcess::ExitedNormally || d->process->exitCode() != 0) {
if (!m_d->remoteStderr.isEmpty()) if (!d->remoteStderr.isEmpty())
emit errorMessage(tr("uname failed: %1\n").arg(QString::fromUtf8(m_d->remoteStderr))); emit errorMessage(tr("uname failed: %1\n").arg(QString::fromUtf8(d->remoteStderr)));
else else
emit errorMessage(tr("uname failed.\n")); emit errorMessage(tr("uname failed.\n"));
} else { } else {
emit progressMessage(QString::fromUtf8(m_d->remoteStdout)); emit progressMessage(QString::fromUtf8(d->remoteStdout));
} }
connect(&m_d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGatheringError(QString))); connect(&d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGatheringError(QString)));
connect(&m_d->portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady())); connect(&d->portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady()));
emit progressMessage(tr("Checking if specified ports are available...")); emit progressMessage(tr("Checking if specified ports are available..."));
m_d->state = TestingPorts; d->state = TestingPorts;
m_d->portsGatherer.start(m_d->connection, m_d->deviceConfiguration); d->portsGatherer.start(d->connection, d->deviceConfiguration);
} }
void GenericLinuxDeviceTester::handlePortsGatheringError(const QString &message) void GenericLinuxDeviceTester::handlePortsGatheringError(const QString &message)
{ {
QTC_ASSERT(m_d->state == TestingPorts, return); QTC_ASSERT(d->state == TestingPorts, return);
emit errorMessage(tr("Error gathering ports: %1\n").arg(message)); emit errorMessage(tr("Error gathering ports: %1\n").arg(message));
setFinished(TestFailure); setFinished(TestFailure);
@@ -191,13 +191,13 @@ void GenericLinuxDeviceTester::handlePortsGatheringError(const QString &message)
void GenericLinuxDeviceTester::handlePortListReady() void GenericLinuxDeviceTester::handlePortListReady()
{ {
QTC_ASSERT(m_d->state == TestingPorts, return); QTC_ASSERT(d->state == TestingPorts, return);
if (m_d->portsGatherer.usedPorts().isEmpty()) { if (d->portsGatherer.usedPorts().isEmpty()) {
emit progressMessage("All specified ports are available.\n"); emit progressMessage("All specified ports are available.\n");
} else { } else {
QString portList; QString portList;
foreach (const int port, m_d->portsGatherer.usedPorts()) foreach (const int port, d->portsGatherer.usedPorts())
portList += QString::number(port) + QLatin1String(", "); portList += QString::number(port) + QLatin1String(", ");
portList.remove(portList.count() - 2, 2); portList.remove(portList.count() - 2, 2);
emit errorMessage(tr("The following specified ports are currently in use: %1\n") emit errorMessage(tr("The following specified ports are currently in use: %1\n")
@@ -208,11 +208,11 @@ void GenericLinuxDeviceTester::handlePortListReady()
void GenericLinuxDeviceTester::setFinished(TestResult result) void GenericLinuxDeviceTester::setFinished(TestResult result)
{ {
m_d->state = Inactive; d->state = Inactive;
m_d->remoteStdout.clear(); d->remoteStdout.clear();
m_d->remoteStderr.clear(); d->remoteStderr.clear();
disconnect(m_d->connection.data(), 0, this, 0); disconnect(d->connection.data(), 0, this, 0);
disconnect(&m_d->portsGatherer, 0, this, 0); disconnect(&d->portsGatherer, 0, this, 0);
emit finished(result); emit finished(result);
} }

View File

@@ -94,7 +94,7 @@ private slots:
private: private:
void setFinished(TestResult result); void setFinished(TestResult result);
Internal::GenericLinuxDeviceTesterPrivate * const m_d; Internal::GenericLinuxDeviceTesterPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -65,7 +65,7 @@ private slots:
void handleInstallerStderr(); void handleInstallerStderr();
private: private:
virtual QStringList madArguments() const=0; virtual QStringList madArguments() const = 0;
QProcess *m_installerProcess; QProcess *m_installerProcess;
}; };

View File

@@ -90,7 +90,7 @@ private:
virtual QString packageFileName() const; virtual QString packageFileName() const;
virtual bool createPackage(QProcess *buildProc, const QFutureInterface<bool> &fi)=0; virtual bool createPackage(QProcess *buildProc, const QFutureInterface<bool> &fi)=0;
virtual bool isMetaDataNewerThan(const QDateTime &packageDate) const=0; virtual bool isMetaDataNewerThan(const QDateTime &packageDate) const = 0;
QString projectName() const; QString projectName() const;
static QString nativePath(const QFile &file); static QString nativePath(const QFile &file);

View File

@@ -135,17 +135,17 @@ public:
} // namespace Internal } // namespace Internal
PortList::PortList() : m_d(new Internal::PortListPrivate) PortList::PortList() : d(new Internal::PortListPrivate)
{ {
} }
PortList::PortList(const PortList &other) : m_d(new Internal::PortListPrivate(*other.m_d)) PortList::PortList(const PortList &other) : d(new Internal::PortListPrivate(*other.d))
{ {
} }
PortList &PortList::operator=(const PortList &other) PortList &PortList::operator=(const PortList &other)
{ {
*m_d = *other.m_d; *d = *other.d;
return *this; return *this;
} }
@@ -158,14 +158,14 @@ void PortList::addPort(int port) { addRange(port, port); }
void PortList::addRange(int startPort, int endPort) void PortList::addRange(int startPort, int endPort)
{ {
m_d->ranges << Internal::Range(startPort, endPort); d->ranges << Internal::Range(startPort, endPort);
} }
bool PortList::hasMore() const { return !m_d->ranges.isEmpty(); } bool PortList::hasMore() const { return !d->ranges.isEmpty(); }
bool PortList::contains(int port) const bool PortList::contains(int port) const
{ {
foreach (const Internal::Range &r, m_d->ranges) { foreach (const Internal::Range &r, d->ranges) {
if (port >= r.first && port <= r.second) if (port >= r.first && port <= r.second)
return true; return true;
} }
@@ -175,26 +175,26 @@ bool PortList::contains(int port) const
int PortList::count() const int PortList::count() const
{ {
int n = 0; int n = 0;
foreach (const Internal::Range &r, m_d->ranges) foreach (const Internal::Range &r, d->ranges)
n += r.second - r.first + 1; n += r.second - r.first + 1;
return n; return n;
} }
int PortList::getNext() int PortList::getNext()
{ {
Q_ASSERT(!m_d->ranges.isEmpty()); Q_ASSERT(!d->ranges.isEmpty());
Internal::Range &firstRange = m_d->ranges.first(); Internal::Range &firstRange = d->ranges.first();
const int next = firstRange.first++; const int next = firstRange.first++;
if (firstRange.first > firstRange.second) if (firstRange.first > firstRange.second)
m_d->ranges.removeFirst(); d->ranges.removeFirst();
return next; return next;
} }
QString PortList::toString() const QString PortList::toString() const
{ {
QString stringRep; QString stringRep;
foreach (const Internal::Range &range, m_d->ranges) { foreach (const Internal::Range &range, d->ranges) {
stringRep += QString::number(range.first); stringRep += QString::number(range.first);
if (range.second != range.first) if (range.second != range.first)
stringRep += QLatin1Char('-') + QString::number(range.second); stringRep += QLatin1Char('-') + QString::number(range.second);

View File

@@ -60,7 +60,7 @@ public:
static QString regularExpression(); static QString regularExpression();
private: private:
Internal::PortListPrivate * const m_d; Internal::PortListPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -52,15 +52,15 @@ using namespace Internal;
PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const LinuxDeviceConfiguration::ConstPtr &deviceConfig, PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const LinuxDeviceConfiguration::ConstPtr &deviceConfig,
QWidget *parent) QWidget *parent)
: QProgressDialog(parent), m_d(new PublicKeyDeploymentDialogPrivate) : QProgressDialog(parent), d(new PublicKeyDeploymentDialogPrivate)
{ {
setAutoReset(false); setAutoReset(false);
setAutoClose(false); setAutoClose(false);
setMinimumDuration(0); setMinimumDuration(0);
setMaximum(1); setMaximum(1);
m_d->keyDeployer = new SshKeyDeployer(this); d->keyDeployer = new SshKeyDeployer(this);
m_d->done = false; d->done = false;
setLabelText(tr("Waiting for file name...")); setLabelText(tr("Waiting for file name..."));
const Utils::SshConnectionParameters sshParams = deviceConfig->sshParameters(); const Utils::SshConnectionParameters sshParams = deviceConfig->sshParameters();
@@ -76,21 +76,21 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const LinuxDeviceConfigurat
setLabelText(tr("Deploying...")); setLabelText(tr("Deploying..."));
setValue(0); setValue(0);
connect(this, SIGNAL(canceled()), SLOT(handleCanceled())); connect(this, SIGNAL(canceled()), SLOT(handleCanceled()));
connect(m_d->keyDeployer, SIGNAL(error(QString)), SLOT(handleDeploymentError(QString))); connect(d->keyDeployer, SIGNAL(error(QString)), SLOT(handleDeploymentError(QString)));
connect(m_d->keyDeployer, SIGNAL(finishedSuccessfully()), SLOT(handleDeploymentSuccess())); connect(d->keyDeployer, SIGNAL(finishedSuccessfully()), SLOT(handleDeploymentSuccess()));
m_d->keyDeployer->deployPublicKey(sshParams, publicKeyFileName); d->keyDeployer->deployPublicKey(sshParams, publicKeyFileName);
} }
PublicKeyDeploymentDialog::~PublicKeyDeploymentDialog() PublicKeyDeploymentDialog::~PublicKeyDeploymentDialog()
{ {
delete m_d; delete d;
} }
void PublicKeyDeploymentDialog::handleDeploymentSuccess() void PublicKeyDeploymentDialog::handleDeploymentSuccess()
{ {
handleDeploymentFinished(QString()); handleDeploymentFinished(QString());
setValue(1); setValue(1);
m_d->done = true; d->done = true;
} }
void PublicKeyDeploymentDialog::handleDeploymentError(const QString &errorMsg) void PublicKeyDeploymentDialog::handleDeploymentError(const QString &errorMsg)
@@ -115,9 +115,9 @@ void PublicKeyDeploymentDialog::handleDeploymentFinished(const QString &errorMsg
void PublicKeyDeploymentDialog::handleCanceled() void PublicKeyDeploymentDialog::handleCanceled()
{ {
disconnect(m_d->keyDeployer, 0, this, 0); disconnect(d->keyDeployer, 0, this, 0);
m_d->keyDeployer->stopDeployment(); d->keyDeployer->stopDeployment();
if (m_d->done) if (d->done)
accept(); accept();
else else
reject(); reject();

View File

@@ -63,7 +63,7 @@ private slots:
private: private:
void handleDeploymentFinished(const QString &errorMsg); void handleDeploymentFinished(const QString &errorMsg);
Internal::PublicKeyDeploymentDialogPrivate * const m_d; Internal::PublicKeyDeploymentDialogPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -66,14 +66,14 @@ public:
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n); QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const; QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
virtual bool allowsRemoteMounts() const=0; virtual bool allowsRemoteMounts() const = 0;
virtual bool allowsPackagingDisabling() const=0; virtual bool allowsPackagingDisabling() const = 0;
virtual bool allowsQmlDebugging() const=0; virtual bool allowsQmlDebugging() const = 0;
virtual QString projectVersion(QString *error = 0) const=0; virtual QString projectVersion(QString *error = 0) const = 0;
virtual QString packageName() const=0; virtual QString packageName() const = 0;
virtual QString shortDescription() const=0; virtual QString shortDescription() const = 0;
virtual QString packageFileName() const=0; virtual QString packageFileName() const = 0;
bool setProjectVersion(const QString &version, QString *error = 0); bool setProjectVersion(const QString &version, QString *error = 0);
bool setPackageName(const QString &packageName); bool setPackageName(const QString &packageName);
@@ -100,9 +100,9 @@ private:
virtual bool setShortDescriptionInternal(const QString &description)=0; virtual bool setShortDescriptionInternal(const QString &description)=0;
virtual ActionStatus createSpecialTemplates()=0; virtual ActionStatus createSpecialTemplates()=0;
virtual void handleTargetAddedSpecial()=0; virtual void handleTargetAddedSpecial()=0;
virtual bool targetCanBeRemoved() const=0; virtual bool targetCanBeRemoved() const = 0;
virtual void removeTarget()=0; virtual void removeTarget()=0;
virtual QStringList packagingFilePaths() const=0; virtual QStringList packagingFilePaths() const = 0;
ActionStatus createTemplates(); ActionStatus createTemplates();
bool initPackagingSettingsFromOtherTarget(); bool initPackagingSettingsFromOtherTarget();
@@ -124,7 +124,7 @@ public:
QString debianDirPath() const; QString debianDirPath() const;
QStringList debianFiles() const; QStringList debianFiles() const;
virtual QString debianDirName() const=0; virtual QString debianDirName() const = 0;
virtual QString projectVersion(QString *error = 0) const; virtual QString projectVersion(QString *error = 0) const;
virtual QString packageName() const; virtual QString packageName() const;
virtual QString shortDescription() const; virtual QString shortDescription() const;
@@ -135,7 +135,7 @@ public:
bool setPackageManagerName(const QString &name, QString *error = 0); bool setPackageManagerName(const QString &name, QString *error = 0);
QString packageManagerName() const; QString packageManagerName() const;
virtual QSize packageManagerIconSize() const=0; virtual QSize packageManagerIconSize() const = 0;
signals: signals:
void debianDirContentsChanged(); void debianDirContentsChanged();
@@ -163,8 +163,8 @@ private:
virtual QStringList packagingFilePaths() const; virtual QStringList packagingFilePaths() const;
virtual void addAdditionalControlFileFields(QByteArray &controlContents)=0; virtual void addAdditionalControlFileFields(QByteArray &controlContents)=0;
virtual QByteArray packageManagerNameFieldName() const=0; virtual QByteArray packageManagerNameFieldName() const = 0;
virtual QByteArray defaultSection() const=0; virtual QByteArray defaultSection() const = 0;
QString changeLogFilePath() const; QString changeLogFilePath() const;
QString controlFilePath() const; QString controlFilePath() const;
@@ -218,7 +218,7 @@ private:
virtual bool initAdditionalPackagingSettingsFromOtherTarget(); virtual bool initAdditionalPackagingSettingsFromOtherTarget();
virtual QStringList packagingFilePaths() const { return QStringList(specFilePath()); } virtual QStringList packagingFilePaths() const { return QStringList(specFilePath()); }
virtual QString specFileName() const=0; virtual QString specFileName() const = 0;
QByteArray getValueForTag(const QByteArray &tag, QString *error) const; QByteArray getValueForTag(const QByteArray &tag, QString *error) const;
bool setValueForTag(const QByteArray &tag, const QByteArray &value, bool setValueForTag(const QByteArray &tag, const QByteArray &value,

View File

@@ -96,55 +96,55 @@ using namespace Internal;
AbstractRemoteLinuxApplicationRunner::AbstractRemoteLinuxApplicationRunner(RemoteLinuxRunConfiguration *runConfig, AbstractRemoteLinuxApplicationRunner::AbstractRemoteLinuxApplicationRunner(RemoteLinuxRunConfiguration *runConfig,
QObject *parent) QObject *parent)
: QObject(parent), m_d(new AbstractRemoteLinuxApplicationRunnerPrivate(runConfig)) : QObject(parent), d(new AbstractRemoteLinuxApplicationRunnerPrivate(runConfig))
{ {
connect(&m_d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGathererError(QString))); connect(&d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGathererError(QString)));
connect(&m_d->portsGatherer, SIGNAL(portListReady()), SLOT(handleUsedPortsAvailable())); connect(&d->portsGatherer, SIGNAL(portListReady()), SLOT(handleUsedPortsAvailable()));
} }
AbstractRemoteLinuxApplicationRunner::~AbstractRemoteLinuxApplicationRunner() AbstractRemoteLinuxApplicationRunner::~AbstractRemoteLinuxApplicationRunner()
{ {
delete m_d; delete d;
} }
SshConnection::Ptr AbstractRemoteLinuxApplicationRunner::connection() const SshConnection::Ptr AbstractRemoteLinuxApplicationRunner::connection() const
{ {
return m_d->connection; return d->connection;
} }
LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxApplicationRunner::devConfig() const LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxApplicationRunner::devConfig() const
{ {
return m_d->devConfig; return d->devConfig;
} }
const RemoteLinuxUsedPortsGatherer *AbstractRemoteLinuxApplicationRunner::usedPortsGatherer() const const RemoteLinuxUsedPortsGatherer *AbstractRemoteLinuxApplicationRunner::usedPortsGatherer() const
{ {
return &m_d->portsGatherer; return &d->portsGatherer;
} }
PortList *AbstractRemoteLinuxApplicationRunner::freePorts() PortList *AbstractRemoteLinuxApplicationRunner::freePorts()
{ {
return &m_d->freePorts; return &d->freePorts;
} }
QString AbstractRemoteLinuxApplicationRunner::remoteExecutable() const QString AbstractRemoteLinuxApplicationRunner::remoteExecutable() const
{ {
return m_d->remoteExecutable; return d->remoteExecutable;
} }
QString AbstractRemoteLinuxApplicationRunner::arguments() const QString AbstractRemoteLinuxApplicationRunner::arguments() const
{ {
return m_d->appArguments; return d->appArguments;
} }
QString AbstractRemoteLinuxApplicationRunner::commandPrefix() const QString AbstractRemoteLinuxApplicationRunner::commandPrefix() const
{ {
return m_d->commandPrefix; return d->commandPrefix;
} }
void AbstractRemoteLinuxApplicationRunner::start() void AbstractRemoteLinuxApplicationRunner::start()
{ {
QTC_ASSERT(!m_d->stopRequested && m_d->state == Inactive, return); QTC_ASSERT(!d->stopRequested && d->state == Inactive, return);
QString errorMsg; QString errorMsg;
if (!canRun(errorMsg)) { if (!canRun(errorMsg)) {
@@ -152,22 +152,22 @@ void AbstractRemoteLinuxApplicationRunner::start()
return; return;
} }
m_d->state = SettingUpDevice; d->state = SettingUpDevice;
doDeviceSetup(); doDeviceSetup();
} }
void AbstractRemoteLinuxApplicationRunner::stop() void AbstractRemoteLinuxApplicationRunner::stop()
{ {
if (m_d->stopRequested) if (d->stopRequested)
return; return;
switch (m_d->state) { switch (d->state) {
case Connecting: case Connecting:
setInactive(); setInactive();
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
break; break;
case GatheringPorts: case GatheringPorts:
m_d->portsGatherer.stop(); d->portsGatherer.stop();
setInactive(); setInactive();
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
break; break;
@@ -177,15 +177,15 @@ void AbstractRemoteLinuxApplicationRunner::stop()
case AdditionalInitializing: case AdditionalInitializing:
case ProcessStarting: case ProcessStarting:
case PostRunCleaning: case PostRunCleaning:
m_d->stopRequested = true; // TODO: We might need stopPreRunCleaning() etc. for the subclasses d->stopRequested = true; // TODO: We might need stopPreRunCleaning() etc. for the subclasses
break; break;
case ReadyForExecution: case ReadyForExecution:
m_d->stopRequested = true; d->stopRequested = true;
m_d->state = PostRunCleaning; d->state = PostRunCleaning;
doPostRunCleanup(); doPostRunCleanup();
break; break;
case ProcessStarted: case ProcessStarted:
m_d->stopRequested = true; d->stopRequested = true;
cleanup(); cleanup();
break; break;
case Inactive: case Inactive:
@@ -195,38 +195,38 @@ void AbstractRemoteLinuxApplicationRunner::stop()
void AbstractRemoteLinuxApplicationRunner::handleConnected() void AbstractRemoteLinuxApplicationRunner::handleConnected()
{ {
QTC_ASSERT(m_d->state == Connecting, return); QTC_ASSERT(d->state == Connecting, return);
if (m_d->stopRequested) { if (d->stopRequested) {
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
setInactive(); setInactive();
} else { } else {
m_d->state = PreRunCleaning; d->state = PreRunCleaning;
cleanup(); cleanup();
} }
} }
void AbstractRemoteLinuxApplicationRunner::handleConnectionFailure() void AbstractRemoteLinuxApplicationRunner::handleConnectionFailure()
{ {
QTC_ASSERT(m_d->state != Inactive, return); QTC_ASSERT(d->state != Inactive, return);
if (m_d->state != Connecting || m_d->state != PreRunCleaning) if (d->state != Connecting || d->state != PreRunCleaning)
doAdditionalConnectionErrorHandling(); doAdditionalConnectionErrorHandling();
const QString errorMsg = m_d->state == Connecting const QString errorMsg = d->state == Connecting
? tr("Could not connect to host: %1") : tr("Connection error: %1"); ? tr("Could not connect to host: %1") : tr("Connection error: %1");
emitError(errorMsg.arg(m_d->connection->errorString())); emitError(errorMsg.arg(d->connection->errorString()));
} }
void AbstractRemoteLinuxApplicationRunner::cleanup() void AbstractRemoteLinuxApplicationRunner::cleanup()
{ {
QTC_ASSERT(m_d->state == PreRunCleaning QTC_ASSERT(d->state == PreRunCleaning
|| (m_d->state == ProcessStarted && m_d->stopRequested), return); || (d->state == ProcessStarted && d->stopRequested), return);
emit reportProgress(tr("Killing remote process(es)...")); emit reportProgress(tr("Killing remote process(es)..."));
m_d->cleaner = m_d->connection->createRemoteProcess(killApplicationCommandLine().toUtf8()); d->cleaner = d->connection->createRemoteProcess(killApplicationCommandLine().toUtf8());
connect(m_d->cleaner.data(), SIGNAL(closed(int)), SLOT(handleCleanupFinished(int))); connect(d->cleaner.data(), SIGNAL(closed(int)), SLOT(handleCleanupFinished(int)));
m_d->cleaner->start(); d->cleaner->start();
} }
void AbstractRemoteLinuxApplicationRunner::handleCleanupFinished(int exitStatus) void AbstractRemoteLinuxApplicationRunner::handleCleanupFinished(int exitStatus)
@@ -235,56 +235,56 @@ void AbstractRemoteLinuxApplicationRunner::handleCleanupFinished(int exitStatus)
|| exitStatus == SshRemoteProcess::KilledBySignal || exitStatus == SshRemoteProcess::KilledBySignal
|| exitStatus == SshRemoteProcess::ExitedNormally); || exitStatus == SshRemoteProcess::ExitedNormally);
QTC_ASSERT(m_d->state == PreRunCleaning QTC_ASSERT(d->state == PreRunCleaning
|| (m_d->state == ProcessStarted && m_d->stopRequested) || m_d->state == Inactive, return); || (d->state == ProcessStarted && d->stopRequested) || d->state == Inactive, return);
if (m_d->state == Inactive) if (d->state == Inactive)
return; return;
if (m_d->stopRequested && m_d->state == PreRunCleaning) { if (d->stopRequested && d->state == PreRunCleaning) {
setInactive(); setInactive();
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
return; return;
} }
if (m_d->stopRequested) { if (d->stopRequested) {
m_d->state = PostRunCleaning; d->state = PostRunCleaning;
doPostRunCleanup(); doPostRunCleanup();
return; return;
} }
if (exitStatus != SshRemoteProcess::ExitedNormally) { if (exitStatus != SshRemoteProcess::ExitedNormally) {
emitError(tr("Initial cleanup failed: %1").arg(m_d->cleaner->errorString())); emitError(tr("Initial cleanup failed: %1").arg(d->cleaner->errorString()));
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
return; return;
} }
m_d->state = AdditionalPreRunCleaning; d->state = AdditionalPreRunCleaning;
doAdditionalInitialCleanup(); doAdditionalInitialCleanup();
} }
void AbstractRemoteLinuxApplicationRunner::startExecution(const QByteArray &remoteCall) void AbstractRemoteLinuxApplicationRunner::startExecution(const QByteArray &remoteCall)
{ {
QTC_ASSERT(m_d->state == ReadyForExecution, return); QTC_ASSERT(d->state == ReadyForExecution, return);
if (m_d->stopRequested) if (d->stopRequested)
return; return;
m_d->runner = m_d->connection->createRemoteProcess(remoteCall); d->runner = d->connection->createRemoteProcess(remoteCall);
connect(m_d->runner.data(), SIGNAL(started()), SLOT(handleRemoteProcessStarted())); connect(d->runner.data(), SIGNAL(started()), SLOT(handleRemoteProcessStarted()));
connect(m_d->runner.data(), SIGNAL(closed(int)), SLOT(handleRemoteProcessFinished(int))); connect(d->runner.data(), SIGNAL(closed(int)), SLOT(handleRemoteProcessFinished(int)));
connect(m_d->runner.data(), SIGNAL(outputAvailable(QByteArray)), connect(d->runner.data(), SIGNAL(outputAvailable(QByteArray)),
SIGNAL(remoteOutput(QByteArray))); SIGNAL(remoteOutput(QByteArray)));
connect(m_d->runner.data(), SIGNAL(errorOutputAvailable(QByteArray)), connect(d->runner.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SIGNAL(remoteErrorOutput(QByteArray))); SIGNAL(remoteErrorOutput(QByteArray)));
m_d->state = ProcessStarting; d->state = ProcessStarting;
m_d->runner->start(); d->runner->start();
} }
void AbstractRemoteLinuxApplicationRunner::handleRemoteProcessStarted() void AbstractRemoteLinuxApplicationRunner::handleRemoteProcessStarted()
{ {
QTC_ASSERT(m_d->state == ProcessStarting, return); QTC_ASSERT(d->state == ProcessStarting, return);
m_d->state = ProcessStarted; d->state = ProcessStarted;
if (m_d->stopRequested) { if (d->stopRequested) {
cleanup(); cleanup();
return; return;
} }
@@ -298,32 +298,32 @@ void AbstractRemoteLinuxApplicationRunner::handleRemoteProcessFinished(int exitS
Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart
|| exitStatus == SshRemoteProcess::KilledBySignal || exitStatus == SshRemoteProcess::KilledBySignal
|| exitStatus == SshRemoteProcess::ExitedNormally); || exitStatus == SshRemoteProcess::ExitedNormally);
QTC_ASSERT(m_d->state == ProcessStarted || m_d->state == Inactive, return); QTC_ASSERT(d->state == ProcessStarted || d->state == Inactive, return);
m_d->exitStatus = exitStatus; d->exitStatus = exitStatus;
if (!m_d->stopRequested && m_d->state != Inactive) { if (!d->stopRequested && d->state != Inactive) {
m_d->state = PostRunCleaning; d->state = PostRunCleaning;
doPostRunCleanup(); doPostRunCleanup();
} }
} }
void AbstractRemoteLinuxApplicationRunner::setInactive() void AbstractRemoteLinuxApplicationRunner::setInactive()
{ {
m_d->portsGatherer.stop(); d->portsGatherer.stop();
if (m_d->connection) { if (d->connection) {
disconnect(m_d->connection.data(), 0, this, 0); disconnect(d->connection.data(), 0, this, 0);
SshConnectionManager::instance().releaseConnection(m_d->connection); SshConnectionManager::instance().releaseConnection(d->connection);
m_d->connection = SshConnection::Ptr(); d->connection = SshConnection::Ptr();
} }
if (m_d->cleaner) if (d->cleaner)
disconnect(m_d->cleaner.data(), 0, this, 0); disconnect(d->cleaner.data(), 0, this, 0);
m_d->stopRequested = false; d->stopRequested = false;
m_d->state = Inactive; d->state = Inactive;
} }
void AbstractRemoteLinuxApplicationRunner::emitError(const QString &errorMsg, bool force) void AbstractRemoteLinuxApplicationRunner::emitError(const QString &errorMsg, bool force)
{ {
if (m_d->state != Inactive) { if (d->state != Inactive) {
setInactive(); setInactive();
emit error(errorMsg); emit error(errorMsg);
} else if (force) { } else if (force) {
@@ -333,7 +333,7 @@ void AbstractRemoteLinuxApplicationRunner::emitError(const QString &errorMsg, bo
void AbstractRemoteLinuxApplicationRunner::handlePortsGathererError(const QString &errorMsg) void AbstractRemoteLinuxApplicationRunner::handlePortsGathererError(const QString &errorMsg)
{ {
if (m_d->state != Inactive) { if (d->state != Inactive) {
if (connection()->errorState() != SshNoError) { if (connection()->errorState() != SshNoError) {
emitError(errorMsg); emitError(errorMsg);
} else { } else {
@@ -345,26 +345,26 @@ void AbstractRemoteLinuxApplicationRunner::handlePortsGathererError(const QStrin
void AbstractRemoteLinuxApplicationRunner::handleUsedPortsAvailable() void AbstractRemoteLinuxApplicationRunner::handleUsedPortsAvailable()
{ {
QTC_ASSERT(m_d->state == GatheringPorts, return); QTC_ASSERT(d->state == GatheringPorts, return);
if (m_d->stopRequested) { if (d->stopRequested) {
setInactive(); setInactive();
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
return; return;
} }
m_d->state = AdditionalInitializing; d->state = AdditionalInitializing;
doAdditionalInitializations(); doAdditionalInitializations();
} }
bool AbstractRemoteLinuxApplicationRunner::canRun(QString &whyNot) const bool AbstractRemoteLinuxApplicationRunner::canRun(QString &whyNot) const
{ {
if (m_d->remoteExecutable.isEmpty()) { if (d->remoteExecutable.isEmpty()) {
whyNot = tr("No remote executable set."); whyNot = tr("No remote executable set.");
return false; return false;
} }
if (!m_d->devConfig) { if (!d->devConfig) {
whyNot = tr("No device configuration set."); whyNot = tr("No device configuration set.");
return false; return false;
} }
@@ -374,80 +374,80 @@ bool AbstractRemoteLinuxApplicationRunner::canRun(QString &whyNot) const
void AbstractRemoteLinuxApplicationRunner::setDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &deviceConfig) void AbstractRemoteLinuxApplicationRunner::setDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &deviceConfig)
{ {
m_d->devConfig = deviceConfig; d->devConfig = deviceConfig;
} }
void AbstractRemoteLinuxApplicationRunner::handleDeviceSetupDone(bool success) void AbstractRemoteLinuxApplicationRunner::handleDeviceSetupDone(bool success)
{ {
QTC_ASSERT(m_d->state == SettingUpDevice, return); QTC_ASSERT(d->state == SettingUpDevice, return);
if (!success || m_d->stopRequested) { if (!success || d->stopRequested) {
setInactive(); setInactive();
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
return; return;
} }
m_d->connection = SshConnectionManager::instance().acquireConnection(m_d->devConfig->sshParameters()); d->connection = SshConnectionManager::instance().acquireConnection(d->devConfig->sshParameters());
m_d->state = Connecting; d->state = Connecting;
m_d->exitStatus = -1; d->exitStatus = -1;
m_d->freePorts = m_d->initialFreePorts; d->freePorts = d->initialFreePorts;
connect(m_d->connection.data(), SIGNAL(connected()), SLOT(handleConnected())); connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
connect(m_d->connection.data(), SIGNAL(error(Utils::SshError)), connect(d->connection.data(), SIGNAL(error(Utils::SshError)),
SLOT(handleConnectionFailure())); SLOT(handleConnectionFailure()));
if (m_d->connection->state() == SshConnection::Connected) { if (d->connection->state() == SshConnection::Connected) {
handleConnected(); handleConnected();
} else { } else {
emit reportProgress(tr("Connecting to device...")); emit reportProgress(tr("Connecting to device..."));
if (m_d->connection->state() == Utils::SshConnection::Unconnected) if (d->connection->state() == Utils::SshConnection::Unconnected)
m_d->connection->connectToHost(); d->connection->connectToHost();
} }
} }
void AbstractRemoteLinuxApplicationRunner::handleInitialCleanupDone(bool success) void AbstractRemoteLinuxApplicationRunner::handleInitialCleanupDone(bool success)
{ {
QTC_ASSERT(m_d->state == AdditionalPreRunCleaning, return); QTC_ASSERT(d->state == AdditionalPreRunCleaning, return);
if (!success || m_d->stopRequested) { if (!success || d->stopRequested) {
setInactive(); setInactive();
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
return; return;
} }
m_d->state = GatheringPorts; d->state = GatheringPorts;
m_d->portsGatherer.start(m_d->connection, m_d->devConfig); d->portsGatherer.start(d->connection, d->devConfig);
} }
void AbstractRemoteLinuxApplicationRunner::handleInitializationsDone(bool success) void AbstractRemoteLinuxApplicationRunner::handleInitializationsDone(bool success)
{ {
QTC_ASSERT(m_d->state == AdditionalInitializing, return); QTC_ASSERT(d->state == AdditionalInitializing, return);
if (!success) { if (!success) {
setInactive(); setInactive();
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
return; return;
} }
if (m_d->stopRequested) { if (d->stopRequested) {
m_d->state = PostRunCleaning; d->state = PostRunCleaning;
doPostRunCleanup(); doPostRunCleanup();
return; return;
} }
m_d->state = ReadyForExecution; d->state = ReadyForExecution;
emit readyForExecution(); emit readyForExecution();
} }
void AbstractRemoteLinuxApplicationRunner::handlePostRunCleanupDone() void AbstractRemoteLinuxApplicationRunner::handlePostRunCleanupDone()
{ {
QTC_ASSERT(m_d->state == PostRunCleaning, return); QTC_ASSERT(d->state == PostRunCleaning, return);
const bool wasStopRequested = m_d->stopRequested; const bool wasStopRequested = d->stopRequested;
setInactive(); setInactive();
if (wasStopRequested) if (wasStopRequested)
emit remoteProcessFinished(InvalidExitCode); emit remoteProcessFinished(InvalidExitCode);
else if (m_d->exitStatus == SshRemoteProcess::ExitedNormally) else if (d->exitStatus == SshRemoteProcess::ExitedNormally)
emit remoteProcessFinished(m_d->runner->exitCode()); emit remoteProcessFinished(d->runner->exitCode());
else else
emit error(tr("Error running remote process: %1").arg(m_d->runner->errorString())); emit error(tr("Error running remote process: %1").arg(d->runner->errorString()));
} }
const qint64 AbstractRemoteLinuxApplicationRunner::InvalidExitCode = std::numeric_limits<qint64>::min(); const qint64 AbstractRemoteLinuxApplicationRunner::InvalidExitCode = std::numeric_limits<qint64>::min();

View File

@@ -105,7 +105,7 @@ private slots:
private: private:
virtual QString killApplicationCommandLine() const=0; virtual QString killApplicationCommandLine() const = 0;
// Implement to do custom setup of the device *before* connecting. // Implement to do custom setup of the device *before* connecting.
// Call handleDeviceSetupDone() afterwards. // Call handleDeviceSetupDone() afterwards.
@@ -127,7 +127,7 @@ private:
void emitError(const QString &errorMsg, bool force = false); void emitError(const QString &errorMsg, bool force = false);
void cleanup(); void cleanup();
Internal::AbstractRemoteLinuxApplicationRunnerPrivate * const m_d; Internal::AbstractRemoteLinuxApplicationRunnerPrivate * const d;
}; };

View File

@@ -135,28 +135,28 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R
AbstractRemoteLinuxDebugSupport::AbstractRemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig, AbstractRemoteLinuxDebugSupport::AbstractRemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig,
DebuggerEngine *engine) DebuggerEngine *engine)
: QObject(engine), m_d(new AbstractRemoteLinuxDebugSupportPrivate(runConfig, engine)) : QObject(engine), d(new AbstractRemoteLinuxDebugSupportPrivate(runConfig, engine))
{ {
connect(m_d->engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested())); connect(d->engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested()));
} }
AbstractRemoteLinuxDebugSupport::~AbstractRemoteLinuxDebugSupport() AbstractRemoteLinuxDebugSupport::~AbstractRemoteLinuxDebugSupport()
{ {
setFinished(); setFinished();
delete m_d; delete d;
} }
void AbstractRemoteLinuxDebugSupport::showMessage(const QString &msg, int channel) void AbstractRemoteLinuxDebugSupport::showMessage(const QString &msg, int channel)
{ {
if (m_d->engine) if (d->engine)
m_d->engine->showMessage(msg, channel); d->engine->showMessage(msg, channel);
} }
void AbstractRemoteLinuxDebugSupport::handleAdapterSetupRequested() void AbstractRemoteLinuxDebugSupport::handleAdapterSetupRequested()
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
m_d->state = StartingRunner; d->state = StartingRunner;
showMessage(tr("Preparing remote side ...\n"), AppStuff); showMessage(tr("Preparing remote side ...\n"), AppStuff);
disconnect(runner(), 0, this, 0); disconnect(runner(), 0, this, 0);
connect(runner(), SIGNAL(error(QString)), this, SLOT(handleSshError(QString))); connect(runner(), SIGNAL(error(QString)), this, SLOT(handleSshError(QString)));
@@ -167,52 +167,52 @@ void AbstractRemoteLinuxDebugSupport::handleAdapterSetupRequested()
void AbstractRemoteLinuxDebugSupport::handleSshError(const QString &error) void AbstractRemoteLinuxDebugSupport::handleSshError(const QString &error)
{ {
if (m_d->state == Debugging) { if (d->state == Debugging) {
showMessage(error, AppError); showMessage(error, AppError);
if (m_d->engine) if (d->engine)
m_d->engine->notifyInferiorIll(); d->engine->notifyInferiorIll();
} else if (m_d->state != Inactive) { } else if (d->state != Inactive) {
handleAdapterSetupFailed(error); handleAdapterSetupFailed(error);
} }
} }
void AbstractRemoteLinuxDebugSupport::startExecution() void AbstractRemoteLinuxDebugSupport::startExecution()
{ {
if (m_d->state == Inactive) if (d->state == Inactive)
return; return;
QTC_ASSERT(m_d->state == StartingRunner, return); QTC_ASSERT(d->state == StartingRunner, return);
if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { if (d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
if (!setPort(m_d->gdbServerPort)) if (!setPort(d->gdbServerPort))
return; return;
} }
if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { if (d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
if (!setPort(m_d->qmlPort)) if (!setPort(d->qmlPort))
return; return;
} }
m_d->state = StartingRemoteProcess; d->state = StartingRemoteProcess;
m_d->gdbserverOutput.clear(); d->gdbserverOutput.clear();
connect(runner(), SIGNAL(remoteErrorOutput(QByteArray)), this, connect(runner(), SIGNAL(remoteErrorOutput(QByteArray)), this,
SLOT(handleRemoteErrorOutput(QByteArray))); SLOT(handleRemoteErrorOutput(QByteArray)));
connect(runner(), SIGNAL(remoteOutput(QByteArray)), this, connect(runner(), SIGNAL(remoteOutput(QByteArray)), this,
SLOT(handleRemoteOutput(QByteArray))); SLOT(handleRemoteOutput(QByteArray)));
if (m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) { if (d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) {
connect(runner(), SIGNAL(remoteProcessStarted()), connect(runner(), SIGNAL(remoteProcessStarted()),
SLOT(handleRemoteProcessStarted())); SLOT(handleRemoteProcessStarted()));
} }
const QString &remoteExe = runner()->remoteExecutable(); const QString &remoteExe = runner()->remoteExecutable();
QString args = runner()->arguments(); QString args = runner()->arguments();
if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { if (d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
args += QString(QLatin1String(" -qmljsdebugger=port:%1,block")) args += QString(QLatin1String(" -qmljsdebugger=port:%1,block"))
.arg(m_d->qmlPort); .arg(d->qmlPort);
} }
const QString remoteCommandLine = m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly const QString remoteCommandLine = d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly
? QString::fromLocal8Bit("%1 %2 %3").arg(runner()->commandPrefix()).arg(remoteExe).arg(args) ? QString::fromLocal8Bit("%1 %2 %3").arg(runner()->commandPrefix()).arg(remoteExe).arg(args)
: QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4").arg(runner()->commandPrefix()) : QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4").arg(runner()->commandPrefix())
.arg(m_d->gdbServerPort).arg(remoteExe).arg(args); .arg(d->gdbServerPort).arg(remoteExe).arg(args);
connect(runner(), SIGNAL(remoteProcessFinished(qint64)), connect(runner(), SIGNAL(remoteProcessFinished(qint64)),
SLOT(handleRemoteProcessFinished(qint64))); SLOT(handleRemoteProcessFinished(qint64)));
runner()->startExecution(remoteCommandLine.toUtf8()); runner()->startExecution(remoteCommandLine.toUtf8());
@@ -220,21 +220,21 @@ void AbstractRemoteLinuxDebugSupport::startExecution()
void AbstractRemoteLinuxDebugSupport::handleRemoteProcessFinished(qint64 exitCode) void AbstractRemoteLinuxDebugSupport::handleRemoteProcessFinished(qint64 exitCode)
{ {
if (!m_d->engine || m_d->state == Inactive) if (!d->engine || d->state == Inactive)
return; return;
if (m_d->state == Debugging) { if (d->state == Debugging) {
// The QML engine does not realize on its own that the application has finished. // The QML engine does not realize on its own that the application has finished.
if (m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) if (d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly)
m_d->engine->quitDebugger(); d->engine->quitDebugger();
else if (exitCode != 0) else if (exitCode != 0)
m_d->engine->notifyInferiorIll(); d->engine->notifyInferiorIll();
} else { } else {
const QString errorMsg = m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly const QString errorMsg = d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly
? tr("Remote application failed with exit code %1.").arg(exitCode) ? tr("Remote application failed with exit code %1.").arg(exitCode)
: tr("The gdbserver process closed unexpectedly."); : tr("The gdbserver process closed unexpectedly.");
m_d->engine->handleRemoteSetupFailed(errorMsg); d->engine->handleRemoteSetupFailed(errorMsg);
} }
} }
@@ -245,26 +245,26 @@ void AbstractRemoteLinuxDebugSupport::handleDebuggingFinished()
void AbstractRemoteLinuxDebugSupport::handleRemoteOutput(const QByteArray &output) void AbstractRemoteLinuxDebugSupport::handleRemoteOutput(const QByteArray &output)
{ {
QTC_ASSERT(m_d->state == Inactive || m_d->state == Debugging, return); QTC_ASSERT(d->state == Inactive || d->state == Debugging, return);
showMessage(QString::fromUtf8(output), AppOutput); showMessage(QString::fromUtf8(output), AppOutput);
} }
void AbstractRemoteLinuxDebugSupport::handleRemoteErrorOutput(const QByteArray &output) void AbstractRemoteLinuxDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
{ {
QTC_ASSERT(m_d->state == Inactive || m_d->state == StartingRemoteProcess || m_d->state == Debugging, QTC_ASSERT(d->state == Inactive || d->state == StartingRemoteProcess || d->state == Debugging,
return); return);
if (!m_d->engine) if (!d->engine)
return; return;
showMessage(QString::fromUtf8(output), AppOutput); showMessage(QString::fromUtf8(output), AppOutput);
if (m_d->state == StartingRemoteProcess if (d->state == StartingRemoteProcess
&& m_d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { && d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
m_d->gdbserverOutput += output; d->gdbserverOutput += output;
if (m_d->gdbserverOutput.contains("Listening on port")) { if (d->gdbserverOutput.contains("Listening on port")) {
handleAdapterSetupDone(); handleAdapterSetupDone();
m_d->gdbserverOutput.clear(); d->gdbserverOutput.clear();
} }
} }
} }
@@ -277,28 +277,28 @@ void AbstractRemoteLinuxDebugSupport::handleProgressReport(const QString &progre
void AbstractRemoteLinuxDebugSupport::handleAdapterSetupFailed(const QString &error) void AbstractRemoteLinuxDebugSupport::handleAdapterSetupFailed(const QString &error)
{ {
setFinished(); setFinished();
m_d->engine->handleRemoteSetupFailed(tr("Initial setup failed: %1").arg(error)); d->engine->handleRemoteSetupFailed(tr("Initial setup failed: %1").arg(error));
} }
void AbstractRemoteLinuxDebugSupport::handleAdapterSetupDone() void AbstractRemoteLinuxDebugSupport::handleAdapterSetupDone()
{ {
m_d->state = Debugging; d->state = Debugging;
m_d->engine->handleRemoteSetupDone(m_d->gdbServerPort, m_d->qmlPort); d->engine->handleRemoteSetupDone(d->gdbServerPort, d->qmlPort);
} }
void AbstractRemoteLinuxDebugSupport::handleRemoteProcessStarted() void AbstractRemoteLinuxDebugSupport::handleRemoteProcessStarted()
{ {
Q_ASSERT(m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly); Q_ASSERT(d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly);
QTC_ASSERT(m_d->state == StartingRemoteProcess, return); QTC_ASSERT(d->state == StartingRemoteProcess, return);
handleAdapterSetupDone(); handleAdapterSetupDone();
} }
void AbstractRemoteLinuxDebugSupport::setFinished() void AbstractRemoteLinuxDebugSupport::setFinished()
{ {
if (m_d->state == Inactive) if (d->state == Inactive)
return; return;
m_d->state = Inactive; d->state = Inactive;
runner()->stop(); runner()->stop();
} }
@@ -316,18 +316,18 @@ bool AbstractRemoteLinuxDebugSupport::setPort(int &port)
RemoteLinuxDebugSupport::RemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig, RemoteLinuxDebugSupport::RemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig,
DebuggerEngine *engine) DebuggerEngine *engine)
: AbstractRemoteLinuxDebugSupport(runConfig, engine), : AbstractRemoteLinuxDebugSupport(runConfig, engine),
m_d(new RemoteLinuxDebugSupportPrivate(runConfig)) d(new RemoteLinuxDebugSupportPrivate(runConfig))
{ {
} }
RemoteLinuxDebugSupport::~RemoteLinuxDebugSupport() RemoteLinuxDebugSupport::~RemoteLinuxDebugSupport()
{ {
delete m_d; delete d;
} }
AbstractRemoteLinuxApplicationRunner *RemoteLinuxDebugSupport::runner() const AbstractRemoteLinuxApplicationRunner *RemoteLinuxDebugSupport::runner() const
{ {
return &m_d->runner; return &d->runner;
} }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -75,7 +75,7 @@ private slots:
private: private:
virtual AbstractRemoteLinuxApplicationRunner *runner() const=0; virtual AbstractRemoteLinuxApplicationRunner *runner() const = 0;
void handleAdapterSetupFailed(const QString &error); void handleAdapterSetupFailed(const QString &error);
void handleAdapterSetupDone(); void handleAdapterSetupDone();
@@ -83,7 +83,7 @@ private:
bool setPort(int &port); bool setPort(int &port);
void showMessage(const QString &msg, int channel); void showMessage(const QString &msg, int channel);
Internal::AbstractRemoteLinuxDebugSupportPrivate * const m_d; Internal::AbstractRemoteLinuxDebugSupportPrivate * const d;
}; };
@@ -97,7 +97,7 @@ public:
private: private:
AbstractRemoteLinuxApplicationRunner *runner() const; AbstractRemoteLinuxApplicationRunner *runner() const;
Internal::RemoteLinuxDebugSupportPrivate * const m_d; Internal::RemoteLinuxDebugSupportPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -62,9 +62,9 @@ using namespace Internal;
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
const QString &id, const QString &defaultDisplayName, const QString &supportedOsType) const QString &id, const QString &defaultDisplayName, const QString &supportedOsType)
: DeployConfiguration(target, id), m_d(new RemoteLinuxDeployConfigurationPrivate) : DeployConfiguration(target, id), d(new RemoteLinuxDeployConfigurationPrivate)
{ {
m_d->supportedOsType = supportedOsType; d->supportedOsType = supportedOsType;
setDefaultDisplayName(defaultDisplayName); setDefaultDisplayName(defaultDisplayName);
// A DeploymentInfo object is only dependent on the active build // A DeploymentInfo object is only dependent on the active build
@@ -77,14 +77,14 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
const RemoteLinuxDeployConfiguration * const mdc const RemoteLinuxDeployConfiguration * const mdc
= qobject_cast<const RemoteLinuxDeployConfiguration *>(dc); = qobject_cast<const RemoteLinuxDeployConfiguration *>(dc);
if (mdc) { if (mdc) {
m_d->deploymentInfo = mdc->deploymentInfo(); d->deploymentInfo = mdc->deploymentInfo();
m_d->devConfModel = mdc->m_d->devConfModel; d->devConfModel = mdc->d->devConfModel;
break; break;
} }
} }
if (!m_d->deploymentInfo) { if (!d->deploymentInfo) {
m_d->deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target))); d->deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target)));
m_d->devConfModel = QSharedPointer<TypeSpecificDeviceConfigurationListModel> d->devConfModel = QSharedPointer<TypeSpecificDeviceConfigurationListModel>
(new TypeSpecificDeviceConfigurationListModel(supportedOsType)); (new TypeSpecificDeviceConfigurationListModel(supportedOsType));
} }
@@ -93,34 +93,34 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
RemoteLinuxDeployConfiguration *source) RemoteLinuxDeployConfiguration *source)
: DeployConfiguration(target, source), m_d(new RemoteLinuxDeployConfigurationPrivate) : DeployConfiguration(target, source), d(new RemoteLinuxDeployConfigurationPrivate)
{ {
m_d->supportedOsType = source->supportedOsType(); d->supportedOsType = source->supportedOsType();
m_d->deploymentInfo = source->deploymentInfo(); d->deploymentInfo = source->deploymentInfo();
m_d->devConfModel = source->deviceConfigModel(); d->devConfModel = source->deviceConfigModel();
initialize(); initialize();
} }
RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration() RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration()
{ {
delete m_d; delete d;
} }
void RemoteLinuxDeployConfiguration::initialize() void RemoteLinuxDeployConfiguration::initialize()
{ {
m_d->deviceConfiguration = deviceConfigModel()->defaultDeviceConfig(); d->deviceConfiguration = deviceConfigModel()->defaultDeviceConfig();
connect(deviceConfigModel().data(), SIGNAL(updated()), connect(deviceConfigModel().data(), SIGNAL(updated()),
SLOT(handleDeviceConfigurationListUpdated())); SLOT(handleDeviceConfigurationListUpdated()));
} }
void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated() void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
{ {
setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(m_d->deviceConfiguration)); setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(d->deviceConfiguration));
} }
void RemoteLinuxDeployConfiguration::setDeviceConfig(LinuxDeviceConfiguration::Id internalId) void RemoteLinuxDeployConfiguration::setDeviceConfig(LinuxDeviceConfiguration::Id internalId)
{ {
m_d->deviceConfiguration = deviceConfigModel()->find(internalId); d->deviceConfiguration = deviceConfigModel()->find(internalId);
emit deviceConfigurationListChanged(); emit deviceConfigurationListChanged();
emit currentDeviceConfigurationChanged(); emit currentDeviceConfigurationChanged();
} }
@@ -138,15 +138,15 @@ QVariantMap RemoteLinuxDeployConfiguration::toMap() const
{ {
QVariantMap map = DeployConfiguration::toMap(); QVariantMap map = DeployConfiguration::toMap();
map.insert(QLatin1String(DeviceIdKey), map.insert(QLatin1String(DeviceIdKey),
LinuxDeviceConfigurations::instance()->internalId(m_d->deviceConfiguration)); LinuxDeviceConfigurations::instance()->internalId(d->deviceConfiguration));
return map; return map;
} }
void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index) void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index)
{ {
const LinuxDeviceConfiguration::ConstPtr &newDevConf = deviceConfigModel()->deviceAt(index); const LinuxDeviceConfiguration::ConstPtr &newDevConf = deviceConfigModel()->deviceAt(index);
if (m_d->deviceConfiguration != newDevConf) { if (d->deviceConfiguration != newDevConf) {
m_d->deviceConfiguration = newDevConf; d->deviceConfiguration = newDevConf;
emit currentDeviceConfigurationChanged(); emit currentDeviceConfigurationChanged();
} }
} }
@@ -158,22 +158,22 @@ DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget()
QSharedPointer<DeploymentInfo> RemoteLinuxDeployConfiguration::deploymentInfo() const QSharedPointer<DeploymentInfo> RemoteLinuxDeployConfiguration::deploymentInfo() const
{ {
return m_d->deploymentInfo; return d->deploymentInfo;
} }
QSharedPointer<TypeSpecificDeviceConfigurationListModel> RemoteLinuxDeployConfiguration::deviceConfigModel() const QSharedPointer<TypeSpecificDeviceConfigurationListModel> RemoteLinuxDeployConfiguration::deviceConfigModel() const
{ {
return m_d->devConfModel; return d->devConfModel;
} }
LinuxDeviceConfiguration::ConstPtr RemoteLinuxDeployConfiguration::deviceConfiguration() const LinuxDeviceConfiguration::ConstPtr RemoteLinuxDeployConfiguration::deviceConfiguration() const
{ {
return m_d->deviceConfiguration; return d->deviceConfiguration;
} }
QString RemoteLinuxDeployConfiguration::supportedOsType() const QString RemoteLinuxDeployConfiguration::supportedOsType() const
{ {
return m_d->supportedOsType; return d->supportedOsType;
} }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -94,7 +94,7 @@ private:
void setDeviceConfig(LinuxDeviceConfiguration::Id internalId); void setDeviceConfig(LinuxDeviceConfiguration::Id internalId);
Q_SLOT void handleDeviceConfigurationListUpdated(); Q_SLOT void handleDeviceConfigurationListUpdated();
Internal::RemoteLinuxDeployConfigurationPrivate * const m_d; Internal::RemoteLinuxDeployConfigurationPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -58,102 +58,102 @@ public:
using namespace Internal; using namespace Internal;
RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(QWidget *parent) : RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(QWidget *parent) :
DeployConfigurationWidget(parent), m_d(new RemoteLinuxDeployConfigurationWidgetPrivate) DeployConfigurationWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate)
{ {
m_d->ui.setupUi(this); d->ui.setupUi(this);
} }
RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget() RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget()
{ {
delete m_d; delete d;
} }
void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc) void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc)
{ {
m_d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc); d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc);
Q_ASSERT(m_d->deployConfiguration); Q_ASSERT(d->deployConfiguration);
connect(m_d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)), connect(d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)),
SLOT(showDeviceConfigurations())); SLOT(showDeviceConfigurations()));
m_d->ui.deviceConfigsComboBox->setModel(m_d->deployConfiguration->deviceConfigModel().data()); d->ui.deviceConfigsComboBox->setModel(d->deployConfiguration->deviceConfigModel().data());
connect(m_d->ui.deviceConfigsComboBox, SIGNAL(activated(int)), connect(d->ui.deviceConfigsComboBox, SIGNAL(activated(int)),
SLOT(handleSelectedDeviceConfigurationChanged(int))); SLOT(handleSelectedDeviceConfigurationChanged(int)));
connect(m_d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), connect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()),
SLOT(handleDeviceConfigurationListChanged())); SLOT(handleDeviceConfigurationListChanged()));
handleDeviceConfigurationListChanged(); handleDeviceConfigurationListChanged();
m_d->ui.projectsComboBox->setModel(m_d->deployConfiguration->deploymentInfo().data()); d->ui.projectsComboBox->setModel(d->deployConfiguration->deploymentInfo().data());
connect(m_d->deployConfiguration->deploymentInfo().data(), SIGNAL(modelAboutToBeReset()), connect(d->deployConfiguration->deploymentInfo().data(), SIGNAL(modelAboutToBeReset()),
SLOT(handleModelListToBeReset())); SLOT(handleModelListToBeReset()));
// Queued connection because of race condition with combo box's reaction // Queued connection because of race condition with combo box's reaction
// to modelReset(). // to modelReset().
connect(m_d->deployConfiguration->deploymentInfo().data(), SIGNAL(modelReset()), connect(d->deployConfiguration->deploymentInfo().data(), SIGNAL(modelReset()),
SLOT(handleModelListReset()), Qt::QueuedConnection); SLOT(handleModelListReset()), Qt::QueuedConnection);
connect(m_d->ui.projectsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModel(int))); connect(d->ui.projectsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModel(int)));
handleModelListReset(); handleModelListReset();
} }
RemoteLinuxDeployConfiguration *RemoteLinuxDeployConfigurationWidget::deployConfiguration() const RemoteLinuxDeployConfiguration *RemoteLinuxDeployConfigurationWidget::deployConfiguration() const
{ {
return m_d->deployConfiguration; return d->deployConfiguration;
} }
DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel() const DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel() const
{ {
const int modelRow = m_d->ui.projectsComboBox->currentIndex(); const int modelRow = d->ui.projectsComboBox->currentIndex();
if (modelRow == -1) if (modelRow == -1)
return 0; return 0;
return m_d->deployConfiguration->deploymentInfo()->modelAt(modelRow); return d->deployConfiguration->deploymentInfo()->modelAt(modelRow);
} }
void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset() void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset()
{ {
m_d->ui.tableView->setModel(0); d->ui.tableView->setModel(0);
} }
void RemoteLinuxDeployConfigurationWidget::handleModelListReset() void RemoteLinuxDeployConfigurationWidget::handleModelListReset()
{ {
QTC_ASSERT(m_d->deployConfiguration->deploymentInfo()->modelCount() QTC_ASSERT(d->deployConfiguration->deploymentInfo()->modelCount()
== m_d->ui.projectsComboBox->count(), return); == d->ui.projectsComboBox->count(), return);
if (m_d->deployConfiguration->deploymentInfo()->modelCount() > 0) { if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) {
if (m_d->ui.projectsComboBox->currentIndex() == -1) if (d->ui.projectsComboBox->currentIndex() == -1)
m_d->ui.projectsComboBox->setCurrentIndex(0); d->ui.projectsComboBox->setCurrentIndex(0);
else else
setModel(m_d->ui.projectsComboBox->currentIndex()); setModel(d->ui.projectsComboBox->currentIndex());
} }
} }
void RemoteLinuxDeployConfigurationWidget::setModel(int row) void RemoteLinuxDeployConfigurationWidget::setModel(int row)
{ {
DeployableFilesPerProFile * const proFileInfo = row == -1 DeployableFilesPerProFile * const proFileInfo = row == -1
? 0 : m_d->deployConfiguration->deploymentInfo()->modelAt(row); ? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row);
m_d->ui.tableView->setModel(proFileInfo); d->ui.tableView->setModel(proFileInfo);
if (proFileInfo) if (proFileInfo)
m_d->ui.tableView->resizeRowsToContents(); d->ui.tableView->resizeRowsToContents();
emit currentModelChanged(proFileInfo); emit currentModelChanged(proFileInfo);
} }
void RemoteLinuxDeployConfigurationWidget::handleSelectedDeviceConfigurationChanged(int index) void RemoteLinuxDeployConfigurationWidget::handleSelectedDeviceConfigurationChanged(int index)
{ {
disconnect(m_d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), this, disconnect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), this,
SLOT(handleDeviceConfigurationListChanged())); SLOT(handleDeviceConfigurationListChanged()));
m_d->deployConfiguration->setDeviceConfiguration(index); d->deployConfiguration->setDeviceConfiguration(index);
connect(m_d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), connect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()),
SLOT(handleDeviceConfigurationListChanged())); SLOT(handleDeviceConfigurationListChanged()));
} }
void RemoteLinuxDeployConfigurationWidget::handleDeviceConfigurationListChanged() void RemoteLinuxDeployConfigurationWidget::handleDeviceConfigurationListChanged()
{ {
const LinuxDeviceConfiguration::ConstPtr &devConf const LinuxDeviceConfiguration::ConstPtr &devConf
= m_d->deployConfiguration->deviceConfiguration(); = d->deployConfiguration->deviceConfiguration();
const LinuxDeviceConfiguration::Id internalId const LinuxDeviceConfiguration::Id internalId
= LinuxDeviceConfigurations::instance()->internalId(devConf); = LinuxDeviceConfigurations::instance()->internalId(devConf);
const int newIndex = m_d->deployConfiguration->deviceConfigModel()->indexForInternalId(internalId); const int newIndex = d->deployConfiguration->deviceConfigModel()->indexForInternalId(internalId);
m_d->ui.deviceConfigsComboBox->setCurrentIndex(newIndex); d->ui.deviceConfigsComboBox->setCurrentIndex(newIndex);
} }
void RemoteLinuxDeployConfigurationWidget::showDeviceConfigurations() void RemoteLinuxDeployConfigurationWidget::showDeviceConfigurations()

View File

@@ -69,7 +69,7 @@ private slots:
void showDeviceConfigurations(); void showDeviceConfigurations();
private: private:
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const m_d; Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -54,64 +54,64 @@ public:
} // namespace Internal } // namespace Internal
AbstractRemoteLinuxPackageInstaller::AbstractRemoteLinuxPackageInstaller(QObject *parent) AbstractRemoteLinuxPackageInstaller::AbstractRemoteLinuxPackageInstaller(QObject *parent)
: QObject(parent), m_d(new Internal::AbstractRemoteLinuxPackageInstallerPrivate) : QObject(parent), d(new Internal::AbstractRemoteLinuxPackageInstallerPrivate)
{ {
} }
AbstractRemoteLinuxPackageInstaller::~AbstractRemoteLinuxPackageInstaller() AbstractRemoteLinuxPackageInstaller::~AbstractRemoteLinuxPackageInstaller()
{ {
delete m_d; delete d;
} }
void AbstractRemoteLinuxPackageInstaller::installPackage(const SshConnection::Ptr &connection, void AbstractRemoteLinuxPackageInstaller::installPackage(const SshConnection::Ptr &connection,
const QString &packageFilePath, bool removePackageFile) const QString &packageFilePath, bool removePackageFile)
{ {
QTC_ASSERT(connection && connection->state() == SshConnection::Connected QTC_ASSERT(connection && connection->state() == SshConnection::Connected
&& !m_d->isRunning, return); && !d->isRunning, return);
prepareInstallation(); prepareInstallation();
m_d->installer = SshRemoteProcessRunner::create(connection); d->installer = SshRemoteProcessRunner::create(connection);
connect(m_d->installer.data(), SIGNAL(connectionError(Utils::SshError)), connect(d->installer.data(), SIGNAL(connectionError(Utils::SshError)),
SLOT(handleConnectionError())); SLOT(handleConnectionError()));
connect(m_d->installer.data(), SIGNAL(processOutputAvailable(QByteArray)), connect(d->installer.data(), SIGNAL(processOutputAvailable(QByteArray)),
SLOT(handleInstallerOutput(QByteArray))); SLOT(handleInstallerOutput(QByteArray)));
connect(m_d->installer.data(), SIGNAL(processErrorOutputAvailable(QByteArray)), connect(d->installer.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
SLOT(handleInstallerErrorOutput(QByteArray))); SLOT(handleInstallerErrorOutput(QByteArray)));
connect(m_d->installer.data(), SIGNAL(processClosed(int)), SLOT(handleInstallationFinished(int))); connect(d->installer.data(), SIGNAL(processClosed(int)), SLOT(handleInstallationFinished(int)));
QString cmdLine = installCommandLine(packageFilePath); QString cmdLine = installCommandLine(packageFilePath);
if (removePackageFile) if (removePackageFile)
cmdLine += QLatin1String(" && (rm ") + packageFilePath + QLatin1String(" || :)"); cmdLine += QLatin1String(" && (rm ") + packageFilePath + QLatin1String(" || :)");
m_d->installer->run(cmdLine.toUtf8()); d->installer->run(cmdLine.toUtf8());
m_d->isRunning = true; d->isRunning = true;
} }
void AbstractRemoteLinuxPackageInstaller::cancelInstallation() void AbstractRemoteLinuxPackageInstaller::cancelInstallation()
{ {
QTC_ASSERT(m_d->installer && m_d->installer->connection()->state() == SshConnection::Connected QTC_ASSERT(d->installer && d->installer->connection()->state() == SshConnection::Connected
&& m_d->isRunning, return); && d->isRunning, return);
const SshRemoteProcessRunner::Ptr killProcess const SshRemoteProcessRunner::Ptr killProcess
= SshRemoteProcessRunner::create(m_d->installer->connection()); = SshRemoteProcessRunner::create(d->installer->connection());
killProcess->run(cancelInstallationCommandLine().toUtf8()); killProcess->run(cancelInstallationCommandLine().toUtf8());
setFinished(); setFinished();
} }
void AbstractRemoteLinuxPackageInstaller::handleConnectionError() void AbstractRemoteLinuxPackageInstaller::handleConnectionError()
{ {
if (!m_d->isRunning) if (!d->isRunning)
return; return;
emit finished(tr("Connection failure: %1").arg(m_d->installer->connection()->errorString())); emit finished(tr("Connection failure: %1").arg(d->installer->connection()->errorString()));
setFinished(); setFinished();
} }
void AbstractRemoteLinuxPackageInstaller::handleInstallationFinished(int exitStatus) void AbstractRemoteLinuxPackageInstaller::handleInstallationFinished(int exitStatus)
{ {
if (!m_d->isRunning) if (!d->isRunning)
return; return;
if (exitStatus != SshRemoteProcess::ExitedNormally if (exitStatus != SshRemoteProcess::ExitedNormally
|| m_d->installer->process()->exitCode() != 0) { || d->installer->process()->exitCode() != 0) {
emit finished(tr("Installing package failed.")); emit finished(tr("Installing package failed."));
} else if (!errorString().isEmpty()) { } else if (!errorString().isEmpty()) {
emit finished(errorString()); emit finished(errorString());
@@ -134,9 +134,9 @@ void AbstractRemoteLinuxPackageInstaller::handleInstallerErrorOutput(const QByte
void AbstractRemoteLinuxPackageInstaller::setFinished() void AbstractRemoteLinuxPackageInstaller::setFinished()
{ {
disconnect(m_d->installer.data(), 0, this, 0); disconnect(d->installer.data(), 0, this, 0);
m_d->installer.clear(); d->installer.clear();
m_d->isRunning = false; d->isRunning = false;
} }

View File

@@ -73,15 +73,15 @@ private slots:
void handleInstallerErrorOutput(const QByteArray &output); void handleInstallerErrorOutput(const QByteArray &output);
private: private:
virtual QString installCommandLine(const QString &packageFilePath) const=0; virtual QString installCommandLine(const QString &packageFilePath) const = 0;
virtual QString cancelInstallationCommandLine() const=0; virtual QString cancelInstallationCommandLine() const = 0;
virtual void prepareInstallation() {} virtual void prepareInstallation() {}
virtual QString errorString() const { return QString(); } virtual QString errorString() const { return QString(); }
void setFinished(); void setFinished();
Internal::AbstractRemoteLinuxPackageInstallerPrivate * const m_d; Internal::AbstractRemoteLinuxPackageInstallerPrivate * const d;
}; };

View File

@@ -58,32 +58,32 @@ using namespace Internal;
RemoteLinuxProcessesDialog::RemoteLinuxProcessesDialog(AbstractRemoteLinuxProcessList *processList, RemoteLinuxProcessesDialog::RemoteLinuxProcessesDialog(AbstractRemoteLinuxProcessList *processList,
QWidget *parent) QWidget *parent)
: QDialog(parent), m_d(new RemoteLinuxProcessesDialogPrivate(processList)) : QDialog(parent), d(new RemoteLinuxProcessesDialogPrivate(processList))
{ {
processList->setParent(this); processList->setParent(this);
m_d->ui.setupUi(this); d->ui.setupUi(this);
m_d->ui.tableView->setSelectionBehavior(QAbstractItemView::SelectRows); d->ui.tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_d->proxyModel.setSourceModel(m_d->processList); d->proxyModel.setSourceModel(d->processList);
m_d->proxyModel.setDynamicSortFilter(true); d->proxyModel.setDynamicSortFilter(true);
m_d->proxyModel.setFilterKeyColumn(1); d->proxyModel.setFilterKeyColumn(1);
m_d->ui.tableView->setModel(&m_d->proxyModel); d->ui.tableView->setModel(&d->proxyModel);
connect(m_d->ui.processFilterLineEdit, SIGNAL(textChanged(QString)), connect(d->ui.processFilterLineEdit, SIGNAL(textChanged(QString)),
&m_d->proxyModel, SLOT(setFilterRegExp(QString))); &d->proxyModel, SLOT(setFilterRegExp(QString)));
connect(m_d->ui.tableView->selectionModel(), connect(d->ui.tableView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(handleSelectionChanged())); SLOT(handleSelectionChanged()));
connect(m_d->ui.updateListButton, SIGNAL(clicked()), connect(d->ui.updateListButton, SIGNAL(clicked()),
SLOT(updateProcessList())); SLOT(updateProcessList()));
connect(m_d->ui.killProcessButton, SIGNAL(clicked()), SLOT(killProcess())); connect(d->ui.killProcessButton, SIGNAL(clicked()), SLOT(killProcess()));
connect(m_d->processList, SIGNAL(error(QString)), connect(d->processList, SIGNAL(error(QString)),
SLOT(handleRemoteError(QString))); SLOT(handleRemoteError(QString)));
connect(m_d->processList, SIGNAL(modelReset()), connect(d->processList, SIGNAL(modelReset()),
SLOT(handleProcessListUpdated())); SLOT(handleProcessListUpdated()));
connect(m_d->processList, SIGNAL(processKilled()), connect(d->processList, SIGNAL(processKilled()),
SLOT(handleProcessKilled()), Qt::QueuedConnection); SLOT(handleProcessKilled()), Qt::QueuedConnection);
connect(&m_d->proxyModel, SIGNAL(layoutChanged()), connect(&d->proxyModel, SIGNAL(layoutChanged()),
SLOT(handleProcessListUpdated())); SLOT(handleProcessListUpdated()));
handleSelectionChanged(); handleSelectionChanged();
updateProcessList(); updateProcessList();
@@ -91,39 +91,39 @@ RemoteLinuxProcessesDialog::RemoteLinuxProcessesDialog(AbstractRemoteLinuxProces
RemoteLinuxProcessesDialog::~RemoteLinuxProcessesDialog() RemoteLinuxProcessesDialog::~RemoteLinuxProcessesDialog()
{ {
delete m_d; delete d;
} }
void RemoteLinuxProcessesDialog::handleRemoteError(const QString &errorMsg) void RemoteLinuxProcessesDialog::handleRemoteError(const QString &errorMsg)
{ {
QMessageBox::critical(this, tr("Remote Error"), errorMsg); QMessageBox::critical(this, tr("Remote Error"), errorMsg);
m_d->ui.updateListButton->setEnabled(true); d->ui.updateListButton->setEnabled(true);
handleSelectionChanged(); handleSelectionChanged();
} }
void RemoteLinuxProcessesDialog::handleProcessListUpdated() void RemoteLinuxProcessesDialog::handleProcessListUpdated()
{ {
m_d->ui.updateListButton->setEnabled(true); d->ui.updateListButton->setEnabled(true);
m_d->ui.tableView->resizeRowsToContents(); d->ui.tableView->resizeRowsToContents();
handleSelectionChanged(); handleSelectionChanged();
} }
void RemoteLinuxProcessesDialog::updateProcessList() void RemoteLinuxProcessesDialog::updateProcessList()
{ {
m_d->ui.updateListButton->setEnabled(false); d->ui.updateListButton->setEnabled(false);
m_d->ui.killProcessButton->setEnabled(false); d->ui.killProcessButton->setEnabled(false);
m_d->processList->update(); d->processList->update();
} }
void RemoteLinuxProcessesDialog::killProcess() void RemoteLinuxProcessesDialog::killProcess()
{ {
const QModelIndexList &indexes const QModelIndexList &indexes
= m_d->ui.tableView->selectionModel()->selectedIndexes(); = d->ui.tableView->selectionModel()->selectedIndexes();
if (indexes.empty()) if (indexes.empty())
return; return;
m_d->ui.updateListButton->setEnabled(false); d->ui.updateListButton->setEnabled(false);
m_d->ui.killProcessButton->setEnabled(false); d->ui.killProcessButton->setEnabled(false);
m_d->processList->killProcess(m_d->proxyModel.mapToSource(indexes.first()).row()); d->processList->killProcess(d->proxyModel.mapToSource(indexes.first()).row());
} }
void RemoteLinuxProcessesDialog::handleProcessKilled() void RemoteLinuxProcessesDialog::handleProcessKilled()
@@ -133,7 +133,7 @@ void RemoteLinuxProcessesDialog::handleProcessKilled()
void RemoteLinuxProcessesDialog::handleSelectionChanged() void RemoteLinuxProcessesDialog::handleSelectionChanged()
{ {
m_d->ui.killProcessButton->setEnabled(m_d->ui.tableView->selectionModel()->hasSelection()); d->ui.killProcessButton->setEnabled(d->ui.tableView->selectionModel()->hasSelection());
} }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -60,7 +60,7 @@ private slots:
void handleSelectionChanged(); void handleSelectionChanged();
private: private:
Internal::RemoteLinuxProcessesDialogPrivate * const m_d; Internal::RemoteLinuxProcessesDialogPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -72,42 +72,42 @@ using namespace Internal;
AbstractRemoteLinuxProcessList::AbstractRemoteLinuxProcessList(const LinuxDeviceConfiguration::ConstPtr &devConfig, AbstractRemoteLinuxProcessList::AbstractRemoteLinuxProcessList(const LinuxDeviceConfiguration::ConstPtr &devConfig,
QObject *parent) QObject *parent)
: QAbstractTableModel(parent), m_d(new AbstractRemoteLinuxProcessListPrivate(devConfig)) : QAbstractTableModel(parent), d(new AbstractRemoteLinuxProcessListPrivate(devConfig))
{ {
} }
LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxProcessList::deviceConfiguration() const LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxProcessList::deviceConfiguration() const
{ {
return m_d->deviceConfiguration; return d->deviceConfiguration;
} }
AbstractRemoteLinuxProcessList::~AbstractRemoteLinuxProcessList() AbstractRemoteLinuxProcessList::~AbstractRemoteLinuxProcessList()
{ {
delete m_d; delete d;
} }
void AbstractRemoteLinuxProcessList::update() void AbstractRemoteLinuxProcessList::update()
{ {
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
beginResetModel(); beginResetModel();
m_d->remoteProcesses.clear(); d->remoteProcesses.clear();
m_d->state = Listing; d->state = Listing;
startProcess(listProcessesCommandLine()); startProcess(listProcessesCommandLine());
} }
void AbstractRemoteLinuxProcessList::killProcess(int row) void AbstractRemoteLinuxProcessList::killProcess(int row)
{ {
QTC_ASSERT(row >= 0 && row < m_d->remoteProcesses.count(), return); QTC_ASSERT(row >= 0 && row < d->remoteProcesses.count(), return);
QTC_ASSERT(m_d->state == Inactive, return); QTC_ASSERT(d->state == Inactive, return);
m_d->state = Killing; d->state = Killing;
startProcess(killProcessCommandLine(m_d->remoteProcesses.at(row))); startProcess(killProcessCommandLine(d->remoteProcesses.at(row)));
} }
int AbstractRemoteLinuxProcessList::rowCount(const QModelIndex &parent) const int AbstractRemoteLinuxProcessList::rowCount(const QModelIndex &parent) const
{ {
return parent.isValid() ? 0 : m_d->remoteProcesses.count(); return parent.isValid() ? 0 : d->remoteProcesses.count();
} }
int AbstractRemoteLinuxProcessList::columnCount(const QModelIndex &) const { return 2; } int AbstractRemoteLinuxProcessList::columnCount(const QModelIndex &) const { return 2; }
@@ -126,7 +126,7 @@ QVariant AbstractRemoteLinuxProcessList::data(const QModelIndex &index, int role
if (!index.isValid() || index.row() >= rowCount(index.parent()) if (!index.isValid() || index.row() >= rowCount(index.parent())
|| index.column() >= columnCount() || role != Qt::DisplayRole) || index.column() >= columnCount() || role != Qt::DisplayRole)
return QVariant(); return QVariant();
const RemoteProcess &proc = m_d->remoteProcesses.at(index.row()); const RemoteProcess &proc = d->remoteProcesses.at(index.row());
if (index.column() == 0) if (index.column() == 0)
return proc.pid; return proc.pid;
else else
@@ -135,61 +135,61 @@ QVariant AbstractRemoteLinuxProcessList::data(const QModelIndex &index, int role
void AbstractRemoteLinuxProcessList::handleRemoteStdOut(const QByteArray &output) void AbstractRemoteLinuxProcessList::handleRemoteStdOut(const QByteArray &output)
{ {
if (m_d->state == Listing) if (d->state == Listing)
m_d->remoteStdout += output; d->remoteStdout += output;
} }
void AbstractRemoteLinuxProcessList::handleRemoteStdErr(const QByteArray &output) void AbstractRemoteLinuxProcessList::handleRemoteStdErr(const QByteArray &output)
{ {
if (m_d->state != Inactive) if (d->state != Inactive)
m_d->remoteStderr += output; d->remoteStderr += output;
} }
void AbstractRemoteLinuxProcessList::handleConnectionError() void AbstractRemoteLinuxProcessList::handleConnectionError()
{ {
QTC_ASSERT(m_d->state != Inactive, return); QTC_ASSERT(d->state != Inactive, return);
emit error(tr("Connection failure: %1").arg(m_d->process->connection()->errorString())); emit error(tr("Connection failure: %1").arg(d->process->connection()->errorString()));
beginResetModel(); beginResetModel();
m_d->remoteProcesses.clear(); d->remoteProcesses.clear();
endResetModel(); endResetModel();
setFinished(); setFinished();
} }
void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus) void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
{ {
QTC_ASSERT(m_d->state != Inactive, return); QTC_ASSERT(d->state != Inactive, return);
switch (exitStatus) { switch (exitStatus) {
case SshRemoteProcess::FailedToStart: case SshRemoteProcess::FailedToStart:
m_d->errorMsg = tr("Error: Remote process failed to start: %1") d->errorMsg = tr("Error: Remote process failed to start: %1")
.arg(m_d->process->process()->errorString()); .arg(d->process->process()->errorString());
break; break;
case SshRemoteProcess::KilledBySignal: case SshRemoteProcess::KilledBySignal:
m_d->errorMsg = tr("Error: Remote process crashed: %1") d->errorMsg = tr("Error: Remote process crashed: %1")
.arg(m_d->process->process()->errorString()); .arg(d->process->process()->errorString());
break; break;
case SshRemoteProcess::ExitedNormally: case SshRemoteProcess::ExitedNormally:
if (m_d->process->process()->exitCode() == 0) { if (d->process->process()->exitCode() == 0) {
if (m_d->state == Listing) if (d->state == Listing)
m_d->remoteProcesses = buildProcessList(QString::fromUtf8(m_d->remoteStdout)); d->remoteProcesses = buildProcessList(QString::fromUtf8(d->remoteStdout));
} else { } else {
m_d->errorMsg = tr("Remote process failed."); d->errorMsg = tr("Remote process failed.");
} }
break; break;
default: default:
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid exit status"); Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid exit status");
} }
if (!m_d->errorMsg.isEmpty()) { if (!d->errorMsg.isEmpty()) {
if (!m_d->remoteStderr.isEmpty()) if (!d->remoteStderr.isEmpty())
m_d->errorMsg += tr("\nRemote stderr was: %1").arg(QString::fromUtf8(m_d->remoteStderr)); d->errorMsg += tr("\nRemote stderr was: %1").arg(QString::fromUtf8(d->remoteStderr));
emit error(m_d->errorMsg); emit error(d->errorMsg);
} else if (m_d->state == Killing) { } else if (d->state == Killing) {
emit processKilled(); emit processKilled();
} }
if (m_d->state == Listing) if (d->state == Listing)
endResetModel(); endResetModel();
setFinished(); setFinished();
@@ -197,24 +197,24 @@ void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
void AbstractRemoteLinuxProcessList::startProcess(const QString &cmdLine) void AbstractRemoteLinuxProcessList::startProcess(const QString &cmdLine)
{ {
connect(m_d->process.data(), SIGNAL(connectionError(Utils::SshError)), connect(d->process.data(), SIGNAL(connectionError(Utils::SshError)),
SLOT(handleConnectionError())); SLOT(handleConnectionError()));
connect(m_d->process.data(), SIGNAL(processOutputAvailable(QByteArray)), connect(d->process.data(), SIGNAL(processOutputAvailable(QByteArray)),
SLOT(handleRemoteStdOut(QByteArray))); SLOT(handleRemoteStdOut(QByteArray)));
connect(m_d->process.data(), SIGNAL(processErrorOutputAvailable(QByteArray)), connect(d->process.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
SLOT(handleRemoteStdErr(QByteArray))); SLOT(handleRemoteStdErr(QByteArray)));
connect(m_d->process.data(), SIGNAL(processClosed(int)), connect(d->process.data(), SIGNAL(processClosed(int)),
SLOT(handleRemoteProcessFinished(int))); SLOT(handleRemoteProcessFinished(int)));
m_d->remoteStdout.clear(); d->remoteStdout.clear();
m_d->remoteStderr.clear(); d->remoteStderr.clear();
m_d->errorMsg.clear(); d->errorMsg.clear();
m_d->process->run(cmdLine.toUtf8()); d->process->run(cmdLine.toUtf8());
} }
void AbstractRemoteLinuxProcessList::setFinished() void AbstractRemoteLinuxProcessList::setFinished()
{ {
disconnect(m_d->process.data(), 0, this, 0); disconnect(d->process.data(), 0, this, 0);
m_d->state = Inactive; d->state = Inactive;
} }

View File

@@ -84,14 +84,14 @@ private:
int role = Qt::DisplayRole) const; int role = Qt::DisplayRole) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual QString listProcessesCommandLine() const=0; virtual QString listProcessesCommandLine() const = 0;
virtual QString killProcessCommandLine(const RemoteProcess &process) const=0; virtual QString killProcessCommandLine(const RemoteProcess &process) const = 0;
virtual QList<RemoteProcess> buildProcessList(const QString &listProcessesReply) const=0; virtual QList<RemoteProcess> buildProcessList(const QString &listProcessesReply) const = 0;
void startProcess(const QString &cmdLine); void startProcess(const QString &cmdLine);
void setFinished(); void setFinished();
Internal::AbstractRemoteLinuxProcessListPrivate * const m_d; Internal::AbstractRemoteLinuxProcessListPrivate * const d;
}; };

View File

@@ -99,7 +99,7 @@ using namespace Internal;
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, const QString &id, RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, const QString &id,
const QString &proFilePath) const QString &proFilePath)
: RunConfiguration(parent, id), : RunConfiguration(parent, id),
m_d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent)) d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent))
{ {
init(); init();
} }
@@ -107,7 +107,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent,
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent,
RemoteLinuxRunConfiguration *source) RemoteLinuxRunConfiguration *source)
: RunConfiguration(parent, source), : RunConfiguration(parent, source),
m_d(new RemoteLinuxRunConfigurationPrivate(source->m_d)) d(new RemoteLinuxRunConfigurationPrivate(source->d))
{ {
init(); init();
} }
@@ -144,33 +144,33 @@ Qt4BuildConfiguration *RemoteLinuxRunConfiguration::activeQt4BuildConfiguration(
bool RemoteLinuxRunConfiguration::isEnabled() const bool RemoteLinuxRunConfiguration::isEnabled() const
{ {
if (m_d->parseInProgress) { if (d->parseInProgress) {
m_d->disabledReason = tr("The .pro file is being parsed."); d->disabledReason = tr("The .pro file is being parsed.");
return false; return false;
} }
if (!m_d->validParse) { if (!d->validParse) {
m_d->disabledReason = tr("The .pro file could not be parsed."); d->disabledReason = tr("The .pro file could not be parsed.");
return false; return false;
} }
if (!deviceConfig()) { if (!deviceConfig()) {
m_d->disabledReason = tr("No device configuration set."); d->disabledReason = tr("No device configuration set.");
return false; return false;
} }
if (!activeQt4BuildConfiguration()) { if (!activeQt4BuildConfiguration()) {
m_d->disabledReason = tr("No active build configuration."); d->disabledReason = tr("No active build configuration.");
return false; return false;
} }
if (remoteExecutableFilePath().isEmpty()) { if (remoteExecutableFilePath().isEmpty()) {
m_d->disabledReason = tr("Don't know what to run."); d->disabledReason = tr("Don't know what to run.");
return false; return false;
} }
m_d->disabledReason.clear(); d->disabledReason.clear();
return true; return true;
} }
QString RemoteLinuxRunConfiguration::disabledReason() const QString RemoteLinuxRunConfiguration::disabledReason() const
{ {
return m_d->disabledReason; return d->disabledReason;
} }
QWidget *RemoteLinuxRunConfiguration::createConfigurationWidget() QWidget *RemoteLinuxRunConfiguration::createConfigurationWidget()
@@ -185,10 +185,10 @@ Utils::OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() con
void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress) void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress)
{ {
if (m_d->proFilePath == pro->path()) { if (d->proFilePath == pro->path()) {
bool enabled = isEnabled(); bool enabled = isEnabled();
m_d->validParse = success; d->validParse = success;
m_d->parseInProgress = parseInProgress; d->parseInProgress = parseInProgress;
if (enabled != isEnabled()) if (enabled != isEnabled())
updateEnabledState(); updateEnabledState();
if (!parseInProgress) if (!parseInProgress)
@@ -199,12 +199,12 @@ void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNod
QVariantMap RemoteLinuxRunConfiguration::toMap() const QVariantMap RemoteLinuxRunConfiguration::toMap() const
{ {
QVariantMap map(RunConfiguration::toMap()); QVariantMap map(RunConfiguration::toMap());
map.insert(QLatin1String(ArgumentsKey), m_d->arguments); map.insert(QLatin1String(ArgumentsKey), d->arguments);
const QDir dir = QDir(target()->project()->projectDirectory()); const QDir dir = QDir(target()->project()->projectDirectory());
map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(m_d->proFilePath)); map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->proFilePath));
map.insert(QLatin1String(BaseEnvironmentBaseKey), m_d->baseEnvironmentType); map.insert(QLatin1String(BaseEnvironmentBaseKey), d->baseEnvironmentType);
map.insert(QLatin1String(UserEnvironmentChangesKey), map.insert(QLatin1String(UserEnvironmentChangesKey),
Utils::EnvironmentItem::toStringList(m_d->userEnvironmentChanges)); Utils::EnvironmentItem::toStringList(d->userEnvironmentChanges));
return map; return map;
} }
@@ -213,17 +213,17 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
if (!RunConfiguration::fromMap(map)) if (!RunConfiguration::fromMap(map))
return false; return false;
m_d->arguments = map.value(QLatin1String(ArgumentsKey)).toString(); d->arguments = map.value(QLatin1String(ArgumentsKey)).toString();
const QDir dir = QDir(target()->project()->projectDirectory()); const QDir dir = QDir(target()->project()->projectDirectory());
m_d->proFilePath = dir.filePath(map.value(QLatin1String(ProFileKey)).toString()); d->proFilePath = dir.filePath(map.value(QLatin1String(ProFileKey)).toString());
m_d->userEnvironmentChanges = d->userEnvironmentChanges =
Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(UserEnvironmentChangesKey)) Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(UserEnvironmentChangesKey))
.toStringList()); .toStringList());
m_d->baseEnvironmentType = static_cast<BaseEnvironmentType>(map.value(QLatin1String(BaseEnvironmentBaseKey), d->baseEnvironmentType = static_cast<BaseEnvironmentType>(map.value(QLatin1String(BaseEnvironmentBaseKey),
SystemBaseEnvironment).toInt()); SystemBaseEnvironment).toInt());
m_d->validParse = qt4Target()->qt4Project()->validParse(m_d->proFilePath); d->validParse = qt4Target()->qt4Project()->validParse(d->proFilePath);
m_d->parseInProgress = qt4Target()->qt4Project()->parseInProgress(m_d->proFilePath); d->parseInProgress = qt4Target()->qt4Project()->parseInProgress(d->proFilePath);
setDefaultDisplayName(defaultDisplayName()); setDefaultDisplayName(defaultDisplayName());
@@ -232,8 +232,8 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
QString RemoteLinuxRunConfiguration::defaultDisplayName() QString RemoteLinuxRunConfiguration::defaultDisplayName()
{ {
if (!m_d->proFilePath.isEmpty()) if (!d->proFilePath.isEmpty())
return (QFileInfo(m_d->proFilePath).completeBaseName()) + QLatin1String(" (remote)"); return (QFileInfo(d->proFilePath).completeBaseName()) + QLatin1String(" (remote)");
//: Remote Linux run configuration default display name //: Remote Linux run configuration default display name
return tr("Run on remote device"); return tr("Run on remote device");
} }
@@ -256,7 +256,7 @@ RemoteLinuxDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() cons
QString RemoteLinuxRunConfiguration::arguments() const QString RemoteLinuxRunConfiguration::arguments() const
{ {
return m_d->arguments; return d->arguments;
} }
QString RemoteLinuxRunConfiguration::environmentPreparationCommand() const QString RemoteLinuxRunConfiguration::environmentPreparationCommand() const
@@ -279,7 +279,7 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
{ {
TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode() TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode()
->targetInformation(m_d->proFilePath); ->targetInformation(d->proFilePath);
if (!ti.valid) if (!ti.valid)
return QString(); return QString();
@@ -303,7 +303,7 @@ PortList RemoteLinuxRunConfiguration::freePorts() const
void RemoteLinuxRunConfiguration::setArguments(const QString &args) void RemoteLinuxRunConfiguration::setArguments(const QString &args)
{ {
m_d->arguments = args; d->arguments = args;
} }
RemoteLinuxRunConfiguration::DebuggingType RemoteLinuxRunConfiguration::debuggingType() const RemoteLinuxRunConfiguration::DebuggingType RemoteLinuxRunConfiguration::debuggingType() const
@@ -355,22 +355,22 @@ void RemoteLinuxRunConfiguration::handleDeployablesUpdated()
QString RemoteLinuxRunConfiguration::baseEnvironmentText() const QString RemoteLinuxRunConfiguration::baseEnvironmentText() const
{ {
if (m_d->baseEnvironmentType == CleanBaseEnvironment) if (d->baseEnvironmentType == CleanBaseEnvironment)
return tr("Clean Environment"); return tr("Clean Environment");
else if (m_d->baseEnvironmentType == SystemBaseEnvironment) else if (d->baseEnvironmentType == SystemBaseEnvironment)
return tr("System Environment"); return tr("System Environment");
return QString(); return QString();
} }
RemoteLinuxRunConfiguration::BaseEnvironmentType RemoteLinuxRunConfiguration::baseEnvironmentType() const RemoteLinuxRunConfiguration::BaseEnvironmentType RemoteLinuxRunConfiguration::baseEnvironmentType() const
{ {
return m_d->baseEnvironmentType; return d->baseEnvironmentType;
} }
void RemoteLinuxRunConfiguration::setBaseEnvironmentType(BaseEnvironmentType env) void RemoteLinuxRunConfiguration::setBaseEnvironmentType(BaseEnvironmentType env)
{ {
if (m_d->baseEnvironmentType != env) { if (d->baseEnvironmentType != env) {
m_d->baseEnvironmentType = env; d->baseEnvironmentType = env;
emit baseEnvironmentChanged(); emit baseEnvironmentChanged();
} }
} }
@@ -384,13 +384,13 @@ Utils::Environment RemoteLinuxRunConfiguration::environment() const
Utils::Environment RemoteLinuxRunConfiguration::baseEnvironment() const Utils::Environment RemoteLinuxRunConfiguration::baseEnvironment() const
{ {
return (m_d->baseEnvironmentType == SystemBaseEnvironment ? systemEnvironment() return (d->baseEnvironmentType == SystemBaseEnvironment ? systemEnvironment()
: Utils::Environment()); : Utils::Environment());
} }
QList<Utils::EnvironmentItem> RemoteLinuxRunConfiguration::userEnvironmentChanges() const QList<Utils::EnvironmentItem> RemoteLinuxRunConfiguration::userEnvironmentChanges() const
{ {
return m_d->userEnvironmentChanges; return d->userEnvironmentChanges;
} }
QString RemoteLinuxRunConfiguration::userEnvironmentChangesAsString() const QString RemoteLinuxRunConfiguration::userEnvironmentChangesAsString() const
@@ -405,33 +405,33 @@ QString RemoteLinuxRunConfiguration::userEnvironmentChangesAsString() const
void RemoteLinuxRunConfiguration::setUserEnvironmentChanges( void RemoteLinuxRunConfiguration::setUserEnvironmentChanges(
const QList<Utils::EnvironmentItem> &diff) const QList<Utils::EnvironmentItem> &diff)
{ {
if (m_d->userEnvironmentChanges != diff) { if (d->userEnvironmentChanges != diff) {
m_d->userEnvironmentChanges = diff; d->userEnvironmentChanges = diff;
emit userEnvironmentChangesChanged(diff); emit userEnvironmentChangesChanged(diff);
} }
} }
Utils::Environment RemoteLinuxRunConfiguration::systemEnvironment() const Utils::Environment RemoteLinuxRunConfiguration::systemEnvironment() const
{ {
return m_d->systemEnvironment; return d->systemEnvironment;
} }
void RemoteLinuxRunConfiguration::setSystemEnvironment(const Utils::Environment &environment) void RemoteLinuxRunConfiguration::setSystemEnvironment(const Utils::Environment &environment)
{ {
if (m_d->systemEnvironment.size() == 0 || m_d->systemEnvironment != environment) { if (d->systemEnvironment.size() == 0 || d->systemEnvironment != environment) {
m_d->systemEnvironment = environment; d->systemEnvironment = environment;
emit systemEnvironmentChanged(); emit systemEnvironmentChanged();
} }
} }
QString RemoteLinuxRunConfiguration::proFilePath() const QString RemoteLinuxRunConfiguration::proFilePath() const
{ {
return m_d->proFilePath; return d->proFilePath;
} }
void RemoteLinuxRunConfiguration::setDisabledReason(const QString &reason) const void RemoteLinuxRunConfiguration::setDisabledReason(const QString &reason) const
{ {
m_d->disabledReason = reason; d->disabledReason = reason;
} }
const QString RemoteLinuxRunConfiguration::Id = QLatin1String("RemoteLinuxRunConfiguration"); const QString RemoteLinuxRunConfiguration::Id = QLatin1String("RemoteLinuxRunConfiguration");

View File

@@ -140,7 +140,7 @@ private:
void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff); void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
void setSystemEnvironment(const Utils::Environment &environment); void setSystemEnvironment(const Utils::Environment &environment);
Internal::RemoteLinuxRunConfigurationPrivate * const m_d; Internal::RemoteLinuxRunConfigurationPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -101,56 +101,56 @@ using namespace Internal;
RemoteLinuxRunConfigurationWidget::RemoteLinuxRunConfigurationWidget(RemoteLinuxRunConfiguration *runConfiguration, RemoteLinuxRunConfigurationWidget::RemoteLinuxRunConfigurationWidget(RemoteLinuxRunConfiguration *runConfiguration,
QWidget *parent) QWidget *parent)
: QWidget(parent), m_d(new RemoteLinuxRunConfigurationWidgetPrivate(runConfiguration)) : QWidget(parent), d(new RemoteLinuxRunConfigurationWidgetPrivate(runConfiguration))
{ {
QVBoxLayout *topLayout = new QVBoxLayout(this); QVBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setMargin(0); topLayout->setMargin(0);
addDisabledLabel(topLayout); addDisabledLabel(topLayout);
topLayout->addWidget(&m_d->topWidget); topLayout->addWidget(&d->topWidget);
QVBoxLayout *mainLayout = new QVBoxLayout(&m_d->topWidget); QVBoxLayout *mainLayout = new QVBoxLayout(&d->topWidget);
mainLayout->setMargin(0); mainLayout->setMargin(0);
addGenericWidgets(mainLayout); addGenericWidgets(mainLayout);
addEnvironmentWidgets(mainLayout); addEnvironmentWidgets(mainLayout);
connect(m_d->runConfiguration, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), connect(d->runConfiguration, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
SLOT(handleCurrentDeviceConfigChanged())); SLOT(handleCurrentDeviceConfigChanged()));
handleCurrentDeviceConfigChanged(); handleCurrentDeviceConfigChanged();
connect(m_d->runConfiguration, SIGNAL(isEnabledChanged(bool)), connect(d->runConfiguration, SIGNAL(isEnabledChanged(bool)),
SLOT(runConfigurationEnabledChange(bool))); SLOT(runConfigurationEnabledChange(bool)));
runConfigurationEnabledChange(m_d->runConfiguration->isEnabled()); runConfigurationEnabledChange(d->runConfiguration->isEnabled());
} }
RemoteLinuxRunConfigurationWidget::~RemoteLinuxRunConfigurationWidget() RemoteLinuxRunConfigurationWidget::~RemoteLinuxRunConfigurationWidget()
{ {
delete m_d; delete d;
} }
void RemoteLinuxRunConfigurationWidget::addDisabledLabel(QVBoxLayout *topLayout) void RemoteLinuxRunConfigurationWidget::addDisabledLabel(QVBoxLayout *topLayout)
{ {
QHBoxLayout * const hl = new QHBoxLayout; QHBoxLayout * const hl = new QHBoxLayout;
hl->addStretch(); hl->addStretch();
m_d->disabledIcon.setPixmap(QPixmap(QString::fromUtf8(":/projectexplorer/images/compile_warning.png"))); d->disabledIcon.setPixmap(QPixmap(QString::fromUtf8(":/projectexplorer/images/compile_warning.png")));
hl->addWidget(&m_d->disabledIcon); hl->addWidget(&d->disabledIcon);
m_d->disabledReason.setVisible(false); d->disabledReason.setVisible(false);
hl->addWidget(&m_d->disabledReason); hl->addWidget(&d->disabledReason);
hl->addStretch(); hl->addStretch();
topLayout->addLayout(hl); topLayout->addLayout(hl);
} }
void RemoteLinuxRunConfigurationWidget::suppressQmlDebuggingOptions() void RemoteLinuxRunConfigurationWidget::suppressQmlDebuggingOptions()
{ {
m_d->debuggingLanguagesLabel.hide(); d->debuggingLanguagesLabel.hide();
m_d->debugCppOnlyButton.hide(); d->debugCppOnlyButton.hide();
m_d->debugQmlOnlyButton.hide(); d->debugQmlOnlyButton.hide();
m_d->debugCppAndQmlButton.hide(); d->debugCppAndQmlButton.hide();
} }
void RemoteLinuxRunConfigurationWidget::runConfigurationEnabledChange(bool enabled) void RemoteLinuxRunConfigurationWidget::runConfigurationEnabledChange(bool enabled)
{ {
m_d->topWidget.setEnabled(enabled); d->topWidget.setEnabled(enabled);
m_d->disabledIcon.setVisible(!enabled); d->disabledIcon.setVisible(!enabled);
m_d->disabledReason.setVisible(!enabled); d->disabledReason.setVisible(!enabled);
m_d->disabledReason.setText(m_d->runConfiguration->disabledReason()); d->disabledReason.setText(d->runConfiguration->disabledReason());
} }
void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout) void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
@@ -162,7 +162,7 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
QWidget * const devConfWidget = new QWidget; QWidget * const devConfWidget = new QWidget;
QHBoxLayout * const devConfLayout = new QHBoxLayout(devConfWidget); QHBoxLayout * const devConfLayout = new QHBoxLayout(devConfWidget);
devConfLayout->setMargin(0); devConfLayout->setMargin(0);
devConfLayout->addWidget(&m_d->devConfLabel); devConfLayout->addWidget(&d->devConfLabel);
QLabel * const addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>") QLabel * const addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>")
.arg(QLatin1String("deviceconfig"))); .arg(QLatin1String("deviceconfig")));
addDevConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); addDevConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
@@ -174,46 +174,46 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
devConfLayout->addWidget(debuggerConfLabel); devConfLayout->addWidget(debuggerConfLabel);
formLayout->addRow(new QLabel(tr("Device configuration:")), devConfWidget); formLayout->addRow(new QLabel(tr("Device configuration:")), devConfWidget);
m_d->localExecutableLabel.setText(m_d->runConfiguration->localExecutableFilePath()); d->localExecutableLabel.setText(d->runConfiguration->localExecutableFilePath());
formLayout->addRow(tr("Executable on host:"), &m_d->localExecutableLabel); formLayout->addRow(tr("Executable on host:"), &d->localExecutableLabel);
formLayout->addRow(tr("Executable on device:"), &m_d->remoteExecutableLabel); formLayout->addRow(tr("Executable on device:"), &d->remoteExecutableLabel);
m_d->argsLineEdit.setText(m_d->runConfiguration->arguments()); d->argsLineEdit.setText(d->runConfiguration->arguments());
formLayout->addRow(tr("Arguments:"), &m_d->argsLineEdit); formLayout->addRow(tr("Arguments:"), &d->argsLineEdit);
QHBoxLayout * const debugButtonsLayout = new QHBoxLayout; QHBoxLayout * const debugButtonsLayout = new QHBoxLayout;
m_d->debugCppOnlyButton.setText(tr("C++ only")); d->debugCppOnlyButton.setText(tr("C++ only"));
m_d->debugQmlOnlyButton.setText(tr("QML only")); d->debugQmlOnlyButton.setText(tr("QML only"));
m_d->debugCppAndQmlButton.setText(tr("C++ and QML")); d->debugCppAndQmlButton.setText(tr("C++ and QML"));
m_d->debuggingLanguagesLabel.setText(tr("Debugging type:")); d->debuggingLanguagesLabel.setText(tr("Debugging type:"));
QButtonGroup * const buttonGroup = new QButtonGroup; QButtonGroup * const buttonGroup = new QButtonGroup;
buttonGroup->addButton(&m_d->debugCppOnlyButton); buttonGroup->addButton(&d->debugCppOnlyButton);
buttonGroup->addButton(&m_d->debugQmlOnlyButton); buttonGroup->addButton(&d->debugQmlOnlyButton);
buttonGroup->addButton(&m_d->debugCppAndQmlButton); buttonGroup->addButton(&d->debugCppAndQmlButton);
debugButtonsLayout->addWidget(&m_d->debugCppOnlyButton); debugButtonsLayout->addWidget(&d->debugCppOnlyButton);
debugButtonsLayout->addWidget(&m_d->debugQmlOnlyButton); debugButtonsLayout->addWidget(&d->debugQmlOnlyButton);
debugButtonsLayout->addWidget(&m_d->debugCppAndQmlButton); debugButtonsLayout->addWidget(&d->debugCppAndQmlButton);
debugButtonsLayout->addStretch(1); debugButtonsLayout->addStretch(1);
formLayout->addRow(&m_d->debuggingLanguagesLabel, debugButtonsLayout); formLayout->addRow(&d->debuggingLanguagesLabel, debugButtonsLayout);
if (m_d->runConfiguration->useCppDebugger()) { if (d->runConfiguration->useCppDebugger()) {
if (m_d->runConfiguration->useQmlDebugger()) if (d->runConfiguration->useQmlDebugger())
m_d->debugCppAndQmlButton.setChecked(true); d->debugCppAndQmlButton.setChecked(true);
else else
m_d->debugCppOnlyButton.setChecked(true); d->debugCppOnlyButton.setChecked(true);
} else { } else {
m_d->debugQmlOnlyButton.setChecked(true); d->debugQmlOnlyButton.setChecked(true);
} }
connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this, connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
SLOT(showDeviceConfigurationsDialog(QString))); SLOT(showDeviceConfigurationsDialog(QString)));
connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this, connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this,
SLOT(showDeviceConfigurationsDialog(QString))); SLOT(showDeviceConfigurationsDialog(QString)));
connect(&m_d->argsLineEdit, SIGNAL(textEdited(QString)), SLOT(argumentsEdited(QString))); connect(&d->argsLineEdit, SIGNAL(textEdited(QString)), SLOT(argumentsEdited(QString)));
connect(&m_d->debugCppOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged())); connect(&d->debugCppOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
connect(&m_d->debugQmlOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged())); connect(&d->debugQmlOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
connect(&m_d->debugCppAndQmlButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged())); connect(&d->debugCppAndQmlButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
connect(m_d->runConfiguration, SIGNAL(targetInformationChanged()), this, connect(d->runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation())); SLOT(updateTargetInformation()));
connect(m_d->runConfiguration, SIGNAL(deploySpecsChanged()), SLOT(handleDeploySpecsChanged())); connect(d->runConfiguration, SIGNAL(deploySpecsChanged()), SLOT(handleDeploySpecsChanged()));
handleDeploySpecsChanged(); handleDeploySpecsChanged();
} }
@@ -224,50 +224,50 @@ void RemoteLinuxRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainL
baseEnvironmentLayout->setMargin(0); baseEnvironmentLayout->setMargin(0);
QLabel * const 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); baseEnvironmentLayout->addWidget(label);
m_d->baseEnvironmentComboBox.addItems(QStringList() << tr("Clean Environment") d->baseEnvironmentComboBox.addItems(QStringList() << tr("Clean Environment")
<< tr("System Environment")); << tr("System Environment"));
m_d->baseEnvironmentComboBox.setCurrentIndex(m_d->runConfiguration->baseEnvironmentType()); d->baseEnvironmentComboBox.setCurrentIndex(d->runConfiguration->baseEnvironmentType());
baseEnvironmentLayout->addWidget(&m_d->baseEnvironmentComboBox); baseEnvironmentLayout->addWidget(&d->baseEnvironmentComboBox);
m_d->fetchEnvButton.setText(FetchEnvButtonText); d->fetchEnvButton.setText(FetchEnvButtonText);
baseEnvironmentLayout->addWidget(&m_d->fetchEnvButton); baseEnvironmentLayout->addWidget(&d->fetchEnvButton);
baseEnvironmentLayout->addStretch(10); baseEnvironmentLayout->addStretch(10);
m_d->environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget); d->environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
m_d->environmentWidget->setBaseEnvironment(m_d->deviceEnvReader.deviceEnvironment()); d->environmentWidget->setBaseEnvironment(d->deviceEnvReader.deviceEnvironment());
m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText()); d->environmentWidget->setBaseEnvironmentText(d->runConfiguration->baseEnvironmentText());
m_d->environmentWidget->setUserChanges(m_d->runConfiguration->userEnvironmentChanges()); d->environmentWidget->setUserChanges(d->runConfiguration->userEnvironmentChanges());
mainLayout->addWidget(m_d->environmentWidget); mainLayout->addWidget(d->environmentWidget);
connect(m_d->environmentWidget, SIGNAL(userChangesChanged()), SLOT(userChangesEdited())); connect(d->environmentWidget, SIGNAL(userChangesChanged()), SLOT(userChangesEdited()));
connect(&m_d->baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)), connect(&d->baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(baseEnvironmentSelected(int))); this, SLOT(baseEnvironmentSelected(int)));
connect(m_d->runConfiguration, SIGNAL(baseEnvironmentChanged()), connect(d->runConfiguration, SIGNAL(baseEnvironmentChanged()),
this, SLOT(baseEnvironmentChanged())); this, SLOT(baseEnvironmentChanged()));
connect(m_d->runConfiguration, SIGNAL(systemEnvironmentChanged()), connect(d->runConfiguration, SIGNAL(systemEnvironmentChanged()),
this, SLOT(systemEnvironmentChanged())); this, SLOT(systemEnvironmentChanged()));
connect(m_d->runConfiguration, connect(d->runConfiguration,
SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)), SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>))); SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)));
connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); connect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
connect(&m_d->deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished())); connect(&d->deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished()));
connect(&m_d->deviceEnvReader, SIGNAL(error(QString)), SLOT(fetchEnvironmentError(QString))); connect(&d->deviceEnvReader, SIGNAL(error(QString)), SLOT(fetchEnvironmentError(QString)));
} }
void RemoteLinuxRunConfigurationWidget::argumentsEdited(const QString &text) void RemoteLinuxRunConfigurationWidget::argumentsEdited(const QString &text)
{ {
m_d->runConfiguration->setArguments(text); d->runConfiguration->setArguments(text);
} }
void RemoteLinuxRunConfigurationWidget::updateTargetInformation() void RemoteLinuxRunConfigurationWidget::updateTargetInformation()
{ {
m_d->localExecutableLabel d->localExecutableLabel
.setText(QDir::toNativeSeparators(m_d->runConfiguration->localExecutableFilePath())); .setText(QDir::toNativeSeparators(d->runConfiguration->localExecutableFilePath()));
} }
void RemoteLinuxRunConfigurationWidget::handleDeploySpecsChanged() void RemoteLinuxRunConfigurationWidget::handleDeploySpecsChanged()
{ {
m_d->remoteExecutableLabel.setText(m_d->runConfiguration->remoteExecutableFilePath()); d->remoteExecutableLabel.setText(d->runConfiguration->remoteExecutableFilePath());
} }
void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link) void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link)
@@ -283,29 +283,29 @@ void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QSt
void RemoteLinuxRunConfigurationWidget::handleCurrentDeviceConfigChanged() void RemoteLinuxRunConfigurationWidget::handleCurrentDeviceConfigChanged()
{ {
m_d->devConfLabel.setText(RemoteLinuxUtils::deviceConfigurationName(m_d->runConfiguration->deviceConfig())); d->devConfLabel.setText(RemoteLinuxUtils::deviceConfigurationName(d->runConfiguration->deviceConfig()));
} }
void RemoteLinuxRunConfigurationWidget::fetchEnvironment() void RemoteLinuxRunConfigurationWidget::fetchEnvironment()
{ {
disconnect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); disconnect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment())); connect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
m_d->fetchEnvButton.setText(tr("Cancel Fetch Operation")); d->fetchEnvButton.setText(tr("Cancel Fetch Operation"));
m_d->deviceEnvReader.start(m_d->runConfiguration->environmentPreparationCommand()); d->deviceEnvReader.start(d->runConfiguration->environmentPreparationCommand());
} }
void RemoteLinuxRunConfigurationWidget::stopFetchEnvironment() void RemoteLinuxRunConfigurationWidget::stopFetchEnvironment()
{ {
m_d->deviceEnvReader.stop(); d->deviceEnvReader.stop();
fetchEnvironmentFinished(); fetchEnvironmentFinished();
} }
void RemoteLinuxRunConfigurationWidget::fetchEnvironmentFinished() void RemoteLinuxRunConfigurationWidget::fetchEnvironmentFinished()
{ {
disconnect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment())); disconnect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); connect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
m_d->fetchEnvButton.setText(FetchEnvButtonText); d->fetchEnvButton.setText(FetchEnvButtonText);
m_d->runConfiguration->setSystemEnvironment(m_d->deviceEnvReader.deviceEnvironment()); d->runConfiguration->setSystemEnvironment(d->deviceEnvReader.deviceEnvironment());
} }
void RemoteLinuxRunConfigurationWidget::fetchEnvironmentError(const QString &error) void RemoteLinuxRunConfigurationWidget::fetchEnvironmentError(const QString &error)
@@ -316,48 +316,48 @@ void RemoteLinuxRunConfigurationWidget::fetchEnvironmentError(const QString &err
void RemoteLinuxRunConfigurationWidget::userChangesEdited() void RemoteLinuxRunConfigurationWidget::userChangesEdited()
{ {
m_d->ignoreChange = true; d->ignoreChange = true;
m_d->runConfiguration->setUserEnvironmentChanges(m_d->environmentWidget->userChanges()); d->runConfiguration->setUserEnvironmentChanges(d->environmentWidget->userChanges());
m_d->ignoreChange = false; d->ignoreChange = false;
} }
void RemoteLinuxRunConfigurationWidget::baseEnvironmentSelected(int index) void RemoteLinuxRunConfigurationWidget::baseEnvironmentSelected(int index)
{ {
m_d->ignoreChange = true; d->ignoreChange = true;
m_d->runConfiguration->setBaseEnvironmentType(RemoteLinuxRunConfiguration::BaseEnvironmentType(index)); d->runConfiguration->setBaseEnvironmentType(RemoteLinuxRunConfiguration::BaseEnvironmentType(index));
m_d->environmentWidget->setBaseEnvironment(m_d->runConfiguration->baseEnvironment()); d->environmentWidget->setBaseEnvironment(d->runConfiguration->baseEnvironment());
m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText()); d->environmentWidget->setBaseEnvironmentText(d->runConfiguration->baseEnvironmentText());
m_d->ignoreChange = false; d->ignoreChange = false;
} }
void RemoteLinuxRunConfigurationWidget::baseEnvironmentChanged() void RemoteLinuxRunConfigurationWidget::baseEnvironmentChanged()
{ {
if (m_d->ignoreChange) if (d->ignoreChange)
return; return;
m_d->baseEnvironmentComboBox.setCurrentIndex(m_d->runConfiguration->baseEnvironmentType()); d->baseEnvironmentComboBox.setCurrentIndex(d->runConfiguration->baseEnvironmentType());
m_d->environmentWidget->setBaseEnvironment(m_d->runConfiguration->baseEnvironment()); d->environmentWidget->setBaseEnvironment(d->runConfiguration->baseEnvironment());
m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText()); d->environmentWidget->setBaseEnvironmentText(d->runConfiguration->baseEnvironmentText());
} }
void RemoteLinuxRunConfigurationWidget::systemEnvironmentChanged() void RemoteLinuxRunConfigurationWidget::systemEnvironmentChanged()
{ {
m_d->environmentWidget->setBaseEnvironment(m_d->runConfiguration->systemEnvironment()); d->environmentWidget->setBaseEnvironment(d->runConfiguration->systemEnvironment());
} }
void RemoteLinuxRunConfigurationWidget::userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges) void RemoteLinuxRunConfigurationWidget::userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges)
{ {
if (m_d->ignoreChange) if (d->ignoreChange)
return; return;
m_d->environmentWidget->setUserChanges(userChanges); d->environmentWidget->setUserChanges(userChanges);
} }
void RemoteLinuxRunConfigurationWidget::handleDebuggingTypeChanged() void RemoteLinuxRunConfigurationWidget::handleDebuggingTypeChanged()
{ {
m_d->runConfiguration->setUseCppDebugger(m_d->debugCppOnlyButton.isChecked() d->runConfiguration->setUseCppDebugger(d->debugCppOnlyButton.isChecked()
|| m_d->debugCppAndQmlButton.isChecked()); || d->debugCppAndQmlButton.isChecked());
m_d->runConfiguration->setUseQmlDebugger(m_d->debugQmlOnlyButton.isChecked() d->runConfiguration->setUseQmlDebugger(d->debugQmlOnlyButton.isChecked()
|| m_d->debugCppAndQmlButton.isChecked()); || d->debugCppAndQmlButton.isChecked());
} }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -82,7 +82,7 @@ private:
void addGenericWidgets(QVBoxLayout *mainLayout); void addGenericWidgets(QVBoxLayout *mainLayout);
void addEnvironmentWidgets(QVBoxLayout *mainLayout); void addEnvironmentWidgets(QVBoxLayout *mainLayout);
Internal::RemoteLinuxRunConfigurationWidgetPrivate * const m_d; Internal::RemoteLinuxRunConfigurationWidgetPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -54,7 +54,7 @@ public:
virtual bool isRunning() const; virtual bool isRunning() const;
virtual QIcon icon() const; virtual QIcon icon() const;
virtual AbstractRemoteLinuxApplicationRunner *runner() const=0; virtual AbstractRemoteLinuxApplicationRunner *runner() const = 0;
private slots: private slots:
void startExecution(); void startExecution();

View File

@@ -60,54 +60,54 @@ class RemoteLinuxUsedPortsGathererPrivate
using namespace Internal; using namespace Internal;
RemoteLinuxUsedPortsGatherer::RemoteLinuxUsedPortsGatherer(QObject *parent) : RemoteLinuxUsedPortsGatherer::RemoteLinuxUsedPortsGatherer(QObject *parent) :
QObject(parent), m_d(new RemoteLinuxUsedPortsGathererPrivate) QObject(parent), d(new RemoteLinuxUsedPortsGathererPrivate)
{ {
} }
RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer() RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer()
{ {
delete m_d; delete d;
} }
void RemoteLinuxUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection, void RemoteLinuxUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection,
const LinuxDeviceConfiguration::ConstPtr &devConf) const LinuxDeviceConfiguration::ConstPtr &devConf)
{ {
if (m_d->running) if (d->running)
qWarning("Unexpected call of %s in running state", Q_FUNC_INFO); qWarning("Unexpected call of %s in running state", Q_FUNC_INFO);
m_d->portsToCheck = devConf->freePorts(); d->portsToCheck = devConf->freePorts();
m_d->usedPorts.clear(); d->usedPorts.clear();
m_d->remoteStdout.clear(); d->remoteStdout.clear();
m_d->remoteStderr.clear(); d->remoteStderr.clear();
m_d->procRunner = SshRemoteProcessRunner::create(connection); d->procRunner = SshRemoteProcessRunner::create(connection);
connect(m_d->procRunner.data(), SIGNAL(connectionError(Utils::SshError)), connect(d->procRunner.data(), SIGNAL(connectionError(Utils::SshError)),
SLOT(handleConnectionError())); SLOT(handleConnectionError()));
connect(m_d->procRunner.data(), SIGNAL(processClosed(int)), connect(d->procRunner.data(), SIGNAL(processClosed(int)),
SLOT(handleProcessClosed(int))); SLOT(handleProcessClosed(int)));
connect(m_d->procRunner.data(), SIGNAL(processOutputAvailable(QByteArray)), connect(d->procRunner.data(), SIGNAL(processOutputAvailable(QByteArray)),
SLOT(handleRemoteStdOut(QByteArray))); SLOT(handleRemoteStdOut(QByteArray)));
connect(m_d->procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)), connect(d->procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
SLOT(handleRemoteStdErr(QByteArray))); SLOT(handleRemoteStdErr(QByteArray)));
const QString command = QLatin1String("sed " const QString command = QLatin1String("sed "
"'s/.*: [[:xdigit:]]\\{8\\}:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp"); "'s/.*: [[:xdigit:]]\\{8\\}:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp");
m_d->procRunner->run(command.toUtf8()); d->procRunner->run(command.toUtf8());
m_d->running = true; d->running = true;
} }
void RemoteLinuxUsedPortsGatherer::stop() void RemoteLinuxUsedPortsGatherer::stop()
{ {
if (!m_d->running) if (!d->running)
return; return;
m_d->running = false; d->running = false;
disconnect(m_d->procRunner->connection().data(), 0, this, 0); disconnect(d->procRunner->connection().data(), 0, this, 0);
if (m_d->procRunner->process()) if (d->procRunner->process())
m_d->procRunner->process()->closeChannel(); d->procRunner->process()->closeChannel();
} }
int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
{ {
while (freePorts->hasMore()) { while (freePorts->hasMore()) {
const int port = freePorts->getNext(); const int port = freePorts->getNext();
if (!m_d->usedPorts.contains(port)) if (!d->usedPorts.contains(port))
return port; return port;
} }
return -1; return -1;
@@ -115,12 +115,12 @@ int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
QList<int> RemoteLinuxUsedPortsGatherer::usedPorts() const QList<int> RemoteLinuxUsedPortsGatherer::usedPorts() const
{ {
return m_d->usedPorts; return d->usedPorts;
} }
void RemoteLinuxUsedPortsGatherer::setupUsedPorts() void RemoteLinuxUsedPortsGatherer::setupUsedPorts()
{ {
QList<QByteArray> portStrings = m_d->remoteStdout.split('\n'); QList<QByteArray> portStrings = d->remoteStdout.split('\n');
portStrings.removeFirst(); portStrings.removeFirst();
foreach (const QByteArray &portString, portStrings) { foreach (const QByteArray &portString, portStrings) {
if (portString.isEmpty()) if (portString.isEmpty())
@@ -128,8 +128,8 @@ void RemoteLinuxUsedPortsGatherer::setupUsedPorts()
bool ok; bool ok;
const int port = portString.toInt(&ok, 16); const int port = portString.toInt(&ok, 16);
if (ok) { if (ok) {
if (m_d->portsToCheck.contains(port) && !m_d->usedPorts.contains(port)) if (d->portsToCheck.contains(port) && !d->usedPorts.contains(port))
m_d->usedPorts << port; d->usedPorts << port;
} else { } else {
qWarning("%s: Unexpected string '%s' is not a port.", qWarning("%s: Unexpected string '%s' is not a port.",
Q_FUNC_INFO, portString.data()); Q_FUNC_INFO, portString.data());
@@ -140,33 +140,33 @@ void RemoteLinuxUsedPortsGatherer::setupUsedPorts()
void RemoteLinuxUsedPortsGatherer::handleConnectionError() void RemoteLinuxUsedPortsGatherer::handleConnectionError()
{ {
if (!m_d->running) if (!d->running)
return; return;
emit error(tr("Connection error: %1"). emit error(tr("Connection error: %1").
arg(m_d->procRunner->connection()->errorString())); arg(d->procRunner->connection()->errorString()));
stop(); stop();
} }
void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus) void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
{ {
if (!m_d->running) if (!d->running)
return; return;
QString errMsg; QString errMsg;
switch (exitStatus) { switch (exitStatus) {
case SshRemoteProcess::FailedToStart: case SshRemoteProcess::FailedToStart:
errMsg = tr("Could not start remote process: %1") errMsg = tr("Could not start remote process: %1")
.arg(m_d->procRunner->process()->errorString()); .arg(d->procRunner->process()->errorString());
break; break;
case SshRemoteProcess::KilledBySignal: case SshRemoteProcess::KilledBySignal:
errMsg = tr("Remote process crashed: %1") errMsg = tr("Remote process crashed: %1")
.arg(m_d->procRunner->process()->errorString()); .arg(d->procRunner->process()->errorString());
break; break;
case SshRemoteProcess::ExitedNormally: case SshRemoteProcess::ExitedNormally:
if (m_d->procRunner->process()->exitCode() == 0) { if (d->procRunner->process()->exitCode() == 0) {
setupUsedPorts(); setupUsedPorts();
} else { } else {
errMsg = tr("Remote process failed; exit code was %1.") errMsg = tr("Remote process failed; exit code was %1.")
.arg(m_d->procRunner->process()->exitCode()); .arg(d->procRunner->process()->exitCode());
} }
break; break;
default: default:
@@ -174,9 +174,9 @@ void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
} }
if (!errMsg.isEmpty()) { if (!errMsg.isEmpty()) {
if (!m_d->remoteStderr.isEmpty()) { if (!d->remoteStderr.isEmpty()) {
errMsg += tr("\nRemote error output was: %1") errMsg += tr("\nRemote error output was: %1")
.arg(QString::fromUtf8(m_d->remoteStderr)); .arg(QString::fromUtf8(d->remoteStderr));
} }
emit error(errMsg); emit error(errMsg);
} }
@@ -185,12 +185,12 @@ void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
void RemoteLinuxUsedPortsGatherer::handleRemoteStdOut(const QByteArray &output) void RemoteLinuxUsedPortsGatherer::handleRemoteStdOut(const QByteArray &output)
{ {
m_d->remoteStdout += output; d->remoteStdout += output;
} }
void RemoteLinuxUsedPortsGatherer::handleRemoteStdErr(const QByteArray &output) void RemoteLinuxUsedPortsGatherer::handleRemoteStdErr(const QByteArray &output)
{ {
m_d->remoteStderr += output; d->remoteStderr += output;
} }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -77,7 +77,7 @@ private slots:
private: private:
void setupUsedPorts(); void setupUsedPorts();
Internal::RemoteLinuxUsedPortsGathererPrivate * const m_d; Internal::RemoteLinuxUsedPortsGathererPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -50,21 +50,21 @@ public:
} // namespace Internal } // namespace Internal
SshKeyDeployer::SshKeyDeployer(QObject *parent) SshKeyDeployer::SshKeyDeployer(QObject *parent)
: QObject(parent), m_d(new Internal::SshKeyDeployerPrivate) : QObject(parent), d(new Internal::SshKeyDeployerPrivate)
{ {
} }
SshKeyDeployer::~SshKeyDeployer() SshKeyDeployer::~SshKeyDeployer()
{ {
cleanup(); cleanup();
delete m_d; delete d;
} }
void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams, void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams,
const QString &keyFilePath) const QString &keyFilePath)
{ {
cleanup(); cleanup();
m_d->deployProcess = SshRemoteProcessRunner::create(sshParams); d->deployProcess = SshRemoteProcessRunner::create(sshParams);
Utils::FileReader reader; Utils::FileReader reader;
if (!reader.fetch(keyFilePath)) { if (!reader.fetch(keyFilePath)) {
@@ -72,21 +72,21 @@ void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams,
return; return;
} }
connect(m_d->deployProcess.data(), SIGNAL(connectionError(Utils::SshError)), this, connect(d->deployProcess.data(), SIGNAL(connectionError(Utils::SshError)), this,
SLOT(handleConnectionFailure())); SLOT(handleConnectionFailure()));
connect(m_d->deployProcess.data(), SIGNAL(processClosed(int)), this, connect(d->deployProcess.data(), SIGNAL(processClosed(int)), this,
SLOT(handleKeyUploadFinished(int))); SLOT(handleKeyUploadFinished(int)));
const QByteArray command = "test -d .ssh " const QByteArray command = "test -d .ssh "
"|| mkdir .ssh && chmod 0700 .ssh && echo '" "|| mkdir .ssh && chmod 0700 .ssh && echo '"
+ reader.data() + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys"; + reader.data() + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys";
m_d->deployProcess->run(command); d->deployProcess->run(command);
} }
void SshKeyDeployer::handleConnectionFailure() void SshKeyDeployer::handleConnectionFailure()
{ {
if (!m_d->deployProcess) if (!d->deployProcess)
return; return;
const QString errorMsg = m_d->deployProcess->connection()->errorString(); const QString errorMsg = d->deployProcess->connection()->errorString();
cleanup(); cleanup();
emit error(tr("Connection failed: %1").arg(errorMsg)); emit error(tr("Connection failed: %1").arg(errorMsg));
} }
@@ -97,11 +97,11 @@ void SshKeyDeployer::handleKeyUploadFinished(int exitStatus)
|| exitStatus == SshRemoteProcess::KilledBySignal || exitStatus == SshRemoteProcess::KilledBySignal
|| exitStatus == SshRemoteProcess::ExitedNormally); || exitStatus == SshRemoteProcess::ExitedNormally);
if (!m_d->deployProcess) if (!d->deployProcess)
return; return;
const int exitCode = m_d->deployProcess->process()->exitCode(); const int exitCode = d->deployProcess->process()->exitCode();
const QString errorMsg = m_d->deployProcess->process()->errorString(); const QString errorMsg = d->deployProcess->process()->errorString();
cleanup(); cleanup();
if (exitStatus == SshRemoteProcess::ExitedNormally && exitCode == 0) if (exitStatus == SshRemoteProcess::ExitedNormally && exitCode == 0)
emit finishedSuccessfully(); emit finishedSuccessfully();
@@ -116,9 +116,9 @@ void SshKeyDeployer::stopDeployment()
void SshKeyDeployer::cleanup() void SshKeyDeployer::cleanup()
{ {
if (m_d->deployProcess) { if (d->deployProcess) {
disconnect(m_d->deployProcess.data(), 0, this, 0); disconnect(d->deployProcess.data(), 0, this, 0);
m_d->deployProcess.clear(); d->deployProcess.clear();
} }
} }

View File

@@ -67,7 +67,7 @@ private slots:
private: private:
void cleanup(); void cleanup();
Internal::SshKeyDeployerPrivate * const m_d; Internal::SshKeyDeployerPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -52,18 +52,18 @@ using namespace Internal;
UploadAndInstallTarPackageService::UploadAndInstallTarPackageService(QObject *parent) UploadAndInstallTarPackageService::UploadAndInstallTarPackageService(QObject *parent)
: AbstractUploadAndInstallPackageService(parent), : AbstractUploadAndInstallPackageService(parent),
m_d(new UploadAndInstallTarPackageServicePrivate) d(new UploadAndInstallTarPackageServicePrivate)
{ {
} }
UploadAndInstallTarPackageService::~UploadAndInstallTarPackageService() UploadAndInstallTarPackageService::~UploadAndInstallTarPackageService()
{ {
delete m_d; delete d;
} }
AbstractRemoteLinuxPackageInstaller *UploadAndInstallTarPackageService::packageInstaller() const AbstractRemoteLinuxPackageInstaller *UploadAndInstallTarPackageService::packageInstaller() const
{ {
return &m_d->installer; return &d->installer;
} }

View File

@@ -53,7 +53,7 @@ public:
private: private:
AbstractRemoteLinuxPackageInstaller *packageInstaller() const; AbstractRemoteLinuxPackageInstaller *packageInstaller() const;
Internal::UploadAndInstallTarPackageServicePrivate *m_d; Internal::UploadAndInstallTarPackageServicePrivate *d;
}; };