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:
Tobias Hunger
2017-03-03 17:10:00 +01:00
parent 2fde3fffa9
commit 49fef0ae24
15 changed files with 35 additions and 47 deletions

View File

@@ -56,12 +56,9 @@ const int MIN_TIME_BETWEEN_PROJECT_SCANS = 4500;
NimProject::NimProject(const FileName &fileName)
{
setId(Constants::C_NIMPROJECT_ID);
setDocument(new TextEditor::TextDocument);
document()->setFilePath(fileName);
QFileInfo fi = fileName.toFileInfo();
QDir dir = fi.dir();
setRootProjectNode(new NimProjectNode(*this, FileName::fromString(dir.absolutePath())));
rootProjectNode()->setDisplayName(dir.dirName());
auto doc = new TextEditor::TextDocument;
doc->setFilePath(fileName);
setDocument(doc);
m_projectScanTimer.setSingleShot(true);
connect(&m_projectScanTimer, &QTimer::timeout, this, &NimProject::collectProjectFiles);
@@ -73,7 +70,7 @@ NimProject::NimProject(const FileName &fileName)
QString NimProject::displayName() const
{
return rootProjectNode()->displayName();
return projectFilePath().toFileInfo().completeBaseName();
}
QStringList NimProject::files(FilesMode) const