blob: 64476943391d5df10bb8ed51032b60558b7ae6b2 (
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
71
72
73
74
75
|
// 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
#include "qmldesigner_global.h"
#include <generatedcomponentutils.h>
#include <QObject>
#include <QList>
#include <QLoggingCategory>
#include <designdocument.h>
#include <map>
#include <memory>
namespace Core { class IEditor; }
namespace ProjectExplorer { class Node; }
namespace ProjectExplorer { class Project; }
namespace QmlDesigner {
class QmlDesignerProjectManager;
Q_DECLARE_LOGGING_CATEGORY(documentManagerLog)
class QMLDESIGNER_EXPORT DocumentManager : public QObject
{
Q_OBJECT
public:
DocumentManager(QmlDesignerProjectManager &projectManager,
ExternalDependenciesInterface &externalDependencies)
: m_projectManager{projectManager}
, m_externalDependencies{externalDependencies}
, m_generatedComponentUtils(externalDependencies)
{}
void setCurrentDesignDocument(Core::IEditor *editor);
DesignDocument *currentDesignDocument() const;
bool hasCurrentDesignDocument() const;
void removeEditors(const QList<Core::IEditor *> &editors);
void resetPossibleImports();
const GeneratedComponentUtils &generatedComponentUtils() const;
static bool goIntoComponent(const ModelNode &modelNode);
static void goIntoComponent(const QString &fileName);
static bool createFile(const QString &filePath, const QString &contents);
static void addFileToVersionControl(const QString &directoryPath, const QString &newFilePath);
static Utils::FilePath currentFilePath();
static Utils::FilePath currentProjectDirPath();
static QString currentProjectName();
static QStringList isoIconsQmakeVariableValue(const QString &proPath);
static bool setIsoIconsQmakeVariableValue(const QString &proPath, const QStringList &value);
static void findPathToIsoProFile(bool *iconResourceFileAlreadyExists, QString *resourceFilePath,
QString *resourceFileProPath, const QString &isoIconsQrcFile);
static bool isoProFileSupportsAddingExistingFiles(const QString &resourceFileProPath);
static bool addResourceFileToIsoProject(const QString &resourceFileProPath, const QString &resourceFilePath);
static bool belongsToQmakeProject();
static Utils::FilePath currentResourcePath();
private:
std::map<Core::IEditor *, std::unique_ptr<DesignDocument>> m_designDocuments;
QPointer<DesignDocument> m_currentDesignDocument;
QmlDesignerProjectManager &m_projectManager;
ExternalDependenciesInterface &m_externalDependencies;
GeneratedComponentUtils m_generatedComponentUtils;
};
} // namespace QmlDesigner
|