QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MavlinkActionSettings.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6
7SettingsGroupLayout {
8 Layout.fillWidth: true
9 Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 35
10 heading: qsTr("MAVLink Actions")
11 headingDescription: qsTr("Action JSON files should be created in the '%1' folder.").arg(QGroundControl.settingsManager.appSettings.mavlinkActionsSavePath)
12
13 property var _mavlinkActionsSettings: QGroundControl.settingsManager.mavlinkActionsSettings
14
15 function mavlinkActionList() {
16 var fileModel = QGCFileDialogController.getFiles(QGroundControl.settingsManager.appSettings.mavlinkActionsSavePath, "*.json")
17 fileModel.unshift(qsTr("<None>"))
18 return fileModel
19 }
20
21 LabelledComboBox {
22 Layout.fillWidth: true
23 label: qsTr("Fly View Actions")
24 model: mavlinkActionList()
25 onActivated: (index) => index == 0 ? _mavlinkActionsSettings.flyViewActionsFile.rawValue = "" : _mavlinkActionsSettings.flyViewActionsFile.rawValue = comboBox.currentText
26 enabled: model.length > 1
27
28 Component.onCompleted: {
29 var index = comboBox.find(_mavlinkActionsSettings.flyViewActionsFile.valueString)
30 comboBox.currentIndex = index == -1 ? 0 : index
31 }
32 }
33
34 LabelledComboBox {
35 Layout.fillWidth: true
36 label: qsTr("Joystick Actions")
37 model: mavlinkActionList()
38 onActivated: (index) => index == 0 ? _mavlinkActionsSettings.joystickActionsFile.rawValue = "" : _mavlinkActionsSettings.joystickActionsFile.rawValue = comboBox.currentText
39 enabled: model.length > 1
40
41 Component.onCompleted: {
42 var index = comboBox.find(_mavlinkActionsSettings.joystickActionsFile.valueString)
43 comboBox.currentIndex = index == -1 ? 0 : index
44 }
45 }
46}