blob: a42164d1bdc043a048895cf13bb660c9227dd35f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#ifndef QDS_USE_PROJECTSTORAGE
# include "qmldesignercorelib_global.h"
# include <generatedcomponentutils.h>
# include <import.h>
# include <QObject>
# include <QString>
# include <QUrl>
# include <QFileSystemWatcher>
# include <QMultiHash>
# include <QPointer>
# include <QFileInfo>
# include <QDir>
namespace QmlDesigner {
class Model;
class QMLDESIGNERCORE_EXPORT SubComponentManager : public QObject
{
Q_OBJECT
public:
explicit SubComponentManager(Model *model,
class ExternalDependenciesInterface &externalDependencies);
void update(const QUrl &fileUrl, const Imports &imports);
void addAndParseImport(const Import &import);
QStringList qmlFiles() const;
QStringList directories() const;
private: // functions
void parseDirectory(const QString &canonicalDirPath, bool addToLibrary = true, const TypeName &qualification = TypeName());
void parseFile(const QString &canonicalFilePath, bool addToLibrary, const QString&);
void parseFile(const QString &canonicalFilePath);
bool addImport(const Import &import, int index = -1);
void removeImport(int index);
void parseDirectories();
QFileInfoList watchedFiles(const QString &canonicalDirPath);
void unregisterQmlFile(const QFileInfo &fileInfo, const QString &qualifier);
void registerQmlFile(const QFileInfo &fileInfo, const QString &qualifier, bool addToLibrary);
Model *model() const;
QStringList importPaths() const;
void parseQuick3DAssetsDir(const QString &quick3DAssetsPath);
void parseQuick3DAssetsItem(const QString &importUrl, const QString &quick3DAssetsPath = {});
QStringList quick3DAssetPaths() const;
TypeName resolveDirQualifier(const QString &dirPath) const;
private: // variables
QFileSystemWatcher m_watcher;
Imports m_imports;
// key: canonical directory path
QMultiHash<QString,QString> m_dirToQualifier;
QUrl m_filePath;
QDir m_filePathDir;
QPointer<Model> m_model;
ExternalDependenciesInterface &m_externalDependencies;
GeneratedComponentUtils m_componentUtils;
};
} // namespace QmlDesigner
#endif
|