|
|
|
@ -188,6 +188,70 @@ Rectangle {
@@ -188,6 +188,70 @@ Rectangle {
|
|
|
|
|
property Fact _updateHomePosition: QGroundControl.settingsManager.flyViewSettings.updateHomePosition |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FactCheckBox { |
|
|
|
|
text: qsTr("Enable Custom Actions") |
|
|
|
|
visible: _enableCustomActions.visible |
|
|
|
|
fact: _enableCustomActions |
|
|
|
|
|
|
|
|
|
property Fact _enableCustomActions: QGroundControl.settingsManager.flyViewSettings.enableCustomActions |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------- |
|
|
|
|
//-- CustomAction definition path |
|
|
|
|
GridLayout { |
|
|
|
|
id: customActions |
|
|
|
|
|
|
|
|
|
columns: 2 |
|
|
|
|
visible: QGroundControl.settingsManager.flyViewSettings.enableCustomActions.rawValue |
|
|
|
|
|
|
|
|
|
onVisibleChanged: { |
|
|
|
|
if (jsonFile.rawValue === "" && ScreenTools.isMobile) { |
|
|
|
|
jsonFile.rawValue = _defaultFile |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
property Fact jsonFile: QGroundControl.settingsManager.flyViewSettings.customActionDefinitions |
|
|
|
|
property string _defaultDir: QGroundControl.settingsManager.appSettings.customActionsSavePath |
|
|
|
|
property string _defaultFile: _defaultDir + "/CustomActions.json" |
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
text: qsTr("Custom Action Definitions") |
|
|
|
|
|
|
|
|
|
Layout.columnSpan: 2 |
|
|
|
|
Layout.alignment: Qt.AlignHCenter |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCTextField { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
readOnly: true |
|
|
|
|
text: customActions.jsonFile.rawValue === "" ? qsTr("<not set>") : customActions.jsonFile.rawValue |
|
|
|
|
} |
|
|
|
|
QGCButton { |
|
|
|
|
visible: !ScreenTools.isMobile |
|
|
|
|
text: qsTr("Browse") |
|
|
|
|
onClicked: customActionPathBrowseDialog.openForLoad() |
|
|
|
|
QGCFileDialog { |
|
|
|
|
id: customActionPathBrowseDialog |
|
|
|
|
title: qsTr("Choose the Custom Action Definitions file") |
|
|
|
|
folder: customActions.jsonFile.rawValue |
|
|
|
|
selectExisting: true |
|
|
|
|
selectFolder: false |
|
|
|
|
onAcceptedForLoad: customActions.jsonFile.rawValue = file |
|
|
|
|
nameFilters: ["JSON files (*.json)"] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// The file loader on Android doesn't work, so we hard code the path to the |
|
|
|
|
// JSON file. However, we need a button to force a refresh if the JSON file |
|
|
|
|
// is changed. |
|
|
|
|
QGCButton { |
|
|
|
|
visible: ScreenTools.isMobile |
|
|
|
|
text: qsTr("Reload") |
|
|
|
|
onClicked: { |
|
|
|
|
customActions.jsonFile.valueChanged(customActions.jsonFile.rawValue) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GridLayout { |
|
|
|
|
columns: 2 |
|
|
|
|
|
|
|
|
|