Commit 4f47a8d7 authored by hjk's avatar hjk

ProjectExplorer: Remove FolderNode::projectNodes()

Merged into the using code now.

Change-Id: I4b39998799dde530ab48c504ac2a389d72705c4f
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 151ae22b
......@@ -218,10 +218,11 @@ void FlatModel::rebuildModel()
QSet<Node *> seen;
rootItem()->removeChildren();
const QList<ProjectNode *> projectNodes = SessionManager::sessionNode()->projectNodes();
for (ProjectNode *projectNode : projectNodes) {
if (!seen.contains(projectNode))
addProjectNode(rootItem(), projectNode, &seen);
for (Node *node : SessionManager::sessionNode()->nodes()) {
if (ProjectNode *projectNode = node->asProjectNode()) {
if (!seen.contains(projectNode))
addProjectNode(rootItem(), projectNode, &seen);
}
}
rootItem()->sortChildren(&sortWrapperNodes);
......@@ -284,10 +285,11 @@ void FlatModel::addProjectNode(WrapperNode *parent, ProjectNode *projectNode, QS
auto node = new WrapperNode(projectNode);
parent->appendChild(node);
addFolderNode(node, projectNode, seen);
const QList<ProjectNode *> subProjectNodes = projectNode->projectNodes();
for (ProjectNode *subProjectNode : subProjectNodes) {
if (!seen->contains(subProjectNode))
addProjectNode(node, subProjectNode, seen);
for (Node *subNode : projectNode->nodes()) {
if (ProjectNode *subProjectNode = subNode->asProjectNode()) {
if (!seen->contains(subProjectNode))
addProjectNode(node, subProjectNode, seen);
}
}
node->sortChildren(&sortWrapperNodes);
}
......
......@@ -764,16 +764,6 @@ ProjectNode *ProjectNode::projectNode(const Utils::FileName &file) const
return nullptr;
}
QList<ProjectNode*> FolderNode::projectNodes() const
{
QList<ProjectNode *> nodes;
for (Node *node : m_nodes) {
if (ProjectNode *pnode = node->asProjectNode())
nodes.append(pnode);
}
return nodes;
}
bool FolderNode::isEmpty() const
{
return m_nodes.isEmpty();
......
......@@ -242,9 +242,6 @@ public:
void addNode(Node *node);
void removeNode(Node *node);
// all subFolders that are projects
QList<ProjectNode*> projectNodes() const;
void makeEmpty();
bool isEmpty() const;
......
......@@ -293,10 +293,11 @@ static inline AddNewTree *buildAddFilesTree(SessionNode *root, const QStringList
Node *contextNode, BestNodeSelector *selector)
{
QList<AddNewTree *> children;
foreach (ProjectNode *pn, root->projectNodes()) {
AddNewTree *child = buildAddFilesTree(pn, files, contextNode, selector);
if (child)
children.append(child);
for (Node *node : root->nodes()) {
if (ProjectNode *pn = node->asProjectNode()) {
if (AddNewTree *child = buildAddFilesTree(pn, files, contextNode, selector))
children.append(child);
}
}
children.prepend(createNoneNode(selector));
return new AddNewTree(root, children, root->displayName());
......
......@@ -202,10 +202,11 @@ QmakeProFileNode *QmakeProFileNode::findProFileFor(const FileName &fileName) con
{
if (fileName == filePath())
return const_cast<QmakeProFileNode *>(this);
foreach (ProjectNode *pn, projectNodes())
if (QmakeProFileNode *qmakeProFileNode = dynamic_cast<QmakeProFileNode *>(pn))
for (Node *node : nodes()) {
if (QmakeProFileNode *qmakeProFileNode = dynamic_cast<QmakeProFileNode *>(node))
if (QmakeProFileNode *result = qmakeProFileNode->findProFileFor(fileName))
return result;
}
return nullptr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment