ProjectExplorer: Use visitor-by-lambda for project tree

And inline it into user code. Less code in total and no intermediate
node lists.

Change-Id: I3724883408bfaa868266110aee27bbffd4d96bd8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
hjk
2017-03-06 18:03:43 +01:00
parent 05e8f34d3e
commit d6df4492d0
15 changed files with 55 additions and 321 deletions

View File

@@ -31,12 +31,12 @@
#include "todoitemsmodel.h"
#include "todoitemsscanner.h"
#include <projectexplorer/nodesvisitor.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/idocument.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/projecttree.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/idocument.h>
#include <projectexplorer/session.h>
#include <QTimer>
@@ -148,13 +148,13 @@ void TodoItemsProvider::setItemsListWithinSubproject()
if (node) {
ProjectNode *projectNode = node->parentProjectNode();
if (projectNode) {
FindAllFilesVisitor filesVisitor;
projectNode->accept(&filesVisitor);
// FIXME: The name doesn't match the implementation that lists all files.
QSet<Utils::FileName> subprojectFileNames;
projectNode->forEachGenericNode([&](Node *node) {
subprojectFileNames.insert(node->filePath());
});
// files must be both in the current subproject and the startup-project.
QSet<Utils::FileName> subprojectFileNames =
QSet<Utils::FileName>::fromList(filesVisitor.filePaths());
QSet<QString> fileNames = QSet<QString>::fromList(
m_startupProject->files(ProjectExplorer::Project::SourceFiles));
QHashIterator<QString, QList<TodoItem> > it(m_itemsHash);