diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index bb15ed1ee4c..c0aa4e162e7 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -75,7 +75,7 @@ public: RemoteLinuxCustomRunConfigurationFactory customRunConfigurationFactory; RemoteLinuxDeployConfigurationFactory deployConfigurationFactory; GenericDeployStepFactory tarPackageCreationStepFactory; - GenericDeployStepFactory tarPackageDeployStepFactory; + TarPackageDeployStepFactory tarPackageDeployStepFactory; GenericDeployStepFactory genericDirectUploadStepFactory; GenericDeployStepFactory rsyncDeployStepFactory; GenericDeployStepFactory customCommandDeployStepFactory; diff --git a/src/plugins/remotelinux/tarpackagedeploystep.cpp b/src/plugins/remotelinux/tarpackagedeploystep.cpp index db8fdec076d..99d78099fea 100644 --- a/src/plugins/remotelinux/tarpackagedeploystep.cpp +++ b/src/plugins/remotelinux/tarpackagedeploystep.cpp @@ -26,18 +26,18 @@ #include "tarpackagedeploystep.h" #include "abstractremotelinuxdeployservice.h" +#include "abstractremotelinuxdeploystep.h" #include "remotelinux_constants.h" #include "tarpackagecreationstep.h" #include #include #include +#include #include #include -#include - using namespace ProjectExplorer; using namespace Utils; @@ -49,10 +49,11 @@ class TarPackageInstaller : public QObject Q_OBJECT public: - TarPackageInstaller(QObject *parent = nullptr); + TarPackageInstaller(); - void installPackage(const ProjectExplorer::IDeviceConstPtr &deviceConfig, - const QString &packageFilePath, bool removePackageFile); + void installPackage(const IDeviceConstPtr &deviceConfig, + const QString &packageFilePath, + bool removePackageFile); void cancelInstallation(); signals: @@ -66,8 +67,7 @@ private: QtcProcess m_killer; }; -TarPackageInstaller::TarPackageInstaller(QObject *parent) - : QObject(parent) +TarPackageInstaller::TarPackageInstaller() { connect(&m_installer, &QtcProcess::readyReadStandardOutput, this, [this] { emit stdoutData(QString::fromUtf8(m_installer.readAllStandardOutput())); @@ -230,44 +230,50 @@ void TarPackageDeployService::setFinished() handleDeploymentDone(); } -} // namespace Internal +// TarPackageDeployStep -using namespace Internal; - -TarPackageDeployStep::TarPackageDeployStep(BuildStepList *bsl, Id id) - : AbstractRemoteLinuxDeployStep(bsl, id) +class TarPackageDeployStep : public AbstractRemoteLinuxDeployStep { - auto service = createDeployService(); + Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::TarPackageDeployStep) - setWidgetExpandedByDefault(false); +public: + TarPackageDeployStep(BuildStepList *bsl, Id id) + : AbstractRemoteLinuxDeployStep(bsl, id) + { + auto service = createDeployService(); - setInternalInitializer([this, service] { - const TarPackageCreationStep *pStep = nullptr; + setWidgetExpandedByDefault(false); - for (BuildStep *step : deployConfiguration()->stepList()->steps()) { - if (step == this) - break; - if ((pStep = qobject_cast(step))) - break; - } - if (!pStep) - return CheckResult::failure(tr("No tarball creation step found.")); + setInternalInitializer([this, service] { + const TarPackageCreationStep *pStep = nullptr; - service->setPackageFilePath(pStep->packageFilePath()); - return service->isDeploymentPossible(); - }); + for (BuildStep *step : deployConfiguration()->stepList()->steps()) { + if (step == this) + break; + if ((pStep = qobject_cast(step))) + break; + } + if (!pStep) + return CheckResult::failure(tr("No tarball creation step found.")); + + service->setPackageFilePath(pStep->packageFilePath()); + return service->isDeploymentPossible(); + }); + } +}; + + +// TarPackageDeployStepFactory + +TarPackageDeployStepFactory::TarPackageDeployStepFactory() +{ + registerStep(Constants::TarPackageDeployStepId); + setDisplayName(TarPackageDeployStep::tr("Deploy tarball via SFTP upload")); + setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux); + setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); } -Id TarPackageDeployStep::stepId() -{ - return Constants::TarPackageDeployStepId; -} - -QString TarPackageDeployStep::displayName() -{ - return tr("Deploy tarball via SFTP upload"); -} - -} //namespace RemoteLinux +} // Internal +} // RemoteLinux #include "tarpackagedeploystep.moc" diff --git a/src/plugins/remotelinux/tarpackagedeploystep.h b/src/plugins/remotelinux/tarpackagedeploystep.h index e1113bebcbc..716fbb7876b 100644 --- a/src/plugins/remotelinux/tarpackagedeploystep.h +++ b/src/plugins/remotelinux/tarpackagedeploystep.h @@ -25,19 +25,16 @@ #pragma once -#include "abstractremotelinuxdeploystep.h" +#include namespace RemoteLinux { +namespace Internal { -class TarPackageDeployStep : public AbstractRemoteLinuxDeployStep +class TarPackageDeployStepFactory : public ProjectExplorer::BuildStepFactory { - Q_OBJECT - public: - TarPackageDeployStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id); - - static Utils::Id stepId(); - static QString displayName(); + TarPackageDeployStepFactory(); }; -} //namespace RemoteLinux +} // Internal +} // RemoteLinux