forked from qt-creator/qt-creator
ProjectExplorer: Unify (sub-) project error reporting
Change-Id: I8916d3aa8e915700717faf62b4a55ce84183221f Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -2738,6 +2738,28 @@ static bool hasBuildSettings(const Project *pro)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QPair<bool, QString> subprojectEnabledState(const Project *pro)
|
||||||
|
{
|
||||||
|
QPair<bool, QString> result;
|
||||||
|
result.first = true;
|
||||||
|
|
||||||
|
const QList<Project *> &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<br>")
|
||||||
|
.arg(project->displayName(),
|
||||||
|
project->activeTarget()->activeBuildConfiguration()->disabledReason());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
QPair<bool, QString> ProjectExplorerPluginPrivate::buildSettingsEnabled(const Project *pro)
|
QPair<bool, QString> ProjectExplorerPluginPrivate::buildSettingsEnabled(const Project *pro)
|
||||||
{
|
{
|
||||||
QPair<bool, QString> result;
|
QPair<bool, QString> result;
|
||||||
@@ -2755,18 +2777,7 @@ QPair<bool, QString> ProjectExplorerPluginPrivate::buildSettingsEnabled(const Pr
|
|||||||
result.first = false;
|
result.first = false;
|
||||||
result.second = tr("Project has no build settings.");
|
result.second = tr("Project has no build settings.");
|
||||||
} else {
|
} else {
|
||||||
const QList<Project *> & projects = SessionManager::projectOrder(pro);
|
result = subprojectEnabledState(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<br>")
|
|
||||||
.arg(project->displayName(),
|
|
||||||
project->activeTarget()->activeBuildConfiguration()->disabledReason());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -2785,18 +2796,7 @@ QPair<bool, QString> ProjectExplorerPluginPrivate::buildSettingsEnabledForSessio
|
|||||||
result.first = false;
|
result.first = false;
|
||||||
result.second = tr("Project has no build settings.");
|
result.second = tr("Project has no build settings.");
|
||||||
} else {
|
} else {
|
||||||
foreach (Project *project, SessionManager::projectOrder(nullptr)) {
|
result = subprojectEnabledState(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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user