diff --git a/src/plugins/qmldesigner/designercore/projectstorage/projectstoragepathwatcher.h b/src/plugins/qmldesigner/designercore/projectstorage/projectstoragepathwatcher.h index 1e89b6185cb..6d14d1e42f1 100644 --- a/src/plugins/qmldesigner/designercore/projectstorage/projectstoragepathwatcher.h +++ b/src/plugins/qmldesigner/designercore/projectstorage/projectstoragepathwatcher.h @@ -32,7 +32,6 @@ void set_greedy_intersection_call( } } - template class ProjectStoragePathWatcher : public ProjectStoragePathWatcherInterface { diff --git a/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h b/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h index 33d0f99e32f..43fd5237103 100644 --- a/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h +++ b/src/plugins/qmldesigner/designercore/projectstorage/projectstorageupdater.h @@ -41,13 +41,15 @@ public: FileStatusCache &fileStatusCache, PathCache &pathCache, QmlDocumentParserInterface &qmlDocumentParser, - QmlTypesParserInterface &qmlTypesParser) + QmlTypesParserInterface &qmlTypesParser, + class ProjectStoragePathWatcherInterface &pathWatcher) : m_fileSystem{fileSystem} , m_projectStorage{projectStorage} , m_fileStatusCache{fileStatusCache} , m_pathCache{pathCache} , m_qmlDocumentParser{qmlDocumentParser} , m_qmlTypesParser{qmlTypesParser} + , m_pathWatcher{pathWatcher} {} void update(QStringList directories, QStringList qmlTypesPaths); @@ -151,6 +153,7 @@ private: PathCache &m_pathCache; QmlDocumentParserInterface &m_qmlDocumentParser; QmlTypesParserInterface &m_qmlTypesParser; + ProjectStoragePathWatcherInterface &m_pathWatcher; }; } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp index 766b18af463..46a5e925b8b 100644 --- a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp +++ b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,7 @@ #include +#include #include namespace QmlDesigner { @@ -179,8 +181,15 @@ public: FileStatusCache fileStatusCache{fileSystem}; QmlDocumentParser qmlDocumentParser{storage, pathCache}; QmlTypesParser qmlTypesParser{pathCache, storage}; - ProjectStorageUpdater updater{ - fileSystem, storage, fileStatusCache, pathCache, qmlDocumentParser, qmlTypesParser}; + ProjectStoragePathWatcher + pathWatcher{pathCache, fileSystem, &updater}; + ProjectStorageUpdater updater{fileSystem, + storage, + fileStatusCache, + pathCache, + qmlDocumentParser, + qmlTypesParser, + pathWatcher}; }; std::unique_ptr createProjectStorageData(::ProjectExplorer::Project *project) diff --git a/tests/unit/unittest/projectstoragepathwatchermock.h b/tests/unit/unittest/projectstoragepathwatchermock.h index 61d66c1d417..b0902c24442 100644 --- a/tests/unit/unittest/projectstoragepathwatchermock.h +++ b/tests/unit/unittest/projectstoragepathwatchermock.h @@ -7,7 +7,7 @@ #include "projectstorage/projectstoragepathwatcherinterface.h" -class MockProjectStoragePathWatcher : public QmlDesigner::ProjectStoragePathWatcherInterface +class ProjectStoragePathWatcherMock : public QmlDesigner::ProjectStoragePathWatcherInterface { public: MOCK_METHOD(void, updateIdPaths, (const std::vector &idPaths), ()); diff --git a/tests/unit/unittest/projectstorageupdater-test.cpp b/tests/unit/unittest/projectstorageupdater-test.cpp index 6d55565c1e2..39f8cdd87d9 100644 --- a/tests/unit/unittest/projectstorageupdater-test.cpp +++ b/tests/unit/unittest/projectstorageupdater-test.cpp @@ -5,6 +5,7 @@ #include "filesystemmock.h" #include "projectstoragemock.h" +#include "projectstoragepathwatchermock.h" #include "qmldocumentparsermock.h" #include "qmltypesparsermock.h" @@ -218,12 +219,14 @@ protected: QmlDesigner::ProjectStorage storage{database, database.isInitialized()}; QmlDesigner::SourcePathCache> sourcePathCache{ storage}; + NiceMock patchWatcherMock; QmlDesigner::ProjectStorageUpdater updater{fileSystemMock, projectStorageMock, fileStatusCache, sourcePathCache, qmlDocumentParserMock, - qmlTypesParserMock}; + qmlTypesParserMock, + patchWatcherMock}; SourceId qmltypesPathSourceId = sourcePathCache.sourceId("/path/example.qmltypes"); SourceId qmltypes2PathSourceId = sourcePathCache.sourceId("/path/types/example2.qmltypes"); SourceId qmlDirPathSourceId = sourcePathCache.sourceId("/path/qmldir");