Project: Unify handling of displayName

Unify the handling of displayName with a proper changed signal across
all projects.

Change-Id: I7e503528854b85f6f38de4b0943775f82a0d6123
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Tobias Hunger
2017-04-07 14:35:49 +02:00
parent 28c8da4f90
commit 0951589420
19 changed files with 31 additions and 63 deletions

View File

@@ -79,6 +79,7 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM
setId(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
setDisplayName(projectDirectory().fileName());
connect(this, &CMakeProject::activeTargetChanged, this, &CMakeProject::handleActiveTargetChanged);
connect(&m_treeScanner, &TreeScanner::finished, this, &CMakeProject::handleTreeScanningFinished);
@@ -145,8 +146,10 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
Kit *k = t->kit();
auto newRoot = bc->generateProjectTree(m_allFiles);
if (newRoot)
if (newRoot) {
setRootProjectNode(newRoot);
setDisplayName(newRoot->displayName());
}
updateApplicationAndDeploymentTargets();
updateTargetRunConfigurations(t);
@@ -296,12 +299,6 @@ bool CMakeProject::hasBuildTarget(const QString &title) const
return anyOf(buildTargets(), [title](const CMakeBuildTarget &ct) { return ct.title == title; });
}
QString CMakeProject::displayName() const
{
auto root = dynamic_cast<CMakeProjectNode *>(rootProjectNode());
return root ? root->displayName() : projectDirectory().fileName();
}
Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
{
RestoreResult result = Project::fromMap(map, errorMessage);