RemoteLinux: Modernize

modernize-*

Change-Id: Ifdf0e781c63941625ca032a8e1752082f4abc3ce
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Alessandro Portale
2018-11-24 17:06:01 +01:00
parent 77c729bb8a
commit f52f25e150
34 changed files with 119 additions and 139 deletions

View File

@@ -74,7 +74,7 @@ AbstractPackagingStep::~AbstractPackagingStep()
void AbstractPackagingStep::handleBuildConfigurationChanged() void AbstractPackagingStep::handleBuildConfigurationChanged()
{ {
if (d->currentBuildConfiguration) if (d->currentBuildConfiguration)
disconnect(d->currentBuildConfiguration, 0, this, 0); disconnect(d->currentBuildConfiguration, nullptr, this, nullptr);
d->currentBuildConfiguration = buildConfiguration(); d->currentBuildConfiguration = buildConfiguration();
if (d->currentBuildConfiguration) { if (d->currentBuildConfiguration) {
connect(d->currentBuildConfiguration, &BuildConfiguration::buildDirectoryChanged, connect(d->currentBuildConfiguration, &BuildConfiguration::buildDirectoryChanged,

View File

@@ -51,16 +51,13 @@ enum State { Inactive, SettingUpDevice, Connecting, Deploying };
class AbstractRemoteLinuxDeployServicePrivate class AbstractRemoteLinuxDeployServicePrivate
{ {
public: public:
AbstractRemoteLinuxDeployServicePrivate()
: connection(0), state(Inactive), stopRequested(false) {}
IDevice::ConstPtr deviceConfiguration; IDevice::ConstPtr deviceConfiguration;
QPointer<Target> target; QPointer<Target> target;
DeploymentTimeInfo deployTimes; DeploymentTimeInfo deployTimes;
SshConnection *connection; SshConnection *connection = nullptr;
State state; State state = Inactive;
bool stopRequested; bool stopRequested = false;
}; };
} // namespace Internal } // namespace Internal
@@ -260,9 +257,9 @@ void AbstractRemoteLinuxDeployService::setFinished()
{ {
d->state = Inactive; d->state = Inactive;
if (d->connection) { if (d->connection) {
disconnect(d->connection, 0, this, 0); disconnect(d->connection, nullptr, this, nullptr);
QSsh::releaseConnection(d->connection); QSsh::releaseConnection(d->connection);
d->connection = 0; d->connection = nullptr;
} }
d->stopRequested = false; d->stopRequested = false;
emit finished(); emit finished();

View File

@@ -144,7 +144,7 @@ void AbstractRemoteLinuxDeployStep::handleFinished()
emit addOutput(tr("Deploy step failed."), OutputFormat::ErrorMessage); emit addOutput(tr("Deploy step failed."), OutputFormat::ErrorMessage);
else else
emit addOutput(tr("Deploy step finished."), OutputFormat::NormalMessage); emit addOutput(tr("Deploy step finished."), OutputFormat::NormalMessage);
disconnect(deployService(), 0, this, 0); disconnect(deployService(), nullptr, this, nullptr);
reportRunResult(d->future, !d->hasError); reportRunResult(d->future, !d->hasError);
} }

View File

@@ -176,8 +176,8 @@ void AbstractUploadAndInstallPackageService::handleInstallationFinished(const QS
void AbstractUploadAndInstallPackageService::setFinished() void AbstractUploadAndInstallPackageService::setFinished()
{ {
d->state = Inactive; d->state = Inactive;
disconnect(d->uploader, 0, this, 0); disconnect(d->uploader, nullptr, this, nullptr);
disconnect(packageInstaller(), 0, this, 0); disconnect(packageInstaller(), nullptr, this, nullptr);
handleDeploymentDone(); handleDeploymentDone();
} }

View File

@@ -42,7 +42,7 @@ public:
protected: protected:
explicit AbstractUploadAndInstallPackageService(QObject *parent); explicit AbstractUploadAndInstallPackageService(QObject *parent);
~AbstractUploadAndInstallPackageService(); ~AbstractUploadAndInstallPackageService() override;
QString packageFilePath() const; QString packageFilePath() const;
@@ -53,11 +53,11 @@ private:
virtual AbstractRemoteLinuxPackageInstaller *packageInstaller() const = 0; virtual AbstractRemoteLinuxPackageInstaller *packageInstaller() const = 0;
virtual QString uploadDir() const; // Defaults to remote user's home directory. virtual QString uploadDir() const; // Defaults to remote user's home directory.
bool isDeploymentNecessary() const; bool isDeploymentNecessary() const override;
void doDeviceSetup(); void doDeviceSetup() override;
void stopDeviceSetup(); void stopDeviceSetup() override;
void doDeploy(); void doDeploy() override;
void stopDeployment(); void stopDeployment() override;
void setFinished(); void setFinished();

View File

@@ -35,16 +35,16 @@ class EmbeddedLinuxQtVersion : public QtSupport::BaseQtVersion
public: public:
EmbeddedLinuxQtVersion() = default; EmbeddedLinuxQtVersion() = default;
EmbeddedLinuxQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString()); EmbeddedLinuxQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
~EmbeddedLinuxQtVersion() = default; ~EmbeddedLinuxQtVersion() override = default;
EmbeddedLinuxQtVersion *clone() const; EmbeddedLinuxQtVersion *clone() const override;
QString type() const; QString type() const override;
QList<ProjectExplorer::Abi> detectQtAbis() const; QList<ProjectExplorer::Abi> detectQtAbis() const override;
QString description() const; QString description() const override;
QSet<Core::Id> targetDeviceTypes() const; QSet<Core::Id> targetDeviceTypes() const override;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -36,8 +36,7 @@ namespace Internal {
EmbeddedLinuxQtVersionFactory::EmbeddedLinuxQtVersionFactory(QObject *parent) : QtSupport::QtVersionFactory(parent) EmbeddedLinuxQtVersionFactory::EmbeddedLinuxQtVersionFactory(QObject *parent) : QtSupport::QtVersionFactory(parent)
{ } { }
EmbeddedLinuxQtVersionFactory::~EmbeddedLinuxQtVersionFactory() EmbeddedLinuxQtVersionFactory::~EmbeddedLinuxQtVersionFactory() = default;
{ }
bool EmbeddedLinuxQtVersionFactory::canRestore(const QString &type) bool EmbeddedLinuxQtVersionFactory::canRestore(const QString &type)
{ {
@@ -47,8 +46,8 @@ bool EmbeddedLinuxQtVersionFactory::canRestore(const QString &type)
QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::restore(const QString &type, const QVariantMap &data) QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::restore(const QString &type, const QVariantMap &data)
{ {
if (!canRestore(type)) if (!canRestore(type))
return 0; return nullptr;
EmbeddedLinuxQtVersion *v = new EmbeddedLinuxQtVersion; auto v = new EmbeddedLinuxQtVersion;
v->fromMap(data); v->fromMap(data);
return v; return v;
} }
@@ -67,9 +66,9 @@ QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::create(const Utils::Fil
QFileInfo fi = qmakePath.toFileInfo(); QFileInfo fi = qmakePath.toFileInfo();
if (!fi.exists() || !fi.isExecutable() || !fi.isFile()) if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
return 0; return nullptr;
EmbeddedLinuxQtVersion *version = new EmbeddedLinuxQtVersion(qmakePath, isAutoDetected, autoDetectionSource); auto version = new EmbeddedLinuxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
QList<ProjectExplorer::Abi> abis = version->qtAbis(); QList<ProjectExplorer::Abi> abis = version->qtAbis();
// Note: This fails for e.g. intel/meego cross builds on x86 linux machines. // Note: This fails for e.g. intel/meego cross builds on x86 linux machines.
@@ -79,7 +78,7 @@ QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::create(const Utils::Fil
return version; return version;
delete version; delete version;
return 0; return nullptr;
} }
} // namespace Internal } // namespace Internal

View File

@@ -33,16 +33,16 @@ namespace Internal {
class EmbeddedLinuxQtVersionFactory : public QtSupport::QtVersionFactory class EmbeddedLinuxQtVersionFactory : public QtSupport::QtVersionFactory
{ {
public: public:
explicit EmbeddedLinuxQtVersionFactory(QObject *parent = 0); explicit EmbeddedLinuxQtVersionFactory(QObject *parent = nullptr);
~EmbeddedLinuxQtVersionFactory(); ~EmbeddedLinuxQtVersionFactory() override;
bool canRestore(const QString &type); bool canRestore(const QString &type) override;
QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data); QtSupport::BaseQtVersion *restore(const QString &type, const QVariantMap &data) override;
int priority() const; int priority() const override;
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator,
bool isAutoDetected = false, bool isAutoDetected = false,
const QString &autoDetectionSource = QString()); const QString &autoDetectionSource = QString()) override;
}; };
} // Internal } // Internal

View File

@@ -71,13 +71,10 @@ struct Job
class GenericDirectUploadServicePrivate class GenericDirectUploadServicePrivate
{ {
public: public:
GenericDirectUploadServicePrivate() bool incremental = false;
: incremental(false), ignoreMissingFiles(false), state(Inactive) {} bool ignoreMissingFiles = false;
bool incremental;
bool ignoreMissingFiles;
bool uploadJobRunning = false; bool uploadJobRunning = false;
State state; State state = Inactive;
QList<DeployableFile> filesToUpload; QList<DeployableFile> filesToUpload;
@@ -373,21 +370,21 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
void GenericDirectUploadService::handleStdOutData() void GenericDirectUploadService::handleStdOutData()
{ {
SshRemoteProcess * const process = qobject_cast<SshRemoteProcess *>(sender()); auto const process = qobject_cast<SshRemoteProcess *>(sender());
if (process) if (process)
emit stdOutData(QString::fromUtf8(process->readAllStandardOutput())); emit stdOutData(QString::fromUtf8(process->readAllStandardOutput()));
} }
void GenericDirectUploadService::handleStdErrData() void GenericDirectUploadService::handleStdErrData()
{ {
SshRemoteProcess * const process = qobject_cast<SshRemoteProcess *>(sender()); auto const process = qobject_cast<SshRemoteProcess *>(sender());
if (process) if (process)
emit stdErrData(QString::fromUtf8(process->readAllStandardError())); emit stdErrData(QString::fromUtf8(process->readAllStandardError()));
} }
void GenericDirectUploadService::handleReadChannelFinished() void GenericDirectUploadService::handleReadChannelFinished()
{ {
SshRemoteProcess * const process = qobject_cast<SshRemoteProcess *>(sender()); auto const process = qobject_cast<SshRemoteProcess *>(sender());
if (process && process->atEnd()) if (process && process->atEnd())
process->close(); process->close();
} }
@@ -479,7 +476,7 @@ void GenericDirectUploadService::queryFiles()
{ {
QTC_ASSERT(d->state == Uploading, return); QTC_ASSERT(d->state == Uploading, return);
for (const DeployableFile &file : d->deployableFiles) { for (const DeployableFile &file : qAsConst(d->deployableFiles)) {
if (!d->incremental || hasLocalFileChanged(file)) { if (!d->incremental || hasLocalFileChanged(file)) {
d->filesToUpload.append(file); d->filesToUpload.append(file);
continue; continue;

View File

@@ -40,8 +40,8 @@ class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationWidget
public: public:
explicit GenericLinuxDeviceConfigurationWidget( explicit GenericLinuxDeviceConfigurationWidget(
const ProjectExplorer::IDevice::Ptr &deviceConfig, QWidget *parent = 0); const ProjectExplorer::IDevice::Ptr &deviceConfig, QWidget *parent = nullptr);
~GenericLinuxDeviceConfigurationWidget(); ~GenericLinuxDeviceConfigurationWidget() override;
private: private:
void authenticationTypeChanged(); void authenticationTypeChanged();
@@ -58,7 +58,7 @@ private:
void createNewKey(); void createNewKey();
void hostKeyCheckingChanged(bool doCheck); void hostKeyCheckingChanged(bool doCheck);
void updateDeviceFromUi(); void updateDeviceFromUi() override;
void updatePortsWarningLabel(); void updatePortsWarningLabel();
void initGui(); void initGui();

View File

@@ -38,8 +38,8 @@ class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationWizard : public Utils::W
Q_OBJECT Q_OBJECT
public: public:
GenericLinuxDeviceConfigurationWizard(QWidget *parent = 0); GenericLinuxDeviceConfigurationWizard(QWidget *parent = nullptr);
~GenericLinuxDeviceConfigurationWizard(); ~GenericLinuxDeviceConfigurationWizard() override;
ProjectExplorer::IDevice::Ptr device(); ProjectExplorer::IDevice::Ptr device();

View File

@@ -159,7 +159,7 @@ GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationW
setTitle(tr("Summary")); setTitle(tr("Summary"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color) setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
d->infoLabel.setWordWrap(true); d->infoLabel.setWordWrap(true);
QVBoxLayout * const layout = new QVBoxLayout(this); auto const layout = new QVBoxLayout(this);
layout->addWidget(&d->infoLabel); layout->addWidget(&d->infoLabel);
} }

View File

@@ -64,7 +64,7 @@ public:
} }
private: private:
QString listProcessesCommandLine() const QString listProcessesCommandLine() const override
{ {
return QString::fromLatin1( return QString::fromLatin1(
"for dir in `ls -d /proc/[0123456789]*`; do " "for dir in `ls -d /proc/[0123456789]*`; do "
@@ -77,7 +77,7 @@ private:
"done").arg(QLatin1String(Delimiter0)).arg(QLatin1String(Delimiter1)); "done").arg(QLatin1String(Delimiter0)).arg(QLatin1String(Delimiter1));
} }
QList<DeviceProcessItem> buildProcessList(const QString &listProcessesReply) const QList<DeviceProcessItem> buildProcessList(const QString &listProcessesReply) const override
{ {
QList<DeviceProcessItem> processes; QList<DeviceProcessItem> processes;
const QStringList lines = listProcessesReply.split(QString::fromLatin1(Delimiter0) const QStringList lines = listProcessesReply.split(QString::fromLatin1(Delimiter0)
@@ -123,7 +123,7 @@ private:
class LinuxPortsGatheringMethod : public PortsGatheringMethod class LinuxPortsGatheringMethod : public PortsGatheringMethod
{ {
Runnable runnable(QAbstractSocket::NetworkLayerProtocol protocol) const Runnable runnable(QAbstractSocket::NetworkLayerProtocol protocol) const override
{ {
// We might encounter the situation that protocol is given IPv6 // We might encounter the situation that protocol is given IPv6
// but the consumer of the free port information decides to open // but the consumer of the free port information decides to open
@@ -142,7 +142,7 @@ class LinuxPortsGatheringMethod : public PortsGatheringMethod
return runnable; return runnable;
} }
QList<Utils::Port> usedPorts(const QByteArray &output) const QList<Utils::Port> usedPorts(const QByteArray &output) const override
{ {
QList<Utils::Port> ports; QList<Utils::Port> ports;
QList<QByteArray> portStrings = output.split('\n'); QList<QByteArray> portStrings = output.split('\n');
@@ -198,7 +198,7 @@ void LinuxDevice::executeAction(Core::Id actionId, QWidget *parent)
{ {
QTC_ASSERT(actionIds().contains(actionId), return); QTC_ASSERT(actionIds().contains(actionId), return);
QDialog *d = 0; QDialog *d = nullptr;
const LinuxDevice::ConstPtr device = sharedFromThis().staticCast<const LinuxDevice>(); const LinuxDevice::ConstPtr device = sharedFromThis().staticCast<const LinuxDevice>();
if (actionId == Constants::GenericDeployKeyToDeviceActionId) if (actionId == Constants::GenericDeployKeyToDeviceActionId)
d = PublicKeyDeploymentDialog::createDialog(device, parent); d = PublicKeyDeploymentDialog::createDialog(device, parent);
@@ -219,10 +219,7 @@ LinuxDevice::LinuxDevice(const QString &name, Core::Id type, MachineType machine
setDisplayName(name); setDisplayName(name);
} }
LinuxDevice::LinuxDevice(const LinuxDevice &other) LinuxDevice::LinuxDevice(const LinuxDevice &other) = default;
: IDevice(other)
{
}
LinuxDevice::Ptr LinuxDevice::create() LinuxDevice::Ptr LinuxDevice::create()
{ {

View File

@@ -39,8 +39,8 @@ class REMOTELINUX_EXPORT LinuxDevice : public ProjectExplorer::IDevice
Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::LinuxDevice) Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::LinuxDevice)
public: public:
typedef QSharedPointer<LinuxDevice> Ptr; using Ptr = QSharedPointer<LinuxDevice>;
typedef QSharedPointer<const LinuxDevice> ConstPtr; using ConstPtr = QSharedPointer<const LinuxDevice>;
static Ptr create(); static Ptr create();
static Ptr create(const QString &name, Core::Id type, MachineType machineType, static Ptr create(const QString &name, Core::Id type, MachineType machineType,
@@ -66,7 +66,7 @@ public:
ProjectExplorer::DeviceEnvironmentFetcher::Ptr environmentFetcher() const override; ProjectExplorer::DeviceEnvironmentFetcher::Ptr environmentFetcher() const override;
protected: protected:
LinuxDevice() {} LinuxDevice() = default;
LinuxDevice(const QString &name, Core::Id type, LinuxDevice(const QString &name, Core::Id type,
MachineType machineType, Origin origin, Core::Id id); MachineType machineType, Origin origin, Core::Id id);
LinuxDevice(const LinuxDevice &other); LinuxDevice(const LinuxDevice &other);

View File

@@ -203,11 +203,11 @@ void GenericLinuxDeviceTester::handleSftpError(const QString &message)
void GenericLinuxDeviceTester::setFinished(TestResult result) void GenericLinuxDeviceTester::setFinished(TestResult result)
{ {
d->state = Inactive; d->state = Inactive;
disconnect(&d->portsGatherer, 0, this, 0); disconnect(&d->portsGatherer, nullptr, this, nullptr);
if (d->connection) { if (d->connection) {
disconnect(d->connection, 0, this, 0); disconnect(d->connection, nullptr, this, nullptr);
d->connection->deleteLater(); d->connection->deleteLater();
d->connection = 0; d->connection = nullptr;
} }
emit finished(result); emit finished(result);
} }

View File

@@ -35,13 +35,11 @@ namespace RemoteLinux {
namespace Internal { namespace Internal {
PackageUploader::PackageUploader(QObject *parent) : PackageUploader::PackageUploader(QObject *parent) :
QObject(parent), m_state(Inactive), m_connection(0) QObject(parent), m_state(Inactive), m_connection(nullptr)
{ {
} }
PackageUploader::~PackageUploader() PackageUploader::~PackageUploader() = default;
{
}
void PackageUploader::uploadPackage(SshConnection *connection, void PackageUploader::uploadPackage(SshConnection *connection,
const QString &localFilePath, const QString &remoteFilePath) const QString &localFilePath, const QString &remoteFilePath)
@@ -138,12 +136,12 @@ void PackageUploader::setState(State newState)
return; return;
if (newState == Inactive) { if (newState == Inactive) {
if (m_uploader) { if (m_uploader) {
disconnect(m_uploader.data(), 0, this, 0); disconnect(m_uploader.data(), nullptr, this, nullptr);
m_uploader.clear(); m_uploader.clear();
} }
if (m_connection) { if (m_connection) {
disconnect(m_connection, 0, this, 0); disconnect(m_connection, nullptr, this, nullptr);
m_connection = 0; m_connection = nullptr;
} }
} }
m_state = newState; m_state = newState;

View File

@@ -43,8 +43,8 @@ class PackageUploader : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit PackageUploader(QObject *parent = 0); explicit PackageUploader(QObject *parent = nullptr);
~PackageUploader(); ~PackageUploader() override;
// Connection has to be established already. // Connection has to be established already.
void uploadPackage(QSsh::SshConnection *connection, void uploadPackage(QSsh::SshConnection *connection,

View File

@@ -55,7 +55,7 @@ PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog(const IDevice
tr("Choose Public Key File"), dir, tr("Choose Public Key File"), dir,
tr("Public Key Files (*.pub);;All Files (*)")); tr("Public Key Files (*.pub);;All Files (*)"));
if (publicKeyFileName.isEmpty()) if (publicKeyFileName.isEmpty())
return 0; return nullptr;
return new PublicKeyDeploymentDialog(deviceConfig, publicKeyFileName, parent); return new PublicKeyDeploymentDialog(deviceConfig, publicKeyFileName, parent);
} }
@@ -114,7 +114,7 @@ void PublicKeyDeploymentDialog::handleDeploymentFinished(const QString &errorMsg
void PublicKeyDeploymentDialog::handleCanceled() void PublicKeyDeploymentDialog::handleCanceled()
{ {
disconnect(&d->keyDeployer, 0, this, 0); disconnect(&d->keyDeployer, nullptr, this, nullptr);
d->keyDeployer.stopDeployment(); d->keyDeployer.stopDeployment();
if (d->done) if (d->done)
accept(); accept();

View File

@@ -40,13 +40,13 @@ class REMOTELINUX_EXPORT PublicKeyDeploymentDialog : public QProgressDialog
public: public:
// Asks for public key and returns null if the file dialog is canceled. // Asks for public key and returns null if the file dialog is canceled.
static PublicKeyDeploymentDialog *createDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfig, static PublicKeyDeploymentDialog *createDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfig,
QWidget *parent = 0); QWidget *parent = nullptr);
~PublicKeyDeploymentDialog(); ~PublicKeyDeploymentDialog() override;
private: private:
explicit PublicKeyDeploymentDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfig, explicit PublicKeyDeploymentDialog(const ProjectExplorer::IDevice::ConstPtr &deviceConfig,
const QString &publicKeyFileName, QWidget *parent = 0); const QString &publicKeyFileName, QWidget *parent = nullptr);
void handleDeploymentFinished(const QString &errorMsg); void handleDeploymentFinished(const QString &errorMsg);
void handleDeploymentError(const QString &errorMsg); void handleDeploymentError(const QString &errorMsg);
void handleDeploymentSuccess(); void handleDeploymentSuccess();

View File

@@ -42,7 +42,7 @@ RemoteLinuxCheckForFreeDiskSpaceService::RemoteLinuxCheckForFreeDiskSpaceService
: AbstractRemoteLinuxDeployService(parent), : AbstractRemoteLinuxDeployService(parent),
d(new Internal::RemoteLinuxCheckForFreeDiskSpaceServicePrivate) d(new Internal::RemoteLinuxCheckForFreeDiskSpaceServicePrivate)
{ {
d->processRunner = 0; d->processRunner = nullptr;
d->requiredSpaceInBytes = 0; d->requiredSpaceInBytes = 0;
} }
@@ -97,13 +97,13 @@ void RemoteLinuxCheckForFreeDiskSpaceService::handleProcessFinished()
freeSpace /= 1024; // convert kilobyte to megabyte freeSpace /= 1024; // convert kilobyte to megabyte
if (freeSpace < requiredSpaceInMegaBytes) { if (freeSpace < requiredSpaceInMegaBytes) {
emit errorMessage(tr("The remote file system has only %n megabytes of free space, " emit errorMessage(tr("The remote file system has only %n megabytes of free space, "
"but %1 megabytes are required.", 0, freeSpace).arg(requiredSpaceInMegaBytes)); "but %1 megabytes are required.", nullptr, freeSpace).arg(requiredSpaceInMegaBytes));
stopDeployment(); stopDeployment();
return; return;
} }
emit progressMessage(tr("The remote file system has %n megabytes of free space, going ahead.", emit progressMessage(tr("The remote file system has %n megabytes of free space, going ahead.",
0, freeSpace)); nullptr, freeSpace));
stopDeployment(); stopDeployment();
} }
@@ -142,10 +142,10 @@ void RemoteLinuxCheckForFreeDiskSpaceService::stopDeployment()
void RemoteLinuxCheckForFreeDiskSpaceService::cleanup() void RemoteLinuxCheckForFreeDiskSpaceService::cleanup()
{ {
if (d->processRunner) { if (d->processRunner) {
disconnect(d->processRunner, 0, this, 0); disconnect(d->processRunner, nullptr, this, nullptr);
d->processRunner->cancel(); d->processRunner->cancel();
delete d->processRunner; delete d->processRunner;
d->processRunner = 0; d->processRunner = nullptr;
} }
} }

View File

@@ -34,8 +34,8 @@ class REMOTELINUX_EXPORT RemoteLinuxCheckForFreeDiskSpaceService : public Abstra
{ {
Q_OBJECT Q_OBJECT
public: public:
RemoteLinuxCheckForFreeDiskSpaceService(QObject *parent = 0); RemoteLinuxCheckForFreeDiskSpaceService(QObject *parent = nullptr);
~RemoteLinuxCheckForFreeDiskSpaceService(); ~RemoteLinuxCheckForFreeDiskSpaceService() override;
void setPathToCheck(const QString &path); void setPathToCheck(const QString &path);
void setRequiredSpaceInBytes(quint64 sizeInBytes); void setRequiredSpaceInBytes(quint64 sizeInBytes);
@@ -44,13 +44,13 @@ private:
void handleStdErr(); void handleStdErr();
void handleProcessFinished(); void handleProcessFinished();
bool isDeploymentNecessary() const { return true; } bool isDeploymentNecessary() const override { return true; }
void doDeviceSetup() { handleDeviceSetupDone(true); } void doDeviceSetup() override { handleDeviceSetupDone(true); }
void stopDeviceSetup() { handleDeviceSetupDone(false); } void stopDeviceSetup() override { handleDeviceSetupDone(false); }
bool isDeploymentPossible(QString *whyNot) const; bool isDeploymentPossible(QString *whyNot) const override;
void doDeploy(); void doDeploy() override;
void stopDeployment(); void stopDeployment() override;
void cleanup(); void cleanup();

View File

@@ -39,11 +39,9 @@ enum State { Inactive, Running };
class RemoteLinuxCustomCommandDeployservicePrivate class RemoteLinuxCustomCommandDeployservicePrivate
{ {
public: public:
RemoteLinuxCustomCommandDeployservicePrivate() : state(Inactive), runner(0) { }
QString commandLine; QString commandLine;
State state; State state = Inactive;
SshRemoteProcessRunner *runner; SshRemoteProcessRunner *runner = nullptr;
}; };
} // namespace Internal } // namespace Internal
@@ -105,7 +103,7 @@ void RemoteLinuxCustomCommandDeployService::stopDeployment()
{ {
QTC_ASSERT(d->state == Running, return); QTC_ASSERT(d->state == Running, return);
disconnect(d->runner, 0, this, 0); disconnect(d->runner, nullptr, this, nullptr);
d->runner->cancel(); d->runner->cancel();
d->state = Inactive; d->state = Inactive;
handleDeploymentDone(); handleDeploymentDone();

View File

@@ -35,19 +35,19 @@ class REMOTELINUX_EXPORT RemoteLinuxCustomCommandDeployService
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RemoteLinuxCustomCommandDeployService(QObject *parent = 0); explicit RemoteLinuxCustomCommandDeployService(QObject *parent = nullptr);
~RemoteLinuxCustomCommandDeployService(); ~RemoteLinuxCustomCommandDeployService() override;
void setCommandLine(const QString &commandLine); void setCommandLine(const QString &commandLine);
bool isDeploymentNecessary() const { return true; } bool isDeploymentNecessary() const override { return true; }
bool isDeploymentPossible(QString *whyNot = 0) const; bool isDeploymentPossible(QString *whyNot = nullptr) const override;
protected: protected:
void doDeviceSetup() { handleDeviceSetupDone(true); } void doDeviceSetup() override { handleDeviceSetupDone(true); }
void stopDeviceSetup() { handleDeviceSetupDone(false); } void stopDeviceSetup() override { handleDeviceSetupDone(false); }
void doDeploy(); void doDeploy() override;
void stopDeployment(); void stopDeployment() override;
private: private:
void handleStdout(); void handleStdout();

View File

@@ -43,7 +43,7 @@ public:
RemoteLinuxEnvironmentAspectWidget(RemoteLinuxEnvironmentAspect *aspect, RemoteLinuxEnvironmentAspectWidget(RemoteLinuxEnvironmentAspect *aspect,
ProjectExplorer::Target *target); ProjectExplorer::Target *target);
RemoteLinuxEnvironmentAspect *aspect() const; RemoteLinuxEnvironmentAspect *aspect() const override;
QPushButton *fetchButton() const; QPushButton *fetchButton() const;
private: private:

View File

@@ -37,10 +37,8 @@ namespace Internal {
RemoteLinuxEnvironmentReader::RemoteLinuxEnvironmentReader(const IDevice::ConstPtr &device, RemoteLinuxEnvironmentReader::RemoteLinuxEnvironmentReader(const IDevice::ConstPtr &device,
QObject *parent) QObject *parent)
: QObject(parent) : QObject(parent)
, m_stop(false)
, m_env(Utils::OsTypeLinux) , m_env(Utils::OsTypeLinux)
, m_device(device) , m_device(device)
, m_deviceProcess(0)
{ {
} }
@@ -127,7 +125,7 @@ void RemoteLinuxEnvironmentReader::destroyProcess()
if (m_deviceProcess->state() != QProcess::NotRunning) if (m_deviceProcess->state() != QProcess::NotRunning)
m_deviceProcess->terminate(); m_deviceProcess->terminate();
m_deviceProcess->deleteLater(); m_deviceProcess->deleteLater();
m_deviceProcess = 0; m_deviceProcess = nullptr;
} }
} // namespace Internal } // namespace Internal

View File

@@ -41,7 +41,7 @@ class RemoteLinuxEnvironmentReader : public QObject
public: public:
RemoteLinuxEnvironmentReader(const ProjectExplorer::IDevice::ConstPtr &device, RemoteLinuxEnvironmentReader(const ProjectExplorer::IDevice::ConstPtr &device,
QObject *parent = 0); QObject *parent = nullptr);
void start(); void start();
void stop(); void stop();
@@ -58,10 +58,10 @@ private:
void setFinished(); void setFinished();
void destroyProcess(); void destroyProcess();
bool m_stop; bool m_stop = false;
Utils::Environment m_env; Utils::Environment m_env;
ProjectExplorer::IDevice::ConstPtr m_device; ProjectExplorer::IDevice::ConstPtr m_device;
ProjectExplorer::DeviceProcess *m_deviceProcess; ProjectExplorer::DeviceProcess *m_deviceProcess = nullptr;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -37,12 +37,10 @@ namespace Internal {
class AbstractRemoteLinuxPackageInstallerPrivate class AbstractRemoteLinuxPackageInstallerPrivate
{ {
public: public:
AbstractRemoteLinuxPackageInstallerPrivate() : isRunning(false), installer(0), killProcess(0) {} bool isRunning = false;
bool isRunning;
IDevice::ConstPtr deviceConfig; IDevice::ConstPtr deviceConfig;
SshRemoteProcessRunner *installer; SshRemoteProcessRunner *installer = nullptr;
SshRemoteProcessRunner *killProcess; SshRemoteProcessRunner *killProcess = nullptr;
}; };
} // namespace Internal } // namespace Internal
@@ -127,7 +125,7 @@ void AbstractRemoteLinuxPackageInstaller::handleInstallerErrorOutput()
void AbstractRemoteLinuxPackageInstaller::setFinished() void AbstractRemoteLinuxPackageInstaller::setFinished()
{ {
disconnect(d->installer, 0, this, 0); disconnect(d->installer, nullptr, this, nullptr);
d->isRunning = false; d->isRunning = false;
} }

View File

@@ -38,7 +38,7 @@ class REMOTELINUX_EXPORT AbstractRemoteLinuxPackageInstaller : public QObject
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(AbstractRemoteLinuxPackageInstaller) Q_DISABLE_COPY(AbstractRemoteLinuxPackageInstaller)
public: public:
~AbstractRemoteLinuxPackageInstaller(); ~AbstractRemoteLinuxPackageInstaller() override;
void installPackage(const ProjectExplorer::IDevice::ConstPtr &deviceConfig, void installPackage(const ProjectExplorer::IDevice::ConstPtr &deviceConfig,
const QString &packageFilePath, bool removePackageFile); const QString &packageFilePath, bool removePackageFile);
@@ -50,7 +50,7 @@ signals:
void finished(const QString &errorMsg = QString()); void finished(const QString &errorMsg = QString());
protected: protected:
explicit AbstractRemoteLinuxPackageInstaller(QObject *parent = 0); explicit AbstractRemoteLinuxPackageInstaller(QObject *parent = nullptr);
private: private:
void handleConnectionError(); void handleConnectionError();
@@ -74,11 +74,11 @@ class REMOTELINUX_EXPORT RemoteLinuxTarPackageInstaller : public AbstractRemoteL
{ {
Q_OBJECT Q_OBJECT
public: public:
RemoteLinuxTarPackageInstaller(QObject *parent = 0); RemoteLinuxTarPackageInstaller(QObject *parent = nullptr);
private: private:
QString installCommandLine(const QString &packageFilePath) const; QString installCommandLine(const QString &packageFilePath) const override;
QString cancelInstallationCommandLine() const; QString cancelInstallationCommandLine() const override;
}; };

View File

@@ -34,9 +34,7 @@ using namespace ProjectExplorer;
RemoteLinuxSignalOperation::RemoteLinuxSignalOperation( RemoteLinuxSignalOperation::RemoteLinuxSignalOperation(
const QSsh::SshConnectionParameters &sshParameters) const QSsh::SshConnectionParameters &sshParameters)
: DeviceProcessSignalOperation() : m_sshParameters(sshParameters)
, m_sshParameters(sshParameters)
, m_runner(0)
{} {}
RemoteLinuxSignalOperation::~RemoteLinuxSignalOperation() RemoteLinuxSignalOperation::~RemoteLinuxSignalOperation()
@@ -68,7 +66,7 @@ void RemoteLinuxSignalOperation::run(const QString &command)
void RemoteLinuxSignalOperation::finish() void RemoteLinuxSignalOperation::finish()
{ {
delete m_runner; delete m_runner;
m_runner = 0; m_runner = nullptr;
emit finished(m_errorMessage); emit finished(m_errorMessage);
} }

View File

@@ -61,7 +61,7 @@ private:
void finish(); void finish();
const QSsh::SshConnectionParameters m_sshParameters; const QSsh::SshConnectionParameters m_sshParameters;
QSsh::SshRemoteProcessRunner *m_runner; QSsh::SshRemoteProcessRunner *m_runner = nullptr;
friend class LinuxDevice; friend class LinuxDevice;
}; };

View File

@@ -101,7 +101,7 @@ void SshKeyDeployer::stopDeployment()
void SshKeyDeployer::cleanup() void SshKeyDeployer::cleanup()
{ {
disconnect(&d->deployProcess, 0, this, 0); disconnect(&d->deployProcess, nullptr, this, nullptr);
} }
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -39,8 +39,8 @@ class REMOTELINUX_EXPORT SshKeyDeployer : public QObject
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(SshKeyDeployer) Q_DISABLE_COPY(SshKeyDeployer)
public: public:
explicit SshKeyDeployer(QObject *parent = 0); explicit SshKeyDeployer(QObject *parent = nullptr);
~SshKeyDeployer(); ~SshKeyDeployer() override;
void deployPublicKey(const QSsh::SshConnectionParameters &sshParams, void deployPublicKey(const QSsh::SshConnectionParameters &sshParams,
const QString &keyFilePath); const QString &keyFilePath);

View File

@@ -41,8 +41,8 @@ class TypeSpecificDeviceConfigurationListModel : public QAbstractListModel
public: public:
explicit TypeSpecificDeviceConfigurationListModel(ProjectExplorer::Target *target); explicit TypeSpecificDeviceConfigurationListModel(ProjectExplorer::Target *target);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
private: private:
int indexForId(Core::Id id) const; int indexForId(Core::Id id) const;

View File

@@ -39,10 +39,10 @@ class REMOTELINUX_EXPORT UploadAndInstallTarPackageService : public AbstractUplo
public: public:
explicit UploadAndInstallTarPackageService(QObject *parent); explicit UploadAndInstallTarPackageService(QObject *parent);
~UploadAndInstallTarPackageService(); ~UploadAndInstallTarPackageService() override;
private: private:
AbstractRemoteLinuxPackageInstaller *packageInstaller() const; AbstractRemoteLinuxPackageInstaller *packageInstaller() const override;
Internal::UploadAndInstallTarPackageServicePrivate *d; Internal::UploadAndInstallTarPackageServicePrivate *d;
}; };
@@ -55,7 +55,7 @@ class REMOTELINUX_EXPORT UploadAndInstallTarPackageStep : public AbstractRemoteL
public: public:
explicit UploadAndInstallTarPackageStep(ProjectExplorer::BuildStepList *bsl); explicit UploadAndInstallTarPackageStep(ProjectExplorer::BuildStepList *bsl);
bool initInternal(QString *error = 0) override; bool initInternal(QString *error = nullptr) override;
static Core::Id stepId(); static Core::Id stepId();
static QString displayName(); static QString displayName();