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
|
// Copyright (C) 2021 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 "buildpropertiessettings.h"
#include "projectexplorerconstants.h"
#include <utils/layoutbuilder.h>
using namespace Utils;
namespace ProjectExplorer {
// Default directory:
const char DEFAULT_BUILD_DIRECTORY_TEMPLATE[]
= "../%{JS: Util.asciify(\"build-%{Project:Name}-%{Kit:FileSystemName}-%{BuildConfig:Name}\")}";
BuildPropertiesSettings::BuildTriStateAspect::BuildTriStateAspect()
: TriStateAspect{
BuildPropertiesSettings::tr("Enable"),
BuildPropertiesSettings::tr("Disable"),
BuildPropertiesSettings::tr("Use Project Default")}
{}
BuildPropertiesSettings::BuildPropertiesSettings()
{
setAutoApply(false);
registerAspect(&buildDirectoryTemplate);
buildDirectoryTemplate.setDisplayStyle(StringAspect::LineEditDisplay);
buildDirectoryTemplate.setSettingsKey("Directories/BuildDirectory.TemplateV2");
buildDirectoryTemplate.setDefaultValue(DEFAULT_BUILD_DIRECTORY_TEMPLATE);
buildDirectoryTemplate.setLabelText(tr("Default build directory:"));
buildDirectoryTemplate.setUseGlobalMacroExpander();
buildDirectoryTemplate.setUseResetButton();
registerAspect(&buildDirectoryTemplateOld); // TODO: Remove in ~4.16
buildDirectoryTemplateOld.setSettingsKey("Directories/BuildDirectory.Template");
buildDirectoryTemplateOld.setDefaultValue(DEFAULT_BUILD_DIRECTORY_TEMPLATE);
registerAspect(&separateDebugInfo);
separateDebugInfo.setSettingsKey("ProjectExplorer/Settings/SeparateDebugInfo");
separateDebugInfo.setLabelText(tr("Separate debug info:"));
registerAspect(&qmlDebugging);
qmlDebugging.setSettingsKey("ProjectExplorer/Settings/QmlDebugging");
qmlDebugging.setLabelText(tr("QML debugging:"));
registerAspect(&qtQuickCompiler);
qtQuickCompiler.setSettingsKey("ProjectExplorer/Settings/QtQuickCompiler");
qtQuickCompiler.setLabelText(tr("Use qmlcachegen:"));
QObject::connect(&showQtSettings, &BoolAspect::valueChanged,
&qmlDebugging, &BaseAspect::setVisible);
QObject::connect(&showQtSettings, &BoolAspect::valueChanged,
&qtQuickCompiler, &BaseAspect::setVisible);
}
void BuildPropertiesSettings::readSettings(QSettings *s)
{
AspectContainer::readSettings(s);
// TODO: Remove in ~4.16
QString v = buildDirectoryTemplate.value();
if (v.isEmpty())
v = buildDirectoryTemplateOld.value();
if (v.isEmpty())
v = DEFAULT_BUILD_DIRECTORY_TEMPLATE;
v.replace("%{CurrentProject:Name}", "%{Project:Name}");
v.replace("%{CurrentKit:FileSystemName}", "%{Kit:FileSystemName}");
v.replace("%{CurrentBuild:Name}", "%{BuildConfig:Name}");
buildDirectoryTemplate.setValue(v);
}
QString BuildPropertiesSettings::defaultBuildDirectoryTemplate()
{
return QString(DEFAULT_BUILD_DIRECTORY_TEMPLATE);
}
namespace Internal {
BuildPropertiesSettingsPage::BuildPropertiesSettingsPage(BuildPropertiesSettings *settings)
{
setId("AB.ProjectExplorer.BuildPropertiesSettingsPage");
setDisplayName(BuildPropertiesSettings::tr("Default Build Properties"));
setCategory(ProjectExplorer::Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
setSettings(settings);
setLayouter([settings](QWidget *widget) {
BuildPropertiesSettings &s = *settings;
using namespace Layouting;
Column {
Form {
s.buildDirectoryTemplate,
s.separateDebugInfo,
s.qmlDebugging,
s.qtQuickCompiler
},
st
}.attachTo(widget);
});
}
} // Internal
} // ProjectExplorer
|