forked from qt-creator/qt-creator
ProjectExplorer: Create initial project tree
Create an initial project tree with a ProjectNode and a FileNode for the project file itself. Fix the Projects to not implement their own tree before they have better data. Change-Id: I147ccd5603d22d1d60880a97f30fd8c271eac88c Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -80,14 +80,10 @@ CMakeProject::CMakeProject(const FileName &fileName)
|
||||
setDocument(new TextEditor::TextDocument);
|
||||
document()->setFilePath(fileName);
|
||||
|
||||
setRootProjectNode(new CMakeListsNode(fileName));
|
||||
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
|
||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
|
||||
rootProjectNode()->setDisplayName(fileName.parentDir().fileName());
|
||||
|
||||
connect(this, &CMakeProject::activeTargetChanged, this, &CMakeProject::handleActiveTargetChanged);
|
||||
|
||||
connect(&m_treeScanner, &TreeScanner::finished, this, &CMakeProject::handleTreeScanningFinished);
|
||||
|
||||
m_treeScanner.setFilter([this](const Utils::MimeType &mimeType, const Utils::FileName &fn) {
|
||||
@@ -306,6 +302,8 @@ bool CMakeProject::hasBuildTarget(const QString &title) const
|
||||
|
||||
QString CMakeProject::displayName() const
|
||||
{
|
||||
if (!rootProjectNode())
|
||||
return projectDirectory().fileName();
|
||||
return rootProjectNode()->displayName();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user