forked from qt-creator/qt-creator
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:
@@ -81,39 +81,39 @@ public:
|
||||
using namespace Internal;
|
||||
|
||||
AbstractRemoteLinuxDeployService::AbstractRemoteLinuxDeployService(QObject *parent)
|
||||
: QObject(parent), m_d(new AbstractRemoteLinuxDeployServicePrivate)
|
||||
: QObject(parent), d(new AbstractRemoteLinuxDeployServicePrivate)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractRemoteLinuxDeployService::~AbstractRemoteLinuxDeployService()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
const Qt4BuildConfiguration *AbstractRemoteLinuxDeployService::qt4BuildConfiguration() const
|
||||
{
|
||||
return m_d->buildConfiguration;
|
||||
return d->buildConfiguration;
|
||||
}
|
||||
|
||||
LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxDeployService::deviceConfiguration() const
|
||||
{
|
||||
return m_d->deviceConfiguration;
|
||||
return d->deviceConfiguration;
|
||||
}
|
||||
|
||||
SshConnection::Ptr AbstractRemoteLinuxDeployService::connection() const
|
||||
{
|
||||
return m_d->connection;
|
||||
return d->connection;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::saveDeploymentTimeStamp(const DeployableFile &deployableFile)
|
||||
{
|
||||
m_d->lastDeployed.insert(DeployablePerHost(deployableFile,
|
||||
d->lastDeployed.insert(DeployablePerHost(deployableFile,
|
||||
deviceConfiguration()->sshParameters().host), QDateTime::currentDateTime());
|
||||
}
|
||||
|
||||
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));
|
||||
return !lastDeployed.isValid()
|
||||
|| QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed;
|
||||
@@ -121,17 +121,17 @@ bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const Deplo
|
||||
|
||||
void AbstractRemoteLinuxDeployService::setDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &deviceConfiguration)
|
||||
{
|
||||
m_d->deviceConfiguration = deviceConfiguration;
|
||||
d->deviceConfiguration = deviceConfiguration;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::setBuildConfiguration(Qt4BuildConfiguration *bc)
|
||||
{
|
||||
m_d->buildConfiguration = bc;
|
||||
d->buildConfiguration = bc;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::start()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Inactive, return);
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
QString errorMsg;
|
||||
if (!isDeploymentPossible(&errorMsg)) {
|
||||
@@ -146,27 +146,27 @@ void AbstractRemoteLinuxDeployService::start()
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = SettingUpDevice;
|
||||
d->state = SettingUpDevice;
|
||||
doDeviceSetup();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::stop()
|
||||
{
|
||||
if (m_d->stopRequested)
|
||||
if (d->stopRequested)
|
||||
return;
|
||||
|
||||
switch (m_d->state) {
|
||||
switch (d->state) {
|
||||
case Inactive:
|
||||
break;
|
||||
case SettingUpDevice:
|
||||
m_d->stopRequested = true;
|
||||
d->stopRequested = true;
|
||||
stopDeviceSetup();
|
||||
break;
|
||||
case Connecting:
|
||||
setFinished();
|
||||
break;
|
||||
case Deploying:
|
||||
m_d->stopRequested = true;
|
||||
d->stopRequested = true;
|
||||
stopDeployment();
|
||||
break;
|
||||
}
|
||||
@@ -190,7 +190,7 @@ QVariantMap AbstractRemoteLinuxDeployService::exportDeployTimes() const
|
||||
QVariantList remotePathList;
|
||||
QVariantList timeList;
|
||||
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;
|
||||
remotePathList << it.key().first.remoteDir;
|
||||
hostList << it.key().second;
|
||||
@@ -214,64 +214,64 @@ void AbstractRemoteLinuxDeployService::importDeployTimes(const QVariantMap &map)
|
||||
= qMin(qMin(hostList.size(), fileList.size()),
|
||||
qMin(remotePathList.size(), timeList.size()));
|
||||
for (int i = 0; i < elemCount; ++i) {
|
||||
const DeployableFile d(fileList.at(i).toString(), remotePathList.at(i).toString());
|
||||
m_d->lastDeployed.insert(DeployablePerHost(d, hostList.at(i).toString()),
|
||||
const DeployableFile df(fileList.at(i).toString(), remotePathList.at(i).toString());
|
||||
d->lastDeployed.insert(DeployablePerHost(df, hostList.at(i).toString()),
|
||||
timeList.at(i).toDateTime());
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = Connecting;
|
||||
m_d->connection = SshConnectionManager::instance().acquireConnection(m_d->deviceConfiguration->sshParameters());
|
||||
connect(m_d->connection.data(), SIGNAL(error(Utils::SshError)),
|
||||
d->state = Connecting;
|
||||
d->connection = SshConnectionManager::instance().acquireConnection(d->deviceConfiguration->sshParameters());
|
||||
connect(d->connection.data(), SIGNAL(error(Utils::SshError)),
|
||||
SLOT(handleConnectionFailure()));
|
||||
if (m_d->connection->state() == SshConnection::Connected) {
|
||||
if (d->connection->state() == SshConnection::Connected) {
|
||||
handleConnected();
|
||||
} else {
|
||||
connect(m_d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
||||
connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
||||
emit progressMessage(tr("Connecting to device..."));
|
||||
if (m_d->connection->state() == SshConnection::Unconnected)
|
||||
m_d->connection->connectToHost();
|
||||
if (d->connection->state() == SshConnection::Unconnected)
|
||||
d->connection->connectToHost();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::handleDeploymentDone()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Deploying, return);
|
||||
QTC_ASSERT(d->state == Deploying, return);
|
||||
|
||||
setFinished();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::handleConnected()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Connecting, return);
|
||||
QTC_ASSERT(d->state == Connecting, return);
|
||||
|
||||
if (m_d->stopRequested) {
|
||||
if (d->stopRequested) {
|
||||
setFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = Deploying;
|
||||
d->state = Deploying;
|
||||
doDeploy();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::handleConnectionFailure()
|
||||
{
|
||||
switch (m_d->state) {
|
||||
switch (d->state) {
|
||||
case Inactive:
|
||||
case SettingUpDevice:
|
||||
qWarning("%s: Unexpected state %d.", Q_FUNC_INFO, m_d->state);
|
||||
qWarning("%s: Unexpected state %d.", Q_FUNC_INFO, d->state);
|
||||
break;
|
||||
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)
|
||||
errorMsg += tr("\nDid the emulator fail to start?");
|
||||
else
|
||||
@@ -281,20 +281,20 @@ void AbstractRemoteLinuxDeployService::handleConnectionFailure()
|
||||
break;
|
||||
}
|
||||
case Deploying:
|
||||
emit errorMessage(tr("Connection error: %1").arg(m_d->connection->errorString()));
|
||||
emit errorMessage(tr("Connection error: %1").arg(d->connection->errorString()));
|
||||
stopDeployment();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDeployService::setFinished()
|
||||
{
|
||||
m_d->state = Inactive;
|
||||
if (m_d->connection) {
|
||||
disconnect(m_d->connection.data(), 0, this, 0);
|
||||
SshConnectionManager::instance().releaseConnection(m_d->connection);
|
||||
m_d->connection = SshConnection::Ptr();
|
||||
d->state = Inactive;
|
||||
if (d->connection) {
|
||||
disconnect(d->connection.data(), 0, this, 0);
|
||||
SshConnectionManager::instance().releaseConnection(d->connection);
|
||||
d->connection = SshConnection::Ptr();
|
||||
}
|
||||
m_d->stopRequested = false;
|
||||
d->stopRequested = false;
|
||||
emit finished();
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ private:
|
||||
|
||||
void setFinished();
|
||||
|
||||
Internal::AbstractRemoteLinuxDeployServicePrivate * const m_d;
|
||||
Internal::AbstractRemoteLinuxDeployServicePrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -68,23 +68,23 @@ using namespace Internal;
|
||||
|
||||
AbstractUploadAndInstallPackageService::AbstractUploadAndInstallPackageService(QObject *parent)
|
||||
: AbstractRemoteLinuxDeployService(parent),
|
||||
m_d(new AbstractUploadAndInstallPackageServicePrivate)
|
||||
d(new AbstractUploadAndInstallPackageServicePrivate)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractUploadAndInstallPackageService::~AbstractUploadAndInstallPackageService()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void AbstractUploadAndInstallPackageService::setPackageFilePath(const QString &filePath)
|
||||
{
|
||||
m_d->packageFilePath = filePath;
|
||||
d->packageFilePath = filePath;
|
||||
}
|
||||
|
||||
QString AbstractUploadAndInstallPackageService::packageFilePath() const
|
||||
{
|
||||
return m_d->packageFilePath;
|
||||
return d->packageFilePath;
|
||||
}
|
||||
|
||||
QString AbstractUploadAndInstallPackageService::uploadDir() const
|
||||
@@ -99,38 +99,38 @@ bool AbstractUploadAndInstallPackageService::isDeploymentNecessary() const
|
||||
|
||||
void AbstractUploadAndInstallPackageService::doDeviceSetup()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Inactive, return);
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
handleDeviceSetupDone(true);
|
||||
}
|
||||
|
||||
void AbstractUploadAndInstallPackageService::stopDeviceSetup()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Inactive, return);
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
handleDeviceSetupDone(false);
|
||||
}
|
||||
|
||||
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 remoteFilePath = uploadDir() + QLatin1Char('/') + fileName;
|
||||
connect(m_d->uploader, SIGNAL(progress(QString)), SIGNAL(progressMessage(QString)));
|
||||
connect(m_d->uploader, SIGNAL(uploadFinished(QString)), SLOT(handleUploadFinished(QString)));
|
||||
m_d->uploader->uploadPackage(connection(), packageFilePath(), remoteFilePath);
|
||||
connect(d->uploader, SIGNAL(progress(QString)), SIGNAL(progressMessage(QString)));
|
||||
connect(d->uploader, SIGNAL(uploadFinished(QString)), SLOT(handleUploadFinished(QString)));
|
||||
d->uploader->uploadPackage(connection(), packageFilePath(), remoteFilePath);
|
||||
}
|
||||
|
||||
void AbstractUploadAndInstallPackageService::stopDeployment()
|
||||
{
|
||||
switch (m_d->state) {
|
||||
switch (d->state) {
|
||||
case Inactive:
|
||||
qWarning("%s: Unexpected state 'Inactive'.", Q_FUNC_INFO);
|
||||
break;
|
||||
case Uploading:
|
||||
m_d->uploader->cancelUpload();
|
||||
d->uploader->cancelUpload();
|
||||
setFinished();
|
||||
break;
|
||||
case Installing:
|
||||
@@ -142,7 +142,7 @@ void AbstractUploadAndInstallPackageService::stopDeployment()
|
||||
|
||||
void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString &errorMsg)
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Uploading, return);
|
||||
QTC_ASSERT(d->state == Uploading, return);
|
||||
|
||||
if (!errorMsg.isEmpty()) {
|
||||
emit errorMessage(errorMsg);
|
||||
@@ -153,7 +153,7 @@ void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString
|
||||
emit progressMessage(tr("Successfully uploaded package file."));
|
||||
const QString remoteFilePath = uploadDir() + QLatin1Char('/')
|
||||
+ QFileInfo(packageFilePath()).fileName();
|
||||
m_d->state = Installing;
|
||||
d->state = Installing;
|
||||
emit progressMessage(tr("Installing package to device..."));
|
||||
connect(packageInstaller(), SIGNAL(stdoutData(QString)), SIGNAL(stdOutData(QString)));
|
||||
connect(packageInstaller(), SIGNAL(stderrData(QString)), SIGNAL(stdErrData(QString)));
|
||||
@@ -164,7 +164,7 @@ void AbstractUploadAndInstallPackageService::handleUploadFinished(const QString
|
||||
|
||||
void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QString &errorMsg)
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Installing, return);
|
||||
QTC_ASSERT(d->state == Installing, return);
|
||||
|
||||
if (errorMsg.isEmpty()) {
|
||||
saveDeploymentTimeStamp(DeployableFile(packageFilePath(), QString()));
|
||||
@@ -177,8 +177,8 @@ void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QS
|
||||
|
||||
void AbstractUploadAndInstallPackageService::setFinished()
|
||||
{
|
||||
m_d->state = Inactive;
|
||||
disconnect(m_d->uploader, 0, this, 0);
|
||||
d->state = Inactive;
|
||||
disconnect(d->uploader, 0, this, 0);
|
||||
disconnect(packageInstaller(), 0, this, 0);
|
||||
handleDeploymentDone();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
|
||||
void setFinished();
|
||||
|
||||
Internal::AbstractUploadAndInstallPackageServicePrivate * const m_d;
|
||||
Internal::AbstractUploadAndInstallPackageServicePrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -75,37 +75,37 @@ using namespace Internal;
|
||||
|
||||
DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode,
|
||||
QObject *parent)
|
||||
: QAbstractTableModel(parent), m_d(new DeployableFilesPerProFilePrivate(proFileNode))
|
||||
: QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode))
|
||||
{
|
||||
if (m_d->projectType == ApplicationTemplate) {
|
||||
m_d->deployables.prepend(DeployableFile(localExecutableFilePath(),
|
||||
m_d->installsList.targetPath));
|
||||
} else if (m_d->projectType == LibraryTemplate) {
|
||||
if (d->projectType == ApplicationTemplate) {
|
||||
d->deployables.prepend(DeployableFile(localExecutableFilePath(),
|
||||
d->installsList.targetPath));
|
||||
} else if (d->projectType == LibraryTemplate) {
|
||||
foreach (const QString &filePath, localLibraryFilePaths()) {
|
||||
m_d->deployables.prepend(DeployableFile(filePath,
|
||||
m_d->installsList.targetPath));
|
||||
d->deployables.prepend(DeployableFile(filePath,
|
||||
d->installsList.targetPath));
|
||||
}
|
||||
}
|
||||
foreach (const InstallsItem &elem, m_d->installsList.items) {
|
||||
foreach (const InstallsItem &elem, d->installsList.items) {
|
||||
foreach (const QString &file, elem.files)
|
||||
m_d->deployables << DeployableFile(file, elem.path);
|
||||
d->deployables << DeployableFile(file, elem.path);
|
||||
}
|
||||
}
|
||||
|
||||
DeployableFilesPerProFile::~DeployableFilesPerProFile()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
DeployableFile DeployableFilesPerProFile::deployableAt(int row) const
|
||||
{
|
||||
Q_ASSERT(row >= 0 && row < rowCount());
|
||||
return m_d->deployables.at(row);
|
||||
return d->deployables.at(row);
|
||||
}
|
||||
|
||||
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
|
||||
@@ -118,7 +118,7 @@ QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) con
|
||||
if (!index.isValid() || index.row() >= rowCount())
|
||||
return QVariant();
|
||||
|
||||
if (m_d->projectType != AuxTemplate && !hasTargetPath() && index.row() == 0
|
||||
if (d->projectType != AuxTemplate && !hasTargetPath() && index.row() == 0
|
||||
&& index.column() == 1) {
|
||||
if (role == Qt::DisplayRole)
|
||||
return tr("<no target path set>");
|
||||
@@ -147,34 +147,34 @@ QVariant DeployableFilesPerProFile::headerData(int section,
|
||||
|
||||
QString DeployableFilesPerProFile::localExecutableFilePath() const
|
||||
{
|
||||
if (!m_d->targetInfo.valid || m_d->projectType != ApplicationTemplate)
|
||||
if (!d->targetInfo.valid || d->projectType != ApplicationTemplate)
|
||||
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
|
||||
{
|
||||
if (!m_d->targetInfo.valid || m_d->projectType != LibraryTemplate)
|
||||
if (!d->targetInfo.valid || d->projectType != LibraryTemplate)
|
||||
return QStringList();
|
||||
QString basePath = m_d->targetInfo.workingDir + QLatin1String("/lib");
|
||||
const bool isStatic = m_d->config.contains(QLatin1String("static"))
|
||||
|| m_d->config.contains(QLatin1String("staticlib"));
|
||||
basePath += m_d->targetInfo.target + QLatin1String(isStatic ? ".a" : ".so");
|
||||
QString basePath = d->targetInfo.workingDir + QLatin1String("/lib");
|
||||
const bool isStatic = d->config.contains(QLatin1String("static"))
|
||||
|| d->config.contains(QLatin1String("staticlib"));
|
||||
basePath += d->targetInfo.target + QLatin1String(isStatic ? ".a" : ".so");
|
||||
basePath = QDir::cleanPath(basePath);
|
||||
const QChar dot(QLatin1Char('.'));
|
||||
const QString filePathMajor = basePath + dot
|
||||
+ QString::number(m_d->projectVersion.major);
|
||||
+ QString::number(d->projectVersion.major);
|
||||
const QString filePathMinor = filePathMajor + dot
|
||||
+ QString::number(m_d->projectVersion.minor);
|
||||
+ QString::number(d->projectVersion.minor);
|
||||
const QString filePathPatch = filePathMinor + dot
|
||||
+ QString::number(m_d->projectVersion.patch);
|
||||
+ QString::number(d->projectVersion.patch);
|
||||
return QStringList() << filePathPatch << filePathMinor << filePathMajor
|
||||
<< basePath;
|
||||
}
|
||||
|
||||
QString DeployableFilesPerProFile::remoteExecutableFilePath() const
|
||||
{
|
||||
return hasTargetPath() && m_d->projectType == ApplicationTemplate
|
||||
return hasTargetPath() && d->projectType == ApplicationTemplate
|
||||
? deployableAt(0).remoteDir + QLatin1Char('/')
|
||||
+ QFileInfo(localExecutableFilePath()).fileName()
|
||||
: QString();
|
||||
@@ -182,18 +182,18 @@ QString DeployableFilesPerProFile::remoteExecutableFilePath() const
|
||||
|
||||
QString DeployableFilesPerProFile::projectDir() const
|
||||
{
|
||||
return QFileInfo(m_d->proFilePath).dir().path();
|
||||
return QFileInfo(d->proFilePath).dir().path();
|
||||
}
|
||||
|
||||
bool DeployableFilesPerProFile::hasTargetPath() const
|
||||
{
|
||||
return !m_d->installsList.targetPath.isEmpty();
|
||||
return !d->installsList.targetPath.isEmpty();
|
||||
}
|
||||
|
||||
bool DeployableFilesPerProFile::isModified() const { return m_d->modified; }
|
||||
void DeployableFilesPerProFile::setUnModified() { m_d->modified = false; }
|
||||
QString DeployableFilesPerProFile::projectName() const { return m_d->projectName; }
|
||||
QString DeployableFilesPerProFile::proFilePath() const { return m_d->proFilePath; }
|
||||
Qt4ProjectType DeployableFilesPerProFile::projectType() const { return m_d->projectType; }
|
||||
QString DeployableFilesPerProFile::applicationName() const { return m_d->targetInfo.target; }
|
||||
bool DeployableFilesPerProFile::isModified() const { return d->modified; }
|
||||
void DeployableFilesPerProFile::setUnModified() { d->modified = false; }
|
||||
QString DeployableFilesPerProFile::projectName() const { return d->projectName; }
|
||||
QString DeployableFilesPerProFile::proFilePath() const { return d->proFilePath; }
|
||||
Qt4ProjectType DeployableFilesPerProFile::projectType() const { return d->projectType; }
|
||||
QString DeployableFilesPerProFile::applicationName() const { return d->targetInfo.target; }
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
|
||||
QStringList localLibraryFilePaths() const;
|
||||
|
||||
Internal::DeployableFilesPerProFilePrivate * const m_d;
|
||||
Internal::DeployableFilesPerProFilePrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -60,55 +60,55 @@ public:
|
||||
|
||||
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)),
|
||||
SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
|
||||
m_d->updateTimer.setInterval(1500);
|
||||
m_d->updateTimer.setSingleShot(true);
|
||||
connect(&m_d->updateTimer, SIGNAL(timeout()), this, SLOT(createModels()));
|
||||
d->updateTimer.setInterval(1500);
|
||||
d->updateTimer.setSingleShot(true);
|
||||
connect(&d->updateTimer, SIGNAL(timeout()), this, SLOT(createModels()));
|
||||
createModels();
|
||||
}
|
||||
|
||||
DeploymentInfo::~DeploymentInfo()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void DeploymentInfo::startTimer(Qt4ProjectManager::Qt4ProFileNode*, bool success, bool parseInProgress)
|
||||
{
|
||||
Q_UNUSED(success)
|
||||
if (!parseInProgress)
|
||||
m_d->updateTimer.start();
|
||||
d->updateTimer.start();
|
||||
}
|
||||
|
||||
void DeploymentInfo::createModels()
|
||||
{
|
||||
if (m_d->target->project()->activeTarget() != m_d->target)
|
||||
if (d->target->project()->activeTarget() != d->target)
|
||||
return;
|
||||
const Qt4BuildConfiguration *bc = m_d->target->activeQt4BuildConfiguration();
|
||||
const Qt4BuildConfiguration *bc = d->target->activeQt4BuildConfiguration();
|
||||
if (!bc || !bc->qtVersion() || !bc->qtVersion()->isValid()) {
|
||||
beginResetModel();
|
||||
qDeleteAll(m_d->listModels);
|
||||
m_d->listModels.clear();
|
||||
qDeleteAll(d->listModels);
|
||||
d->listModels.clear();
|
||||
endResetModel();
|
||||
return;
|
||||
}
|
||||
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.
|
||||
return;
|
||||
m_d->updateTimer.stop();
|
||||
disconnect(m_d->target->qt4Project(),
|
||||
d->updateTimer.stop();
|
||||
disconnect(d->target->qt4Project(),
|
||||
SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
|
||||
this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
|
||||
beginResetModel();
|
||||
qDeleteAll(m_d->listModels);
|
||||
m_d->listModels.clear();
|
||||
qDeleteAll(d->listModels);
|
||||
d->listModels.clear();
|
||||
createModels(rootNode);
|
||||
endResetModel();
|
||||
connect(m_d->target->qt4Project(),
|
||||
connect(d->target->qt4Project(),
|
||||
SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
|
||||
this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
|
||||
}
|
||||
@@ -119,7 +119,7 @@ void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode)
|
||||
case ApplicationTemplate:
|
||||
case LibraryTemplate:
|
||||
case AuxTemplate:
|
||||
m_d->listModels << new DeployableFilesPerProFile(proFileNode, this);
|
||||
d->listModels << new DeployableFilesPerProFile(proFileNode, this);
|
||||
break;
|
||||
case SubDirsTemplate: {
|
||||
const QList<Qt4PriFileNode *> &subProjects = proFileNode->subProjectNodesExact();
|
||||
@@ -137,13 +137,13 @@ void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode)
|
||||
|
||||
void DeploymentInfo::setUnmodified()
|
||||
{
|
||||
foreach (DeployableFilesPerProFile * const model, m_d->listModels)
|
||||
foreach (DeployableFilesPerProFile * const model, d->listModels)
|
||||
model->setUnModified();
|
||||
}
|
||||
|
||||
bool DeploymentInfo::isModified() const
|
||||
{
|
||||
foreach (const DeployableFilesPerProFile * const model, m_d->listModels) {
|
||||
foreach (const DeployableFilesPerProFile * const model, d->listModels) {
|
||||
if (model->isModified())
|
||||
return true;
|
||||
}
|
||||
@@ -153,14 +153,14 @@ bool DeploymentInfo::isModified() const
|
||||
int DeploymentInfo::deployableCount() const
|
||||
{
|
||||
int count = 0;
|
||||
foreach (const DeployableFilesPerProFile * const model, m_d->listModels)
|
||||
foreach (const DeployableFilesPerProFile * const model, d->listModels)
|
||||
count += model->rowCount();
|
||||
return count;
|
||||
}
|
||||
|
||||
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);
|
||||
if (i < model->rowCount())
|
||||
return model->deployableAt(i);
|
||||
@@ -173,7 +173,7 @@ DeployableFile DeploymentInfo::deployableAt(int i) 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)
|
||||
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()
|
||||
|| index.column() != 0)
|
||||
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
|
||||
&& !model->hasTargetPath()) {
|
||||
QBrush brush;
|
||||
@@ -202,7 +202,7 @@ QVariant DeploymentInfo::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int DeploymentInfo::modelCount() const { return m_d->listModels.count(); }
|
||||
DeployableFilesPerProFile *DeploymentInfo::modelAt(int i) const { return m_d->listModels.at(i); }
|
||||
int DeploymentInfo::modelCount() const { return d->listModels.count(); }
|
||||
DeployableFilesPerProFile *DeploymentInfo::modelAt(int i) const { return d->listModels.at(i); }
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
Q_SLOT void createModels();
|
||||
void createModels(const Qt4ProjectManager::Qt4ProFileNode *proFileNode);
|
||||
|
||||
Internal::DeploymentInfoPrivate * const m_d;
|
||||
Internal::DeploymentInfoPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -80,14 +80,14 @@ DeploymentSettingsAssistant::DeploymentSettingsAssistant(const QString &qmakeSco
|
||||
const QString &installPrefix, const QSharedPointer<DeploymentInfo> &deploymentInfo,
|
||||
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()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool DeploymentSettingsAssistant::addDeployableToProFile(const DeployableFilesPerProFile *proFileInfo,
|
||||
@@ -106,7 +106,7 @@ bool DeploymentSettingsAssistant::addLinesToProFile(const DeployableFilesPerProF
|
||||
Core::FileChangeBlocker update(proFileInfo->proFilePath());
|
||||
|
||||
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");
|
||||
Utils::FileSaver saver(proFileInfo->proFilePath(), QIODevice::Append);
|
||||
saver.write(proFileString.toLocal8Bit());
|
||||
@@ -117,12 +117,12 @@ void DeploymentSettingsAssistant::handleDeploymentInfoUpdated()
|
||||
{
|
||||
QList<DeployableFilesPerProFile *> proFilesToAskAbout;
|
||||
QList<DeployableFilesPerProFile *> proFilesToUpdate;
|
||||
for (int i = 0; i < m_d->deploymentInfo->modelCount(); ++i) {
|
||||
DeployableFilesPerProFile * const proFileInfo = m_d->deploymentInfo->modelAt(i);
|
||||
for (int i = 0; i < d->deploymentInfo->modelCount(); ++i) {
|
||||
DeployableFilesPerProFile * const proFileInfo = d->deploymentInfo->modelAt(i);
|
||||
if (proFileInfo->projectType() != AuxTemplate && !proFileInfo->hasTargetPath()) {
|
||||
const UpdateSettingsMap::ConstIterator it
|
||||
= m_d->updateSettings.find(proFileInfo->proFilePath());
|
||||
if (it == m_d->updateSettings.constEnd())
|
||||
= d->updateSettings.find(proFileInfo->proFilePath());
|
||||
if (it == d->updateSettings.constEnd())
|
||||
proFilesToAskAbout << proFileInfo;
|
||||
else if (it.value() == UpdateProFile)
|
||||
proFilesToUpdate << proFileInfo;
|
||||
@@ -136,7 +136,7 @@ void DeploymentSettingsAssistant::handleDeploymentInfoUpdated()
|
||||
foreach (const ProFilesUpdateDialog::UpdateSetting &setting, settings) {
|
||||
const ProFileUpdateSetting updateSetting = setting.second
|
||||
? UpdateProFile : DontUpdateProFile;
|
||||
m_d->updateSettings.insert(setting.first->proFilePath(), updateSetting);
|
||||
d->updateSettings.insert(setting.first->proFilePath(), updateSetting);
|
||||
if (updateSetting == UpdateProFile)
|
||||
proFilesToUpdate << setting.first;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ void DeploymentSettingsAssistant::handleDeploymentInfoUpdated()
|
||||
foreach (const DeployableFilesPerProFile * const proFileInfo, proFilesToUpdate) {
|
||||
const QString remoteDirSuffix = QLatin1String(proFileInfo->projectType() == LibraryTemplate
|
||||
? "/lib" : "/bin");
|
||||
const QString remoteDir = QLatin1String("target.path = ") + m_d->installPrefix
|
||||
const QString remoteDir = QLatin1String("target.path = ") + d->installPrefix
|
||||
+ QLatin1Char('/') + proFileInfo->projectName() + remoteDirSuffix;
|
||||
const QStringList deployInfo = QStringList() << remoteDir
|
||||
<< QLatin1String("INSTALLS += target");
|
||||
|
||||
@@ -64,7 +64,7 @@ private slots:
|
||||
private:
|
||||
bool addLinesToProFile(const DeployableFilesPerProFile *proFileInfo, const QStringList &lines);
|
||||
|
||||
Internal::DeploymentSettingsAssistantInternal * const m_d;
|
||||
Internal::DeploymentSettingsAssistantInternal * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -72,74 +72,74 @@ public:
|
||||
using namespace Internal;
|
||||
|
||||
GenericDirectUploadService::GenericDirectUploadService(QObject *parent)
|
||||
: AbstractRemoteLinuxDeployService(parent), m_d(new GenericDirectUploadServicePrivate)
|
||||
: AbstractRemoteLinuxDeployService(parent), d(new GenericDirectUploadServicePrivate)
|
||||
{
|
||||
}
|
||||
|
||||
void GenericDirectUploadService::setDeployableFiles(const QList<DeployableFile> &deployableFiles)
|
||||
{
|
||||
m_d->deployableFiles = deployableFiles;
|
||||
d->deployableFiles = deployableFiles;
|
||||
}
|
||||
|
||||
void GenericDirectUploadService::setIncrementalDeployment(bool incremental)
|
||||
{
|
||||
m_d->incremental = incremental;
|
||||
d->incremental = incremental;
|
||||
}
|
||||
|
||||
bool GenericDirectUploadService::isDeploymentNecessary() const
|
||||
{
|
||||
m_d->filesToUpload.clear();
|
||||
for (int i = 0; i < m_d->deployableFiles.count(); ++i)
|
||||
checkDeploymentNeeded(m_d->deployableFiles.at(i));
|
||||
return !m_d->filesToUpload.isEmpty();
|
||||
d->filesToUpload.clear();
|
||||
for (int i = 0; i < d->deployableFiles.count(); ++i)
|
||||
checkDeploymentNeeded(d->deployableFiles.at(i));
|
||||
return !d->filesToUpload.isEmpty();
|
||||
}
|
||||
|
||||
void GenericDirectUploadService::doDeviceSetup()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Inactive, return);
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
handleDeviceSetupDone(true);
|
||||
}
|
||||
|
||||
void GenericDirectUploadService::stopDeviceSetup()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Inactive, return);
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
handleDeviceSetupDone(false);
|
||||
}
|
||||
|
||||
void GenericDirectUploadService::doDeploy()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Inactive, setFinished(); return);
|
||||
QTC_ASSERT(d->state == Inactive, setFinished(); return);
|
||||
|
||||
m_d->uploader = connection()->createSftpChannel();
|
||||
connect(m_d->uploader.data(), SIGNAL(initialized()), SLOT(handleSftpInitialized()));
|
||||
connect(m_d->uploader.data(), SIGNAL(initializationFailed(QString)),
|
||||
d->uploader = connection()->createSftpChannel();
|
||||
connect(d->uploader.data(), SIGNAL(initialized()), SLOT(handleSftpInitialized()));
|
||||
connect(d->uploader.data(), SIGNAL(initializationFailed(QString)),
|
||||
SLOT(handleSftpInitializationFailed(QString)));
|
||||
m_d->uploader->initialize();
|
||||
m_d->state = InitializingSftp;
|
||||
d->uploader->initialize();
|
||||
d->state = InitializingSftp;
|
||||
}
|
||||
|
||||
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();
|
||||
handleDeploymentDone();
|
||||
return;
|
||||
}
|
||||
|
||||
Q_ASSERT(!m_d->filesToUpload.isEmpty());
|
||||
connect(m_d->uploader.data(), SIGNAL(finished(Utils::SftpJobId, QString)),
|
||||
Q_ASSERT(!d->filesToUpload.isEmpty());
|
||||
connect(d->uploader.data(), SIGNAL(finished(Utils::SftpJobId, QString)),
|
||||
SLOT(handleUploadFinished(Utils::SftpJobId,QString)));
|
||||
m_d->state = Uploading;
|
||||
d->state = Uploading;
|
||||
uploadNextFile();
|
||||
}
|
||||
|
||||
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));
|
||||
setFinished();
|
||||
@@ -150,26 +150,26 @@ void GenericDirectUploadService::handleUploadFinished(Utils::SftpJobId jobId, co
|
||||
{
|
||||
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();
|
||||
handleDeploymentDone();
|
||||
}
|
||||
|
||||
const DeployableFile d = m_d->filesToUpload.takeFirst();
|
||||
const DeployableFile df = d->filesToUpload.takeFirst();
|
||||
if (!errorMsg.isEmpty()) {
|
||||
emit errorMessage(tr("Upload of file '%1' failed: %2")
|
||||
.arg(QDir::toNativeSeparators(d.localFilePath), errorMsg));
|
||||
.arg(QDir::toNativeSeparators(df.localFilePath), errorMsg));
|
||||
setFinished();
|
||||
handleDeploymentDone();
|
||||
} else {
|
||||
saveDeploymentTimeStamp(d);
|
||||
saveDeploymentTimeStamp(df);
|
||||
|
||||
// Terrible hack for Windows.
|
||||
if (d.remoteDir.contains(QLatin1String("bin"))) {
|
||||
const QString remoteFilePath = d.remoteDir + QLatin1Char('/')
|
||||
+ QFileInfo(d.localFilePath).fileName();
|
||||
if (df.remoteDir.contains(QLatin1String("bin"))) {
|
||||
const QString remoteFilePath = df.remoteDir + QLatin1Char('/')
|
||||
+ QFileInfo(df.localFilePath).fileName();
|
||||
const QString command = QLatin1String("chmod a+x ") + remoteFilePath;
|
||||
connection()->createRemoteProcess(command.toUtf8())->start();
|
||||
}
|
||||
@@ -180,63 +180,63 @@ void GenericDirectUploadService::handleUploadFinished(Utils::SftpJobId jobId, co
|
||||
|
||||
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();
|
||||
handleDeploymentDone();
|
||||
}
|
||||
|
||||
const DeployableFile d = m_d->filesToUpload.takeFirst();
|
||||
const QString nativePath = QDir::toNativeSeparators(d.localFilePath);
|
||||
if (exitStatus != SshRemoteProcess::ExitedNormally || m_d->lnProc->exitCode() != 0) {
|
||||
const DeployableFile df = d->filesToUpload.takeFirst();
|
||||
const QString nativePath = QDir::toNativeSeparators(df.localFilePath);
|
||||
if (exitStatus != SshRemoteProcess::ExitedNormally || d->lnProc->exitCode() != 0) {
|
||||
emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath));
|
||||
setFinished();
|
||||
handleDeploymentDone();
|
||||
return;
|
||||
} else {
|
||||
saveDeploymentTimeStamp(d);
|
||||
saveDeploymentTimeStamp(df);
|
||||
uploadNextFile();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
handleDeploymentDone();
|
||||
}
|
||||
|
||||
const DeployableFile &d = m_d->filesToUpload.first();
|
||||
QFileInfo fi(d.localFilePath);
|
||||
const QString nativePath = QDir::toNativeSeparators(d.localFilePath);
|
||||
if (exitStatus != SshRemoteProcess::ExitedNormally || m_d->mkdirProc->exitCode() != 0) {
|
||||
const DeployableFile &df = d->filesToUpload.first();
|
||||
QFileInfo fi(df.localFilePath);
|
||||
const QString nativePath = QDir::toNativeSeparators(df.localFilePath);
|
||||
if (exitStatus != SshRemoteProcess::ExitedNormally || d->mkdirProc->exitCode() != 0) {
|
||||
emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath));
|
||||
setFinished();
|
||||
handleDeploymentDone();
|
||||
} else if (fi.isDir()) {
|
||||
saveDeploymentTimeStamp(d);
|
||||
m_d->filesToUpload.removeFirst();
|
||||
saveDeploymentTimeStamp(df);
|
||||
d->filesToUpload.removeFirst();
|
||||
uploadNextFile();
|
||||
} else {
|
||||
const QString remoteFilePath = d.remoteDir + QLatin1Char('/') + fi.fileName();
|
||||
const QString remoteFilePath = df.remoteDir + QLatin1Char('/') + fi.fileName();
|
||||
if (fi.isSymLink()) {
|
||||
const QString target = fi.dir().relativeFilePath(fi.symLinkTarget()); // see QTBUG-5817.
|
||||
const QString command = QLatin1String("ln -vsf ") + target + QLatin1Char(' ')
|
||||
+ remoteFilePath;
|
||||
|
||||
// See comment in SftpChannel::createLink as to why we can't use it.
|
||||
m_d->lnProc = connection()->createRemoteProcess(command.toUtf8());
|
||||
connect(m_d->lnProc.data(), SIGNAL(closed(int)), SLOT(handleLnFinished(int)));
|
||||
connect(m_d->lnProc.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
d->lnProc = connection()->createRemoteProcess(command.toUtf8());
|
||||
connect(d->lnProc.data(), SIGNAL(closed(int)), SLOT(handleLnFinished(int)));
|
||||
connect(d->lnProc.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
SLOT(handleStdOutData(QByteArray)));
|
||||
connect(m_d->lnProc.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
connect(d->lnProc.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
SLOT(handleStdErrData(QByteArray)));
|
||||
m_d->lnProc->start();
|
||||
d->lnProc->start();
|
||||
} else {
|
||||
const SftpJobId job = m_d->uploader->uploadFile(d.localFilePath, remoteFilePath,
|
||||
const SftpJobId job = d->uploader->uploadFile(df.localFilePath, remoteFilePath,
|
||||
SftpOverwriteExisting);
|
||||
if (job == SftpInvalidJob) {
|
||||
emit errorMessage(tr("Failed to upload file '%1': "
|
||||
@@ -260,7 +260,7 @@ void GenericDirectUploadService::handleStdErrData(const QByteArray &data)
|
||||
|
||||
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();
|
||||
handleDeploymentDone();
|
||||
@@ -272,8 +272,8 @@ void GenericDirectUploadService::checkDeploymentNeeded(const DeployableFile &dep
|
||||
if (fileInfo.isDir()) {
|
||||
const QStringList files = QDir(deployable.localFilePath)
|
||||
.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
if (files.isEmpty() && (!m_d->incremental || hasChangedSinceLastDeployment(deployable)))
|
||||
m_d->filesToUpload << deployable;
|
||||
if (files.isEmpty() && (!d->incremental || hasChangedSinceLastDeployment(deployable)))
|
||||
d->filesToUpload << deployable;
|
||||
foreach (const QString &fileName, files) {
|
||||
const QString localFilePath = deployable.localFilePath
|
||||
+ QLatin1Char('/') + fileName;
|
||||
@@ -281,49 +281,49 @@ void GenericDirectUploadService::checkDeploymentNeeded(const DeployableFile &dep
|
||||
+ fileInfo.fileName();
|
||||
checkDeploymentNeeded(DeployableFile(localFilePath, remoteDir));
|
||||
}
|
||||
} else if (!m_d->incremental || hasChangedSinceLastDeployment(deployable)) {
|
||||
m_d->filesToUpload << deployable;
|
||||
} else if (!d->incremental || hasChangedSinceLastDeployment(deployable)) {
|
||||
d->filesToUpload << deployable;
|
||||
}
|
||||
}
|
||||
|
||||
void GenericDirectUploadService::setFinished()
|
||||
{
|
||||
m_d->stopRequested = false;
|
||||
m_d->state = Inactive;
|
||||
if (m_d->mkdirProc)
|
||||
disconnect(m_d->mkdirProc.data(), 0, this, 0);
|
||||
if (m_d->lnProc)
|
||||
disconnect(m_d->lnProc.data(), 0, this, 0);
|
||||
if (m_d->uploader) {
|
||||
disconnect(m_d->uploader.data(), 0, this, 0);
|
||||
m_d->uploader->closeChannel();
|
||||
d->stopRequested = false;
|
||||
d->state = Inactive;
|
||||
if (d->mkdirProc)
|
||||
disconnect(d->mkdirProc.data(), 0, this, 0);
|
||||
if (d->lnProc)
|
||||
disconnect(d->lnProc.data(), 0, this, 0);
|
||||
if (d->uploader) {
|
||||
disconnect(d->uploader.data(), 0, this, 0);
|
||||
d->uploader->closeChannel();
|
||||
}
|
||||
}
|
||||
|
||||
void GenericDirectUploadService::uploadNextFile()
|
||||
{
|
||||
if (m_d->filesToUpload.isEmpty()) {
|
||||
if (d->filesToUpload.isEmpty()) {
|
||||
emit progressMessage(tr("All files successfully deployed."));
|
||||
setFinished();
|
||||
handleDeploymentDone();
|
||||
return;
|
||||
}
|
||||
|
||||
const DeployableFile &d = m_d->filesToUpload.first();
|
||||
QString dirToCreate = d.remoteDir;
|
||||
QFileInfo fi(d.localFilePath);
|
||||
const DeployableFile &df = d->filesToUpload.first();
|
||||
QString dirToCreate = df.remoteDir;
|
||||
QFileInfo fi(df.localFilePath);
|
||||
if (fi.isDir())
|
||||
dirToCreate += QLatin1Char('/') + fi.fileName();
|
||||
const QString command = QLatin1String("mkdir -p ") + dirToCreate;
|
||||
m_d->mkdirProc = connection()->createRemoteProcess(command.toUtf8());
|
||||
connect(m_d->mkdirProc.data(), SIGNAL(closed(int)), SLOT(handleMkdirFinished(int)));
|
||||
connect(m_d->mkdirProc.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
d->mkdirProc = connection()->createRemoteProcess(command.toUtf8());
|
||||
connect(d->mkdirProc.data(), SIGNAL(closed(int)), SLOT(handleMkdirFinished(int)));
|
||||
connect(d->mkdirProc.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
SLOT(handleStdOutData(QByteArray)));
|
||||
connect(m_d->mkdirProc.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
connect(d->mkdirProc.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
SLOT(handleStdErrData(QByteArray)));
|
||||
emit progressMessage(tr("Uploading file '%1'...")
|
||||
.arg(QDir::toNativeSeparators(d.localFilePath)));
|
||||
m_d->mkdirProc->start();
|
||||
.arg(QDir::toNativeSeparators(df.localFilePath)));
|
||||
d->mkdirProc->start();
|
||||
}
|
||||
|
||||
} //namespace RemoteLinux
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
void setFinished();
|
||||
void uploadNextFile();
|
||||
|
||||
Internal::GenericDirectUploadServicePrivate * const m_d;
|
||||
Internal::GenericDirectUploadServicePrivate * const d;
|
||||
};
|
||||
|
||||
} //namespace RemoteLinux
|
||||
|
||||
@@ -59,32 +59,32 @@ public:
|
||||
|
||||
GenericLinuxDeviceConfigurationWizard::GenericLinuxDeviceConfigurationWizard(QWidget *parent)
|
||||
: ILinuxDeviceConfigurationWizard(parent),
|
||||
m_d(new Internal::GenericLinuxDeviceConfigurationWizardPrivate(this))
|
||||
d(new Internal::GenericLinuxDeviceConfigurationWizardPrivate(this))
|
||||
{
|
||||
setWindowTitle(tr("New Generic Linux Device Configuration Setup"));
|
||||
setPage(Internal::SetupPageId, &m_d->setupPage);
|
||||
setPage(Internal::FinalPageId, &m_d->finalPage);
|
||||
m_d->finalPage.setCommitPage(true);
|
||||
setPage(Internal::SetupPageId, &d->setupPage);
|
||||
setPage(Internal::FinalPageId, &d->finalPage);
|
||||
d->finalPage.setCommitPage(true);
|
||||
}
|
||||
|
||||
GenericLinuxDeviceConfigurationWizard::~GenericLinuxDeviceConfigurationWizard()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
LinuxDeviceConfiguration::Ptr GenericLinuxDeviceConfigurationWizard::deviceConfiguration()
|
||||
{
|
||||
Utils::SshConnectionParameters sshParams(SshConnectionParameters::NoProxy);
|
||||
sshParams.host = m_d->setupPage.hostName();
|
||||
sshParams.userName = m_d->setupPage.userName();
|
||||
sshParams.host = d->setupPage.hostName();
|
||||
sshParams.userName = d->setupPage.userName();
|
||||
sshParams.port = 22;
|
||||
sshParams.timeout = 10;
|
||||
sshParams.authenticationType = m_d->setupPage.authenticationType();
|
||||
sshParams.authenticationType = d->setupPage.authenticationType();
|
||||
if (sshParams.authenticationType == SshConnectionParameters::AuthenticationByPassword)
|
||||
sshParams.password = m_d->setupPage.password();
|
||||
sshParams.password = d->setupPage.password();
|
||||
else
|
||||
sshParams.privateKeyFile = m_d->setupPage.privateKeyFilePath();
|
||||
LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(m_d->setupPage.configurationName(),
|
||||
sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
|
||||
LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(d->setupPage.configurationName(),
|
||||
QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Hardware,
|
||||
PortList::fromString(QLatin1String("10000-10100")), sshParams);
|
||||
LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this);
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
LinuxDeviceConfiguration::Ptr deviceConfiguration();
|
||||
|
||||
private:
|
||||
Internal::GenericLinuxDeviceConfigurationWizardPrivate * const m_d;
|
||||
Internal::GenericLinuxDeviceConfigurationWizardPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -53,32 +53,32 @@ public:
|
||||
using namespace Utils;
|
||||
|
||||
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"));
|
||||
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
||||
m_d->ui.privateKeyPathChooser->setExpectedKind(PathChooser::File);
|
||||
connect(m_d->ui.nameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
||||
connect(m_d->ui.hostNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
||||
connect(m_d->ui.userNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
||||
connect(m_d->ui.privateKeyPathChooser, SIGNAL(validChanged()), SIGNAL(completeChanged()));
|
||||
connect(m_d->ui.passwordButton, SIGNAL(toggled(bool)), SLOT(handleAuthTypeChanged()));
|
||||
d->ui.privateKeyPathChooser->setExpectedKind(PathChooser::File);
|
||||
connect(d->ui.nameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
||||
connect(d->ui.hostNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
||||
connect(d->ui.userNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
||||
connect(d->ui.privateKeyPathChooser, SIGNAL(validChanged()), SIGNAL(completeChanged()));
|
||||
connect(d->ui.passwordButton, SIGNAL(toggled(bool)), SLOT(handleAuthTypeChanged()));
|
||||
}
|
||||
|
||||
GenericLinuxDeviceConfigurationWizardSetupPage::~GenericLinuxDeviceConfigurationWizardSetupPage()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void GenericLinuxDeviceConfigurationWizardSetupPage::initializePage()
|
||||
{
|
||||
m_d->ui.nameLineEdit->setText(QLatin1String("(New Configuration)"));
|
||||
m_d->ui.hostNameLineEdit->setText(defaultHostName());
|
||||
m_d->ui.userNameLineEdit->setText(defaultUserName());
|
||||
m_d->ui.passwordButton->setChecked(true);
|
||||
m_d->ui.passwordLineEdit->setText(defaultPassWord());
|
||||
m_d->ui.privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
|
||||
d->ui.nameLineEdit->setText(QLatin1String("(New Configuration)"));
|
||||
d->ui.hostNameLineEdit->setText(defaultHostName());
|
||||
d->ui.userNameLineEdit->setText(defaultUserName());
|
||||
d->ui.passwordButton->setChecked(true);
|
||||
d->ui.passwordLineEdit->setText(defaultPassWord());
|
||||
d->ui.privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
|
||||
handleAuthTypeChanged();
|
||||
}
|
||||
|
||||
@@ -86,39 +86,39 @@ bool GenericLinuxDeviceConfigurationWizardSetupPage::isComplete() const
|
||||
{
|
||||
return !configurationName().isEmpty() && !hostName().isEmpty() && !userName().isEmpty()
|
||||
&& (authenticationType() == SshConnectionParameters::AuthenticationByPassword
|
||||
|| m_d->ui.privateKeyPathChooser->isValid());
|
||||
|| d->ui.privateKeyPathChooser->isValid());
|
||||
}
|
||||
|
||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::configurationName() const
|
||||
{
|
||||
return m_d->ui.nameLineEdit->text().trimmed();
|
||||
return d->ui.nameLineEdit->text().trimmed();
|
||||
}
|
||||
|
||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::hostName() const
|
||||
{
|
||||
return m_d->ui.hostNameLineEdit->text().trimmed();
|
||||
return d->ui.hostNameLineEdit->text().trimmed();
|
||||
}
|
||||
|
||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::userName() const
|
||||
{
|
||||
return m_d->ui.userNameLineEdit->text().trimmed();
|
||||
return d->ui.userNameLineEdit->text().trimmed();
|
||||
}
|
||||
|
||||
SshConnectionParameters::AuthenticationType GenericLinuxDeviceConfigurationWizardSetupPage::authenticationType() const
|
||||
{
|
||||
return m_d->ui.passwordButton->isChecked()
|
||||
return d->ui.passwordButton->isChecked()
|
||||
? SshConnectionParameters::AuthenticationByPassword
|
||||
: SshConnectionParameters::AuthenticationByKey;
|
||||
}
|
||||
|
||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::password() const
|
||||
{
|
||||
return m_d->ui.passwordLineEdit->text();
|
||||
return d->ui.passwordLineEdit->text();
|
||||
}
|
||||
|
||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::privateKeyFilePath() const
|
||||
{
|
||||
return m_d->ui.privateKeyPathChooser->path();
|
||||
return d->ui.privateKeyPathChooser->path();
|
||||
}
|
||||
|
||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultHostName() const
|
||||
@@ -138,30 +138,30 @@ QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultPassWord() const
|
||||
|
||||
void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged()
|
||||
{
|
||||
m_d->ui.passwordLineEdit->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByPassword);
|
||||
m_d->ui.privateKeyPathChooser->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByKey);
|
||||
d->ui.passwordLineEdit->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByPassword);
|
||||
d->ui.privateKeyPathChooser->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByKey);
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
|
||||
GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent)
|
||||
: QWizardPage(parent), m_d(new Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate)
|
||||
: QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate)
|
||||
{
|
||||
setTitle(tr("Setup Finished"));
|
||||
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
||||
m_d->infoLabel.setWordWrap(true);
|
||||
d->infoLabel.setWordWrap(true);
|
||||
QVBoxLayout * const layout = new QVBoxLayout(this);
|
||||
layout->addWidget(&m_d->infoLabel);
|
||||
layout->addWidget(&d->infoLabel);
|
||||
}
|
||||
|
||||
GenericLinuxDeviceConfigurationWizardFinalPage::~GenericLinuxDeviceConfigurationWizardFinalPage()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void GenericLinuxDeviceConfigurationWizardFinalPage::initializePage()
|
||||
{
|
||||
m_d->infoLabel.setText(infoText());
|
||||
d->infoLabel.setText(infoText());
|
||||
}
|
||||
|
||||
QString GenericLinuxDeviceConfigurationWizardFinalPage::infoText() const
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
private:
|
||||
Q_SLOT void handleAuthTypeChanged();
|
||||
|
||||
Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate * const m_d;
|
||||
Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate * const d;
|
||||
};
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ protected:
|
||||
virtual QString infoText() const;
|
||||
|
||||
private:
|
||||
Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate * const m_d;
|
||||
Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -112,25 +112,25 @@ void LinuxDeviceConfigurations::copy(const LinuxDeviceConfigurations *source,
|
||||
LinuxDeviceConfigurations *target, bool deep)
|
||||
{
|
||||
if (deep) {
|
||||
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, source->m_d->devConfigs)
|
||||
target->m_d->devConfigs << LinuxDeviceConfiguration::create(devConf);
|
||||
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, source->d->devConfigs)
|
||||
target->d->devConfigs << LinuxDeviceConfiguration::create(devConf);
|
||||
} else {
|
||||
target->m_d->devConfigs = source->m_d->devConfigs;
|
||||
target->d->devConfigs = source->d->devConfigs;
|
||||
}
|
||||
target->m_d->defaultSshKeyFilePath = source->m_d->defaultSshKeyFilePath;
|
||||
target->m_d->nextId = source->m_d->nextId;
|
||||
target->d->defaultSshKeyFilePath = source->d->defaultSshKeyFilePath;
|
||||
target->d->nextId = source->d->nextId;
|
||||
}
|
||||
|
||||
void LinuxDeviceConfigurations::save()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(SettingsGroup);
|
||||
settings->setValue(IdCounterKey, m_d->nextId);
|
||||
settings->setValue(DefaultKeyFilePathKey, m_d->defaultSshKeyFilePath);
|
||||
settings->beginWriteArray(ConfigListKey, m_d->devConfigs.count());
|
||||
settings->setValue(IdCounterKey, d->nextId);
|
||||
settings->setValue(DefaultKeyFilePathKey, d->defaultSshKeyFilePath);
|
||||
settings->beginWriteArray(ConfigListKey, d->devConfigs.count());
|
||||
int skippedCount = 0;
|
||||
for (int i = 0; i < m_d->devConfigs.count(); ++i) {
|
||||
const LinuxDeviceConfiguration::ConstPtr &devConf = m_d->devConfigs.at(i);
|
||||
for (int i = 0; i < d->devConfigs.count(); ++i) {
|
||||
const LinuxDeviceConfiguration::ConstPtr &devConf = d->devConfigs.at(i);
|
||||
if (devConf->isAutoDetected()) {
|
||||
++skippedCount;
|
||||
} else {
|
||||
@@ -157,11 +157,11 @@ void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration:
|
||||
}
|
||||
devConfig->setName(name);
|
||||
|
||||
devConfig->setInternalId(m_d->nextId++);
|
||||
devConfig->setInternalId(d->nextId++);
|
||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||
if (!defaultDeviceConfig(devConfig->osType()))
|
||||
devConfig->setDefault(true);
|
||||
m_d->devConfigs << devConfig;
|
||||
d->devConfigs << devConfig;
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
@@ -173,12 +173,12 @@ void LinuxDeviceConfigurations::removeConfiguration(int idx)
|
||||
beginRemoveRows(QModelIndex(), idx, idx);
|
||||
const bool wasDefault = deviceAt(idx)->isDefault();
|
||||
const QString osType = deviceAt(idx)->osType();
|
||||
m_d->devConfigs.removeAt(idx);
|
||||
d->devConfigs.removeAt(idx);
|
||||
endRemoveRows();
|
||||
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) {
|
||||
m_d->devConfigs.at(i)->setDefault(true);
|
||||
d->devConfigs.at(i)->setDefault(true);
|
||||
const QModelIndex changedIndex = index(i, 0);
|
||||
emit dataChanged(changedIndex, changedIndex);
|
||||
break;
|
||||
@@ -191,12 +191,12 @@ void LinuxDeviceConfigurations::setDefaultSshKeyFilePath(const QString &path)
|
||||
{
|
||||
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
|
||||
|
||||
m_d->defaultSshKeyFilePath = path;
|
||||
d->defaultSshKeyFilePath = path;
|
||||
}
|
||||
|
||||
QString LinuxDeviceConfigurations::defaultSshKeyFilePath() const
|
||||
{
|
||||
return m_d->defaultSshKeyFilePath;
|
||||
return d->defaultSshKeyFilePath;
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
emit dataChanged(changedIndex, changedIndex);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ void LinuxDeviceConfigurations::setSshParameters(int i,
|
||||
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
|
||||
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)
|
||||
@@ -223,7 +223,7 @@ void LinuxDeviceConfigurations::setFreePorts(int i, const PortList &freePorts)
|
||||
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
|
||||
Q_ASSERT(i >= 0 && i < rowCount());
|
||||
|
||||
m_d->devConfigs.at(i)->setFreePorts(freePorts);
|
||||
d->devConfigs.at(i)->setFreePorts(freePorts);
|
||||
}
|
||||
|
||||
void LinuxDeviceConfigurations::setDefaultDevice(int idx)
|
||||
@@ -231,12 +231,12 @@ void LinuxDeviceConfigurations::setDefaultDevice(int idx)
|
||||
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
|
||||
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())
|
||||
return;
|
||||
QModelIndex oldDefaultIndex;
|
||||
for (int i = 0; i < m_d->devConfigs.count(); ++i) {
|
||||
const LinuxDeviceConfiguration::Ptr &oldDefaultDev = m_d->devConfigs.at(i);
|
||||
for (int i = 0; i < d->devConfigs.count(); ++i) {
|
||||
const LinuxDeviceConfiguration::Ptr &oldDefaultDev = d->devConfigs.at(i);
|
||||
if (oldDefaultDev->isDefault() && oldDefaultDev->osType() == devConf->osType()) {
|
||||
oldDefaultDev->setDefault(false);
|
||||
oldDefaultIndex = index(i, 0);
|
||||
@@ -252,28 +252,28 @@ void LinuxDeviceConfigurations::setDefaultDevice(int idx)
|
||||
}
|
||||
|
||||
LinuxDeviceConfigurations::LinuxDeviceConfigurations(QObject *parent)
|
||||
: QAbstractListModel(parent), m_d(new LinuxDeviceConfigurationsPrivate)
|
||||
: QAbstractListModel(parent), d(new LinuxDeviceConfigurationsPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
LinuxDeviceConfigurations::~LinuxDeviceConfigurations()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void LinuxDeviceConfigurations::load()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(SettingsGroup);
|
||||
m_d->nextId = settings->value(IdCounterKey, 1).toULongLong();
|
||||
m_d->defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey,
|
||||
d->nextId = settings->value(IdCounterKey, 1).toULongLong();
|
||||
d->defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey,
|
||||
LinuxDeviceConfiguration::defaultPrivateKeyFilePath()).toString();
|
||||
int count = settings->beginReadArray(ConfigListKey);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
settings->setArrayIndex(i);
|
||||
LinuxDeviceConfiguration::Ptr devConf
|
||||
= LinuxDeviceConfiguration::create(*settings, m_d->nextId);
|
||||
m_d->devConfigs << devConf;
|
||||
= LinuxDeviceConfiguration::create(*settings, d->nextId);
|
||||
d->devConfigs << devConf;
|
||||
}
|
||||
settings->endArray();
|
||||
settings->endGroup();
|
||||
@@ -283,15 +283,15 @@ void LinuxDeviceConfigurations::load()
|
||||
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::deviceAt(int idx) const
|
||||
{
|
||||
Q_ASSERT(idx >= 0 && idx < rowCount());
|
||||
return m_d->devConfigs.at(idx);
|
||||
return d->devConfigs.at(idx);
|
||||
}
|
||||
|
||||
bool LinuxDeviceConfigurations::hasConfig(const QString &name) const
|
||||
{
|
||||
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));
|
||||
return resultIt != m_d->devConfigs.constEnd();
|
||||
return resultIt != d->devConfigs.constEnd();
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, m_d->devConfigs) {
|
||||
foreach (const LinuxDeviceConfiguration::ConstPtr &devConf, d->devConfigs) {
|
||||
if (devConf->isDefault() && devConf->osType() == osType)
|
||||
return devConf;
|
||||
}
|
||||
@@ -311,7 +311,7 @@ LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::defaultDeviceConfi
|
||||
|
||||
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)
|
||||
return i;
|
||||
}
|
||||
@@ -328,7 +328,7 @@ void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType()
|
||||
QHash<QString, bool> osTypeHasDefault;
|
||||
|
||||
// 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 (osTypeHasDefault.value(devConf->osType()))
|
||||
devConf->setDefault(false);
|
||||
@@ -338,7 +338,7 @@ void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType()
|
||||
}
|
||||
|
||||
// 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())) {
|
||||
devConf->setDefault(true);
|
||||
osTypeHasDefault.insert(devConf->osType(), true);
|
||||
@@ -349,7 +349,7 @@ void LinuxDeviceConfigurations::ensureOneDefaultConfigurationPerOsType()
|
||||
int LinuxDeviceConfigurations::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return m_d->devConfigs.count();
|
||||
return d->devConfigs.count();
|
||||
}
|
||||
|
||||
QVariant LinuxDeviceConfigurations::data(const QModelIndex &index, int role) const
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
LinuxDeviceConfigurations *target, bool deep);
|
||||
void ensureOneDefaultConfigurationPerOsType();
|
||||
|
||||
Internal::LinuxDeviceConfigurationsPrivate * const m_d;
|
||||
Internal::LinuxDeviceConfigurationsPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -58,27 +58,27 @@ using namespace Internal;
|
||||
|
||||
LinuxDeviceTestDialog::LinuxDeviceTestDialog(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration,
|
||||
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);
|
||||
connect(m_d->deviceTester, SIGNAL(progressMessage(QString)), SLOT(handleProgressMessage(QString)));
|
||||
connect(m_d->deviceTester, SIGNAL(errorMessage(QString)), SLOT(handleErrorMessage(QString)));
|
||||
connect(m_d->deviceTester, SIGNAL(finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)),
|
||||
d->deviceTester->setParent(this);
|
||||
connect(d->deviceTester, SIGNAL(progressMessage(QString)), SLOT(handleProgressMessage(QString)));
|
||||
connect(d->deviceTester, SIGNAL(errorMessage(QString)), SLOT(handleErrorMessage(QString)));
|
||||
connect(d->deviceTester, SIGNAL(finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)),
|
||||
SLOT(handleTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)));
|
||||
m_d->deviceTester->testDevice(deviceConfiguration);
|
||||
d->deviceTester->testDevice(deviceConfiguration);
|
||||
}
|
||||
|
||||
LinuxDeviceTestDialog::~LinuxDeviceTestDialog()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void LinuxDeviceTestDialog::reject()
|
||||
{
|
||||
if (!m_d->finished)
|
||||
m_d->deviceTester->stopTest();
|
||||
if (!d->finished)
|
||||
d->deviceTester->stopTest();
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@ void LinuxDeviceTestDialog::handleErrorMessage(const QString &message)
|
||||
|
||||
void LinuxDeviceTestDialog::handleTestFinished(AbstractLinuxDeviceTester::TestResult result)
|
||||
{
|
||||
m_d->finished = true;
|
||||
m_d->ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
|
||||
d->finished = true;
|
||||
d->ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
|
||||
|
||||
if (result == AbstractLinuxDeviceTester::TestSuccess)
|
||||
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)
|
||||
{
|
||||
QTextCharFormat format = m_d->ui.textEdit->currentCharFormat();
|
||||
QTextCharFormat format = d->ui.textEdit->currentCharFormat();
|
||||
format.setForeground(QBrush(QColor(color)));
|
||||
QFont font = format.font();
|
||||
font.setBold(bold);
|
||||
format.setFont(font);
|
||||
m_d->ui.textEdit->setCurrentCharFormat(format);
|
||||
m_d->ui.textEdit->appendPlainText(text);
|
||||
d->ui.textEdit->setCurrentCharFormat(format);
|
||||
d->ui.textEdit->appendPlainText(text);
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -62,7 +62,7 @@ private slots:
|
||||
private:
|
||||
void addText(const QString &text, const QString &color, bool bold);
|
||||
|
||||
Internal::LinuxDeviceTestDialogPrivate * const m_d;
|
||||
Internal::LinuxDeviceTestDialogPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -72,43 +72,43 @@ AbstractLinuxDeviceTester::AbstractLinuxDeviceTester(QObject *parent) : QObject(
|
||||
|
||||
|
||||
GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent)
|
||||
: AbstractLinuxDeviceTester(parent), m_d(new GenericLinuxDeviceTesterPrivate)
|
||||
: AbstractLinuxDeviceTester(parent), d(new GenericLinuxDeviceTesterPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
GenericLinuxDeviceTester::~GenericLinuxDeviceTester()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void GenericLinuxDeviceTester::testDevice(const LinuxDeviceConfiguration::ConstPtr &deviceConfiguration)
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Inactive, return);
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
m_d->deviceConfiguration = deviceConfiguration;
|
||||
m_d->connection = SshConnection::create(deviceConfiguration->sshParameters());
|
||||
connect(m_d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
||||
connect(m_d->connection.data(), SIGNAL(error(Utils::SshError)),
|
||||
d->deviceConfiguration = deviceConfiguration;
|
||||
d->connection = SshConnection::create(deviceConfiguration->sshParameters());
|
||||
connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
||||
connect(d->connection.data(), SIGNAL(error(Utils::SshError)),
|
||||
SLOT(handleConnectionFailure()));
|
||||
|
||||
emit progressMessage(tr("Connecting to host..."));
|
||||
m_d->state = Connecting;
|
||||
m_d->connection->connectToHost();
|
||||
d->state = Connecting;
|
||||
d->connection->connectToHost();
|
||||
}
|
||||
|
||||
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:
|
||||
m_d->connection->disconnectFromHost();
|
||||
d->connection->disconnectFromHost();
|
||||
break;
|
||||
case TestingPorts:
|
||||
m_d->portsGatherer.stop();
|
||||
d->portsGatherer.stop();
|
||||
break;
|
||||
case RunningUname:
|
||||
m_d->process->closeChannel();
|
||||
d->process->closeChannel();
|
||||
break;
|
||||
case Inactive:
|
||||
break;
|
||||
@@ -119,71 +119,71 @@ void GenericLinuxDeviceTester::stopTest()
|
||||
|
||||
SshConnection::Ptr GenericLinuxDeviceTester::connection() const
|
||||
{
|
||||
return m_d->connection;
|
||||
return d->connection;
|
||||
}
|
||||
|
||||
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");
|
||||
connect(m_d->process.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
d->process = d->connection->createRemoteProcess("uname -rsm");
|
||||
connect(d->process.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
SLOT(handleRemoteStdOut(QByteArray)));
|
||||
connect(m_d->process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
connect(d->process.data(), SIGNAL(errorOutputAvailable(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...");
|
||||
m_d->state = RunningUname;
|
||||
m_d->process->start();
|
||||
d->state = RunningUname;
|
||||
d->process->start();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
QTC_ASSERT(m_d->state == RunningUname, return);
|
||||
QTC_ASSERT(d->state == RunningUname, return);
|
||||
|
||||
if (exitStatus != SshRemoteProcess::ExitedNormally || m_d->process->exitCode() != 0) {
|
||||
if (!m_d->remoteStderr.isEmpty())
|
||||
emit errorMessage(tr("uname failed: %1\n").arg(QString::fromUtf8(m_d->remoteStderr)));
|
||||
if (exitStatus != SshRemoteProcess::ExitedNormally || d->process->exitCode() != 0) {
|
||||
if (!d->remoteStderr.isEmpty())
|
||||
emit errorMessage(tr("uname failed: %1\n").arg(QString::fromUtf8(d->remoteStderr)));
|
||||
else
|
||||
emit errorMessage(tr("uname failed.\n"));
|
||||
} 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(&m_d->portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady()));
|
||||
connect(&d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGatheringError(QString)));
|
||||
connect(&d->portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady()));
|
||||
|
||||
emit progressMessage(tr("Checking if specified ports are available..."));
|
||||
m_d->state = TestingPorts;
|
||||
m_d->portsGatherer.start(m_d->connection, m_d->deviceConfiguration);
|
||||
d->state = TestingPorts;
|
||||
d->portsGatherer.start(d->connection, d->deviceConfiguration);
|
||||
}
|
||||
|
||||
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));
|
||||
setFinished(TestFailure);
|
||||
@@ -191,13 +191,13 @@ void GenericLinuxDeviceTester::handlePortsGatheringError(const QString &message)
|
||||
|
||||
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");
|
||||
} else {
|
||||
QString portList;
|
||||
foreach (const int port, m_d->portsGatherer.usedPorts())
|
||||
foreach (const int port, d->portsGatherer.usedPorts())
|
||||
portList += QString::number(port) + QLatin1String(", ");
|
||||
portList.remove(portList.count() - 2, 2);
|
||||
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)
|
||||
{
|
||||
m_d->state = Inactive;
|
||||
m_d->remoteStdout.clear();
|
||||
m_d->remoteStderr.clear();
|
||||
disconnect(m_d->connection.data(), 0, this, 0);
|
||||
disconnect(&m_d->portsGatherer, 0, this, 0);
|
||||
d->state = Inactive;
|
||||
d->remoteStdout.clear();
|
||||
d->remoteStderr.clear();
|
||||
disconnect(d->connection.data(), 0, this, 0);
|
||||
disconnect(&d->portsGatherer, 0, this, 0);
|
||||
emit finished(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ private slots:
|
||||
private:
|
||||
void setFinished(TestResult result);
|
||||
|
||||
Internal::GenericLinuxDeviceTesterPrivate * const m_d;
|
||||
Internal::GenericLinuxDeviceTesterPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -135,17 +135,17 @@ public:
|
||||
|
||||
} // 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)
|
||||
{
|
||||
*m_d = *other.m_d;
|
||||
*d = *other.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -158,14 +158,14 @@ void PortList::addPort(int port) { addRange(port, port); }
|
||||
|
||||
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
|
||||
{
|
||||
foreach (const Internal::Range &r, m_d->ranges) {
|
||||
foreach (const Internal::Range &r, d->ranges) {
|
||||
if (port >= r.first && port <= r.second)
|
||||
return true;
|
||||
}
|
||||
@@ -175,26 +175,26 @@ bool PortList::contains(int port) const
|
||||
int PortList::count() const
|
||||
{
|
||||
int n = 0;
|
||||
foreach (const Internal::Range &r, m_d->ranges)
|
||||
foreach (const Internal::Range &r, d->ranges)
|
||||
n += r.second - r.first + 1;
|
||||
return n;
|
||||
}
|
||||
|
||||
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++;
|
||||
if (firstRange.first > firstRange.second)
|
||||
m_d->ranges.removeFirst();
|
||||
d->ranges.removeFirst();
|
||||
return next;
|
||||
}
|
||||
|
||||
QString PortList::toString() const
|
||||
{
|
||||
QString stringRep;
|
||||
foreach (const Internal::Range &range, m_d->ranges) {
|
||||
foreach (const Internal::Range &range, d->ranges) {
|
||||
stringRep += QString::number(range.first);
|
||||
if (range.second != range.first)
|
||||
stringRep += QLatin1Char('-') + QString::number(range.second);
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
static QString regularExpression();
|
||||
|
||||
private:
|
||||
Internal::PortListPrivate * const m_d;
|
||||
Internal::PortListPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -52,15 +52,15 @@ using namespace Internal;
|
||||
|
||||
PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const LinuxDeviceConfiguration::ConstPtr &deviceConfig,
|
||||
QWidget *parent)
|
||||
: QProgressDialog(parent), m_d(new PublicKeyDeploymentDialogPrivate)
|
||||
: QProgressDialog(parent), d(new PublicKeyDeploymentDialogPrivate)
|
||||
{
|
||||
setAutoReset(false);
|
||||
setAutoClose(false);
|
||||
setMinimumDuration(0);
|
||||
setMaximum(1);
|
||||
|
||||
m_d->keyDeployer = new SshKeyDeployer(this);
|
||||
m_d->done = false;
|
||||
d->keyDeployer = new SshKeyDeployer(this);
|
||||
d->done = false;
|
||||
|
||||
setLabelText(tr("Waiting for file name..."));
|
||||
const Utils::SshConnectionParameters sshParams = deviceConfig->sshParameters();
|
||||
@@ -76,21 +76,21 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const LinuxDeviceConfigurat
|
||||
setLabelText(tr("Deploying..."));
|
||||
setValue(0);
|
||||
connect(this, SIGNAL(canceled()), SLOT(handleCanceled()));
|
||||
connect(m_d->keyDeployer, SIGNAL(error(QString)), SLOT(handleDeploymentError(QString)));
|
||||
connect(m_d->keyDeployer, SIGNAL(finishedSuccessfully()), SLOT(handleDeploymentSuccess()));
|
||||
m_d->keyDeployer->deployPublicKey(sshParams, publicKeyFileName);
|
||||
connect(d->keyDeployer, SIGNAL(error(QString)), SLOT(handleDeploymentError(QString)));
|
||||
connect(d->keyDeployer, SIGNAL(finishedSuccessfully()), SLOT(handleDeploymentSuccess()));
|
||||
d->keyDeployer->deployPublicKey(sshParams, publicKeyFileName);
|
||||
}
|
||||
|
||||
PublicKeyDeploymentDialog::~PublicKeyDeploymentDialog()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void PublicKeyDeploymentDialog::handleDeploymentSuccess()
|
||||
{
|
||||
handleDeploymentFinished(QString());
|
||||
setValue(1);
|
||||
m_d->done = true;
|
||||
d->done = true;
|
||||
}
|
||||
|
||||
void PublicKeyDeploymentDialog::handleDeploymentError(const QString &errorMsg)
|
||||
@@ -115,9 +115,9 @@ void PublicKeyDeploymentDialog::handleDeploymentFinished(const QString &errorMsg
|
||||
|
||||
void PublicKeyDeploymentDialog::handleCanceled()
|
||||
{
|
||||
disconnect(m_d->keyDeployer, 0, this, 0);
|
||||
m_d->keyDeployer->stopDeployment();
|
||||
if (m_d->done)
|
||||
disconnect(d->keyDeployer, 0, this, 0);
|
||||
d->keyDeployer->stopDeployment();
|
||||
if (d->done)
|
||||
accept();
|
||||
else
|
||||
reject();
|
||||
|
||||
@@ -63,7 +63,7 @@ private slots:
|
||||
private:
|
||||
void handleDeploymentFinished(const QString &errorMsg);
|
||||
|
||||
Internal::PublicKeyDeploymentDialogPrivate * const m_d;
|
||||
Internal::PublicKeyDeploymentDialogPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -96,55 +96,55 @@ using namespace Internal;
|
||||
|
||||
AbstractRemoteLinuxApplicationRunner::AbstractRemoteLinuxApplicationRunner(RemoteLinuxRunConfiguration *runConfig,
|
||||
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(&m_d->portsGatherer, SIGNAL(portListReady()), SLOT(handleUsedPortsAvailable()));
|
||||
connect(&d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGathererError(QString)));
|
||||
connect(&d->portsGatherer, SIGNAL(portListReady()), SLOT(handleUsedPortsAvailable()));
|
||||
}
|
||||
|
||||
AbstractRemoteLinuxApplicationRunner::~AbstractRemoteLinuxApplicationRunner()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
SshConnection::Ptr AbstractRemoteLinuxApplicationRunner::connection() const
|
||||
{
|
||||
return m_d->connection;
|
||||
return d->connection;
|
||||
}
|
||||
|
||||
LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxApplicationRunner::devConfig() const
|
||||
{
|
||||
return m_d->devConfig;
|
||||
return d->devConfig;
|
||||
}
|
||||
|
||||
const RemoteLinuxUsedPortsGatherer *AbstractRemoteLinuxApplicationRunner::usedPortsGatherer() const
|
||||
{
|
||||
return &m_d->portsGatherer;
|
||||
return &d->portsGatherer;
|
||||
}
|
||||
|
||||
PortList *AbstractRemoteLinuxApplicationRunner::freePorts()
|
||||
{
|
||||
return &m_d->freePorts;
|
||||
return &d->freePorts;
|
||||
}
|
||||
|
||||
QString AbstractRemoteLinuxApplicationRunner::remoteExecutable() const
|
||||
{
|
||||
return m_d->remoteExecutable;
|
||||
return d->remoteExecutable;
|
||||
}
|
||||
|
||||
QString AbstractRemoteLinuxApplicationRunner::arguments() const
|
||||
{
|
||||
return m_d->appArguments;
|
||||
return d->appArguments;
|
||||
}
|
||||
|
||||
QString AbstractRemoteLinuxApplicationRunner::commandPrefix() const
|
||||
{
|
||||
return m_d->commandPrefix;
|
||||
return d->commandPrefix;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::start()
|
||||
{
|
||||
QTC_ASSERT(!m_d->stopRequested && m_d->state == Inactive, return);
|
||||
QTC_ASSERT(!d->stopRequested && d->state == Inactive, return);
|
||||
|
||||
QString errorMsg;
|
||||
if (!canRun(errorMsg)) {
|
||||
@@ -152,22 +152,22 @@ void AbstractRemoteLinuxApplicationRunner::start()
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = SettingUpDevice;
|
||||
d->state = SettingUpDevice;
|
||||
doDeviceSetup();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::stop()
|
||||
{
|
||||
if (m_d->stopRequested)
|
||||
if (d->stopRequested)
|
||||
return;
|
||||
|
||||
switch (m_d->state) {
|
||||
switch (d->state) {
|
||||
case Connecting:
|
||||
setInactive();
|
||||
emit remoteProcessFinished(InvalidExitCode);
|
||||
break;
|
||||
case GatheringPorts:
|
||||
m_d->portsGatherer.stop();
|
||||
d->portsGatherer.stop();
|
||||
setInactive();
|
||||
emit remoteProcessFinished(InvalidExitCode);
|
||||
break;
|
||||
@@ -177,15 +177,15 @@ void AbstractRemoteLinuxApplicationRunner::stop()
|
||||
case AdditionalInitializing:
|
||||
case ProcessStarting:
|
||||
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;
|
||||
case ReadyForExecution:
|
||||
m_d->stopRequested = true;
|
||||
m_d->state = PostRunCleaning;
|
||||
d->stopRequested = true;
|
||||
d->state = PostRunCleaning;
|
||||
doPostRunCleanup();
|
||||
break;
|
||||
case ProcessStarted:
|
||||
m_d->stopRequested = true;
|
||||
d->stopRequested = true;
|
||||
cleanup();
|
||||
break;
|
||||
case Inactive:
|
||||
@@ -195,38 +195,38 @@ void AbstractRemoteLinuxApplicationRunner::stop()
|
||||
|
||||
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);
|
||||
setInactive();
|
||||
} else {
|
||||
m_d->state = PreRunCleaning;
|
||||
d->state = PreRunCleaning;
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
const QString errorMsg = m_d->state == Connecting
|
||||
const QString errorMsg = d->state == Connecting
|
||||
? 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()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == PreRunCleaning
|
||||
|| (m_d->state == ProcessStarted && m_d->stopRequested), return);
|
||||
QTC_ASSERT(d->state == PreRunCleaning
|
||||
|| (d->state == ProcessStarted && d->stopRequested), return);
|
||||
|
||||
emit reportProgress(tr("Killing remote process(es)..."));
|
||||
m_d->cleaner = m_d->connection->createRemoteProcess(killApplicationCommandLine().toUtf8());
|
||||
connect(m_d->cleaner.data(), SIGNAL(closed(int)), SLOT(handleCleanupFinished(int)));
|
||||
m_d->cleaner->start();
|
||||
d->cleaner = d->connection->createRemoteProcess(killApplicationCommandLine().toUtf8());
|
||||
connect(d->cleaner.data(), SIGNAL(closed(int)), SLOT(handleCleanupFinished(int)));
|
||||
d->cleaner->start();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::handleCleanupFinished(int exitStatus)
|
||||
@@ -235,56 +235,56 @@ void AbstractRemoteLinuxApplicationRunner::handleCleanupFinished(int exitStatus)
|
||||
|| exitStatus == SshRemoteProcess::KilledBySignal
|
||||
|| exitStatus == SshRemoteProcess::ExitedNormally);
|
||||
|
||||
QTC_ASSERT(m_d->state == PreRunCleaning
|
||||
|| (m_d->state == ProcessStarted && m_d->stopRequested) || m_d->state == Inactive, return);
|
||||
QTC_ASSERT(d->state == PreRunCleaning
|
||||
|| (d->state == ProcessStarted && d->stopRequested) || d->state == Inactive, return);
|
||||
|
||||
if (m_d->state == Inactive)
|
||||
if (d->state == Inactive)
|
||||
return;
|
||||
if (m_d->stopRequested && m_d->state == PreRunCleaning) {
|
||||
if (d->stopRequested && d->state == PreRunCleaning) {
|
||||
setInactive();
|
||||
emit remoteProcessFinished(InvalidExitCode);
|
||||
return;
|
||||
}
|
||||
if (m_d->stopRequested) {
|
||||
m_d->state = PostRunCleaning;
|
||||
if (d->stopRequested) {
|
||||
d->state = PostRunCleaning;
|
||||
doPostRunCleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = AdditionalPreRunCleaning;
|
||||
d->state = AdditionalPreRunCleaning;
|
||||
doAdditionalInitialCleanup();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
m_d->runner = m_d->connection->createRemoteProcess(remoteCall);
|
||||
connect(m_d->runner.data(), SIGNAL(started()), SLOT(handleRemoteProcessStarted()));
|
||||
connect(m_d->runner.data(), SIGNAL(closed(int)), SLOT(handleRemoteProcessFinished(int)));
|
||||
connect(m_d->runner.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
d->runner = d->connection->createRemoteProcess(remoteCall);
|
||||
connect(d->runner.data(), SIGNAL(started()), SLOT(handleRemoteProcessStarted()));
|
||||
connect(d->runner.data(), SIGNAL(closed(int)), SLOT(handleRemoteProcessFinished(int)));
|
||||
connect(d->runner.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
SIGNAL(remoteOutput(QByteArray)));
|
||||
connect(m_d->runner.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
connect(d->runner.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
SIGNAL(remoteErrorOutput(QByteArray)));
|
||||
m_d->state = ProcessStarting;
|
||||
m_d->runner->start();
|
||||
d->state = ProcessStarting;
|
||||
d->runner->start();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::handleRemoteProcessStarted()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == ProcessStarting, return);
|
||||
QTC_ASSERT(d->state == ProcessStarting, return);
|
||||
|
||||
m_d->state = ProcessStarted;
|
||||
if (m_d->stopRequested) {
|
||||
d->state = ProcessStarted;
|
||||
if (d->stopRequested) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
@@ -298,32 +298,32 @@ void AbstractRemoteLinuxApplicationRunner::handleRemoteProcessFinished(int exitS
|
||||
Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart
|
||||
|| exitStatus == SshRemoteProcess::KilledBySignal
|
||||
|| 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;
|
||||
if (!m_d->stopRequested && m_d->state != Inactive) {
|
||||
m_d->state = PostRunCleaning;
|
||||
d->exitStatus = exitStatus;
|
||||
if (!d->stopRequested && d->state != Inactive) {
|
||||
d->state = PostRunCleaning;
|
||||
doPostRunCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::setInactive()
|
||||
{
|
||||
m_d->portsGatherer.stop();
|
||||
if (m_d->connection) {
|
||||
disconnect(m_d->connection.data(), 0, this, 0);
|
||||
SshConnectionManager::instance().releaseConnection(m_d->connection);
|
||||
m_d->connection = SshConnection::Ptr();
|
||||
d->portsGatherer.stop();
|
||||
if (d->connection) {
|
||||
disconnect(d->connection.data(), 0, this, 0);
|
||||
SshConnectionManager::instance().releaseConnection(d->connection);
|
||||
d->connection = SshConnection::Ptr();
|
||||
}
|
||||
if (m_d->cleaner)
|
||||
disconnect(m_d->cleaner.data(), 0, this, 0);
|
||||
m_d->stopRequested = false;
|
||||
m_d->state = Inactive;
|
||||
if (d->cleaner)
|
||||
disconnect(d->cleaner.data(), 0, this, 0);
|
||||
d->stopRequested = false;
|
||||
d->state = Inactive;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::emitError(const QString &errorMsg, bool force)
|
||||
{
|
||||
if (m_d->state != Inactive) {
|
||||
if (d->state != Inactive) {
|
||||
setInactive();
|
||||
emit error(errorMsg);
|
||||
} else if (force) {
|
||||
@@ -333,7 +333,7 @@ void AbstractRemoteLinuxApplicationRunner::emitError(const QString &errorMsg, bo
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::handlePortsGathererError(const QString &errorMsg)
|
||||
{
|
||||
if (m_d->state != Inactive) {
|
||||
if (d->state != Inactive) {
|
||||
if (connection()->errorState() != SshNoError) {
|
||||
emitError(errorMsg);
|
||||
} else {
|
||||
@@ -345,26 +345,26 @@ void AbstractRemoteLinuxApplicationRunner::handlePortsGathererError(const QStrin
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::handleUsedPortsAvailable()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == GatheringPorts, return);
|
||||
QTC_ASSERT(d->state == GatheringPorts, return);
|
||||
|
||||
if (m_d->stopRequested) {
|
||||
if (d->stopRequested) {
|
||||
setInactive();
|
||||
emit remoteProcessFinished(InvalidExitCode);
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = AdditionalInitializing;
|
||||
d->state = AdditionalInitializing;
|
||||
doAdditionalInitializations();
|
||||
}
|
||||
|
||||
bool AbstractRemoteLinuxApplicationRunner::canRun(QString &whyNot) const
|
||||
{
|
||||
if (m_d->remoteExecutable.isEmpty()) {
|
||||
if (d->remoteExecutable.isEmpty()) {
|
||||
whyNot = tr("No remote executable set.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_d->devConfig) {
|
||||
if (!d->devConfig) {
|
||||
whyNot = tr("No device configuration set.");
|
||||
return false;
|
||||
}
|
||||
@@ -374,80 +374,80 @@ bool AbstractRemoteLinuxApplicationRunner::canRun(QString &whyNot) const
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::setDeviceConfiguration(const LinuxDeviceConfiguration::ConstPtr &deviceConfig)
|
||||
{
|
||||
m_d->devConfig = deviceConfig;
|
||||
d->devConfig = deviceConfig;
|
||||
}
|
||||
|
||||
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();
|
||||
emit remoteProcessFinished(InvalidExitCode);
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->connection = SshConnectionManager::instance().acquireConnection(m_d->devConfig->sshParameters());
|
||||
m_d->state = Connecting;
|
||||
m_d->exitStatus = -1;
|
||||
m_d->freePorts = m_d->initialFreePorts;
|
||||
connect(m_d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
||||
connect(m_d->connection.data(), SIGNAL(error(Utils::SshError)),
|
||||
d->connection = SshConnectionManager::instance().acquireConnection(d->devConfig->sshParameters());
|
||||
d->state = Connecting;
|
||||
d->exitStatus = -1;
|
||||
d->freePorts = d->initialFreePorts;
|
||||
connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
||||
connect(d->connection.data(), SIGNAL(error(Utils::SshError)),
|
||||
SLOT(handleConnectionFailure()));
|
||||
if (m_d->connection->state() == SshConnection::Connected) {
|
||||
if (d->connection->state() == SshConnection::Connected) {
|
||||
handleConnected();
|
||||
} else {
|
||||
emit reportProgress(tr("Connecting to device..."));
|
||||
if (m_d->connection->state() == Utils::SshConnection::Unconnected)
|
||||
m_d->connection->connectToHost();
|
||||
if (d->connection->state() == Utils::SshConnection::Unconnected)
|
||||
d->connection->connectToHost();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
emit remoteProcessFinished(InvalidExitCode);
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = GatheringPorts;
|
||||
m_d->portsGatherer.start(m_d->connection, m_d->devConfig);
|
||||
d->state = GatheringPorts;
|
||||
d->portsGatherer.start(d->connection, d->devConfig);
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxApplicationRunner::handleInitializationsDone(bool success)
|
||||
{
|
||||
QTC_ASSERT(m_d->state == AdditionalInitializing, return);
|
||||
QTC_ASSERT(d->state == AdditionalInitializing, return);
|
||||
|
||||
if (!success) {
|
||||
setInactive();
|
||||
emit remoteProcessFinished(InvalidExitCode);
|
||||
return;
|
||||
}
|
||||
if (m_d->stopRequested) {
|
||||
m_d->state = PostRunCleaning;
|
||||
if (d->stopRequested) {
|
||||
d->state = PostRunCleaning;
|
||||
doPostRunCleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = ReadyForExecution;
|
||||
d->state = ReadyForExecution;
|
||||
emit readyForExecution();
|
||||
}
|
||||
|
||||
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();
|
||||
if (wasStopRequested)
|
||||
emit remoteProcessFinished(InvalidExitCode);
|
||||
else if (m_d->exitStatus == SshRemoteProcess::ExitedNormally)
|
||||
emit remoteProcessFinished(m_d->runner->exitCode());
|
||||
else if (d->exitStatus == SshRemoteProcess::ExitedNormally)
|
||||
emit remoteProcessFinished(d->runner->exitCode());
|
||||
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();
|
||||
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
void emitError(const QString &errorMsg, bool force = false);
|
||||
void cleanup();
|
||||
|
||||
Internal::AbstractRemoteLinuxApplicationRunnerPrivate * const m_d;
|
||||
Internal::AbstractRemoteLinuxApplicationRunnerPrivate * const d;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -135,28 +135,28 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R
|
||||
|
||||
AbstractRemoteLinuxDebugSupport::AbstractRemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||
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()
|
||||
{
|
||||
setFinished();
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDebugSupport::showMessage(const QString &msg, int channel)
|
||||
{
|
||||
if (m_d->engine)
|
||||
m_d->engine->showMessage(msg, channel);
|
||||
if (d->engine)
|
||||
d->engine->showMessage(msg, channel);
|
||||
}
|
||||
|
||||
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);
|
||||
disconnect(runner(), 0, this, 0);
|
||||
connect(runner(), SIGNAL(error(QString)), this, SLOT(handleSshError(QString)));
|
||||
@@ -167,52 +167,52 @@ void AbstractRemoteLinuxDebugSupport::handleAdapterSetupRequested()
|
||||
|
||||
void AbstractRemoteLinuxDebugSupport::handleSshError(const QString &error)
|
||||
{
|
||||
if (m_d->state == Debugging) {
|
||||
if (d->state == Debugging) {
|
||||
showMessage(error, AppError);
|
||||
if (m_d->engine)
|
||||
m_d->engine->notifyInferiorIll();
|
||||
} else if (m_d->state != Inactive) {
|
||||
if (d->engine)
|
||||
d->engine->notifyInferiorIll();
|
||||
} else if (d->state != Inactive) {
|
||||
handleAdapterSetupFailed(error);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDebugSupport::startExecution()
|
||||
{
|
||||
if (m_d->state == Inactive)
|
||||
if (d->state == Inactive)
|
||||
return;
|
||||
|
||||
QTC_ASSERT(m_d->state == StartingRunner, return);
|
||||
QTC_ASSERT(d->state == StartingRunner, return);
|
||||
|
||||
if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
|
||||
if (!setPort(m_d->gdbServerPort))
|
||||
if (d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
|
||||
if (!setPort(d->gdbServerPort))
|
||||
return;
|
||||
}
|
||||
if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
|
||||
if (!setPort(m_d->qmlPort))
|
||||
if (d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
|
||||
if (!setPort(d->qmlPort))
|
||||
return;
|
||||
}
|
||||
|
||||
m_d->state = StartingRemoteProcess;
|
||||
m_d->gdbserverOutput.clear();
|
||||
d->state = StartingRemoteProcess;
|
||||
d->gdbserverOutput.clear();
|
||||
connect(runner(), SIGNAL(remoteErrorOutput(QByteArray)), this,
|
||||
SLOT(handleRemoteErrorOutput(QByteArray)));
|
||||
connect(runner(), SIGNAL(remoteOutput(QByteArray)), this,
|
||||
SLOT(handleRemoteOutput(QByteArray)));
|
||||
if (m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) {
|
||||
if (d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) {
|
||||
connect(runner(), SIGNAL(remoteProcessStarted()),
|
||||
SLOT(handleRemoteProcessStarted()));
|
||||
}
|
||||
const QString &remoteExe = runner()->remoteExecutable();
|
||||
QString args = runner()->arguments();
|
||||
if (m_d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
|
||||
if (d->debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
|
||||
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 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)),
|
||||
SLOT(handleRemoteProcessFinished(qint64)));
|
||||
runner()->startExecution(remoteCommandLine.toUtf8());
|
||||
@@ -220,21 +220,21 @@ void AbstractRemoteLinuxDebugSupport::startExecution()
|
||||
|
||||
void AbstractRemoteLinuxDebugSupport::handleRemoteProcessFinished(qint64 exitCode)
|
||||
{
|
||||
if (!m_d->engine || m_d->state == Inactive)
|
||||
if (!d->engine || d->state == Inactive)
|
||||
return;
|
||||
|
||||
if (m_d->state == Debugging) {
|
||||
if (d->state == Debugging) {
|
||||
// The QML engine does not realize on its own that the application has finished.
|
||||
if (m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly)
|
||||
m_d->engine->quitDebugger();
|
||||
if (d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly)
|
||||
d->engine->quitDebugger();
|
||||
else if (exitCode != 0)
|
||||
m_d->engine->notifyInferiorIll();
|
||||
d->engine->notifyInferiorIll();
|
||||
|
||||
} 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("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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (!m_d->engine)
|
||||
if (!d->engine)
|
||||
return;
|
||||
|
||||
showMessage(QString::fromUtf8(output), AppOutput);
|
||||
if (m_d->state == StartingRemoteProcess
|
||||
&& m_d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
|
||||
m_d->gdbserverOutput += output;
|
||||
if (m_d->gdbserverOutput.contains("Listening on port")) {
|
||||
if (d->state == StartingRemoteProcess
|
||||
&& d->debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
|
||||
d->gdbserverOutput += output;
|
||||
if (d->gdbserverOutput.contains("Listening on port")) {
|
||||
handleAdapterSetupDone();
|
||||
m_d->gdbserverOutput.clear();
|
||||
d->gdbserverOutput.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,28 +277,28 @@ void AbstractRemoteLinuxDebugSupport::handleProgressReport(const QString &progre
|
||||
void AbstractRemoteLinuxDebugSupport::handleAdapterSetupFailed(const QString &error)
|
||||
{
|
||||
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()
|
||||
{
|
||||
m_d->state = Debugging;
|
||||
m_d->engine->handleRemoteSetupDone(m_d->gdbServerPort, m_d->qmlPort);
|
||||
d->state = Debugging;
|
||||
d->engine->handleRemoteSetupDone(d->gdbServerPort, d->qmlPort);
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDebugSupport::handleRemoteProcessStarted()
|
||||
{
|
||||
Q_ASSERT(m_d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly);
|
||||
QTC_ASSERT(m_d->state == StartingRemoteProcess, return);
|
||||
Q_ASSERT(d->debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly);
|
||||
QTC_ASSERT(d->state == StartingRemoteProcess, return);
|
||||
|
||||
handleAdapterSetupDone();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxDebugSupport::setFinished()
|
||||
{
|
||||
if (m_d->state == Inactive)
|
||||
if (d->state == Inactive)
|
||||
return;
|
||||
m_d->state = Inactive;
|
||||
d->state = Inactive;
|
||||
runner()->stop();
|
||||
}
|
||||
|
||||
@@ -316,18 +316,18 @@ bool AbstractRemoteLinuxDebugSupport::setPort(int &port)
|
||||
RemoteLinuxDebugSupport::RemoteLinuxDebugSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||
DebuggerEngine *engine)
|
||||
: AbstractRemoteLinuxDebugSupport(runConfig, engine),
|
||||
m_d(new RemoteLinuxDebugSupportPrivate(runConfig))
|
||||
d(new RemoteLinuxDebugSupportPrivate(runConfig))
|
||||
{
|
||||
}
|
||||
|
||||
RemoteLinuxDebugSupport::~RemoteLinuxDebugSupport()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
AbstractRemoteLinuxApplicationRunner *RemoteLinuxDebugSupport::runner() const
|
||||
{
|
||||
return &m_d->runner;
|
||||
return &d->runner;
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
bool setPort(int &port);
|
||||
void showMessage(const QString &msg, int channel);
|
||||
|
||||
Internal::AbstractRemoteLinuxDebugSupportPrivate * const m_d;
|
||||
Internal::AbstractRemoteLinuxDebugSupportPrivate * const d;
|
||||
};
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
private:
|
||||
AbstractRemoteLinuxApplicationRunner *runner() const;
|
||||
|
||||
Internal::RemoteLinuxDebugSupportPrivate * const m_d;
|
||||
Internal::RemoteLinuxDebugSupportPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -62,9 +62,9 @@ using namespace Internal;
|
||||
|
||||
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
|
||||
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);
|
||||
|
||||
// A DeploymentInfo object is only dependent on the active build
|
||||
@@ -77,14 +77,14 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
|
||||
const RemoteLinuxDeployConfiguration * const mdc
|
||||
= qobject_cast<const RemoteLinuxDeployConfiguration *>(dc);
|
||||
if (mdc) {
|
||||
m_d->deploymentInfo = mdc->deploymentInfo();
|
||||
m_d->devConfModel = mdc->m_d->devConfModel;
|
||||
d->deploymentInfo = mdc->deploymentInfo();
|
||||
d->devConfModel = mdc->d->devConfModel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!m_d->deploymentInfo) {
|
||||
m_d->deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target)));
|
||||
m_d->devConfModel = QSharedPointer<TypeSpecificDeviceConfigurationListModel>
|
||||
if (!d->deploymentInfo) {
|
||||
d->deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target)));
|
||||
d->devConfModel = QSharedPointer<TypeSpecificDeviceConfigurationListModel>
|
||||
(new TypeSpecificDeviceConfigurationListModel(supportedOsType));
|
||||
}
|
||||
|
||||
@@ -93,34 +93,34 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
|
||||
|
||||
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
|
||||
RemoteLinuxDeployConfiguration *source)
|
||||
: DeployConfiguration(target, source), m_d(new RemoteLinuxDeployConfigurationPrivate)
|
||||
: DeployConfiguration(target, source), d(new RemoteLinuxDeployConfigurationPrivate)
|
||||
{
|
||||
m_d->supportedOsType = source->supportedOsType();
|
||||
m_d->deploymentInfo = source->deploymentInfo();
|
||||
m_d->devConfModel = source->deviceConfigModel();
|
||||
d->supportedOsType = source->supportedOsType();
|
||||
d->deploymentInfo = source->deploymentInfo();
|
||||
d->devConfModel = source->deviceConfigModel();
|
||||
initialize();
|
||||
}
|
||||
|
||||
RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfiguration::initialize()
|
||||
{
|
||||
m_d->deviceConfiguration = deviceConfigModel()->defaultDeviceConfig();
|
||||
d->deviceConfiguration = deviceConfigModel()->defaultDeviceConfig();
|
||||
connect(deviceConfigModel().data(), SIGNAL(updated()),
|
||||
SLOT(handleDeviceConfigurationListUpdated()));
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
|
||||
{
|
||||
setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(m_d->deviceConfiguration));
|
||||
setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(d->deviceConfiguration));
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfiguration::setDeviceConfig(LinuxDeviceConfiguration::Id internalId)
|
||||
{
|
||||
m_d->deviceConfiguration = deviceConfigModel()->find(internalId);
|
||||
d->deviceConfiguration = deviceConfigModel()->find(internalId);
|
||||
emit deviceConfigurationListChanged();
|
||||
emit currentDeviceConfigurationChanged();
|
||||
}
|
||||
@@ -138,15 +138,15 @@ QVariantMap RemoteLinuxDeployConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map = DeployConfiguration::toMap();
|
||||
map.insert(QLatin1String(DeviceIdKey),
|
||||
LinuxDeviceConfigurations::instance()->internalId(m_d->deviceConfiguration));
|
||||
LinuxDeviceConfigurations::instance()->internalId(d->deviceConfiguration));
|
||||
return map;
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index)
|
||||
{
|
||||
const LinuxDeviceConfiguration::ConstPtr &newDevConf = deviceConfigModel()->deviceAt(index);
|
||||
if (m_d->deviceConfiguration != newDevConf) {
|
||||
m_d->deviceConfiguration = newDevConf;
|
||||
if (d->deviceConfiguration != newDevConf) {
|
||||
d->deviceConfiguration = newDevConf;
|
||||
emit currentDeviceConfigurationChanged();
|
||||
}
|
||||
}
|
||||
@@ -158,22 +158,22 @@ DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget()
|
||||
|
||||
QSharedPointer<DeploymentInfo> RemoteLinuxDeployConfiguration::deploymentInfo() const
|
||||
{
|
||||
return m_d->deploymentInfo;
|
||||
return d->deploymentInfo;
|
||||
}
|
||||
|
||||
QSharedPointer<TypeSpecificDeviceConfigurationListModel> RemoteLinuxDeployConfiguration::deviceConfigModel() const
|
||||
{
|
||||
return m_d->devConfModel;
|
||||
return d->devConfModel;
|
||||
}
|
||||
|
||||
LinuxDeviceConfiguration::ConstPtr RemoteLinuxDeployConfiguration::deviceConfiguration() const
|
||||
{
|
||||
return m_d->deviceConfiguration;
|
||||
return d->deviceConfiguration;
|
||||
}
|
||||
|
||||
QString RemoteLinuxDeployConfiguration::supportedOsType() const
|
||||
{
|
||||
return m_d->supportedOsType;
|
||||
return d->supportedOsType;
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
void setDeviceConfig(LinuxDeviceConfiguration::Id internalId);
|
||||
Q_SLOT void handleDeviceConfigurationListUpdated();
|
||||
|
||||
Internal::RemoteLinuxDeployConfigurationPrivate * const m_d;
|
||||
Internal::RemoteLinuxDeployConfigurationPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -58,102 +58,102 @@ public:
|
||||
using namespace Internal;
|
||||
|
||||
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()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc)
|
||||
{
|
||||
m_d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc);
|
||||
Q_ASSERT(m_d->deployConfiguration);
|
||||
d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc);
|
||||
Q_ASSERT(d->deployConfiguration);
|
||||
|
||||
connect(m_d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)),
|
||||
connect(d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)),
|
||||
SLOT(showDeviceConfigurations()));
|
||||
|
||||
m_d->ui.deviceConfigsComboBox->setModel(m_d->deployConfiguration->deviceConfigModel().data());
|
||||
connect(m_d->ui.deviceConfigsComboBox, SIGNAL(activated(int)),
|
||||
d->ui.deviceConfigsComboBox->setModel(d->deployConfiguration->deviceConfigModel().data());
|
||||
connect(d->ui.deviceConfigsComboBox, SIGNAL(activated(int)),
|
||||
SLOT(handleSelectedDeviceConfigurationChanged(int)));
|
||||
connect(m_d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()),
|
||||
connect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()),
|
||||
SLOT(handleDeviceConfigurationListChanged()));
|
||||
handleDeviceConfigurationListChanged();
|
||||
|
||||
m_d->ui.projectsComboBox->setModel(m_d->deployConfiguration->deploymentInfo().data());
|
||||
connect(m_d->deployConfiguration->deploymentInfo().data(), SIGNAL(modelAboutToBeReset()),
|
||||
d->ui.projectsComboBox->setModel(d->deployConfiguration->deploymentInfo().data());
|
||||
connect(d->deployConfiguration->deploymentInfo().data(), SIGNAL(modelAboutToBeReset()),
|
||||
SLOT(handleModelListToBeReset()));
|
||||
|
||||
// Queued connection because of race condition with combo box's reaction
|
||||
// to modelReset().
|
||||
connect(m_d->deployConfiguration->deploymentInfo().data(), SIGNAL(modelReset()),
|
||||
connect(d->deployConfiguration->deploymentInfo().data(), SIGNAL(modelReset()),
|
||||
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();
|
||||
}
|
||||
|
||||
RemoteLinuxDeployConfiguration *RemoteLinuxDeployConfigurationWidget::deployConfiguration() const
|
||||
{
|
||||
return m_d->deployConfiguration;
|
||||
return d->deployConfiguration;
|
||||
}
|
||||
|
||||
DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel() const
|
||||
{
|
||||
const int modelRow = m_d->ui.projectsComboBox->currentIndex();
|
||||
const int modelRow = d->ui.projectsComboBox->currentIndex();
|
||||
if (modelRow == -1)
|
||||
return 0;
|
||||
return m_d->deployConfiguration->deploymentInfo()->modelAt(modelRow);
|
||||
return d->deployConfiguration->deploymentInfo()->modelAt(modelRow);
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset()
|
||||
{
|
||||
m_d->ui.tableView->setModel(0);
|
||||
d->ui.tableView->setModel(0);
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::handleModelListReset()
|
||||
{
|
||||
QTC_ASSERT(m_d->deployConfiguration->deploymentInfo()->modelCount()
|
||||
== m_d->ui.projectsComboBox->count(), return);
|
||||
QTC_ASSERT(d->deployConfiguration->deploymentInfo()->modelCount()
|
||||
== d->ui.projectsComboBox->count(), return);
|
||||
|
||||
if (m_d->deployConfiguration->deploymentInfo()->modelCount() > 0) {
|
||||
if (m_d->ui.projectsComboBox->currentIndex() == -1)
|
||||
m_d->ui.projectsComboBox->setCurrentIndex(0);
|
||||
if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) {
|
||||
if (d->ui.projectsComboBox->currentIndex() == -1)
|
||||
d->ui.projectsComboBox->setCurrentIndex(0);
|
||||
else
|
||||
setModel(m_d->ui.projectsComboBox->currentIndex());
|
||||
setModel(d->ui.projectsComboBox->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::setModel(int row)
|
||||
{
|
||||
DeployableFilesPerProFile * const proFileInfo = row == -1
|
||||
? 0 : m_d->deployConfiguration->deploymentInfo()->modelAt(row);
|
||||
m_d->ui.tableView->setModel(proFileInfo);
|
||||
? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row);
|
||||
d->ui.tableView->setModel(proFileInfo);
|
||||
if (proFileInfo)
|
||||
m_d->ui.tableView->resizeRowsToContents();
|
||||
d->ui.tableView->resizeRowsToContents();
|
||||
emit currentModelChanged(proFileInfo);
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::handleSelectedDeviceConfigurationChanged(int index)
|
||||
{
|
||||
disconnect(m_d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), this,
|
||||
disconnect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), this,
|
||||
SLOT(handleDeviceConfigurationListChanged()));
|
||||
m_d->deployConfiguration->setDeviceConfiguration(index);
|
||||
connect(m_d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()),
|
||||
d->deployConfiguration->setDeviceConfiguration(index);
|
||||
connect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()),
|
||||
SLOT(handleDeviceConfigurationListChanged()));
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::handleDeviceConfigurationListChanged()
|
||||
{
|
||||
const LinuxDeviceConfiguration::ConstPtr &devConf
|
||||
= m_d->deployConfiguration->deviceConfiguration();
|
||||
= d->deployConfiguration->deviceConfiguration();
|
||||
const LinuxDeviceConfiguration::Id internalId
|
||||
= LinuxDeviceConfigurations::instance()->internalId(devConf);
|
||||
const int newIndex = m_d->deployConfiguration->deviceConfigModel()->indexForInternalId(internalId);
|
||||
m_d->ui.deviceConfigsComboBox->setCurrentIndex(newIndex);
|
||||
const int newIndex = d->deployConfiguration->deviceConfigModel()->indexForInternalId(internalId);
|
||||
d->ui.deviceConfigsComboBox->setCurrentIndex(newIndex);
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfigurationWidget::showDeviceConfigurations()
|
||||
|
||||
@@ -69,7 +69,7 @@ private slots:
|
||||
void showDeviceConfigurations();
|
||||
|
||||
private:
|
||||
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const m_d;
|
||||
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -54,64 +54,64 @@ public:
|
||||
} // namespace Internal
|
||||
|
||||
AbstractRemoteLinuxPackageInstaller::AbstractRemoteLinuxPackageInstaller(QObject *parent)
|
||||
: QObject(parent), m_d(new Internal::AbstractRemoteLinuxPackageInstallerPrivate)
|
||||
: QObject(parent), d(new Internal::AbstractRemoteLinuxPackageInstallerPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractRemoteLinuxPackageInstaller::~AbstractRemoteLinuxPackageInstaller()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxPackageInstaller::installPackage(const SshConnection::Ptr &connection,
|
||||
const QString &packageFilePath, bool removePackageFile)
|
||||
{
|
||||
QTC_ASSERT(connection && connection->state() == SshConnection::Connected
|
||||
&& !m_d->isRunning, return);
|
||||
&& !d->isRunning, return);
|
||||
|
||||
prepareInstallation();
|
||||
m_d->installer = SshRemoteProcessRunner::create(connection);
|
||||
connect(m_d->installer.data(), SIGNAL(connectionError(Utils::SshError)),
|
||||
d->installer = SshRemoteProcessRunner::create(connection);
|
||||
connect(d->installer.data(), SIGNAL(connectionError(Utils::SshError)),
|
||||
SLOT(handleConnectionError()));
|
||||
connect(m_d->installer.data(), SIGNAL(processOutputAvailable(QByteArray)),
|
||||
connect(d->installer.data(), SIGNAL(processOutputAvailable(QByteArray)),
|
||||
SLOT(handleInstallerOutput(QByteArray)));
|
||||
connect(m_d->installer.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
|
||||
connect(d->installer.data(), SIGNAL(processErrorOutputAvailable(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);
|
||||
if (removePackageFile)
|
||||
cmdLine += QLatin1String(" && (rm ") + packageFilePath + QLatin1String(" || :)");
|
||||
m_d->installer->run(cmdLine.toUtf8());
|
||||
m_d->isRunning = true;
|
||||
d->installer->run(cmdLine.toUtf8());
|
||||
d->isRunning = true;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxPackageInstaller::cancelInstallation()
|
||||
{
|
||||
QTC_ASSERT(m_d->installer && m_d->installer->connection()->state() == SshConnection::Connected
|
||||
&& m_d->isRunning, return);
|
||||
QTC_ASSERT(d->installer && d->installer->connection()->state() == SshConnection::Connected
|
||||
&& d->isRunning, return);
|
||||
|
||||
const SshRemoteProcessRunner::Ptr killProcess
|
||||
= SshRemoteProcessRunner::create(m_d->installer->connection());
|
||||
= SshRemoteProcessRunner::create(d->installer->connection());
|
||||
killProcess->run(cancelInstallationCommandLine().toUtf8());
|
||||
setFinished();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxPackageInstaller::handleConnectionError()
|
||||
{
|
||||
if (!m_d->isRunning)
|
||||
if (!d->isRunning)
|
||||
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();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxPackageInstaller::handleInstallationFinished(int exitStatus)
|
||||
{
|
||||
if (!m_d->isRunning)
|
||||
if (!d->isRunning)
|
||||
return;
|
||||
|
||||
if (exitStatus != SshRemoteProcess::ExitedNormally
|
||||
|| m_d->installer->process()->exitCode() != 0) {
|
||||
|| d->installer->process()->exitCode() != 0) {
|
||||
emit finished(tr("Installing package failed."));
|
||||
} else if (!errorString().isEmpty()) {
|
||||
emit finished(errorString());
|
||||
@@ -134,9 +134,9 @@ void AbstractRemoteLinuxPackageInstaller::handleInstallerErrorOutput(const QByte
|
||||
|
||||
void AbstractRemoteLinuxPackageInstaller::setFinished()
|
||||
{
|
||||
disconnect(m_d->installer.data(), 0, this, 0);
|
||||
m_d->installer.clear();
|
||||
m_d->isRunning = false;
|
||||
disconnect(d->installer.data(), 0, this, 0);
|
||||
d->installer.clear();
|
||||
d->isRunning = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
|
||||
void setFinished();
|
||||
|
||||
Internal::AbstractRemoteLinuxPackageInstallerPrivate * const m_d;
|
||||
Internal::AbstractRemoteLinuxPackageInstallerPrivate * const d;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -58,32 +58,32 @@ using namespace Internal;
|
||||
|
||||
RemoteLinuxProcessesDialog::RemoteLinuxProcessesDialog(AbstractRemoteLinuxProcessList *processList,
|
||||
QWidget *parent)
|
||||
: QDialog(parent), m_d(new RemoteLinuxProcessesDialogPrivate(processList))
|
||||
: QDialog(parent), d(new RemoteLinuxProcessesDialogPrivate(processList))
|
||||
{
|
||||
processList->setParent(this);
|
||||
|
||||
m_d->ui.setupUi(this);
|
||||
m_d->ui.tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_d->proxyModel.setSourceModel(m_d->processList);
|
||||
m_d->proxyModel.setDynamicSortFilter(true);
|
||||
m_d->proxyModel.setFilterKeyColumn(1);
|
||||
m_d->ui.tableView->setModel(&m_d->proxyModel);
|
||||
connect(m_d->ui.processFilterLineEdit, SIGNAL(textChanged(QString)),
|
||||
&m_d->proxyModel, SLOT(setFilterRegExp(QString)));
|
||||
d->ui.setupUi(this);
|
||||
d->ui.tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
d->proxyModel.setSourceModel(d->processList);
|
||||
d->proxyModel.setDynamicSortFilter(true);
|
||||
d->proxyModel.setFilterKeyColumn(1);
|
||||
d->ui.tableView->setModel(&d->proxyModel);
|
||||
connect(d->ui.processFilterLineEdit, SIGNAL(textChanged(QString)),
|
||||
&d->proxyModel, SLOT(setFilterRegExp(QString)));
|
||||
|
||||
connect(m_d->ui.tableView->selectionModel(),
|
||||
connect(d->ui.tableView->selectionModel(),
|
||||
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
SLOT(handleSelectionChanged()));
|
||||
connect(m_d->ui.updateListButton, SIGNAL(clicked()),
|
||||
connect(d->ui.updateListButton, SIGNAL(clicked()),
|
||||
SLOT(updateProcessList()));
|
||||
connect(m_d->ui.killProcessButton, SIGNAL(clicked()), SLOT(killProcess()));
|
||||
connect(m_d->processList, SIGNAL(error(QString)),
|
||||
connect(d->ui.killProcessButton, SIGNAL(clicked()), SLOT(killProcess()));
|
||||
connect(d->processList, SIGNAL(error(QString)),
|
||||
SLOT(handleRemoteError(QString)));
|
||||
connect(m_d->processList, SIGNAL(modelReset()),
|
||||
connect(d->processList, SIGNAL(modelReset()),
|
||||
SLOT(handleProcessListUpdated()));
|
||||
connect(m_d->processList, SIGNAL(processKilled()),
|
||||
connect(d->processList, SIGNAL(processKilled()),
|
||||
SLOT(handleProcessKilled()), Qt::QueuedConnection);
|
||||
connect(&m_d->proxyModel, SIGNAL(layoutChanged()),
|
||||
connect(&d->proxyModel, SIGNAL(layoutChanged()),
|
||||
SLOT(handleProcessListUpdated()));
|
||||
handleSelectionChanged();
|
||||
updateProcessList();
|
||||
@@ -91,39 +91,39 @@ RemoteLinuxProcessesDialog::RemoteLinuxProcessesDialog(AbstractRemoteLinuxProces
|
||||
|
||||
RemoteLinuxProcessesDialog::~RemoteLinuxProcessesDialog()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void RemoteLinuxProcessesDialog::handleRemoteError(const QString &errorMsg)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Remote Error"), errorMsg);
|
||||
m_d->ui.updateListButton->setEnabled(true);
|
||||
d->ui.updateListButton->setEnabled(true);
|
||||
handleSelectionChanged();
|
||||
}
|
||||
|
||||
void RemoteLinuxProcessesDialog::handleProcessListUpdated()
|
||||
{
|
||||
m_d->ui.updateListButton->setEnabled(true);
|
||||
m_d->ui.tableView->resizeRowsToContents();
|
||||
d->ui.updateListButton->setEnabled(true);
|
||||
d->ui.tableView->resizeRowsToContents();
|
||||
handleSelectionChanged();
|
||||
}
|
||||
|
||||
void RemoteLinuxProcessesDialog::updateProcessList()
|
||||
{
|
||||
m_d->ui.updateListButton->setEnabled(false);
|
||||
m_d->ui.killProcessButton->setEnabled(false);
|
||||
m_d->processList->update();
|
||||
d->ui.updateListButton->setEnabled(false);
|
||||
d->ui.killProcessButton->setEnabled(false);
|
||||
d->processList->update();
|
||||
}
|
||||
|
||||
void RemoteLinuxProcessesDialog::killProcess()
|
||||
{
|
||||
const QModelIndexList &indexes
|
||||
= m_d->ui.tableView->selectionModel()->selectedIndexes();
|
||||
= d->ui.tableView->selectionModel()->selectedIndexes();
|
||||
if (indexes.empty())
|
||||
return;
|
||||
m_d->ui.updateListButton->setEnabled(false);
|
||||
m_d->ui.killProcessButton->setEnabled(false);
|
||||
m_d->processList->killProcess(m_d->proxyModel.mapToSource(indexes.first()).row());
|
||||
d->ui.updateListButton->setEnabled(false);
|
||||
d->ui.killProcessButton->setEnabled(false);
|
||||
d->processList->killProcess(d->proxyModel.mapToSource(indexes.first()).row());
|
||||
}
|
||||
|
||||
void RemoteLinuxProcessesDialog::handleProcessKilled()
|
||||
@@ -133,7 +133,7 @@ void RemoteLinuxProcessesDialog::handleProcessKilled()
|
||||
|
||||
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
|
||||
|
||||
@@ -60,7 +60,7 @@ private slots:
|
||||
void handleSelectionChanged();
|
||||
|
||||
private:
|
||||
Internal::RemoteLinuxProcessesDialogPrivate * const m_d;
|
||||
Internal::RemoteLinuxProcessesDialogPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -72,42 +72,42 @@ using namespace Internal;
|
||||
|
||||
AbstractRemoteLinuxProcessList::AbstractRemoteLinuxProcessList(const LinuxDeviceConfiguration::ConstPtr &devConfig,
|
||||
QObject *parent)
|
||||
: QAbstractTableModel(parent), m_d(new AbstractRemoteLinuxProcessListPrivate(devConfig))
|
||||
: QAbstractTableModel(parent), d(new AbstractRemoteLinuxProcessListPrivate(devConfig))
|
||||
{
|
||||
}
|
||||
|
||||
LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxProcessList::deviceConfiguration() const
|
||||
{
|
||||
return m_d->deviceConfiguration;
|
||||
return d->deviceConfiguration;
|
||||
}
|
||||
|
||||
AbstractRemoteLinuxProcessList::~AbstractRemoteLinuxProcessList()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxProcessList::update()
|
||||
{
|
||||
QTC_ASSERT(m_d->state == Inactive, return);
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
beginResetModel();
|
||||
m_d->remoteProcesses.clear();
|
||||
m_d->state = Listing;
|
||||
d->remoteProcesses.clear();
|
||||
d->state = Listing;
|
||||
startProcess(listProcessesCommandLine());
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxProcessList::killProcess(int row)
|
||||
{
|
||||
QTC_ASSERT(row >= 0 && row < m_d->remoteProcesses.count(), return);
|
||||
QTC_ASSERT(m_d->state == Inactive, return);
|
||||
QTC_ASSERT(row >= 0 && row < d->remoteProcesses.count(), return);
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
m_d->state = Killing;
|
||||
startProcess(killProcessCommandLine(m_d->remoteProcesses.at(row)));
|
||||
d->state = Killing;
|
||||
startProcess(killProcessCommandLine(d->remoteProcesses.at(row)));
|
||||
}
|
||||
|
||||
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; }
|
||||
@@ -126,7 +126,7 @@ QVariant AbstractRemoteLinuxProcessList::data(const QModelIndex &index, int role
|
||||
if (!index.isValid() || index.row() >= rowCount(index.parent())
|
||||
|| index.column() >= columnCount() || role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
const RemoteProcess &proc = m_d->remoteProcesses.at(index.row());
|
||||
const RemoteProcess &proc = d->remoteProcesses.at(index.row());
|
||||
if (index.column() == 0)
|
||||
return proc.pid;
|
||||
else
|
||||
@@ -135,61 +135,61 @@ QVariant AbstractRemoteLinuxProcessList::data(const QModelIndex &index, int role
|
||||
|
||||
void AbstractRemoteLinuxProcessList::handleRemoteStdOut(const QByteArray &output)
|
||||
{
|
||||
if (m_d->state == Listing)
|
||||
m_d->remoteStdout += output;
|
||||
if (d->state == Listing)
|
||||
d->remoteStdout += output;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxProcessList::handleRemoteStdErr(const QByteArray &output)
|
||||
{
|
||||
if (m_d->state != Inactive)
|
||||
m_d->remoteStderr += output;
|
||||
if (d->state != Inactive)
|
||||
d->remoteStderr += output;
|
||||
}
|
||||
|
||||
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();
|
||||
m_d->remoteProcesses.clear();
|
||||
d->remoteProcesses.clear();
|
||||
endResetModel();
|
||||
setFinished();
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
|
||||
{
|
||||
QTC_ASSERT(m_d->state != Inactive, return);
|
||||
QTC_ASSERT(d->state != Inactive, return);
|
||||
|
||||
switch (exitStatus) {
|
||||
case SshRemoteProcess::FailedToStart:
|
||||
m_d->errorMsg = tr("Error: Remote process failed to start: %1")
|
||||
.arg(m_d->process->process()->errorString());
|
||||
d->errorMsg = tr("Error: Remote process failed to start: %1")
|
||||
.arg(d->process->process()->errorString());
|
||||
break;
|
||||
case SshRemoteProcess::KilledBySignal:
|
||||
m_d->errorMsg = tr("Error: Remote process crashed: %1")
|
||||
.arg(m_d->process->process()->errorString());
|
||||
d->errorMsg = tr("Error: Remote process crashed: %1")
|
||||
.arg(d->process->process()->errorString());
|
||||
break;
|
||||
case SshRemoteProcess::ExitedNormally:
|
||||
if (m_d->process->process()->exitCode() == 0) {
|
||||
if (m_d->state == Listing)
|
||||
m_d->remoteProcesses = buildProcessList(QString::fromUtf8(m_d->remoteStdout));
|
||||
if (d->process->process()->exitCode() == 0) {
|
||||
if (d->state == Listing)
|
||||
d->remoteProcesses = buildProcessList(QString::fromUtf8(d->remoteStdout));
|
||||
} else {
|
||||
m_d->errorMsg = tr("Remote process failed.");
|
||||
d->errorMsg = tr("Remote process failed.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid exit status");
|
||||
}
|
||||
|
||||
if (!m_d->errorMsg.isEmpty()) {
|
||||
if (!m_d->remoteStderr.isEmpty())
|
||||
m_d->errorMsg += tr("\nRemote stderr was: %1").arg(QString::fromUtf8(m_d->remoteStderr));
|
||||
emit error(m_d->errorMsg);
|
||||
} else if (m_d->state == Killing) {
|
||||
if (!d->errorMsg.isEmpty()) {
|
||||
if (!d->remoteStderr.isEmpty())
|
||||
d->errorMsg += tr("\nRemote stderr was: %1").arg(QString::fromUtf8(d->remoteStderr));
|
||||
emit error(d->errorMsg);
|
||||
} else if (d->state == Killing) {
|
||||
emit processKilled();
|
||||
}
|
||||
|
||||
if (m_d->state == Listing)
|
||||
if (d->state == Listing)
|
||||
endResetModel();
|
||||
|
||||
setFinished();
|
||||
@@ -197,24 +197,24 @@ void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
|
||||
|
||||
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()));
|
||||
connect(m_d->process.data(), SIGNAL(processOutputAvailable(QByteArray)),
|
||||
connect(d->process.data(), SIGNAL(processOutputAvailable(QByteArray)),
|
||||
SLOT(handleRemoteStdOut(QByteArray)));
|
||||
connect(m_d->process.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
|
||||
connect(d->process.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
|
||||
SLOT(handleRemoteStdErr(QByteArray)));
|
||||
connect(m_d->process.data(), SIGNAL(processClosed(int)),
|
||||
connect(d->process.data(), SIGNAL(processClosed(int)),
|
||||
SLOT(handleRemoteProcessFinished(int)));
|
||||
m_d->remoteStdout.clear();
|
||||
m_d->remoteStderr.clear();
|
||||
m_d->errorMsg.clear();
|
||||
m_d->process->run(cmdLine.toUtf8());
|
||||
d->remoteStdout.clear();
|
||||
d->remoteStderr.clear();
|
||||
d->errorMsg.clear();
|
||||
d->process->run(cmdLine.toUtf8());
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxProcessList::setFinished()
|
||||
{
|
||||
disconnect(m_d->process.data(), 0, this, 0);
|
||||
m_d->state = Inactive;
|
||||
disconnect(d->process.data(), 0, this, 0);
|
||||
d->state = Inactive;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
void startProcess(const QString &cmdLine);
|
||||
void setFinished();
|
||||
|
||||
Internal::AbstractRemoteLinuxProcessListPrivate * const m_d;
|
||||
Internal::AbstractRemoteLinuxProcessListPrivate * const d;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ using namespace Internal;
|
||||
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, const QString &id,
|
||||
const QString &proFilePath)
|
||||
: RunConfiguration(parent, id),
|
||||
m_d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent))
|
||||
d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent))
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -107,7 +107,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent,
|
||||
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent,
|
||||
RemoteLinuxRunConfiguration *source)
|
||||
: RunConfiguration(parent, source),
|
||||
m_d(new RemoteLinuxRunConfigurationPrivate(source->m_d))
|
||||
d(new RemoteLinuxRunConfigurationPrivate(source->d))
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -144,33 +144,33 @@ Qt4BuildConfiguration *RemoteLinuxRunConfiguration::activeQt4BuildConfiguration(
|
||||
|
||||
bool RemoteLinuxRunConfiguration::isEnabled() const
|
||||
{
|
||||
if (m_d->parseInProgress) {
|
||||
m_d->disabledReason = tr("The .pro file is being parsed.");
|
||||
if (d->parseInProgress) {
|
||||
d->disabledReason = tr("The .pro file is being parsed.");
|
||||
return false;
|
||||
}
|
||||
if (!m_d->validParse) {
|
||||
m_d->disabledReason = tr("The .pro file could not be parsed.");
|
||||
if (!d->validParse) {
|
||||
d->disabledReason = tr("The .pro file could not be parsed.");
|
||||
return false;
|
||||
}
|
||||
if (!deviceConfig()) {
|
||||
m_d->disabledReason = tr("No device configuration set.");
|
||||
d->disabledReason = tr("No device configuration set.");
|
||||
return false;
|
||||
}
|
||||
if (!activeQt4BuildConfiguration()) {
|
||||
m_d->disabledReason = tr("No active build configuration.");
|
||||
d->disabledReason = tr("No active build configuration.");
|
||||
return false;
|
||||
}
|
||||
if (remoteExecutableFilePath().isEmpty()) {
|
||||
m_d->disabledReason = tr("Don't know what to run.");
|
||||
d->disabledReason = tr("Don't know what to run.");
|
||||
return false;
|
||||
}
|
||||
m_d->disabledReason.clear();
|
||||
d->disabledReason.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
QString RemoteLinuxRunConfiguration::disabledReason() const
|
||||
{
|
||||
return m_d->disabledReason;
|
||||
return d->disabledReason;
|
||||
}
|
||||
|
||||
QWidget *RemoteLinuxRunConfiguration::createConfigurationWidget()
|
||||
@@ -185,10 +185,10 @@ Utils::OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() con
|
||||
|
||||
void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress)
|
||||
{
|
||||
if (m_d->proFilePath == pro->path()) {
|
||||
if (d->proFilePath == pro->path()) {
|
||||
bool enabled = isEnabled();
|
||||
m_d->validParse = success;
|
||||
m_d->parseInProgress = parseInProgress;
|
||||
d->validParse = success;
|
||||
d->parseInProgress = parseInProgress;
|
||||
if (enabled != isEnabled())
|
||||
updateEnabledState();
|
||||
if (!parseInProgress)
|
||||
@@ -199,12 +199,12 @@ void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNod
|
||||
QVariantMap RemoteLinuxRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(RunConfiguration::toMap());
|
||||
map.insert(QLatin1String(ArgumentsKey), m_d->arguments);
|
||||
map.insert(QLatin1String(ArgumentsKey), d->arguments);
|
||||
const QDir dir = QDir(target()->project()->projectDirectory());
|
||||
map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(m_d->proFilePath));
|
||||
map.insert(QLatin1String(BaseEnvironmentBaseKey), m_d->baseEnvironmentType);
|
||||
map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->proFilePath));
|
||||
map.insert(QLatin1String(BaseEnvironmentBaseKey), d->baseEnvironmentType);
|
||||
map.insert(QLatin1String(UserEnvironmentChangesKey),
|
||||
Utils::EnvironmentItem::toStringList(m_d->userEnvironmentChanges));
|
||||
Utils::EnvironmentItem::toStringList(d->userEnvironmentChanges));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -213,17 +213,17 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
m_d->arguments = map.value(QLatin1String(ArgumentsKey)).toString();
|
||||
d->arguments = map.value(QLatin1String(ArgumentsKey)).toString();
|
||||
const QDir dir = QDir(target()->project()->projectDirectory());
|
||||
m_d->proFilePath = dir.filePath(map.value(QLatin1String(ProFileKey)).toString());
|
||||
m_d->userEnvironmentChanges =
|
||||
d->proFilePath = dir.filePath(map.value(QLatin1String(ProFileKey)).toString());
|
||||
d->userEnvironmentChanges =
|
||||
Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(UserEnvironmentChangesKey))
|
||||
.toStringList());
|
||||
m_d->baseEnvironmentType = static_cast<BaseEnvironmentType>(map.value(QLatin1String(BaseEnvironmentBaseKey),
|
||||
d->baseEnvironmentType = static_cast<BaseEnvironmentType>(map.value(QLatin1String(BaseEnvironmentBaseKey),
|
||||
SystemBaseEnvironment).toInt());
|
||||
|
||||
m_d->validParse = qt4Target()->qt4Project()->validParse(m_d->proFilePath);
|
||||
m_d->parseInProgress = qt4Target()->qt4Project()->parseInProgress(m_d->proFilePath);
|
||||
d->validParse = qt4Target()->qt4Project()->validParse(d->proFilePath);
|
||||
d->parseInProgress = qt4Target()->qt4Project()->parseInProgress(d->proFilePath);
|
||||
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
|
||||
@@ -232,8 +232,8 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
|
||||
|
||||
QString RemoteLinuxRunConfiguration::defaultDisplayName()
|
||||
{
|
||||
if (!m_d->proFilePath.isEmpty())
|
||||
return (QFileInfo(m_d->proFilePath).completeBaseName()) + QLatin1String(" (remote)");
|
||||
if (!d->proFilePath.isEmpty())
|
||||
return (QFileInfo(d->proFilePath).completeBaseName()) + QLatin1String(" (remote)");
|
||||
//: Remote Linux run configuration default display name
|
||||
return tr("Run on remote device");
|
||||
}
|
||||
@@ -256,7 +256,7 @@ RemoteLinuxDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() cons
|
||||
|
||||
QString RemoteLinuxRunConfiguration::arguments() const
|
||||
{
|
||||
return m_d->arguments;
|
||||
return d->arguments;
|
||||
}
|
||||
|
||||
QString RemoteLinuxRunConfiguration::environmentPreparationCommand() const
|
||||
@@ -279,7 +279,7 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const
|
||||
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
|
||||
{
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode()
|
||||
->targetInformation(m_d->proFilePath);
|
||||
->targetInformation(d->proFilePath);
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
|
||||
@@ -303,7 +303,7 @@ PortList RemoteLinuxRunConfiguration::freePorts() const
|
||||
|
||||
void RemoteLinuxRunConfiguration::setArguments(const QString &args)
|
||||
{
|
||||
m_d->arguments = args;
|
||||
d->arguments = args;
|
||||
}
|
||||
|
||||
RemoteLinuxRunConfiguration::DebuggingType RemoteLinuxRunConfiguration::debuggingType() const
|
||||
@@ -355,22 +355,22 @@ void RemoteLinuxRunConfiguration::handleDeployablesUpdated()
|
||||
|
||||
QString RemoteLinuxRunConfiguration::baseEnvironmentText() const
|
||||
{
|
||||
if (m_d->baseEnvironmentType == CleanBaseEnvironment)
|
||||
if (d->baseEnvironmentType == CleanBaseEnvironment)
|
||||
return tr("Clean Environment");
|
||||
else if (m_d->baseEnvironmentType == SystemBaseEnvironment)
|
||||
else if (d->baseEnvironmentType == SystemBaseEnvironment)
|
||||
return tr("System Environment");
|
||||
return QString();
|
||||
}
|
||||
|
||||
RemoteLinuxRunConfiguration::BaseEnvironmentType RemoteLinuxRunConfiguration::baseEnvironmentType() const
|
||||
{
|
||||
return m_d->baseEnvironmentType;
|
||||
return d->baseEnvironmentType;
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfiguration::setBaseEnvironmentType(BaseEnvironmentType env)
|
||||
{
|
||||
if (m_d->baseEnvironmentType != env) {
|
||||
m_d->baseEnvironmentType = env;
|
||||
if (d->baseEnvironmentType != env) {
|
||||
d->baseEnvironmentType = env;
|
||||
emit baseEnvironmentChanged();
|
||||
}
|
||||
}
|
||||
@@ -384,13 +384,13 @@ Utils::Environment RemoteLinuxRunConfiguration::environment() const
|
||||
|
||||
Utils::Environment RemoteLinuxRunConfiguration::baseEnvironment() const
|
||||
{
|
||||
return (m_d->baseEnvironmentType == SystemBaseEnvironment ? systemEnvironment()
|
||||
return (d->baseEnvironmentType == SystemBaseEnvironment ? systemEnvironment()
|
||||
: Utils::Environment());
|
||||
}
|
||||
|
||||
QList<Utils::EnvironmentItem> RemoteLinuxRunConfiguration::userEnvironmentChanges() const
|
||||
{
|
||||
return m_d->userEnvironmentChanges;
|
||||
return d->userEnvironmentChanges;
|
||||
}
|
||||
|
||||
QString RemoteLinuxRunConfiguration::userEnvironmentChangesAsString() const
|
||||
@@ -405,33 +405,33 @@ QString RemoteLinuxRunConfiguration::userEnvironmentChangesAsString() const
|
||||
void RemoteLinuxRunConfiguration::setUserEnvironmentChanges(
|
||||
const QList<Utils::EnvironmentItem> &diff)
|
||||
{
|
||||
if (m_d->userEnvironmentChanges != diff) {
|
||||
m_d->userEnvironmentChanges = diff;
|
||||
if (d->userEnvironmentChanges != diff) {
|
||||
d->userEnvironmentChanges = diff;
|
||||
emit userEnvironmentChangesChanged(diff);
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Environment RemoteLinuxRunConfiguration::systemEnvironment() const
|
||||
{
|
||||
return m_d->systemEnvironment;
|
||||
return d->systemEnvironment;
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfiguration::setSystemEnvironment(const Utils::Environment &environment)
|
||||
{
|
||||
if (m_d->systemEnvironment.size() == 0 || m_d->systemEnvironment != environment) {
|
||||
m_d->systemEnvironment = environment;
|
||||
if (d->systemEnvironment.size() == 0 || d->systemEnvironment != environment) {
|
||||
d->systemEnvironment = environment;
|
||||
emit systemEnvironmentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString RemoteLinuxRunConfiguration::proFilePath() const
|
||||
{
|
||||
return m_d->proFilePath;
|
||||
return d->proFilePath;
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfiguration::setDisabledReason(const QString &reason) const
|
||||
{
|
||||
m_d->disabledReason = reason;
|
||||
d->disabledReason = reason;
|
||||
}
|
||||
|
||||
const QString RemoteLinuxRunConfiguration::Id = QLatin1String("RemoteLinuxRunConfiguration");
|
||||
|
||||
@@ -140,7 +140,7 @@ private:
|
||||
void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
|
||||
void setSystemEnvironment(const Utils::Environment &environment);
|
||||
|
||||
Internal::RemoteLinuxRunConfigurationPrivate * const m_d;
|
||||
Internal::RemoteLinuxRunConfigurationPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -101,56 +101,56 @@ using namespace Internal;
|
||||
|
||||
RemoteLinuxRunConfigurationWidget::RemoteLinuxRunConfigurationWidget(RemoteLinuxRunConfiguration *runConfiguration,
|
||||
QWidget *parent)
|
||||
: QWidget(parent), m_d(new RemoteLinuxRunConfigurationWidgetPrivate(runConfiguration))
|
||||
: QWidget(parent), d(new RemoteLinuxRunConfigurationWidgetPrivate(runConfiguration))
|
||||
{
|
||||
QVBoxLayout *topLayout = new QVBoxLayout(this);
|
||||
topLayout->setMargin(0);
|
||||
addDisabledLabel(topLayout);
|
||||
topLayout->addWidget(&m_d->topWidget);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(&m_d->topWidget);
|
||||
topLayout->addWidget(&d->topWidget);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(&d->topWidget);
|
||||
mainLayout->setMargin(0);
|
||||
addGenericWidgets(mainLayout);
|
||||
addEnvironmentWidgets(mainLayout);
|
||||
|
||||
connect(m_d->runConfiguration, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
|
||||
connect(d->runConfiguration, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
|
||||
SLOT(handleCurrentDeviceConfigChanged()));
|
||||
handleCurrentDeviceConfigChanged();
|
||||
connect(m_d->runConfiguration, SIGNAL(isEnabledChanged(bool)),
|
||||
connect(d->runConfiguration, SIGNAL(isEnabledChanged(bool)),
|
||||
SLOT(runConfigurationEnabledChange(bool)));
|
||||
runConfigurationEnabledChange(m_d->runConfiguration->isEnabled());
|
||||
runConfigurationEnabledChange(d->runConfiguration->isEnabled());
|
||||
}
|
||||
|
||||
RemoteLinuxRunConfigurationWidget::~RemoteLinuxRunConfigurationWidget()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::addDisabledLabel(QVBoxLayout *topLayout)
|
||||
{
|
||||
QHBoxLayout * const hl = new QHBoxLayout;
|
||||
hl->addStretch();
|
||||
m_d->disabledIcon.setPixmap(QPixmap(QString::fromUtf8(":/projectexplorer/images/compile_warning.png")));
|
||||
hl->addWidget(&m_d->disabledIcon);
|
||||
m_d->disabledReason.setVisible(false);
|
||||
hl->addWidget(&m_d->disabledReason);
|
||||
d->disabledIcon.setPixmap(QPixmap(QString::fromUtf8(":/projectexplorer/images/compile_warning.png")));
|
||||
hl->addWidget(&d->disabledIcon);
|
||||
d->disabledReason.setVisible(false);
|
||||
hl->addWidget(&d->disabledReason);
|
||||
hl->addStretch();
|
||||
topLayout->addLayout(hl);
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::suppressQmlDebuggingOptions()
|
||||
{
|
||||
m_d->debuggingLanguagesLabel.hide();
|
||||
m_d->debugCppOnlyButton.hide();
|
||||
m_d->debugQmlOnlyButton.hide();
|
||||
m_d->debugCppAndQmlButton.hide();
|
||||
d->debuggingLanguagesLabel.hide();
|
||||
d->debugCppOnlyButton.hide();
|
||||
d->debugQmlOnlyButton.hide();
|
||||
d->debugCppAndQmlButton.hide();
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::runConfigurationEnabledChange(bool enabled)
|
||||
{
|
||||
m_d->topWidget.setEnabled(enabled);
|
||||
m_d->disabledIcon.setVisible(!enabled);
|
||||
m_d->disabledReason.setVisible(!enabled);
|
||||
m_d->disabledReason.setText(m_d->runConfiguration->disabledReason());
|
||||
d->topWidget.setEnabled(enabled);
|
||||
d->disabledIcon.setVisible(!enabled);
|
||||
d->disabledReason.setVisible(!enabled);
|
||||
d->disabledReason.setText(d->runConfiguration->disabledReason());
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
|
||||
@@ -162,7 +162,7 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
|
||||
QWidget * const devConfWidget = new QWidget;
|
||||
QHBoxLayout * const devConfLayout = new QHBoxLayout(devConfWidget);
|
||||
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>")
|
||||
.arg(QLatin1String("deviceconfig")));
|
||||
addDevConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||
@@ -174,46 +174,46 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
|
||||
devConfLayout->addWidget(debuggerConfLabel);
|
||||
|
||||
formLayout->addRow(new QLabel(tr("Device configuration:")), devConfWidget);
|
||||
m_d->localExecutableLabel.setText(m_d->runConfiguration->localExecutableFilePath());
|
||||
formLayout->addRow(tr("Executable on host:"), &m_d->localExecutableLabel);
|
||||
formLayout->addRow(tr("Executable on device:"), &m_d->remoteExecutableLabel);
|
||||
m_d->argsLineEdit.setText(m_d->runConfiguration->arguments());
|
||||
formLayout->addRow(tr("Arguments:"), &m_d->argsLineEdit);
|
||||
d->localExecutableLabel.setText(d->runConfiguration->localExecutableFilePath());
|
||||
formLayout->addRow(tr("Executable on host:"), &d->localExecutableLabel);
|
||||
formLayout->addRow(tr("Executable on device:"), &d->remoteExecutableLabel);
|
||||
d->argsLineEdit.setText(d->runConfiguration->arguments());
|
||||
formLayout->addRow(tr("Arguments:"), &d->argsLineEdit);
|
||||
|
||||
QHBoxLayout * const debugButtonsLayout = new QHBoxLayout;
|
||||
m_d->debugCppOnlyButton.setText(tr("C++ only"));
|
||||
m_d->debugQmlOnlyButton.setText(tr("QML only"));
|
||||
m_d->debugCppAndQmlButton.setText(tr("C++ and QML"));
|
||||
m_d->debuggingLanguagesLabel.setText(tr("Debugging type:"));
|
||||
d->debugCppOnlyButton.setText(tr("C++ only"));
|
||||
d->debugQmlOnlyButton.setText(tr("QML only"));
|
||||
d->debugCppAndQmlButton.setText(tr("C++ and QML"));
|
||||
d->debuggingLanguagesLabel.setText(tr("Debugging type:"));
|
||||
QButtonGroup * const buttonGroup = new QButtonGroup;
|
||||
buttonGroup->addButton(&m_d->debugCppOnlyButton);
|
||||
buttonGroup->addButton(&m_d->debugQmlOnlyButton);
|
||||
buttonGroup->addButton(&m_d->debugCppAndQmlButton);
|
||||
debugButtonsLayout->addWidget(&m_d->debugCppOnlyButton);
|
||||
debugButtonsLayout->addWidget(&m_d->debugQmlOnlyButton);
|
||||
debugButtonsLayout->addWidget(&m_d->debugCppAndQmlButton);
|
||||
buttonGroup->addButton(&d->debugCppOnlyButton);
|
||||
buttonGroup->addButton(&d->debugQmlOnlyButton);
|
||||
buttonGroup->addButton(&d->debugCppAndQmlButton);
|
||||
debugButtonsLayout->addWidget(&d->debugCppOnlyButton);
|
||||
debugButtonsLayout->addWidget(&d->debugQmlOnlyButton);
|
||||
debugButtonsLayout->addWidget(&d->debugCppAndQmlButton);
|
||||
debugButtonsLayout->addStretch(1);
|
||||
formLayout->addRow(&m_d->debuggingLanguagesLabel, debugButtonsLayout);
|
||||
if (m_d->runConfiguration->useCppDebugger()) {
|
||||
if (m_d->runConfiguration->useQmlDebugger())
|
||||
m_d->debugCppAndQmlButton.setChecked(true);
|
||||
formLayout->addRow(&d->debuggingLanguagesLabel, debugButtonsLayout);
|
||||
if (d->runConfiguration->useCppDebugger()) {
|
||||
if (d->runConfiguration->useQmlDebugger())
|
||||
d->debugCppAndQmlButton.setChecked(true);
|
||||
else
|
||||
m_d->debugCppOnlyButton.setChecked(true);
|
||||
d->debugCppOnlyButton.setChecked(true);
|
||||
} else {
|
||||
m_d->debugQmlOnlyButton.setChecked(true);
|
||||
d->debugQmlOnlyButton.setChecked(true);
|
||||
}
|
||||
|
||||
connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
|
||||
SLOT(showDeviceConfigurationsDialog(QString)));
|
||||
connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this,
|
||||
SLOT(showDeviceConfigurationsDialog(QString)));
|
||||
connect(&m_d->argsLineEdit, SIGNAL(textEdited(QString)), SLOT(argumentsEdited(QString)));
|
||||
connect(&m_d->debugCppOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
|
||||
connect(&m_d->debugQmlOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
|
||||
connect(&m_d->debugCppAndQmlButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
|
||||
connect(m_d->runConfiguration, SIGNAL(targetInformationChanged()), this,
|
||||
connect(&d->argsLineEdit, SIGNAL(textEdited(QString)), SLOT(argumentsEdited(QString)));
|
||||
connect(&d->debugCppOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
|
||||
connect(&d->debugQmlOnlyButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
|
||||
connect(&d->debugCppAndQmlButton, SIGNAL(toggled(bool)), SLOT(handleDebuggingTypeChanged()));
|
||||
connect(d->runConfiguration, SIGNAL(targetInformationChanged()), this,
|
||||
SLOT(updateTargetInformation()));
|
||||
connect(m_d->runConfiguration, SIGNAL(deploySpecsChanged()), SLOT(handleDeploySpecsChanged()));
|
||||
connect(d->runConfiguration, SIGNAL(deploySpecsChanged()), SLOT(handleDeploySpecsChanged()));
|
||||
handleDeploySpecsChanged();
|
||||
}
|
||||
|
||||
@@ -224,50 +224,50 @@ void RemoteLinuxRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainL
|
||||
baseEnvironmentLayout->setMargin(0);
|
||||
QLabel * const label = new QLabel(tr("Base environment for this run configuration:"), this);
|
||||
baseEnvironmentLayout->addWidget(label);
|
||||
m_d->baseEnvironmentComboBox.addItems(QStringList() << tr("Clean Environment")
|
||||
d->baseEnvironmentComboBox.addItems(QStringList() << tr("Clean Environment")
|
||||
<< tr("System Environment"));
|
||||
m_d->baseEnvironmentComboBox.setCurrentIndex(m_d->runConfiguration->baseEnvironmentType());
|
||||
baseEnvironmentLayout->addWidget(&m_d->baseEnvironmentComboBox);
|
||||
d->baseEnvironmentComboBox.setCurrentIndex(d->runConfiguration->baseEnvironmentType());
|
||||
baseEnvironmentLayout->addWidget(&d->baseEnvironmentComboBox);
|
||||
|
||||
m_d->fetchEnvButton.setText(FetchEnvButtonText);
|
||||
baseEnvironmentLayout->addWidget(&m_d->fetchEnvButton);
|
||||
d->fetchEnvButton.setText(FetchEnvButtonText);
|
||||
baseEnvironmentLayout->addWidget(&d->fetchEnvButton);
|
||||
baseEnvironmentLayout->addStretch(10);
|
||||
|
||||
m_d->environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
|
||||
m_d->environmentWidget->setBaseEnvironment(m_d->deviceEnvReader.deviceEnvironment());
|
||||
m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText());
|
||||
m_d->environmentWidget->setUserChanges(m_d->runConfiguration->userEnvironmentChanges());
|
||||
mainLayout->addWidget(m_d->environmentWidget);
|
||||
d->environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
|
||||
d->environmentWidget->setBaseEnvironment(d->deviceEnvReader.deviceEnvironment());
|
||||
d->environmentWidget->setBaseEnvironmentText(d->runConfiguration->baseEnvironmentText());
|
||||
d->environmentWidget->setUserChanges(d->runConfiguration->userEnvironmentChanges());
|
||||
mainLayout->addWidget(d->environmentWidget);
|
||||
|
||||
connect(m_d->environmentWidget, SIGNAL(userChangesChanged()), SLOT(userChangesEdited()));
|
||||
connect(&m_d->baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
|
||||
connect(d->environmentWidget, SIGNAL(userChangesChanged()), SLOT(userChangesEdited()));
|
||||
connect(&d->baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(baseEnvironmentSelected(int)));
|
||||
connect(m_d->runConfiguration, SIGNAL(baseEnvironmentChanged()),
|
||||
connect(d->runConfiguration, SIGNAL(baseEnvironmentChanged()),
|
||||
this, SLOT(baseEnvironmentChanged()));
|
||||
connect(m_d->runConfiguration, SIGNAL(systemEnvironmentChanged()),
|
||||
connect(d->runConfiguration, SIGNAL(systemEnvironmentChanged()),
|
||||
this, SLOT(systemEnvironmentChanged()));
|
||||
connect(m_d->runConfiguration,
|
||||
connect(d->runConfiguration,
|
||||
SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
|
||||
SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)));
|
||||
connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
|
||||
connect(&m_d->deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished()));
|
||||
connect(&m_d->deviceEnvReader, SIGNAL(error(QString)), SLOT(fetchEnvironmentError(QString)));
|
||||
connect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
|
||||
connect(&d->deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished()));
|
||||
connect(&d->deviceEnvReader, SIGNAL(error(QString)), SLOT(fetchEnvironmentError(QString)));
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::argumentsEdited(const QString &text)
|
||||
{
|
||||
m_d->runConfiguration->setArguments(text);
|
||||
d->runConfiguration->setArguments(text);
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::updateTargetInformation()
|
||||
{
|
||||
m_d->localExecutableLabel
|
||||
.setText(QDir::toNativeSeparators(m_d->runConfiguration->localExecutableFilePath()));
|
||||
d->localExecutableLabel
|
||||
.setText(QDir::toNativeSeparators(d->runConfiguration->localExecutableFilePath()));
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::handleDeploySpecsChanged()
|
||||
{
|
||||
m_d->remoteExecutableLabel.setText(m_d->runConfiguration->remoteExecutableFilePath());
|
||||
d->remoteExecutableLabel.setText(d->runConfiguration->remoteExecutableFilePath());
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link)
|
||||
@@ -283,29 +283,29 @@ void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QSt
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::handleCurrentDeviceConfigChanged()
|
||||
{
|
||||
m_d->devConfLabel.setText(RemoteLinuxUtils::deviceConfigurationName(m_d->runConfiguration->deviceConfig()));
|
||||
d->devConfLabel.setText(RemoteLinuxUtils::deviceConfigurationName(d->runConfiguration->deviceConfig()));
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::fetchEnvironment()
|
||||
{
|
||||
disconnect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
|
||||
connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
|
||||
m_d->fetchEnvButton.setText(tr("Cancel Fetch Operation"));
|
||||
m_d->deviceEnvReader.start(m_d->runConfiguration->environmentPreparationCommand());
|
||||
disconnect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
|
||||
connect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
|
||||
d->fetchEnvButton.setText(tr("Cancel Fetch Operation"));
|
||||
d->deviceEnvReader.start(d->runConfiguration->environmentPreparationCommand());
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::stopFetchEnvironment()
|
||||
{
|
||||
m_d->deviceEnvReader.stop();
|
||||
d->deviceEnvReader.stop();
|
||||
fetchEnvironmentFinished();
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::fetchEnvironmentFinished()
|
||||
{
|
||||
disconnect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
|
||||
connect(&m_d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
|
||||
m_d->fetchEnvButton.setText(FetchEnvButtonText);
|
||||
m_d->runConfiguration->setSystemEnvironment(m_d->deviceEnvReader.deviceEnvironment());
|
||||
disconnect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
|
||||
connect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
|
||||
d->fetchEnvButton.setText(FetchEnvButtonText);
|
||||
d->runConfiguration->setSystemEnvironment(d->deviceEnvReader.deviceEnvironment());
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::fetchEnvironmentError(const QString &error)
|
||||
@@ -316,48 +316,48 @@ void RemoteLinuxRunConfigurationWidget::fetchEnvironmentError(const QString &err
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::userChangesEdited()
|
||||
{
|
||||
m_d->ignoreChange = true;
|
||||
m_d->runConfiguration->setUserEnvironmentChanges(m_d->environmentWidget->userChanges());
|
||||
m_d->ignoreChange = false;
|
||||
d->ignoreChange = true;
|
||||
d->runConfiguration->setUserEnvironmentChanges(d->environmentWidget->userChanges());
|
||||
d->ignoreChange = false;
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::baseEnvironmentSelected(int index)
|
||||
{
|
||||
m_d->ignoreChange = true;
|
||||
m_d->runConfiguration->setBaseEnvironmentType(RemoteLinuxRunConfiguration::BaseEnvironmentType(index));
|
||||
m_d->environmentWidget->setBaseEnvironment(m_d->runConfiguration->baseEnvironment());
|
||||
m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText());
|
||||
m_d->ignoreChange = false;
|
||||
d->ignoreChange = true;
|
||||
d->runConfiguration->setBaseEnvironmentType(RemoteLinuxRunConfiguration::BaseEnvironmentType(index));
|
||||
d->environmentWidget->setBaseEnvironment(d->runConfiguration->baseEnvironment());
|
||||
d->environmentWidget->setBaseEnvironmentText(d->runConfiguration->baseEnvironmentText());
|
||||
d->ignoreChange = false;
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::baseEnvironmentChanged()
|
||||
{
|
||||
if (m_d->ignoreChange)
|
||||
if (d->ignoreChange)
|
||||
return;
|
||||
|
||||
m_d->baseEnvironmentComboBox.setCurrentIndex(m_d->runConfiguration->baseEnvironmentType());
|
||||
m_d->environmentWidget->setBaseEnvironment(m_d->runConfiguration->baseEnvironment());
|
||||
m_d->environmentWidget->setBaseEnvironmentText(m_d->runConfiguration->baseEnvironmentText());
|
||||
d->baseEnvironmentComboBox.setCurrentIndex(d->runConfiguration->baseEnvironmentType());
|
||||
d->environmentWidget->setBaseEnvironment(d->runConfiguration->baseEnvironment());
|
||||
d->environmentWidget->setBaseEnvironmentText(d->runConfiguration->baseEnvironmentText());
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (m_d->ignoreChange)
|
||||
if (d->ignoreChange)
|
||||
return;
|
||||
m_d->environmentWidget->setUserChanges(userChanges);
|
||||
d->environmentWidget->setUserChanges(userChanges);
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfigurationWidget::handleDebuggingTypeChanged()
|
||||
{
|
||||
m_d->runConfiguration->setUseCppDebugger(m_d->debugCppOnlyButton.isChecked()
|
||||
|| m_d->debugCppAndQmlButton.isChecked());
|
||||
m_d->runConfiguration->setUseQmlDebugger(m_d->debugQmlOnlyButton.isChecked()
|
||||
|| m_d->debugCppAndQmlButton.isChecked());
|
||||
d->runConfiguration->setUseCppDebugger(d->debugCppOnlyButton.isChecked()
|
||||
|| d->debugCppAndQmlButton.isChecked());
|
||||
d->runConfiguration->setUseQmlDebugger(d->debugQmlOnlyButton.isChecked()
|
||||
|| d->debugCppAndQmlButton.isChecked());
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
void addGenericWidgets(QVBoxLayout *mainLayout);
|
||||
void addEnvironmentWidgets(QVBoxLayout *mainLayout);
|
||||
|
||||
Internal::RemoteLinuxRunConfigurationWidgetPrivate * const m_d;
|
||||
Internal::RemoteLinuxRunConfigurationWidgetPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -60,54 +60,54 @@ class RemoteLinuxUsedPortsGathererPrivate
|
||||
using namespace Internal;
|
||||
|
||||
RemoteLinuxUsedPortsGatherer::RemoteLinuxUsedPortsGatherer(QObject *parent) :
|
||||
QObject(parent), m_d(new RemoteLinuxUsedPortsGathererPrivate)
|
||||
QObject(parent), d(new RemoteLinuxUsedPortsGathererPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void RemoteLinuxUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection,
|
||||
const LinuxDeviceConfiguration::ConstPtr &devConf)
|
||||
{
|
||||
if (m_d->running)
|
||||
if (d->running)
|
||||
qWarning("Unexpected call of %s in running state", Q_FUNC_INFO);
|
||||
m_d->portsToCheck = devConf->freePorts();
|
||||
m_d->usedPorts.clear();
|
||||
m_d->remoteStdout.clear();
|
||||
m_d->remoteStderr.clear();
|
||||
m_d->procRunner = SshRemoteProcessRunner::create(connection);
|
||||
connect(m_d->procRunner.data(), SIGNAL(connectionError(Utils::SshError)),
|
||||
d->portsToCheck = devConf->freePorts();
|
||||
d->usedPorts.clear();
|
||||
d->remoteStdout.clear();
|
||||
d->remoteStderr.clear();
|
||||
d->procRunner = SshRemoteProcessRunner::create(connection);
|
||||
connect(d->procRunner.data(), SIGNAL(connectionError(Utils::SshError)),
|
||||
SLOT(handleConnectionError()));
|
||||
connect(m_d->procRunner.data(), SIGNAL(processClosed(int)),
|
||||
connect(d->procRunner.data(), SIGNAL(processClosed(int)),
|
||||
SLOT(handleProcessClosed(int)));
|
||||
connect(m_d->procRunner.data(), SIGNAL(processOutputAvailable(QByteArray)),
|
||||
connect(d->procRunner.data(), SIGNAL(processOutputAvailable(QByteArray)),
|
||||
SLOT(handleRemoteStdOut(QByteArray)));
|
||||
connect(m_d->procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
|
||||
connect(d->procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
|
||||
SLOT(handleRemoteStdErr(QByteArray)));
|
||||
const QString command = QLatin1String("sed "
|
||||
"'s/.*: [[:xdigit:]]\\{8\\}:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp");
|
||||
m_d->procRunner->run(command.toUtf8());
|
||||
m_d->running = true;
|
||||
d->procRunner->run(command.toUtf8());
|
||||
d->running = true;
|
||||
}
|
||||
|
||||
void RemoteLinuxUsedPortsGatherer::stop()
|
||||
{
|
||||
if (!m_d->running)
|
||||
if (!d->running)
|
||||
return;
|
||||
m_d->running = false;
|
||||
disconnect(m_d->procRunner->connection().data(), 0, this, 0);
|
||||
if (m_d->procRunner->process())
|
||||
m_d->procRunner->process()->closeChannel();
|
||||
d->running = false;
|
||||
disconnect(d->procRunner->connection().data(), 0, this, 0);
|
||||
if (d->procRunner->process())
|
||||
d->procRunner->process()->closeChannel();
|
||||
}
|
||||
|
||||
int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
|
||||
{
|
||||
while (freePorts->hasMore()) {
|
||||
const int port = freePorts->getNext();
|
||||
if (!m_d->usedPorts.contains(port))
|
||||
if (!d->usedPorts.contains(port))
|
||||
return port;
|
||||
}
|
||||
return -1;
|
||||
@@ -115,12 +115,12 @@ int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
|
||||
|
||||
QList<int> RemoteLinuxUsedPortsGatherer::usedPorts() const
|
||||
{
|
||||
return m_d->usedPorts;
|
||||
return d->usedPorts;
|
||||
}
|
||||
|
||||
void RemoteLinuxUsedPortsGatherer::setupUsedPorts()
|
||||
{
|
||||
QList<QByteArray> portStrings = m_d->remoteStdout.split('\n');
|
||||
QList<QByteArray> portStrings = d->remoteStdout.split('\n');
|
||||
portStrings.removeFirst();
|
||||
foreach (const QByteArray &portString, portStrings) {
|
||||
if (portString.isEmpty())
|
||||
@@ -128,8 +128,8 @@ void RemoteLinuxUsedPortsGatherer::setupUsedPorts()
|
||||
bool ok;
|
||||
const int port = portString.toInt(&ok, 16);
|
||||
if (ok) {
|
||||
if (m_d->portsToCheck.contains(port) && !m_d->usedPorts.contains(port))
|
||||
m_d->usedPorts << port;
|
||||
if (d->portsToCheck.contains(port) && !d->usedPorts.contains(port))
|
||||
d->usedPorts << port;
|
||||
} else {
|
||||
qWarning("%s: Unexpected string '%s' is not a port.",
|
||||
Q_FUNC_INFO, portString.data());
|
||||
@@ -140,33 +140,33 @@ void RemoteLinuxUsedPortsGatherer::setupUsedPorts()
|
||||
|
||||
void RemoteLinuxUsedPortsGatherer::handleConnectionError()
|
||||
{
|
||||
if (!m_d->running)
|
||||
if (!d->running)
|
||||
return;
|
||||
emit error(tr("Connection error: %1").
|
||||
arg(m_d->procRunner->connection()->errorString()));
|
||||
arg(d->procRunner->connection()->errorString()));
|
||||
stop();
|
||||
}
|
||||
|
||||
void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
|
||||
{
|
||||
if (!m_d->running)
|
||||
if (!d->running)
|
||||
return;
|
||||
QString errMsg;
|
||||
switch (exitStatus) {
|
||||
case SshRemoteProcess::FailedToStart:
|
||||
errMsg = tr("Could not start remote process: %1")
|
||||
.arg(m_d->procRunner->process()->errorString());
|
||||
.arg(d->procRunner->process()->errorString());
|
||||
break;
|
||||
case SshRemoteProcess::KilledBySignal:
|
||||
errMsg = tr("Remote process crashed: %1")
|
||||
.arg(m_d->procRunner->process()->errorString());
|
||||
.arg(d->procRunner->process()->errorString());
|
||||
break;
|
||||
case SshRemoteProcess::ExitedNormally:
|
||||
if (m_d->procRunner->process()->exitCode() == 0) {
|
||||
if (d->procRunner->process()->exitCode() == 0) {
|
||||
setupUsedPorts();
|
||||
} else {
|
||||
errMsg = tr("Remote process failed; exit code was %1.")
|
||||
.arg(m_d->procRunner->process()->exitCode());
|
||||
.arg(d->procRunner->process()->exitCode());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -174,9 +174,9 @@ void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
|
||||
}
|
||||
|
||||
if (!errMsg.isEmpty()) {
|
||||
if (!m_d->remoteStderr.isEmpty()) {
|
||||
if (!d->remoteStderr.isEmpty()) {
|
||||
errMsg += tr("\nRemote error output was: %1")
|
||||
.arg(QString::fromUtf8(m_d->remoteStderr));
|
||||
.arg(QString::fromUtf8(d->remoteStderr));
|
||||
}
|
||||
emit error(errMsg);
|
||||
}
|
||||
@@ -185,12 +185,12 @@ void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
|
||||
|
||||
void RemoteLinuxUsedPortsGatherer::handleRemoteStdOut(const QByteArray &output)
|
||||
{
|
||||
m_d->remoteStdout += output;
|
||||
d->remoteStdout += output;
|
||||
}
|
||||
|
||||
void RemoteLinuxUsedPortsGatherer::handleRemoteStdErr(const QByteArray &output)
|
||||
{
|
||||
m_d->remoteStderr += output;
|
||||
d->remoteStderr += output;
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -77,7 +77,7 @@ private slots:
|
||||
private:
|
||||
void setupUsedPorts();
|
||||
|
||||
Internal::RemoteLinuxUsedPortsGathererPrivate * const m_d;
|
||||
Internal::RemoteLinuxUsedPortsGathererPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -50,21 +50,21 @@ public:
|
||||
} // namespace Internal
|
||||
|
||||
SshKeyDeployer::SshKeyDeployer(QObject *parent)
|
||||
: QObject(parent), m_d(new Internal::SshKeyDeployerPrivate)
|
||||
: QObject(parent), d(new Internal::SshKeyDeployerPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
SshKeyDeployer::~SshKeyDeployer()
|
||||
{
|
||||
cleanup();
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams,
|
||||
const QString &keyFilePath)
|
||||
{
|
||||
cleanup();
|
||||
m_d->deployProcess = SshRemoteProcessRunner::create(sshParams);
|
||||
d->deployProcess = SshRemoteProcessRunner::create(sshParams);
|
||||
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(keyFilePath)) {
|
||||
@@ -72,21 +72,21 @@ void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams,
|
||||
return;
|
||||
}
|
||||
|
||||
connect(m_d->deployProcess.data(), SIGNAL(connectionError(Utils::SshError)), this,
|
||||
connect(d->deployProcess.data(), SIGNAL(connectionError(Utils::SshError)), this,
|
||||
SLOT(handleConnectionFailure()));
|
||||
connect(m_d->deployProcess.data(), SIGNAL(processClosed(int)), this,
|
||||
connect(d->deployProcess.data(), SIGNAL(processClosed(int)), this,
|
||||
SLOT(handleKeyUploadFinished(int)));
|
||||
const QByteArray command = "test -d .ssh "
|
||||
"|| mkdir .ssh && chmod 0700 .ssh && echo '"
|
||||
+ reader.data() + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys";
|
||||
m_d->deployProcess->run(command);
|
||||
d->deployProcess->run(command);
|
||||
}
|
||||
|
||||
void SshKeyDeployer::handleConnectionFailure()
|
||||
{
|
||||
if (!m_d->deployProcess)
|
||||
if (!d->deployProcess)
|
||||
return;
|
||||
const QString errorMsg = m_d->deployProcess->connection()->errorString();
|
||||
const QString errorMsg = d->deployProcess->connection()->errorString();
|
||||
cleanup();
|
||||
emit error(tr("Connection failed: %1").arg(errorMsg));
|
||||
}
|
||||
@@ -97,11 +97,11 @@ void SshKeyDeployer::handleKeyUploadFinished(int exitStatus)
|
||||
|| exitStatus == SshRemoteProcess::KilledBySignal
|
||||
|| exitStatus == SshRemoteProcess::ExitedNormally);
|
||||
|
||||
if (!m_d->deployProcess)
|
||||
if (!d->deployProcess)
|
||||
return;
|
||||
|
||||
const int exitCode = m_d->deployProcess->process()->exitCode();
|
||||
const QString errorMsg = m_d->deployProcess->process()->errorString();
|
||||
const int exitCode = d->deployProcess->process()->exitCode();
|
||||
const QString errorMsg = d->deployProcess->process()->errorString();
|
||||
cleanup();
|
||||
if (exitStatus == SshRemoteProcess::ExitedNormally && exitCode == 0)
|
||||
emit finishedSuccessfully();
|
||||
@@ -116,9 +116,9 @@ void SshKeyDeployer::stopDeployment()
|
||||
|
||||
void SshKeyDeployer::cleanup()
|
||||
{
|
||||
if (m_d->deployProcess) {
|
||||
disconnect(m_d->deployProcess.data(), 0, this, 0);
|
||||
m_d->deployProcess.clear();
|
||||
if (d->deployProcess) {
|
||||
disconnect(d->deployProcess.data(), 0, this, 0);
|
||||
d->deployProcess.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ private slots:
|
||||
private:
|
||||
void cleanup();
|
||||
|
||||
Internal::SshKeyDeployerPrivate * const m_d;
|
||||
Internal::SshKeyDeployerPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -52,18 +52,18 @@ using namespace Internal;
|
||||
|
||||
UploadAndInstallTarPackageService::UploadAndInstallTarPackageService(QObject *parent)
|
||||
: AbstractUploadAndInstallPackageService(parent),
|
||||
m_d(new UploadAndInstallTarPackageServicePrivate)
|
||||
d(new UploadAndInstallTarPackageServicePrivate)
|
||||
{
|
||||
}
|
||||
|
||||
UploadAndInstallTarPackageService::~UploadAndInstallTarPackageService()
|
||||
{
|
||||
delete m_d;
|
||||
delete d;
|
||||
}
|
||||
|
||||
AbstractRemoteLinuxPackageInstaller *UploadAndInstallTarPackageService::packageInstaller() const
|
||||
{
|
||||
return &m_d->installer;
|
||||
return &d->installer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
private:
|
||||
AbstractRemoteLinuxPackageInstaller *packageInstaller() const;
|
||||
|
||||
Internal::UploadAndInstallTarPackageServicePrivate *m_d;
|
||||
Internal::UploadAndInstallTarPackageServicePrivate *d;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user