forked from qt-creator/qt-creator
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:
@@ -84,29 +84,20 @@ QList<Core::LocatorFilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<
|
||||
void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const
|
||||
{
|
||||
// Get the project containing the target selected
|
||||
CMakeProject *cmakeProject = 0;
|
||||
CMakeProject *cmakeProject = nullptr;
|
||||
|
||||
foreach (Project *p, SessionManager::projects()) {
|
||||
cmakeProject = qobject_cast<CMakeProject *>(p);
|
||||
if (cmakeProject && cmakeProject->projectFilePath().toString() == selection.internalData.toString())
|
||||
break;
|
||||
cmakeProject = 0;
|
||||
}
|
||||
if (!cmakeProject)
|
||||
return;
|
||||
|
||||
if (!cmakeProject->activeTarget())
|
||||
return;
|
||||
|
||||
if (!cmakeProject->activeTarget()->activeBuildConfiguration())
|
||||
if (!cmakeProject || !cmakeProject->activeTarget() || !cmakeProject->activeTarget()->activeBuildConfiguration())
|
||||
return;
|
||||
|
||||
// Find the make step
|
||||
ProjectExplorer::BuildStepList *buildStepList = cmakeProject->activeTarget()->activeBuildConfiguration()
|
||||
->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
auto buildStep
|
||||
= qobject_cast<CMakeBuildStep *>(findOrDefault(buildStepList->steps(),
|
||||
[](BuildStep *s) -> bool { return qobject_cast<CMakeBuildStep *>(s); }));
|
||||
auto buildStep = buildStepList->firstOfType<CMakeBuildStep>();
|
||||
if (!buildStep)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user