blob: 4f7892117331f03ba7204d7d0e29f0185b820dea (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "qmlprojectitem.h"
#include "filefilteritems.h"
#include <utils/algorithm.h>
#include <QDir>
namespace QmlProjectManager {
// kind of initialization
void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
{
if (m_sourceDirectory == directoryPath)
return;
m_sourceDirectory = directoryPath;
for (auto &fileFilter : m_content) {
fileFilter->setDefaultDirectory(directoryPath);
connect(fileFilter.get(),
&FileFilterBaseItem::filesChanged,
this,
&QmlProjectItem::qmlFilesChanged);
}
}
void QmlProjectItem::setTargetDirectory(const QString &directoryPath)
{
m_targetDirectory = directoryPath;
}
void QmlProjectItem::setQtForMCUs(bool b)
{
m_qtForMCUs = b;
}
void QmlProjectItem::setQt6Project(bool qt6Project)
{
m_qt6Project = qt6Project;
}
void QmlProjectItem::setImportPaths(const QStringList &importPaths)
{
if (m_importPaths != importPaths)
m_importPaths = importPaths;
}
void QmlProjectItem::setFileSelectors(const QStringList &selectors)
{
if (m_fileSelectors != selectors)
m_fileSelectors = selectors;
}
void QmlProjectItem::setMultilanguageSupport(const bool isEnabled)
{
m_multilanguageSupport = isEnabled;
}
void QmlProjectItem::setSupportedLanguages(const QStringList &languages)
{
if (m_supportedLanguages != languages)
m_supportedLanguages = languages;
}
void QmlProjectItem::setPrimaryLanguage(const QString &language)
{
if (m_primaryLanguage != language)
m_primaryLanguage = language;
}
/* Returns list of absolute paths */
QStringList QmlProjectItem::files() const
{
QSet<QString> files;
for (const auto &fileFilter : m_content) {
const QStringList fileList = fileFilter->files();
for (const QString &file : fileList) {
files.insert(file);
}
}
return Utils::toList(files);
}
/**
Check whether the project would include a file path
- regardless whether the file already exists or not.
@param filePath: absolute file path to check
*/
bool QmlProjectItem::matchesFile(const QString &filePath) const
{
return Utils::contains(m_content, [&filePath](const auto &fileFilter) {
return fileFilter->matchesFile(filePath);
});
}
void QmlProjectItem::setForceFreeType(bool b)
{
m_forceFreeType = b;
}
Utils::EnvironmentItems QmlProjectItem::environment() const
{
return m_environment;
}
void QmlProjectItem::addToEnviroment(const QString &key, const QString &value)
{
m_environment.append(Utils::EnvironmentItem(key, value));
}
} // namespace QmlProjectManager
|