summaryrefslogtreecommitdiff
path: root/src/plugins/qmldesigner
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2023-03-20 18:53:18 +0100
committerMarco Bubke <marco.bubke@qt.io>2023-03-28 09:18:30 +0000
commit492c2f89c4398fe59196ffcaa4234d9a7c3bd2bf (patch)
tree2f085d6ace21756e3bbf03bccf0acb124ad627fc /src/plugins/qmldesigner
parent77720c1122aed6525ab2c4902cadb8518435cbb8 (diff)
downloadqt-creator-492c2f89c4398fe59196ffcaa4234d9a7c3bd2bf.tar.gz
QmlDesigner: Cleanup code for reuse
Task-number: QDS-9479 Change-Id: If8c66444e7b85255aa2f66519ab74572d3800979 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner')
-rw-r--r--src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.cpp23
-rw-r--r--src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h7
2 files changed, 8 insertions, 22 deletions
diff --git a/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.cpp b/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.cpp
index dcd1168c36..e82590493c 100644
--- a/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.cpp
+++ b/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.cpp
@@ -342,7 +342,6 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
package,
notUpdatedFileStatusSourceIds,
notUpdatedSourceIds,
- directoryPath,
watchedQmlSourceIds,
watchedQmltypesSourceIds);
break;
@@ -408,7 +407,6 @@ void ProjectStorageUpdater::parseProjectDatas(const Storage::Synchronization::Pr
Storage::Synchronization::SynchronizationPackage &package,
SourceIds &notUpdatedFileStatusSourceIds,
SourceIds &notUpdatedSourceIds,
- Utils::SmallStringView directoryPath,
SourceIds &watchedQmlSourceIds,
SourceIds &watchedQmltypesSourceIds)
{
@@ -428,13 +426,7 @@ void ProjectStorageUpdater::parseProjectDatas(const Storage::Synchronization::Pr
case Storage::Synchronization::FileType::QmlDocument: {
watchedQmlSourceIds.push_back(projectData.sourceId);
- SourcePath qmlDocumentPath = m_pathCache.sourcePath(projectData.sourceId);
- parseQmlComponent(qmlDocumentPath.name(),
- qmlDocumentPath,
- directoryPath,
- projectData.sourceId,
- package,
- notUpdatedFileStatusSourceIds);
+ parseQmlComponent(projectData.sourceId, package, notUpdatedFileStatusSourceIds);
}
};
}
@@ -530,10 +522,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
package.types.push_back(std::move(type));
}
-void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView fileName,
- Utils::SmallStringView filePath,
- Utils::SmallStringView directoryPath,
- SourceId sourceId,
+void ProjectStorageUpdater::parseQmlComponent(SourceId sourceId,
Storage::Synchronization::SynchronizationPackage &package,
SourceIds &notUpdatedFileStatusSourceIds)
{
@@ -546,12 +535,12 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView fileName,
package.updatedSourceIds.push_back(sourceId);
- SourcePath sourcePath{filePath};
+ SourcePath sourcePath = m_pathCache.sourcePath(sourceId);
- const auto content = m_fileSystem.contentAsQString(QString{filePath});
- auto type = m_qmlDocumentParser.parse(content, package.imports, sourceId, directoryPath);
+ const auto content = m_fileSystem.contentAsQString(QString{sourcePath});
+ auto type = m_qmlDocumentParser.parse(content, package.imports, sourceId, sourcePath.directory());
- type.typeName = fileName;
+ type.typeName = sourcePath.name();
type.traits = Storage::TypeTraits::Reference;
type.sourceId = sourceId;
type.changeLevel = Storage::Synchronization::ChangeLevel::ExcludeExportedTypes;
diff --git a/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h b/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h
index 82ce8892f4..b81cc834d2 100644
--- a/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h
+++ b/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h
@@ -9,6 +9,7 @@
#include "projectstoragepathwatchernotifierinterface.h"
#include "projectstoragepathwatchertypes.h"
#include "projectstoragetypes.h"
+#include "sourcepath.h"
#include <qmljs/parser/qmldirparser_p.h>
@@ -124,7 +125,6 @@ private:
Storage::Synchronization::SynchronizationPackage &package,
SourceIds &notUpdatedFileStatusSourceIds,
SourceIds &notUpdatedSourceIds,
- Utils::SmallStringView directoryPath,
SourceIds &watchedQmlSourceIds,
SourceIds &watchedQmltypesSourceIds);
FileState parseTypeInfo(const Storage::Synchronization::ProjectData &projectData,
@@ -149,10 +149,7 @@ private:
SourceIds &notUpdatedSourceIds,
SourceIds &watchedQmlSourceIds,
FileState qmldirState);
- void parseQmlComponent(Utils::SmallStringView fileName,
- Utils::SmallStringView filePath,
- Utils::SmallStringView directoryPath,
- SourceId sourceId,
+ void parseQmlComponent(SourceId sourceId,
Storage::Synchronization::SynchronizationPackage &package,
SourceIds &notUpdatedFileStatusSourceIds);