forked from qt-creator/qt-creator
QmlDesigner: Integrate ProjectStoragePathWatcher
Task-number: QDS-9170 Change-Id: Iedbb07e41232beeb73cd12c89f892eec7968d084 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -32,7 +32,6 @@ void set_greedy_intersection_call(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename FileSystemWatcher, typename Timer, class SourcePathCache>
|
||||
class ProjectStoragePathWatcher : public ProjectStoragePathWatcherInterface
|
||||
{
|
||||
|
@@ -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
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include <projectstorage/filesystem.h>
|
||||
#include <projectstorage/nonlockingmutex.h>
|
||||
#include <projectstorage/projectstorage.h>
|
||||
#include <projectstorage/projectstoragepathwatcher.h>
|
||||
#include <projectstorage/projectstorageupdater.h>
|
||||
#include <projectstorage/qmldocumentparser.h>
|
||||
#include <projectstorage/qmltypesparser.h>
|
||||
@@ -38,6 +39,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QQmlEngine>
|
||||
|
||||
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<QFileSystemWatcher, QTimer, ProjectStorageUpdater::PathCache>
|
||||
pathWatcher{pathCache, fileSystem, &updater};
|
||||
ProjectStorageUpdater updater{fileSystem,
|
||||
storage,
|
||||
fileStatusCache,
|
||||
pathCache,
|
||||
qmlDocumentParser,
|
||||
qmlTypesParser,
|
||||
pathWatcher};
|
||||
};
|
||||
|
||||
std::unique_ptr<ProjectStorageData> createProjectStorageData(::ProjectExplorer::Project *project)
|
||||
|
@@ -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<QmlDesigner::IdPaths> &idPaths), ());
|
||||
|
@@ -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<Sqlite::Database> storage{database, database.isInitialized()};
|
||||
QmlDesigner::SourcePathCache<QmlDesigner::ProjectStorage<Sqlite::Database>> sourcePathCache{
|
||||
storage};
|
||||
NiceMock<ProjectStoragePathWatcherMock> 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");
|
||||
|
Reference in New Issue
Block a user