forked from qt-creator/qt-creator
ProjectExplorer: Move part of deploy config initial step handling
... to BuildStepList so it can be re-used in BuildConfiguration when attempting to set up a similar system to specify initial population of step lists. Change-Id: I2301feb2b67a80a9d9e526e4065b4d4487b7fdbd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -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<StepCreationInfo> &infos)
|
||||
{
|
||||
for (const StepCreationInfo &info : infos) {
|
||||
if (!info.condition || info.condition(target()))
|
||||
appendStep(info.stepId);
|
||||
}
|
||||
}
|
||||
|
||||
bool BuildStepList::removeStep(int position)
|
||||
{
|
||||
BuildStep *bs = at(position);
|
||||
|
@@ -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<bool(Target *)> condition; // unset counts as unrestricted
|
||||
};
|
||||
void appendSteps(const QList<StepCreationInfo> &infos);
|
||||
|
||||
bool removeStep(int position);
|
||||
void moveStepUp(int position);
|
||||
BuildStep *at(int position);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -102,15 +102,11 @@ protected:
|
||||
void setConfigBaseId(Core::Id deployConfigBaseId);
|
||||
|
||||
private:
|
||||
struct DeployStepCreationInfo {
|
||||
Core::Id deployStepId;
|
||||
std::function<bool(Target *)> condition; // unset counts as unrestricted
|
||||
};
|
||||
DeployConfiguration *createDeployConfiguration(Target *t);
|
||||
DeployConfiguration *createDeployConfiguration(Target *target);
|
||||
Core::Id m_deployConfigBaseId;
|
||||
Core::Id m_supportedProjectType;
|
||||
QList<Core::Id> m_supportedTargetDeviceTypes;
|
||||
QList<DeployStepCreationInfo> m_initialSteps;
|
||||
QList<BuildStepList::StepCreationInfo> m_initialSteps;
|
||||
QString m_defaultDisplayName;
|
||||
std::function<NamedWidget *(Target *)> m_configWidgetCreator;
|
||||
};
|
||||
|
Reference in New Issue
Block a user