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();
}
#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<AssetPath> BundleHelper::getComponentDependencies(const Utils::FilePath &filePath,
const Utils::FilePath &mainCompDir) const

View File

@@ -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<Timer> m_directoryPathCompressor;

View File

@@ -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<QFileSystemWatcher, QTimer, PathCacheType> pathWatcher;

View File

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