diff --git a/src/plugins/projectexplorer/buildsteplist.cpp b/src/plugins/projectexplorer/buildsteplist.cpp index 40d4c3b9ac7..dab8d70311a 100644 --- a/src/plugins/projectexplorer/buildsteplist.cpp +++ b/src/plugins/projectexplorer/buildsteplist.cpp @@ -162,6 +162,14 @@ void BuildStepList::insertStep(int position, Core::Id stepId) QTC_ASSERT(false, qDebug() << "No factory for build step" << stepId.toString() << "found."); } +void BuildStepList::appendSteps(const QList &infos) +{ + for (const StepCreationInfo &info : infos) { + if (!info.condition || info.condition(target())) + appendStep(info.stepId); + } +} + bool BuildStepList::removeStep(int position) { BuildStep *bs = at(position); diff --git a/src/plugins/projectexplorer/buildsteplist.h b/src/plugins/projectexplorer/buildsteplist.h index 1c3ec4d4740..b9fce034dae 100644 --- a/src/plugins/projectexplorer/buildsteplist.h +++ b/src/plugins/projectexplorer/buildsteplist.h @@ -76,6 +76,13 @@ public: void insertStep(int position, Core::Id id); void appendStep(BuildStep *step) { insertStep(count(), step); } void appendStep(Core::Id stepId) { insertStep(count(), stepId); } + + struct StepCreationInfo { + Core::Id stepId; + std::function condition; // unset counts as unrestricted + }; + void appendSteps(const QList &infos); + bool removeStep(int position); void moveStepUp(int position); BuildStep *at(int position); diff --git a/src/plugins/projectexplorer/deployconfiguration.cpp b/src/plugins/projectexplorer/deployconfiguration.cpp index 83b793ff3b8..7619a06ca24 100644 --- a/src/plugins/projectexplorer/deployconfiguration.cpp +++ b/src/plugins/projectexplorer/deployconfiguration.cpp @@ -197,10 +197,7 @@ DeployConfiguration *DeployConfigurationFactory::create(Target *parent) QTC_ASSERT(canHandle(parent), return nullptr); DeployConfiguration *dc = createDeployConfiguration(parent); QTC_ASSERT(dc, return nullptr); - for (const DeployStepCreationInfo &info : qAsConst(m_initialSteps)) { - if (!info.condition || info.condition(parent)) - dc->stepList()->appendStep(info.deployStepId); - } + dc->stepList()->appendSteps(m_initialSteps); return dc; } diff --git a/src/plugins/projectexplorer/deployconfiguration.h b/src/plugins/projectexplorer/deployconfiguration.h index 3539d73cec7..1d9ff883383 100644 --- a/src/plugins/projectexplorer/deployconfiguration.h +++ b/src/plugins/projectexplorer/deployconfiguration.h @@ -102,15 +102,11 @@ protected: void setConfigBaseId(Core::Id deployConfigBaseId); private: - struct DeployStepCreationInfo { - Core::Id deployStepId; - std::function condition; // unset counts as unrestricted - }; - DeployConfiguration *createDeployConfiguration(Target *t); + DeployConfiguration *createDeployConfiguration(Target *target); Core::Id m_deployConfigBaseId; Core::Id m_supportedProjectType; QList m_supportedTargetDeviceTypes; - QList m_initialSteps; + QList m_initialSteps; QString m_defaultDisplayName; std::function m_configWidgetCreator; };