aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp
diff options
context:
space:
mode:
authorMarco Bubke <[email protected]>2023-03-30 13:14:17 +0200
committerThomas Hartmann <[email protected]>2023-04-19 13:58:22 +0000
commit6035ff939d636c9027d87f95f9b70096dfc04d7e (patch)
treea88e1ae1080325465ed30172091b313bd7414234 /src/plugins/qmldesigner/qmldesignerprojectmanager.cpp
parent79b5a9f03e01712613581e630e51a5143fd9f647 (diff)
QmlDesigner: Add module scanner
For performance reason we want to get the qml modules directly from the file system. When the project storage is finished we can get the modules from there. Task-number: QDS-9542 Change-Id: I26d4b028fbf5ebc541fcd8e34d285ded1fb14935 Reviewed-by: <[email protected]> Reviewed-by: Thomas Hartmann <[email protected]>
Diffstat (limited to 'src/plugins/qmldesigner/qmldesignerprojectmanager.cpp')
-rw-r--r--src/plugins/qmldesigner/qmldesignerprojectmanager.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp
index e6a02fecab7..67144a813b4 100644
--- a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp
+++ b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp
@@ -342,7 +342,7 @@ void projectQmldirPaths(::ProjectExplorer::Target *target, QStringList &qmldirPa
qmldirPaths.push_back(QDir::cleanPath(pojectDirectory.absoluteFilePath(importPath))
+ "/qmldir");
}
-#ifdef QDS_HAS_QMLDOM
+#ifdef QDS_HAS_QMLPRIVATE
bool skipPath(const std::filesystem::path &path)
{
auto directory = path.filename();
@@ -359,25 +359,27 @@ bool skipPath(const std::filesystem::path &path)
}
#endif
-void qtQmldirPaths([[maybe_unused]] ::ProjectExplorer::Target *target,
- [[maybe_unused]] QStringList &qmldirPaths)
+void qtQmldirPaths(::ProjectExplorer::Target *target, QStringList &qmldirPaths)
{
-#ifdef QDS_HAS_QMLDOM
- const QString installDirectory = qmlPath(target).toString();
+#ifdef QDS_HAS_QMLPRIVATE
- const std::filesystem::path installDirectoryPath{installDirectory.toStdString()};
+ if (useProjectStorage()) {
+ const QString installDirectory = qmlPath(target).toString();
- auto current = std::filesystem::recursive_directory_iterator{installDirectoryPath};
- auto end = std::filesystem::end(current);
- for (; current != end; ++current) {
- const auto &entry = *current;
- auto path = entry.path();
- if (current.depth() < 3 && !current->is_regular_file() && skipPath(path)) {
- current.disable_recursion_pending();
- continue;
- }
- if (path.filename() == "qmldir") {
- qmldirPaths.push_back(QString::fromStdU16String(path.generic_u16string()));
+ const std::filesystem::path installDirectoryPath{installDirectory.toStdString()};
+
+ auto current = std::filesystem::recursive_directory_iterator{installDirectoryPath};
+ auto end = std::filesystem::end(current);
+ for (; current != end; ++current) {
+ const auto &entry = *current;
+ auto path = entry.path();
+ if (current.depth() < 3 && !current->is_regular_file() && skipPath(path)) {
+ current.disable_recursion_pending();
+ continue;
+ }
+ if (path.filename() == "qmldir") {
+ qmldirPaths.push_back(QString::fromStdU16String(path.generic_u16string()));
+ }
}
}
#endif