From 092ee20418c0f4428e49b6fa1cd7228719aa6c38 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 11 Feb 2020 14:14:58 +0100 Subject: [PATCH] ProjectExplorer: Unify (sub-) project error reporting Change-Id: I8916d3aa8e915700717faf62b4a55ce84183221f Reviewed-by: hjk --- .../projectexplorer/projectexplorer.cpp | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index b8d25f61229..959f80f93e1 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -2738,6 +2738,28 @@ static bool hasBuildSettings(const Project *pro) }); } +static QPair subprojectEnabledState(const Project *pro) +{ + QPair result; + result.first = true; + + const QList &projects = SessionManager::projectOrder(pro); + foreach (Project *project, projects) { + if (project && project->activeTarget() + && project->activeTarget()->activeBuildConfiguration() + && !project->activeTarget()->activeBuildConfiguration()->isEnabled()) { + result.first = false; + result.second + += QCoreApplication::translate("ProjectExplorerPluginPrivate", + "Building \"%1\" is disabled: %2
") + .arg(project->displayName(), + project->activeTarget()->activeBuildConfiguration()->disabledReason()); + } + } + + return result; +} + QPair ProjectExplorerPluginPrivate::buildSettingsEnabled(const Project *pro) { QPair result; @@ -2755,18 +2777,7 @@ QPair ProjectExplorerPluginPrivate::buildSettingsEnabled(const Pr result.first = false; result.second = tr("Project has no build settings."); } else { - const QList & projects = SessionManager::projectOrder(pro); - foreach (Project *project, projects) { - if (project - && project->activeTarget() - && project->activeTarget()->activeBuildConfiguration() - && !project->activeTarget()->activeBuildConfiguration()->isEnabled()) { - result.first = false; - result.second += tr("Building \"%1\" is disabled: %2
") - .arg(project->displayName(), - project->activeTarget()->activeBuildConfiguration()->disabledReason()); - } - } + result = subprojectEnabledState(pro); } return result; } @@ -2785,18 +2796,7 @@ QPair ProjectExplorerPluginPrivate::buildSettingsEnabledForSessio result.first = false; result.second = tr("Project has no build settings."); } else { - foreach (Project *project, SessionManager::projectOrder(nullptr)) { - if (project - && project->activeTarget() - && project->activeTarget()->activeBuildConfiguration() - && !project->activeTarget()->activeBuildConfiguration()->isEnabled()) { - result.first = false; - result.second += tr("Building \"%1\" is disabled: %2") - .arg(project->displayName(), - project->activeTarget()->activeBuildConfiguration()->disabledReason()); - result.second += QLatin1Char('\n'); - } - } + result = subprojectEnabledState(nullptr); } return result; }