forked from qt-creator/qt-creator
Avoid expanding QRC nodes in main thread
For CMake and Qbs projects and users of TreeScanner, where the tree is already created in a separate thread. Expanding the QRC nodes means reading and parsing the QRC files, which can take up a considerable time (second(s)) if there are hundreds of them in a larger project like Qt Creator. Task-number: QTCREATORBUG-25783 Change-Id: I5ca818b9f75ea6e8ef23f837cc9e15df7e6630e1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <projectexplorer/projecttree.h>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
@@ -708,6 +710,7 @@ FileApiQtcData extractData(FileApiData &input,
|
||||
result.projectParts = generateRawProjectParts(data, sourceDirectory);
|
||||
|
||||
auto pair = generateRootProjectNode(data, sourceDirectory, buildDirectory);
|
||||
ProjectTree::applyTreeManager(pair.first.get()); // QRC nodes
|
||||
result.rootProjectNode = std::move(pair.first);
|
||||
result.knownHeaders = std::move(pair.second);
|
||||
|
||||
|
@@ -391,6 +391,11 @@ void ProjectTree::highlightProject(Project *project, const QString &message)
|
||||
projectTreeWidget->showMessage(project->rootProjectNode(), message);
|
||||
}
|
||||
|
||||
/*!
|
||||
Registers the function \a treeChange to be run on a (sub tree of the)
|
||||
project tree when it is created. The function must be thread-safe, and
|
||||
applying the function on the same tree a second time must be a no-op.
|
||||
*/
|
||||
void ProjectTree::registerTreeManager(const TreeManagerFunction &treeChange)
|
||||
{
|
||||
if (treeChange)
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "projectnodeshelper.h"
|
||||
#include "projecttree.h"
|
||||
|
||||
#include <coreplugin/iversioncontrol.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
@@ -158,6 +159,7 @@ static std::unique_ptr<FolderNode> createFolderNode(const Utils::FilePath &direc
|
||||
std::unique_ptr<FileNode> node(fn->clone());
|
||||
fileSystemNode->addNestedNode(std::move(node));
|
||||
}
|
||||
ProjectTree::applyTreeManager(fileSystemNode.get()); // QRC nodes
|
||||
return fileSystemNode;
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,8 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <projectexplorer/projecttree.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
@@ -230,6 +232,7 @@ QbsProjectNode *QbsNodeTreeBuilder::buildTree(const QString &projectName,
|
||||
}
|
||||
buildSystemFiles->compress();
|
||||
root->addNode(std::move(buildSystemFiles));
|
||||
ProjectTree::applyTreeManager(root.get()); // QRC nodes
|
||||
return root.release();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user