ProjectExplorer: Add some more functions to buildsteplist

Use those functions instead of repeating code all over the place.

Change-Id: I03161663b4d5c538fb2ea667353ab7846373ad81
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2016-04-19 12:36:11 +02:00
parent 385237dbbd
commit f32a1b1e4c
10 changed files with 45 additions and 60 deletions

View File

@@ -42,18 +42,13 @@ public:
template<class T> static T *buildStep(const ProjectExplorer::BuildConfiguration *dc)
{
if (!dc)
return 0;
return nullptr;
foreach (const Core::Id &id, dc->knownStepLists()) {
ProjectExplorer::BuildStepList *bsl = dc->stepList(id);
if (!bsl)
return 0;
const QList<ProjectExplorer::BuildStep *> &buildSteps = bsl->steps();
for (int i = buildSteps.count() - 1; i >= 0; --i) {
if (T * const step = qobject_cast<T *>(buildSteps.at(i)))
return step;
}
T *const step = dc->stepList(id)->firstOfType<T>();
if (step)
return step;
}
return 0;
return nullptr;
}
template<typename State> static void assertState(State expected,