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);
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
setRepeatable(false);
setDisplayName(tr("Deploy to Android device or emulator"));
setDisplayName(AndroidDeployQtStep::tr("Deploy to Android device or emulator"));
}
// AndroidDeployQtStep

View File

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

View File

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

View File

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

View File

@@ -56,7 +56,7 @@ const char AUTOGEN_STEP_ID[] = "AutotoolsProjectManager.AutogenStep";
AutogenStepFactory::AutogenStepFactory()
{
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);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}

View File

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

View File

@@ -55,7 +55,7 @@ const char AUTORECONF_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.Auto
AutoreconfStepFactory::AutoreconfStepFactory()
{
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);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}

View File

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

View File

@@ -70,7 +70,7 @@ static QString projectDirRelativeToBuildDir(BuildConfiguration *bc) {
ConfigureStepFactory::ConfigureStepFactory()
{
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);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}

View File

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

View File

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

View File

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

View File

@@ -555,7 +555,7 @@ QString CMakeBuildStepConfigWidget::summaryText() const
CMakeBuildStepFactory::CMakeBuildStepFactory()
{
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);
}

View File

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

View File

@@ -36,7 +36,7 @@ namespace Internal {
IosDeployStepFactory::IosDeployStepFactory()
{
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);
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
setRepeatable(false);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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