Unverified Commit 894db080 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6136 from DonLakeFlyer/Guided

Add delay to guided commands to catch up with multiple state changes
parents e0d295ed d4d715b6
...@@ -42,10 +42,28 @@ NoMouseThroughRectangle { ...@@ -42,10 +42,28 @@ NoMouseThroughRectangle {
if (hideTrigger) { if (hideTrigger) {
hideTrigger = false hideTrigger = false
altitudeSlider.visible = false altitudeSlider.visible = false
visibleTimer.stop()
visible = false visible = false
} }
} }
function show(immediate) {
if (immediate) {
visible = true
} else {
// We delay showing the confirmation for a small amount in order to any other state
// changes to propogate through the system. This way only the final state shows up.
visibleTimer.restart()
}
}
Timer {
id: visibleTimer
interval: 1000
repeat: false
onTriggered: visible = true
}
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
Column { Column {
......
...@@ -185,9 +185,11 @@ Item { ...@@ -185,9 +185,11 @@ Item {
// Called when an action is about to be executed in order to confirm // Called when an action is about to be executed in order to confirm
function confirmAction(actionCode, actionData) { function confirmAction(actionCode, actionData) {
var showImmediate = true
closeAll() closeAll()
confirmDialog.action = actionCode confirmDialog.action = actionCode
confirmDialog.actionData = actionData confirmDialog.actionData = actionData
confirmDialog.hideTrigger = true
_actionData = actionData _actionData = actionData
switch (actionCode) { switch (actionCode) {
case actionArm: case actionArm:
...@@ -219,6 +221,7 @@ Item { ...@@ -219,6 +221,7 @@ Item {
altitudeSlider.visible = true altitudeSlider.visible = true
break; break;
case actionStartMission: case actionStartMission:
showImmediate = false
confirmDialog.title = startMissionTitle confirmDialog.title = startMissionTitle
confirmDialog.message = startMissionMessage confirmDialog.message = startMissionMessage
confirmDialog.hideTrigger = Qt.binding(function() { return !showStartMission }) confirmDialog.hideTrigger = Qt.binding(function() { return !showStartMission })
...@@ -229,11 +232,13 @@ Item { ...@@ -229,11 +232,13 @@ Item {
confirmDialog.hideTrigger = true confirmDialog.hideTrigger = true
break; break;
case actionContinueMission: case actionContinueMission:
showImmediate = false
confirmDialog.title = continueMissionTitle confirmDialog.title = continueMissionTitle
confirmDialog.message = continueMissionMessage confirmDialog.message = continueMissionMessage
confirmDialog.hideTrigger = Qt.binding(function() { return !showContinueMission }) confirmDialog.hideTrigger = Qt.binding(function() { return !showContinueMission })
break; break;
case actionResumeMission: case actionResumeMission:
showImmediate = false
confirmDialog.title = resumeMissionTitle confirmDialog.title = resumeMissionTitle
confirmDialog.message = resumeMissionMessage confirmDialog.message = resumeMissionMessage
confirmDialog.hideTrigger = Qt.binding(function() { return !showResumeMission }) confirmDialog.hideTrigger = Qt.binding(function() { return !showResumeMission })
...@@ -308,7 +313,7 @@ Item { ...@@ -308,7 +313,7 @@ Item {
console.warn("Unknown actionCode", actionCode) console.warn("Unknown actionCode", actionCode)
return return
} }
confirmDialog.visible = true confirmDialog.show(showImmediate)
} }
// Executes the specified action // Executes the specified action
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment