ProjectExplorer: Simplify BuildStepFactory

De-QObject-ify class, tr contexts are now the product's
context, which was the case in some BuildStepFactories already,
and is current state in {Run,DeployConfiguration}Factory.
One spurious object name removed.

De-virtualize canHandle(), it was never overloaded and is not
intended to be overloaded anymore.

Remove unused clone() function.

Change-Id: Iff7fba5f707505f868f94458084a18650535fa23
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2018-05-14 17:50:56 +02:00
parent 4feb2259d9
commit f44e73b858
32 changed files with 20 additions and 51 deletions

View File

@@ -77,7 +77,7 @@ AndroidDeployQtStepFactory::AndroidDeployQtStepFactory()
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE); setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
setRepeatable(false); setRepeatable(false);
setDisplayName(tr("Deploy to Android device or emulator")); setDisplayName(AndroidDeployQtStep::tr("Deploy to Android device or emulator"));
} }
// AndroidDeployQtStep // AndroidDeployQtStep

View File

@@ -43,7 +43,6 @@ namespace Internal {
class AndroidDeployQtStepFactory : public ProjectExplorer::BuildStepFactory class AndroidDeployQtStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
AndroidDeployQtStepFactory(); AndroidDeployQtStepFactory();
}; };

View File

@@ -155,7 +155,7 @@ AndroidPackageInstallationFactory::AndroidPackageInstallationFactory()
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setSupportedDeviceType(Android::Constants::ANDROID_DEVICE_TYPE); setSupportedDeviceType(Android::Constants::ANDROID_DEVICE_TYPE);
setRepeatable(false); setRepeatable(false);
setDisplayName(tr("Deploy to device")); setDisplayName(AndroidPackageInstallationStep::tr("Deploy to device"));
} }
} // namespace Internal } // namespace Internal

View File

@@ -68,8 +68,6 @@ private:
class AndroidPackageInstallationFactory: public ProjectExplorer::BuildStepFactory class AndroidPackageInstallationFactory: public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
AndroidPackageInstallationFactory(); AndroidPackageInstallationFactory();
}; };

View File

@@ -56,7 +56,7 @@ const char AUTOGEN_STEP_ID[] = "AutotoolsProjectManager.AutogenStep";
AutogenStepFactory::AutogenStepFactory() AutogenStepFactory::AutogenStepFactory()
{ {
registerStep<AutogenStep>(AUTOGEN_STEP_ID); registerStep<AutogenStep>(AUTOGEN_STEP_ID);
setDisplayName(tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id.")); setDisplayName(AutogenStep::tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID); setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
} }

View File

@@ -50,8 +50,6 @@ class AutogenStepConfigWidget;
*/ */
class AutogenStepFactory : public ProjectExplorer::BuildStepFactory class AutogenStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
AutogenStepFactory(); AutogenStepFactory();
}; };

View File

@@ -55,7 +55,7 @@ const char AUTORECONF_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.Auto
AutoreconfStepFactory::AutoreconfStepFactory() AutoreconfStepFactory::AutoreconfStepFactory()
{ {
registerStep<AutoreconfStep>(AUTORECONF_STEP_ID); registerStep<AutoreconfStep>(AUTORECONF_STEP_ID);
setDisplayName(tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id.")); setDisplayName(AutoreconfStep::tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID); setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
} }

View File

@@ -49,8 +49,6 @@ class AutoreconfStep;
*/ */
class AutoreconfStepFactory : public ProjectExplorer::BuildStepFactory class AutoreconfStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
AutoreconfStepFactory(); AutoreconfStepFactory();
}; };

View File

@@ -70,7 +70,7 @@ static QString projectDirRelativeToBuildDir(BuildConfiguration *bc) {
ConfigureStepFactory::ConfigureStepFactory() ConfigureStepFactory::ConfigureStepFactory()
{ {
registerStep<ConfigureStep>(CONFIGURE_STEP_ID); registerStep<ConfigureStep>(CONFIGURE_STEP_ID);
setDisplayName(tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id.")); setDisplayName(ConfigureStep::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID); setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
} }

View File

@@ -49,8 +49,6 @@ class ConfigureStepConfigWidget;
*/ */
class ConfigureStepFactory : public ProjectExplorer::BuildStepFactory class ConfigureStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
ConfigureStepFactory(); ConfigureStepFactory();
}; };

View File

@@ -56,7 +56,6 @@ MakeStepFactory::MakeStepFactory()
} }
}; };
setObjectName("Autotools::MakeStepFactory");
registerStep<Step>(MAKE_STEP_ID); registerStep<Step>(MAKE_STEP_ID);
setDisplayName(ProjectExplorer::MakeStep::defaultDisplayName()); setDisplayName(ProjectExplorer::MakeStep::defaultDisplayName());
setSupportedProjectType(AUTOTOOLS_PROJECT_ID); setSupportedProjectType(AUTOTOOLS_PROJECT_ID);

View File

@@ -37,8 +37,6 @@ namespace Internal {
/////////////////////////// ///////////////////////////
class MakeStepFactory : public ProjectExplorer::BuildStepFactory class MakeStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
MakeStepFactory(); MakeStepFactory();
}; };

View File

@@ -555,7 +555,7 @@ QString CMakeBuildStepConfigWidget::summaryText() const
CMakeBuildStepFactory::CMakeBuildStepFactory() CMakeBuildStepFactory::CMakeBuildStepFactory()
{ {
registerStep<CMakeBuildStep>(Constants::CMAKE_BUILD_STEP_ID); registerStep<CMakeBuildStep>(Constants::CMAKE_BUILD_STEP_ID);
setDisplayName(tr("Build", "Display name for CMakeProjectManager::CMakeBuildStep id.")); setDisplayName(CMakeBuildStep::tr("Build", "Display name for CMakeProjectManager::CMakeBuildStep id."));
setSupportedProjectType(Constants::CMAKEPROJECT_ID); setSupportedProjectType(Constants::CMAKEPROJECT_ID);
} }

View File

@@ -138,8 +138,6 @@ private:
class CMakeBuildStepFactory : public ProjectExplorer::BuildStepFactory class CMakeBuildStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
CMakeBuildStepFactory(); CMakeBuildStepFactory();
}; };

View File

@@ -36,7 +36,7 @@ namespace Internal {
IosDeployStepFactory::IosDeployStepFactory() IosDeployStepFactory::IosDeployStepFactory()
{ {
registerStep<IosDeployStep>(IosDeployStep::Id); registerStep<IosDeployStep>(IosDeployStep::Id);
setDisplayName(tr("Deploy to iOS device or emulator")); setDisplayName(IosDeployStep::tr("Deploy to iOS device or emulator"));
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE}); setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
setRepeatable(false); setRepeatable(false);

View File

@@ -32,8 +32,6 @@ namespace Internal {
class IosDeployStepFactory : public ProjectExplorer::BuildStepFactory class IosDeployStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
IosDeployStepFactory(); IosDeployStepFactory();
}; };

View File

@@ -90,7 +90,6 @@ private:
class IosDsymBuildStepFactory : public ProjectExplorer::BuildStepFactory class IosDsymBuildStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
explicit IosDsymBuildStepFactory(); explicit IosDsymBuildStepFactory();
}; };

View File

@@ -290,7 +290,7 @@ void NimCompilerBuildStep::updateTargetNimFile()
NimCompilerBuildStepFactory::NimCompilerBuildStepFactory() NimCompilerBuildStepFactory::NimCompilerBuildStepFactory()
{ {
registerStep<NimCompilerBuildStep>(Constants::C_NIMCOMPILERBUILDSTEP_ID); registerStep<NimCompilerBuildStep>(Constants::C_NIMCOMPILERBUILDSTEP_ID);
setDisplayName(tr("Nim Compiler Build Step")); setDisplayName(NimCompilerBuildStep::tr("Nim Compiler Build Step"));
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID); setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
setRepeatable(false); setRepeatable(false);

View File

@@ -117,7 +117,7 @@ NimCompilerCleanStepFactory::NimCompilerCleanStepFactory()
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID); setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
setRepeatable(false); setRepeatable(false);
setDisplayName(tr(Nim::Constants::C_NIMCOMPILERCLEANSTEP_DISPLAY)); setDisplayName(NimCompilerCleanStep::tr(Nim::Constants::C_NIMCOMPILERCLEANSTEP_DISPLAY));
} }
} // Nim } // Nim

View File

@@ -118,13 +118,11 @@ public:
BuildStepCreator creator; BuildStepCreator creator;
}; };
class PROJECTEXPLORER_EXPORT BuildStepFactory : public QObject class PROJECTEXPLORER_EXPORT BuildStepFactory
{ {
Q_OBJECT
public: public:
BuildStepFactory(); BuildStepFactory();
~BuildStepFactory() override; virtual ~BuildStepFactory();
static const QList<BuildStepFactory *> allBuildStepFactories(); static const QList<BuildStepFactory *> allBuildStepFactories();
@@ -133,9 +131,12 @@ public:
BuildStep *create(BuildStepList *parent, Core::Id id); BuildStep *create(BuildStepList *parent, Core::Id id);
BuildStep *restore(BuildStepList *parent, const QVariantMap &map); BuildStep *restore(BuildStepList *parent, const QVariantMap &map);
virtual bool canHandle(BuildStepList *bsl) const; bool canHandle(BuildStepList *bsl) const;
protected: protected:
BuildStepFactory(const BuildStepFactory &) = delete;
BuildStepFactory &operator=(const BuildStepFactory &) = delete;
using BuildStepCreator = std::function<BuildStep *(BuildStepList *)>; using BuildStepCreator = std::function<BuildStep *(BuildStepList *)>;
template <class BuildStepType> template <class BuildStepType>

View File

@@ -33,8 +33,6 @@ namespace Internal {
class ProcessStepFactory : public BuildStepFactory class ProcessStepFactory : public BuildStepFactory
{ {
Q_OBJECT
public: public:
ProcessStepFactory(); ProcessStepFactory();
}; };

View File

@@ -832,7 +832,7 @@ bool QbsBuildStepConfigWidget::validateProperties(Utils::FancyLineEdit *edit, QS
QbsBuildStepFactory::QbsBuildStepFactory() QbsBuildStepFactory::QbsBuildStepFactory()
{ {
registerStep<QbsBuildStep>(Constants::QBS_BUILDSTEP_ID); registerStep<QbsBuildStep>(Constants::QBS_BUILDSTEP_ID);
setDisplayName(tr("Qbs Build")); setDisplayName(QbsBuildStep::tr("Qbs Build"));
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setSupportedConfiguration(Constants::QBS_BC_ID); setSupportedConfiguration(Constants::QBS_BC_ID);
setSupportedProjectType(Constants::PROJECT_ID); setSupportedProjectType(Constants::PROJECT_ID);

View File

@@ -143,8 +143,6 @@ private:
class QbsBuildStepFactory : public ProjectExplorer::BuildStepFactory class QbsBuildStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
QbsBuildStepFactory(); QbsBuildStepFactory();
}; };

View File

@@ -295,7 +295,7 @@ QbsCleanStepFactory::QbsCleanStepFactory()
registerStep<QbsCleanStep>(Constants::QBS_CLEANSTEP_ID); registerStep<QbsCleanStep>(Constants::QBS_CLEANSTEP_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
setSupportedConfiguration(Constants::QBS_BC_ID); setSupportedConfiguration(Constants::QBS_BC_ID);
setDisplayName(tr("Qbs Clean")); setDisplayName(QbsCleanStep::tr("Qbs Clean"));
} }
} // namespace Internal } // namespace Internal

View File

@@ -114,8 +114,6 @@ private:
class QbsCleanStepFactory : public ProjectExplorer::BuildStepFactory class QbsCleanStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
QbsCleanStepFactory(); QbsCleanStepFactory();
}; };

View File

@@ -338,7 +338,7 @@ QbsInstallStepFactory::QbsInstallStepFactory()
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); setSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
setSupportedProjectType(Constants::PROJECT_ID); setSupportedProjectType(Constants::PROJECT_ID);
setDisplayName(tr("Qbs Install")); setDisplayName(QbsInstallStep::tr("Qbs Install"));
} }
} // namespace Internal } // namespace Internal

View File

@@ -119,8 +119,6 @@ private:
class QbsInstallStepFactory : public ProjectExplorer::BuildStepFactory class QbsInstallStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
QbsInstallStepFactory(); QbsInstallStepFactory();
}; };

View File

@@ -59,7 +59,7 @@ QmakeAndroidBuildApkStepFactory::QmakeAndroidBuildApkStepFactory()
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE); setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setDisplayName(tr("Build Android APK")); setDisplayName(QmakeAndroidBuildApkStep::tr("Build Android APK"));
setRepeatable(false); setRepeatable(false);
} }

View File

@@ -33,8 +33,6 @@ namespace Internal {
class QmakeAndroidBuildApkStepFactory : public ProjectExplorer::BuildStepFactory class QmakeAndroidBuildApkStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
QmakeAndroidBuildApkStepFactory(); QmakeAndroidBuildApkStepFactory();
}; };

View File

@@ -37,8 +37,6 @@ namespace Internal {
class QmakeMakeStepFactory : public ProjectExplorer::BuildStepFactory class QmakeMakeStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
QmakeMakeStepFactory(); QmakeMakeStepFactory();
}; };

View File

@@ -860,7 +860,7 @@ QMakeStepFactory::QMakeStepFactory()
registerStep<QMakeStep>(QMAKE_BS_ID); registerStep<QMakeStep>(QMAKE_BS_ID);
setSupportedConfiguration(Constants::QMAKE_BC_ID); setSupportedConfiguration(Constants::QMAKE_BC_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setDisplayName(tr("qmake")); setDisplayName(QMakeStep::tr("qmake"));
setFlags(BuildStepInfo::UniqueStep); setFlags(BuildStepInfo::UniqueStep);
} }

View File

@@ -44,7 +44,6 @@ namespace QtSupport { class BaseQtVersion; }
namespace QmakeProjectManager { namespace QmakeProjectManager {
class QmakeBuildConfiguration; class QmakeBuildConfiguration;
class QmakeProject;
namespace Internal { namespace Internal {
@@ -52,8 +51,6 @@ namespace Ui { class QMakeStep; }
class QMakeStepFactory : public ProjectExplorer::BuildStepFactory class QMakeStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
QMakeStepFactory(); QMakeStepFactory();
}; };