diff --git a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp index acce8bf29b6..84e3b274084 100644 --- a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp @@ -4,6 +4,7 @@ #include "devicecheckbuildstep.h" #include "../kitinformation.h" +#include "../projectexplorerconstants.h" #include "../projectexplorertr.h" #include "devicemanager.h" @@ -12,60 +13,61 @@ #include -using namespace ProjectExplorer; +namespace ProjectExplorer { -DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl, Utils::Id id) - : BuildStep(bsl, id) +class DeviceCheckBuildStep : public BuildStep { - setWidgetExpandedByDefault(false); -} - -bool DeviceCheckBuildStep::init() -{ - IDevice::ConstPtr device = DeviceKitAspect::device(kit()); - if (!device) { - Utils::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(kit()); - IDeviceFactory *factory = IDeviceFactory::find(deviceTypeId); - if (!factory || !factory->canCreate()) { - emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage); - return false; - } - - QMessageBox msgBox(QMessageBox::Question, Tr::tr("Set Up Device"), - Tr::tr("There is no device set up for this kit. Do you want to add a device?"), - QMessageBox::Yes|QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::Yes); - if (msgBox.exec() == QMessageBox::No) { - emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage); - return false; - } - - IDevice::Ptr newDevice = factory->create(); - if (newDevice.isNull()) { - emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage); - return false; - } - - DeviceManager *dm = DeviceManager::instance(); - dm->addDevice(newDevice); - - DeviceKitAspect::setDevice(kit(), newDevice); +public: + DeviceCheckBuildStep(BuildStepList *bsl, Utils::Id id) + : BuildStep(bsl, id) + { + setWidgetExpandedByDefault(false); } - return true; + bool init() override + { + IDevice::ConstPtr device = DeviceKitAspect::device(kit()); + if (!device) { + Utils::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(kit()); + IDeviceFactory *factory = IDeviceFactory::find(deviceTypeId); + if (!factory || !factory->canCreate()) { + emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage); + return false; + } + + QMessageBox msgBox(QMessageBox::Question, Tr::tr("Set Up Device"), + Tr::tr("There is no device set up for this kit. Do you want to add a device?"), + QMessageBox::Yes|QMessageBox::No); + msgBox.setDefaultButton(QMessageBox::Yes); + if (msgBox.exec() == QMessageBox::No) { + emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage); + return false; + } + + IDevice::Ptr newDevice = factory->create(); + if (newDevice.isNull()) { + emit addOutput(Tr::tr("No device configured."), BuildStep::OutputFormat::ErrorMessage); + return false; + } + + DeviceManager *dm = DeviceManager::instance(); + dm->addDevice(newDevice); + + DeviceKitAspect::setDevice(kit(), newDevice); + } + + return true; + } + + void doRun() override { emit finished(true); } +}; + +// Factory + +DeviceCheckBuildStepFactory::DeviceCheckBuildStepFactory() +{ + registerStep(Constants::DEVICE_CHECK_STEP); + setDisplayName(Tr::tr("Check for a configured device")); } -void DeviceCheckBuildStep::doRun() -{ - emit finished(true); -} - -Utils::Id DeviceCheckBuildStep::stepId() -{ - return "ProjectExplorer.DeviceCheckBuildStep"; -} - -QString DeviceCheckBuildStep::displayName() -{ - return Tr::tr("Check for a configured device"); -} +} // ProjectExplorer diff --git a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.h b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.h index 8b7d3687b0f..6b7a8edb11b 100644 --- a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.h +++ b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.h @@ -8,18 +8,10 @@ namespace ProjectExplorer { -class PROJECTEXPLORER_EXPORT DeviceCheckBuildStep : public BuildStep +class PROJECTEXPLORER_EXPORT DeviceCheckBuildStepFactory : public BuildStepFactory { - Q_OBJECT - public: - DeviceCheckBuildStep(BuildStepList *bsl, Utils::Id id); - - bool init() override; - void doRun() override; - - static Utils::Id stepId(); - static QString displayName(); + DeviceCheckBuildStepFactory(); }; -} // namespace ProjectExplorer +} // ProjectExplorer diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index f612b9adb08..005981e697d 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -134,6 +134,7 @@ const char BUILDSTEPS_DEPLOY[] = "ProjectExplorer.BuildSteps.Deploy"; const char COPY_FILE_STEP[] = "ProjectExplorer.CopyFileStep"; const char COPY_DIRECTORY_STEP[] = "ProjectExplorer.CopyDirectoryStep"; +const char DEVICE_CHECK_STEP[] = "ProjectExplorer.DeviceCheckBuildStep"; // Language diff --git a/src/plugins/qnx/qnxconstants.h b/src/plugins/qnx/qnxconstants.h index b70db8c87e1..3b8bdd26996 100644 --- a/src/plugins/qnx/qnxconstants.h +++ b/src/plugins/qnx/qnxconstants.h @@ -15,5 +15,6 @@ const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type. const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain"; const char QNX_TMP_DIR[] = "/tmp"; // /var/run is root:root drwxr-xr-x +const char QNX_DIRECT_UPLOAD_STEP_ID[] ="Qnx.DirectUploadStep"; } // Qnx::Constants diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp index 5796668f8ae..7a06effc144 100644 --- a/src/plugins/qnx/qnxplugin.cpp +++ b/src/plugins/qnx/qnxplugin.cpp @@ -43,21 +43,22 @@ using namespace ProjectExplorer; namespace Qnx::Internal { -class QnxUploadStep : public RemoteLinux::GenericDirectUploadStep +// FIXME: Remove... +class QnxUploadStepFactory : public RemoteLinux::GenericDirectUploadStepFactory { public: - QnxUploadStep(BuildStepList *bsl, Utils::Id id) : GenericDirectUploadStep(bsl, id) {} - static Utils::Id stepId() { return "Qnx.DirectUploadStep"; } + QnxUploadStepFactory() + { + registerStep(Constants::QNX_DIRECT_UPLOAD_STEP_ID); + } }; -template -class GenericQnxDeployStepFactory : public BuildStepFactory +template +class QnxDeployStepFactory : public RemoteLinux::MakeInstallStepFactory { public: - GenericQnxDeployStepFactory() + QnxDeployStepFactory() { - registerStep(Step::stepId()); - setDisplayName(Step::displayName()); setSupportedConfiguration(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); } @@ -78,8 +79,8 @@ public: return prj->deploymentKnowledge() == DeploymentKnowledge::Bad && prj->hasMakeInstallEquivalent(); }); - addInitialStep(DeviceCheckBuildStep::stepId()); - addInitialStep(QnxUploadStep::stepId()); + addInitialStep(ProjectExplorer::Constants::DEVICE_CHECK_STEP); + addInitialStep(Constants::QNX_DIRECT_UPLOAD_STEP_ID); } }; @@ -95,9 +96,9 @@ public: QnxQtVersionFactory qtVersionFactory; QnxDeviceFactory deviceFactory; QnxDeployConfigurationFactory deployConfigFactory; - GenericQnxDeployStepFactory directUploadDeployFactory; - GenericQnxDeployStepFactory makeInstallDeployFactory; - GenericQnxDeployStepFactory checkBuildDeployFactory; + QnxDeployStepFactory directUploadDeployFactory; + QnxDeployStepFactory makeInstallDeployFactory; + QnxDeployStepFactory checkBuildDeployFactory; QnxRunConfigurationFactory runConfigFactory; QnxSettingsPage settingsPage; QnxToolChainFactory toolChainFactory; diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp index 8345f76e6d7..7a39b05af45 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.cpp +++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp @@ -322,16 +322,6 @@ GenericDirectUploadStep::~GenericDirectUploadStep() delete d; } -Utils::Id GenericDirectUploadStep::stepId() -{ - return Constants::DirectUploadStepId; -} - -QString GenericDirectUploadStep::displayName() -{ - return Tr::tr("Upload files via SFTP"); -} - // Factory GenericDirectUploadStepFactory::GenericDirectUploadStepFactory() @@ -340,4 +330,4 @@ GenericDirectUploadStepFactory::GenericDirectUploadStepFactory() setDisplayName(Tr::tr("Upload files via SFTP")); } -} //namespace RemoteLinux +} // RemoteLinux diff --git a/src/plugins/remotelinux/genericdirectuploadstep.h b/src/plugins/remotelinux/genericdirectuploadstep.h index 048be324a89..49b9f3b5004 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.h +++ b/src/plugins/remotelinux/genericdirectuploadstep.h @@ -20,9 +20,6 @@ public: bool isDeploymentNecessary() const final; Utils::Tasking::Group deployRecipe() final; - static Utils::Id stepId(); - static QString displayName(); - private: friend class GenericDirectUploadStepPrivate; class GenericDirectUploadStepPrivate *d; diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index 73a30b27e3f..b3af1fb873d 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -34,16 +34,14 @@ using namespace Utils; namespace RemoteLinux { namespace Internal { -template -class GenericDeployStepFactory : public ProjectExplorer::BuildStepFactory +template +class RemoteLinuxDeployStepFactory : public Factory { public: - GenericDeployStepFactory() + RemoteLinuxDeployStepFactory() { - registerStep(Step::stepId()); - setDisplayName(Step::displayName()); - setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux); - setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); + Factory::setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux); + Factory::setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); } }; @@ -56,11 +54,11 @@ public: RemoteLinuxDeployConfigurationFactory deployConfigurationFactory; TarPackageCreationStepFactory tarPackageCreationStepFactory; TarPackageDeployStepFactory tarPackageDeployStepFactory; - GenericDeployStepFactory genericDirectUploadStepFactory; - GenericDeployStepFactory rsyncDeployStepFactory; + RemoteLinuxDeployStepFactory genericDirectUploadStepFactory; + RemoteLinuxDeployStepFactory rsyncDeployStepFactory; CustomCommandDeployStepFactory customCommandDeployStepFactory; KillAppStepFactory killAppStepFactory; - GenericDeployStepFactory makeInstallStepFactory; + RemoteLinuxDeployStepFactory makeInstallStepFactory; RemoteLinuxRunWorkerFactory runWorkerFactory; RemoteLinuxDebugWorkerFactory debugWorkerFactory; RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory;