From 6fd2efab6b9e1d798816b635d19047fd8f54284f Mon Sep 17 00:00:00 2001 From: Burak Hancerli Date: Fri, 21 Mar 2025 08:50:56 +0100 Subject: [PATCH] QmlDesigner: Pass filestatuscache as a ref Change-Id: Ie5fcb1e59beaf7befd430396834e34237f91b886 Reviewed-by: Marco Bubke --- .../qmldesigner/components/componentcore/bundlehelper.cpp | 2 ++ .../projectstorage/projectstoragepathwatcher.h | 8 +++----- .../qmldesigner/project/qmldesignerprojectmanager.cpp | 5 +++-- .../projectstorage/projectstoragepathwatcher-test.cpp | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plugins/qmldesigner/components/componentcore/bundlehelper.cpp b/src/plugins/qmldesigner/components/componentcore/bundlehelper.cpp index 7fef634f2f8..bb8031a8855 100644 --- a/src/plugins/qmldesigner/components/componentcore/bundlehelper.cpp +++ b/src/plugins/qmldesigner/components/componentcore/bundlehelper.cpp @@ -608,6 +608,7 @@ bool BundleHelper::isItemBundle(const QString &bundleId) const || bundleId == compUtils.user3DBundleId(); } +#ifndef QDS_USE_PROJECTSTORAGE namespace { Utils::FilePath getComponentFilePath(const QString &nodeType, const Utils::FilePath &compDir) @@ -664,6 +665,7 @@ Utils::FilePath getComponentFilePath(const QString &nodeType, const Utils::FileP } } // namespace +#endif QSet BundleHelper::getComponentDependencies(const Utils::FilePath &filePath, const Utils::FilePath &mainCompDir) const diff --git a/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstoragepathwatcher.h b/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstoragepathwatcher.h index 9648455c951..8fe2ba60e0a 100644 --- a/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstoragepathwatcher.h +++ b/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstoragepathwatcher.h @@ -38,10 +38,9 @@ class ProjectStoragePathWatcher : public ProjectStoragePathWatcherInterface { public: ProjectStoragePathWatcher(SourcePathCache &pathCache, - FileSystemInterface &fileSystem, + FileStatusCache &fileStatusCache, ProjectStoragePathWatcherNotifierInterface *notifier = nullptr) - : m_fileStatusCache(fileSystem) - , m_fileSystem(fileSystem) + : m_fileStatusCache(fileStatusCache) , m_pathCache(pathCache) , m_notifier(notifier) { @@ -390,8 +389,7 @@ public: private: WatcherEntries m_watchedEntries; FileSystemWatcher m_fileSystemWatcher; - FileStatusCache m_fileStatusCache; - FileSystemInterface &m_fileSystem; + FileStatusCache &m_fileStatusCache; SourcePathCache &m_pathCache; ProjectStoragePathWatcherNotifierInterface *m_notifier; DirectoryPathCompressor m_directoryPathCompressor; diff --git a/src/plugins/qmldesigner/project/qmldesignerprojectmanager.cpp b/src/plugins/qmldesigner/project/qmldesignerprojectmanager.cpp index 45e1d811af4..1ddc3eca2c9 100644 --- a/src/plugins/qmldesigner/project/qmldesignerprojectmanager.cpp +++ b/src/plugins/qmldesigner/project/qmldesignerprojectmanager.cpp @@ -210,8 +210,9 @@ public: projectStorageJournalMode()} , errorNotifier{pathCache} , fileSystem{pathCache} + , fileStatusCache(fileSystem) , qmlDocumentParser{storage, pathCache} - , pathWatcher{pathCache, fileSystem, &updater} + , pathWatcher{pathCache, fileStatusCache, &updater} , projectPartId{ProjectPartId::create( pathCache.sourceContextId(Utils::PathString{project->projectDirectory().path()}) .internalId())} @@ -232,7 +233,7 @@ public: ProjectStorageErrorNotifier errorNotifier; ProjectStorage storage{database, errorNotifier, database.isInitialized()}; FileSystem fileSystem; - FileStatusCache fileStatusCache{fileSystem}; + FileStatusCache fileStatusCache; QmlDocumentParser qmlDocumentParser; QmlTypesParser qmlTypesParser{storage}; ProjectStoragePathWatcher pathWatcher; diff --git a/tests/unit/tests/unittests/projectstorage/projectstoragepathwatcher-test.cpp b/tests/unit/tests/unittests/projectstorage/projectstoragepathwatcher-test.cpp index 879c3ce3ee0..ac591b8c909 100644 --- a/tests/unit/tests/unittests/projectstorage/projectstoragepathwatcher-test.cpp +++ b/tests/unit/tests/unittests/projectstorage/projectstoragepathwatcher-test.cpp @@ -84,7 +84,8 @@ protected: Sqlite::Database &database = staticData->database; QmlDesigner::ProjectStorage &storage = staticData->storage; SourcePathCache pathCache{staticData->sourcePathStorage}; - Watcher watcher{pathCache, mockFileSystem, ¬ifier}; + QmlDesigner::FileStatusCache fileStatusCache{mockFileSystem}; + Watcher watcher{pathCache, fileStatusCache, ¬ifier}; NiceMock &mockQFileSytemWatcher = watcher.fileSystemWatcher(); ProjectChunkId projectChunkId1{ProjectPartId::create(2), SourceType::Qml}; ProjectChunkId projectChunkId2{ProjectPartId::create(2), SourceType::QmlUi};