QmlDesigner: Pass filestatuscache as a ref

Change-Id: Ie5fcb1e59beaf7befd430396834e34237f91b886
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Burak Hancerli
2025-03-21 08:50:56 +01:00
parent a070328c89
commit 6fd2efab6b
4 changed files with 10 additions and 8 deletions

View File

@@ -608,6 +608,7 @@ bool BundleHelper::isItemBundle(const QString &bundleId) const
|| bundleId == compUtils.user3DBundleId(); || bundleId == compUtils.user3DBundleId();
} }
#ifndef QDS_USE_PROJECTSTORAGE
namespace { namespace {
Utils::FilePath getComponentFilePath(const QString &nodeType, const Utils::FilePath &compDir) Utils::FilePath getComponentFilePath(const QString &nodeType, const Utils::FilePath &compDir)
@@ -664,6 +665,7 @@ Utils::FilePath getComponentFilePath(const QString &nodeType, const Utils::FileP
} }
} // namespace } // namespace
#endif
QSet<AssetPath> BundleHelper::getComponentDependencies(const Utils::FilePath &filePath, QSet<AssetPath> BundleHelper::getComponentDependencies(const Utils::FilePath &filePath,
const Utils::FilePath &mainCompDir) const const Utils::FilePath &mainCompDir) const

View File

@@ -38,10 +38,9 @@ class ProjectStoragePathWatcher : public ProjectStoragePathWatcherInterface
{ {
public: public:
ProjectStoragePathWatcher(SourcePathCache &pathCache, ProjectStoragePathWatcher(SourcePathCache &pathCache,
FileSystemInterface &fileSystem, FileStatusCache &fileStatusCache,
ProjectStoragePathWatcherNotifierInterface *notifier = nullptr) ProjectStoragePathWatcherNotifierInterface *notifier = nullptr)
: m_fileStatusCache(fileSystem) : m_fileStatusCache(fileStatusCache)
, m_fileSystem(fileSystem)
, m_pathCache(pathCache) , m_pathCache(pathCache)
, m_notifier(notifier) , m_notifier(notifier)
{ {
@@ -390,8 +389,7 @@ public:
private: private:
WatcherEntries m_watchedEntries; WatcherEntries m_watchedEntries;
FileSystemWatcher m_fileSystemWatcher; FileSystemWatcher m_fileSystemWatcher;
FileStatusCache m_fileStatusCache; FileStatusCache &m_fileStatusCache;
FileSystemInterface &m_fileSystem;
SourcePathCache &m_pathCache; SourcePathCache &m_pathCache;
ProjectStoragePathWatcherNotifierInterface *m_notifier; ProjectStoragePathWatcherNotifierInterface *m_notifier;
DirectoryPathCompressor<Timer> m_directoryPathCompressor; DirectoryPathCompressor<Timer> m_directoryPathCompressor;

View File

@@ -210,8 +210,9 @@ public:
projectStorageJournalMode()} projectStorageJournalMode()}
, errorNotifier{pathCache} , errorNotifier{pathCache}
, fileSystem{pathCache} , fileSystem{pathCache}
, fileStatusCache(fileSystem)
, qmlDocumentParser{storage, pathCache} , qmlDocumentParser{storage, pathCache}
, pathWatcher{pathCache, fileSystem, &updater} , pathWatcher{pathCache, fileStatusCache, &updater}
, projectPartId{ProjectPartId::create( , projectPartId{ProjectPartId::create(
pathCache.sourceContextId(Utils::PathString{project->projectDirectory().path()}) pathCache.sourceContextId(Utils::PathString{project->projectDirectory().path()})
.internalId())} .internalId())}
@@ -232,7 +233,7 @@ public:
ProjectStorageErrorNotifier errorNotifier; ProjectStorageErrorNotifier errorNotifier;
ProjectStorage storage{database, errorNotifier, database.isInitialized()}; ProjectStorage storage{database, errorNotifier, database.isInitialized()};
FileSystem fileSystem; FileSystem fileSystem;
FileStatusCache fileStatusCache{fileSystem}; FileStatusCache fileStatusCache;
QmlDocumentParser qmlDocumentParser; QmlDocumentParser qmlDocumentParser;
QmlTypesParser qmlTypesParser{storage}; QmlTypesParser qmlTypesParser{storage};
ProjectStoragePathWatcher<QFileSystemWatcher, QTimer, PathCacheType> pathWatcher; ProjectStoragePathWatcher<QFileSystemWatcher, QTimer, PathCacheType> pathWatcher;

View File

@@ -84,7 +84,8 @@ protected:
Sqlite::Database &database = staticData->database; Sqlite::Database &database = staticData->database;
QmlDesigner::ProjectStorage &storage = staticData->storage; QmlDesigner::ProjectStorage &storage = staticData->storage;
SourcePathCache pathCache{staticData->sourcePathStorage}; SourcePathCache pathCache{staticData->sourcePathStorage};
Watcher watcher{pathCache, mockFileSystem, &notifier}; QmlDesigner::FileStatusCache fileStatusCache{mockFileSystem};
Watcher watcher{pathCache, fileStatusCache, &notifier};
NiceMock<MockQFileSytemWatcher> &mockQFileSytemWatcher = watcher.fileSystemWatcher(); NiceMock<MockQFileSytemWatcher> &mockQFileSytemWatcher = watcher.fileSystemWatcher();
ProjectChunkId projectChunkId1{ProjectPartId::create(2), SourceType::Qml}; ProjectChunkId projectChunkId1{ProjectPartId::create(2), SourceType::Qml};
ProjectChunkId projectChunkId2{ProjectPartId::create(2), SourceType::QmlUi}; ProjectChunkId projectChunkId2{ProjectPartId::create(2), SourceType::QmlUi};