QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GeneralSettings.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Dialogs
4import QtQuick.Layouts
5
6import QGroundControl
7import QGroundControl.FactControls
8import QGroundControl.Controls
9
10SettingsPage {
11 property var _settingsManager: QGroundControl.settingsManager
12 property var _appSettings: _settingsManager.appSettings
13 property var _brandImageSettings: _settingsManager.brandImageSettings
14 property Fact _appFontPointSize: _appSettings.appFontPointSize
15 property Fact _userBrandImageIndoor: _brandImageSettings.userBrandImageIndoor
16 property Fact _userBrandImageOutdoor: _brandImageSettings.userBrandImageOutdoor
17 property Fact _appSavePath: _appSettings.savePath
18
19 SettingsGroupLayout {
20 Layout.fillWidth: true
21 heading: qsTr("General")
22
23 LabelledFactComboBox {
24 label: qsTr("Language")
25 fact: _appSettings.qLocaleLanguage
26 indexModel: false
27 visible: _appSettings.qLocaleLanguage.visible
28 }
29
30 LabelledFactComboBox {
31 label: qsTr("Color Scheme")
32 fact: _appSettings.indoorPalette
33 indexModel: false
34 visible: _appSettings.indoorPalette.visible
35 }
36
37 LabelledFactComboBox {
38 label: qsTr("Stream GCS Position")
39 fact: _appSettings.followTarget
40 indexModel: false
41 visible: _appSettings.followTarget.visible
42 }
43
44 FactCheckBoxSlider {
45 Layout.fillWidth: true
46 text: qsTr("Mute all audio output")
47 fact: _audioMuted
48 visible: _audioMuted.visible
49 property Fact _audioMuted: _appSettings.audioMuted
50 }
51
52 FactCheckBoxSlider {
53 Layout.fillWidth: true
54 text: fact.shortDescription
55 fact: _appSettings.androidDontSaveToSDCard
56 visible: fact.visible
57 }
58
59 QGCCheckBoxSlider {
60 Layout.fillWidth: true
61 text: qsTr("Clear all settings on next start")
62 checked: false
63 onClicked: {
64 if (checked) {
65 QGroundControl.deleteAllSettingsNextBoot()
66 } else {
67 QGroundControl.clearDeleteAllSettingsNextBoot()
68 }
69 }
70 }
71
72 RowLayout {
73 Layout.fillWidth: true
74 spacing: ScreenTools.defaultFontPixelWidth * 2
75 visible: _appFontPointSize.visible
76
77 QGCLabel {
78 Layout.fillWidth: true
79 text: qsTr("UI Scaling")
80 }
81
82 RowLayout {
83 spacing: ScreenTools.defaultFontPixelWidth * 2
84
85 QGCButton {
86 Layout.preferredWidth: height
87 height: baseFontEdit.height * 1.5
88 text: "-"
89 onClicked: {
90 if (_appFontPointSize.value > _appFontPointSize.min) {
91 _appFontPointSize.value = _appFontPointSize.value - 1
92 }
93 }
94 }
95
96 QGCLabel {
97 id: baseFontEdit
98 width: ScreenTools.defaultFontPixelWidth * 6
99 text: (QGroundControl.settingsManager.appSettings.appFontPointSize.value / ScreenTools.platformFontPointSize * 100).toFixed(0) + "%"
100 }
101
102 QGCButton {
103 Layout.preferredWidth: height
104 height: baseFontEdit.height * 1.5
105 text: "+"
106 onClicked: {
107 if (_appFontPointSize.value < _appFontPointSize.max) {
108 _appFontPointSize.value = _appFontPointSize.value + 1
109 }
110 }
111 }
112 }
113 }
114
115 RowLayout {
116 Layout.fillWidth: true
117 spacing: ScreenTools.defaultFontPixelWidth * 2
118 visible: _appSavePath.visible && !ScreenTools.isMobile
119
120 ColumnLayout {
121 Layout.fillWidth: true
122 spacing: 0
123
124 QGCLabel { text: qsTr("Application Load/Save Path") }
125 QGCLabel {
126 Layout.fillWidth: true
127 font.pointSize: ScreenTools.smallFontPointSize
128 text: _appSavePath.rawValue === "" ? qsTr("<default location>") : _appSavePath.value
129 elide: Text.ElideMiddle
130 }
131 }
132
133 QGCButton {
134 text: qsTr("Browse")
135 onClicked: savePathBrowseDialog.openForLoad()
136 QGCFileDialog {
137 id: savePathBrowseDialog
138 title: qsTr("Choose the location to save/load files")
139 folder: _appSavePath.rawValue
140 selectFolder: true
141 onAcceptedForLoad: (file) => _appSavePath.rawValue = file
142 }
143 }
144 }
145 }
146
147 SettingsGroupLayout {
148 Layout.fillWidth: true
149 heading: qsTr("Units")
150 visible: QGroundControl.settingsManager.unitsSettings.visible
151
152 Repeater {
153 model: [ QGroundControl.settingsManager.unitsSettings.horizontalDistanceUnits, QGroundControl.settingsManager.unitsSettings.verticalDistanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ]
154
155 LabelledFactComboBox {
156 label: modelData.shortDescription
157 fact: modelData
158 indexModel: false
159 }
160 }
161 }
162
163 SettingsGroupLayout {
164 Layout.fillWidth: true
165 heading: qsTr("Brand Image")
166 visible: _brandImageSettings.visible && !ScreenTools.isMobile
167
168 RowLayout {
169 Layout.fillWidth: true
170 spacing: ScreenTools.defaultFontPixelWidth * 2
171 visible: _userBrandImageIndoor.visible
172
173 ColumnLayout {
174 Layout.fillWidth: true
175 spacing: 0
176
177 QGCLabel {
178 Layout.fillWidth: true
179 text: qsTr("Indoor Image")
180 }
181 QGCLabel {
182 Layout.fillWidth: true
183 font.pointSize: ScreenTools.smallFontPointSize
184 text: _userBrandImageIndoor.valueString.replace("file:///", "")
185 elide: Text.ElideMiddle
186 visible: _userBrandImageIndoor.valueString.length > 0
187 }
188 }
189
190 QGCButton {
191 text: qsTr("Browse")
192 onClicked: userBrandImageIndoorBrowseDialog.openForLoad()
193
194 QGCFileDialog {
195 id: userBrandImageIndoorBrowseDialog
196 title: qsTr("Choose custom brand image file")
197 folder: _userBrandImageIndoor.rawValue.replace("file:///", "")
198 selectFolder: false
199 onAcceptedForLoad: (file) => _userBrandImageIndoor.rawValue = "file:///" + file
200 }
201 }
202 }
203
204 RowLayout {
205 Layout.fillWidth: true
206 spacing: ScreenTools.defaultFontPixelWidth * 2
207 visible: _userBrandImageOutdoor.visible
208
209 ColumnLayout {
210 Layout.fillWidth: true
211 spacing: 0
212
213 QGCLabel {
214 Layout.fillWidth: true
215 text: qsTr("Outdoor Image")
216 }
217 QGCLabel {
218 Layout.fillWidth: true
219 font.pointSize: ScreenTools.smallFontPointSize
220 text: _userBrandImageOutdoor.valueString.replace("file:///", "")
221 elide: Text.ElideMiddle
222 visible: _userBrandImageOutdoor.valueString.length > 0
223 }
224 }
225
226 QGCButton {
227 text: qsTr("Browse")
228 onClicked: userBrandImageOutdoorBrowseDialog.openForLoad()
229
230 QGCFileDialog {
231 id: userBrandImageOutdoorBrowseDialog
232 title: qsTr("Choose custom brand image file")
233 folder: _userBrandImageOutdoor.rawValue.replace("file:///", "")
234 selectFolder: false
235 onAcceptedForLoad: (file) => _userBrandImageOutdoor.rawValue = "file:///" + file
236 }
237 }
238 }
239
240 LabelledButton {
241 label: qsTr("Reset Images")
242 buttonText: qsTr("Reset")
243 onClicked: {
244 _userBrandImageIndoor.rawValue = ""
245 _userBrandImageOutdoor.rawValue = ""
246 }
247 }
248 }
249}