ProjectExplorer: Remove hack for virtual folders

Previously virtual folders, that is the "Sources", "Headers" folders used a
hack. This patch removes that hack, by introducing the following changes
- The FlatModel and the ProjectExplorer::Nodes now don't require path() to
  be unique. Thus allowing the virtual folders to all return the same for
  path(). [1]

- Introducing a new node type "VirtualFolder" which is sorted according to
  a priority.

- Introducing a few new virtuals for displayName and toolip(), which can
  be overriden.

[1] Note that all the project managers do require path() to be unique for
some types of nodes.

That also fixes:
Task-number: QTCREATORBUG-7100

Change-Id: I76b730f4c4254e2894467603bbe9a30e356a0bcc
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Daniel Teske
2012-05-04 11:49:37 +02:00
parent 3b4c6c0332
commit e8ee898864
7 changed files with 247 additions and 109 deletions

View File

@@ -376,13 +376,18 @@ void CMakeProject::gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<Pr
list.append(file);
}
bool sortNodesByPath(Node *a, Node *b)
{
return a->path() < b->path();
}
void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> newList)
{
// Gather old list
QList<ProjectExplorer::FileNode *> oldList;
gatherFileNodes(rootNode, oldList);
qSort(oldList.begin(), oldList.end(), ProjectExplorer::ProjectNode::sortNodesByPath);
qSort(newList.begin(), newList.end(), ProjectExplorer::ProjectNode::sortNodesByPath);
qSort(oldList.begin(), oldList.end(), sortNodesByPath);
qSort(newList.begin(), newList.end(), sortNodesByPath);
// generate added and deleted list
QList<ProjectExplorer::FileNode *>::const_iterator oldIt = oldList.constBegin();