Browse Source

Add Custom Actions to existing Guided Actions pane

QGC4.4
Nick Exton 2 years ago
parent
commit
39736a0773
  1. 46
      src/FlightDisplay/GuidedActionList.qml
  2. 2
      src/FlightDisplay/GuidedActionsController.qml

46
src/FlightDisplay/GuidedActionList.qml

@ -14,6 +14,7 @@ import QtQuick.Layouts 1.2 @@ -14,6 +14,7 @@ import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.Palette 1.0
@ -71,6 +72,11 @@ Rectangle { @@ -71,6 +72,11 @@ Rectangle {
}
]
property var _customManager: CustomActionManager {
id: customManager
}
readonly property bool hasCustomActions: QGroundControl.settingsManager.flyViewSettings.enableCustomActions.rawValue && customManager.hasActions
QGCPalette { id: qgcPal }
DeadMouseArea {
@ -102,6 +108,7 @@ Rectangle { @@ -102,6 +108,7 @@ Rectangle {
id: actionRow
spacing: _actionHorizSpacing
// These are the pre-defined Actions
Repeater {
id: actionRepeater
model: _model
@ -119,8 +126,6 @@ Rectangle { @@ -119,8 +126,6 @@ Rectangle {
Layout.minimumWidth: _actionWidth
Layout.maximumWidth: _actionWidth
Layout.fillHeight: true
property real _width: ScreenTools.defaultFontPixelWidth * 25
}
QGCButton {
@ -133,8 +138,41 @@ Rectangle { @@ -133,8 +138,41 @@ Rectangle {
guidedController.confirmAction(modelData.action)
}
}
}
}
} // ColumnLayout
} // Repeater
// These are the user-defined Custom Actions
Repeater {
id: customRepeater
model: customManager.actions
ColumnLayout {
spacing: ScreenTools.defaultFontPixelHeight / 2
visible: _root.hasCustomActions
Layout.fillHeight: true
QGCLabel {
id: customMessage
text: "Custom Action #" + (index + 1)
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
Layout.minimumWidth: _actionWidth
Layout.maximumWidth: _actionWidth
Layout.fillHeight: true
}
QGCButton {
id: customButton
text: object.label
Layout.alignment: Qt.AlignCenter
onClicked: {
var vehicle = QGroundControl.multiVehicleManager.activeVehicle
object.sendTo(vehicle)
}
}
} // ColumnLayout
} // Repeater
}
}
}

2
src/FlightDisplay/GuidedActionsController.qml

@ -130,7 +130,7 @@ Item { @@ -130,7 +130,7 @@ Item {
property bool showROI: _guidedActionsEnabled && _vehicleFlying && __roiSupported && !_missionActive
property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _fixedWingOnApproach
property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying
property bool showActionList: _guidedActionsEnabled && (showStartMission || showResumeMission || showChangeAlt || showLandAbort)
property bool showActionList: _guidedActionsEnabled && (showStartMission || showResumeMission || showChangeAlt || showLandAbort || actionList.hasCustomActions)
property string changeSpeedTitle: _fixedWing ? changeAirspeedTitle : changeCruiseSpeedTitle
property string changeSpeedMessage: _fixedWing ? changeAirspeedMessage : changeCruiseSpeedMessage

Loading…
Cancel
Save