forked from qt-creator/qt-creator
QmlDesigner: Fix QmlTypesParser
Change-Id: I826e1a37747a51602f3f7a8ea675320787080272 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -4,11 +4,10 @@
|
|||||||
#include "qmltypesparser.h"
|
#include "qmltypesparser.h"
|
||||||
|
|
||||||
#include "projectstorage.h"
|
#include "projectstorage.h"
|
||||||
#include "sourcepathcache.h"
|
|
||||||
|
|
||||||
#include <sqlitedatabase.h>
|
#include <sqlitedatabase.h>
|
||||||
|
|
||||||
#ifdef QDS_HAS_QMLPRIVATE
|
#ifdef HasQQmlJSTypeDescriptionReader
|
||||||
#include <private/qqmldomtop_p.h>
|
#include <private/qqmldomtop_p.h>
|
||||||
#include <private/qqmljstypedescriptionreader_p.h>
|
#include <private/qqmljstypedescriptionreader_p.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -20,7 +19,7 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
#if defined(QDS_HAS_QMLPRIVATE) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
#ifdef HasQQmlJSTypeDescriptionReader
|
||||||
|
|
||||||
namespace QmlDom = QQmlJS::Dom;
|
namespace QmlDom = QQmlJS::Dom;
|
||||||
|
|
||||||
|
@@ -10,6 +10,10 @@ namespace Sqlite {
|
|||||||
class Database;
|
class Database;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(QDS_HAS_QMLPRIVATE) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||||
|
#define HasQQmlJSTypeDescriptionReader
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
template<typename Database>
|
template<typename Database>
|
||||||
@@ -22,16 +26,13 @@ class QmlTypesParser : public QmlTypesParserInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using ProjectStorage = QmlDesigner::ProjectStorage<Sqlite::Database>;
|
using ProjectStorage = QmlDesigner::ProjectStorage<Sqlite::Database>;
|
||||||
using PathCache = QmlDesigner::SourcePathCache<ProjectStorage, NonLockingMutex>;
|
|
||||||
|
|
||||||
#ifdef QDS_HAS_QMLPRIVATE
|
#ifdef HasQQmlJSTypeDescriptionReader
|
||||||
QmlTypesParser(PathCache &pathCache, ProjectStorage &storage)
|
QmlTypesParser(ProjectStorage &storage)
|
||||||
: m_pathCache{pathCache}
|
: m_storage{storage}
|
||||||
, m_storage{storage}
|
|
||||||
{}
|
{}
|
||||||
#else
|
#else
|
||||||
QmlTypesParser(PathCache &, ProjectStorage &)
|
QmlTypesParser(ProjectStorage &) {}
|
||||||
{}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void parse(const QString &sourceContent,
|
void parse(const QString &sourceContent,
|
||||||
@@ -40,9 +41,7 @@ public:
|
|||||||
const Storage::Synchronization::ProjectData &projectData) override;
|
const Storage::Synchronization::ProjectData &projectData) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// m_pathCache and m_storage are only used when compiled for QDS
|
#ifdef HasQQmlJSTypeDescriptionReader
|
||||||
#ifdef QDS_HAS_QMLPRIVATE
|
|
||||||
PathCache &m_pathCache;
|
|
||||||
ProjectStorage &m_storage;
|
ProjectStorage &m_storage;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@@ -185,7 +185,7 @@ public:
|
|||||||
FileSystem fileSystem{pathCache};
|
FileSystem fileSystem{pathCache};
|
||||||
FileStatusCache fileStatusCache{fileSystem};
|
FileStatusCache fileStatusCache{fileSystem};
|
||||||
QmlDocumentParser qmlDocumentParser{storage, pathCache};
|
QmlDocumentParser qmlDocumentParser{storage, pathCache};
|
||||||
QmlTypesParser qmlTypesParser{pathCache, storage};
|
QmlTypesParser qmlTypesParser{storage};
|
||||||
ProjectStoragePathWatcher<QFileSystemWatcher, QTimer, ProjectStorageUpdater::PathCache>
|
ProjectStoragePathWatcher<QFileSystemWatcher, QTimer, ProjectStorageUpdater::PathCache>
|
||||||
pathWatcher{pathCache, fileSystem, &updater};
|
pathWatcher{pathCache, fileSystem, &updater};
|
||||||
ProjectPartId projectPartId;
|
ProjectPartId projectPartId;
|
||||||
|
@@ -149,7 +149,7 @@ protected:
|
|||||||
QmlDesigner::ProjectStorage<Sqlite::Database> storage{database, database.isInitialized()};
|
QmlDesigner::ProjectStorage<Sqlite::Database> storage{database, database.isInitialized()};
|
||||||
QmlDesigner::SourcePathCache<QmlDesigner::ProjectStorage<Sqlite::Database>> sourcePathCache{
|
QmlDesigner::SourcePathCache<QmlDesigner::ProjectStorage<Sqlite::Database>> sourcePathCache{
|
||||||
storage};
|
storage};
|
||||||
QmlDesigner::QmlTypesParser parser{sourcePathCache, storage};
|
QmlDesigner::QmlTypesParser parser{storage};
|
||||||
Storage::Imports imports;
|
Storage::Imports imports;
|
||||||
Storage::Types types;
|
Storage::Types types;
|
||||||
SourceId qmltypesFileSourceId{sourcePathCache.sourceId("path/to/types.qmltypes")};
|
SourceId qmltypesFileSourceId{sourcePathCache.sourceId("path/to/types.qmltypes")};
|
||||||
|
Reference in New Issue
Block a user