5import QGroundControl.Controls
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)
13 property var _mavlinkActionsSettings: QGroundControl.settingsManager.mavlinkActionsSettings
15 function mavlinkActionList() {
16 var fileModel = QGCFileDialogController.getFiles(QGroundControl.settingsManager.appSettings.mavlinkActionsSavePath, "*.json")
17 fileModel.unshift(qsTr("<None>"))
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
28 Component.onCompleted: {
29 var index = comboBox.find(_mavlinkActionsSettings.flyViewActionsFile.valueString)
30 comboBox.currentIndex = index == -1 ? 0 : index
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
41 Component.onCompleted: {
42 var index = comboBox.find(_mavlinkActionsSettings.joystickActionsFile.valueString)
43 comboBox.currentIndex = index == -1 ? 0 : index