Commit 82eb4f53 authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent 2a20075f
...@@ -659,6 +659,8 @@ HEADERS += \ ...@@ -659,6 +659,8 @@ HEADERS += \
src/QmlControls/RCToParamDialogController.h \ src/QmlControls/RCToParamDialogController.h \
src/QmlControls/ScreenToolsController.h \ src/QmlControls/ScreenToolsController.h \
src/QmlControls/TerrainProfile.h \ src/QmlControls/TerrainProfile.h \
src/QmlControls/ToolStripAction.h \
src/QmlControls/ToolStripActionList.h \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h \ src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h \
src/Settings/ADSBVehicleManagerSettings.h \ src/Settings/ADSBVehicleManagerSettings.h \
src/Settings/AppSettings.h \ src/Settings/AppSettings.h \
...@@ -867,6 +869,8 @@ SOURCES += \ ...@@ -867,6 +869,8 @@ SOURCES += \
src/QmlControls/RCToParamDialogController.cc \ src/QmlControls/RCToParamDialogController.cc \
src/QmlControls/ScreenToolsController.cc \ src/QmlControls/ScreenToolsController.cc \
src/QmlControls/TerrainProfile.cc \ src/QmlControls/TerrainProfile.cc \
src/QmlControls/ToolStripAction.cc \
src/QmlControls/ToolStripActionList.cc \
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc \ src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc \
src/Settings/ADSBVehicleManagerSettings.cc \ src/Settings/ADSBVehicleManagerSettings.cc \
src/Settings/AppSettings.cc \ src/Settings/AppSettings.cc \
......
...@@ -203,12 +203,19 @@ ...@@ -203,12 +203,19 @@
<file alias="QGroundControl/FlightDisplay/FlyViewMissionCompleteDialog.qml">src/FlightDisplay/FlyViewMissionCompleteDialog.qml</file> <file alias="QGroundControl/FlightDisplay/FlyViewMissionCompleteDialog.qml">src/FlightDisplay/FlyViewMissionCompleteDialog.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewPreFlightChecklistPopup.qml">src/FlightDisplay/FlyViewPreFlightChecklistPopup.qml</file> <file alias="QGroundControl/FlightDisplay/FlyViewPreFlightChecklistPopup.qml">src/FlightDisplay/FlyViewPreFlightChecklistPopup.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewToolStrip.qml">src/FlightDisplay/FlyViewToolStrip.qml</file> <file alias="QGroundControl/FlightDisplay/FlyViewToolStrip.qml">src/FlightDisplay/FlyViewToolStrip.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewToolStripActionList.qml">src/FlightDisplay/FlyViewToolStripActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewVideo.qml">src/FlightDisplay/FlyViewVideo.qml</file> <file alias="QGroundControl/FlightDisplay/FlyViewVideo.qml">src/FlightDisplay/FlyViewVideo.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewWidgetLayer.qml">src/FlightDisplay/FlyViewWidgetLayer.qml</file> <file alias="QGroundControl/FlightDisplay/FlyViewWidgetLayer.qml">src/FlightDisplay/FlyViewWidgetLayer.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionActionList.qml">src/FlightDisplay/GuidedActionActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionConfirm.qml">src/FlightDisplay/GuidedActionConfirm.qml</file> <file alias="QGroundControl/FlightDisplay/GuidedActionConfirm.qml">src/FlightDisplay/GuidedActionConfirm.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionList.qml">src/FlightDisplay/GuidedActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionsController.qml">src/FlightDisplay/GuidedActionsController.qml</file> <file alias="QGroundControl/FlightDisplay/GuidedActionsController.qml">src/FlightDisplay/GuidedActionsController.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionLand.qml">src/FlightDisplay/GuidedActionLand.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionList.qml">src/FlightDisplay/GuidedActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionTakeoff.qml">src/FlightDisplay/GuidedActionTakeoff.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionPause.qml">src/FlightDisplay/GuidedActionPause.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionRTL.qml">src/FlightDisplay/GuidedActionRTL.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedAltitudeSlider.qml">src/FlightDisplay/GuidedAltitudeSlider.qml</file> <file alias="QGroundControl/FlightDisplay/GuidedAltitudeSlider.qml">src/FlightDisplay/GuidedAltitudeSlider.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedToolStripAction.qml">src/FlightDisplay/GuidedToolStripAction.qml</file>
<file alias="QGroundControl/FlightDisplay/MultiVehicleList.qml">src/FlightDisplay/MultiVehicleList.qml</file> <file alias="QGroundControl/FlightDisplay/MultiVehicleList.qml">src/FlightDisplay/MultiVehicleList.qml</file>
<file alias="QGroundControl/FlightDisplay/MultiVehiclePanel.qml">src/FlightDisplay/MultiVehiclePanel.qml</file> <file alias="QGroundControl/FlightDisplay/MultiVehiclePanel.qml">src/FlightDisplay/MultiVehiclePanel.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightBatteryCheck.qml">src/FlightDisplay/PreFlightBatteryCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightBatteryCheck.qml">src/FlightDisplay/PreFlightBatteryCheck.qml</file>
...@@ -216,6 +223,7 @@ ...@@ -216,6 +223,7 @@
<file alias="QGroundControl/FlightDisplay/PreFlightRCCheck.qml">src/FlightDisplay/PreFlightRCCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightRCCheck.qml">src/FlightDisplay/PreFlightRCCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightSensorsHealthCheck.qml">src/FlightDisplay/PreFlightSensorsHealthCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightSensorsHealthCheck.qml">src/FlightDisplay/PreFlightSensorsHealthCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightSoundCheck.qml">src/FlightDisplay/PreFlightSoundCheck.qml</file> <file alias="QGroundControl/FlightDisplay/PreFlightSoundCheck.qml">src/FlightDisplay/PreFlightSoundCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightCheckListShowAction.qml">src/FlightDisplay/PreFlightCheckListShowAction.qml</file>
<file alias="QGroundControl/FlightDisplay/TerrainProgress.qml">src/FlightDisplay/TerrainProgress.qml</file> <file alias="QGroundControl/FlightDisplay/TerrainProgress.qml">src/FlightDisplay/TerrainProgress.qml</file>
<file alias="QGroundControl/FlightDisplay/VehicleWarnings.qml">src/FlightDisplay/VehicleWarnings.qml</file> <file alias="QGroundControl/FlightDisplay/VehicleWarnings.qml">src/FlightDisplay/VehicleWarnings.qml</file>
<file alias="QGroundControl/FlightDisplay/qmldir">src/QmlControls/QGroundControl/FlightDisplay/qmldir</file> <file alias="QGroundControl/FlightDisplay/qmldir">src/QmlControls/QGroundControl/FlightDisplay/qmldir</file>
......
...@@ -34,8 +34,8 @@ import QGroundControl.Vehicle 1.0 ...@@ -34,8 +34,8 @@ import QGroundControl.Vehicle 1.0
Item { Item {
id: _root id: _root
property var parentToolInsets // These insets tell you what screen real estate is available for positioning the controls in your overlay property var parentToolInsets // These insets tell you what screen real estate is available for positioning the controls in your overlay
property var toolInsets: _toolInsets // These are the insets for your custom overlay additions property var totalToolInsets: _toolInsets // These are the insets for your custom overlay additions
property var mapControl property var mapControl
QGCToolInsets { QGCToolInsets {
......
...@@ -27,10 +27,9 @@ Popup { ...@@ -27,10 +27,9 @@ Popup {
clip: true clip: true
} }
property bool useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _enforceChecklist: useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
property bool _checklistComplete: _activeVehicle && (_activeVehicle.checkListState === Vehicle.CheckListPassed) property bool _checklistComplete: _activeVehicle && (_activeVehicle.checkListState === Vehicle.CheckListPassed)
on_ActiveVehicleChanged: _showPreFlightChecklistIfNeeded() on_ActiveVehicleChanged: _showPreFlightChecklistIfNeeded()
......
...@@ -7,103 +7,26 @@ ...@@ -7,103 +7,26 @@
* *
****************************************************************************/ ****************************************************************************/
import QGroundControl 1.0 import QtQml.Models 2.12
import QGroundControl.Controls 1.0
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0
ToolStrip { ToolStrip {
title: qsTr("Fly") id: _root
title: qsTr("Fly")
property var guidedActionsController property var guidedActionsController
property var guidedActionList property var guidedActionList
property bool usePreFlightChecklist
signal displayPreFlightChecklist signal displayPreFlightChecklist
property bool _anyActionAvailable: guidedActionsController.showStartMission || guidedActionsController.showResumeMission || guidedActionsController.showChangeAlt || guidedActionsController.showLandAbort FlyViewToolStripActionList {
property var _actionModel: [ id: flyViewToolStripActionList
{
title: guidedActionsController.startMissionTitle,
text: guidedActionsController.startMissionMessage,
action: guidedActionsController.actionStartMission,
visible: guidedActionsController.showStartMission
},
{
title: guidedActionsController.continueMissionTitle,
text: guidedActionsController.continueMissionMessage,
action: guidedActionsController.actionContinueMission,
visible: guidedActionsController.showContinueMission
},
{
title: guidedActionsController.changeAltTitle,
text: guidedActionsController.changeAltMessage,
action: guidedActionsController.actionChangeAlt,
visible: guidedActionsController.showChangeAlt
},
{
title: guidedActionsController.landAbortTitle,
text: guidedActionsController.landAbortMessage,
action: guidedActionsController.actionLandAbort,
visible: guidedActionsController.showLandAbort
}
]
model: [
{
name: "Checklist",
iconSource: "/qmlimages/check.svg",
buttonVisible: usePreFlightChecklist,
buttonEnabled: usePreFlightChecklist && activeVehicle && !activeVehicle.armed,
},
{
name: guidedActionsController.takeoffTitle,
iconSource: "/res/takeoff.svg",
buttonVisible: guidedActionsController.showTakeoff || !guidedActionsController.showLand,
buttonEnabled: guidedActionsController.showTakeoff,
action: guidedActionsController.actionTakeoff
},
{
name: guidedActionsController.landTitle,
iconSource: "/res/land.svg",
buttonVisible: guidedActionsController.showLand && !guidedActionsController.showTakeoff,
buttonEnabled: guidedActionsController.showLand,
action: guidedActionsController.actionLand
},
{
name: guidedActionsController.rtlTitle,
iconSource: "/res/rtl.svg",
buttonVisible: true,
buttonEnabled: guidedActionsController.showRTL,
action: guidedActionsController.actionRTL
},
{
name: guidedActionsController.pauseTitle,
iconSource: "/res/pause-mission.svg",
buttonVisible: guidedActionsController.showPause,
buttonEnabled: guidedActionsController.showPause,
action: guidedActionsController.actionPause
},
{
name: qsTr("Action"),
iconSource: "/res/action.svg",
buttonVisible: _anyActionAvailable,
buttonEnabled: true,
action: -1
}
]
onClicked: {
if(index === 0) {
displayPreFlightChecklist()
} else {
guidedActionsController.closeAll()
var action = model[index].action
if (action === -1) {
guidedActionList.model = _actionModel
guidedActionList.visible = true
} else {
guidedActionsController.confirmAction(action)
}
}
onDisplayPreFlightChecklist: _root.displayPreFlightChecklist()
} }
model: flyViewToolStripActionList.model
} }
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQml.Models 2.12
import QGroundControl 1.0
import QGroundControl.Controls 1.0
ToolStripActionList {
signal displayPreFlightChecklist
model: [
PreFlightCheckListShowAction {
onTriggered: displayPreFlightChecklist()
},
GuidedActionTakeoff {
guidedController: guidedActionsController
},
GuidedActionLand {
guidedController: guidedActionsController
},
GuidedActionRTL {
guidedController: guidedActionsController
},
GuidedActionPause {
guidedController: guidedActionsController
},
GuidedActionActionList {
guidedController: guidedActionsController
}
]
}
...@@ -38,7 +38,7 @@ Item { ...@@ -38,7 +38,7 @@ Item {
property var mapControl property var mapControl
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _planMasterController: mainWindow.planMasterControllerPlanView property var _planMasterController: mainWindow.planMasterControllerFlyView
property var _missionController: _planMasterController.missionController property var _missionController: _planMasterController.missionController
property var _geoFenceController: _planMasterController.geoFenceController property var _geoFenceController: _planMasterController.geoFenceController
property var _rallyPointController: _planMasterController.rallyPointController property var _rallyPointController: _planMasterController.rallyPointController
...@@ -115,7 +115,6 @@ Item { ...@@ -115,7 +115,6 @@ Item {
maxHeight: parent.height - y - parentToolInsets.leftEdgeBottomInset - _toolsMargin maxHeight: parent.height - y - parentToolInsets.leftEdgeBottomInset - _toolsMargin
guidedActionsController: _guidedController guidedActionsController: _guidedController
guidedActionList: _guidedActionList guidedActionList: _guidedActionList
usePreFlightChecklist: preFlightChecklistPopup.useChecklist
visible: !QGroundControl.videoManager.fullScreen visible: !QGroundControl.videoManager.fullScreen
onDisplayPreFlightChecklist: preFlightChecklistPopup.open() onDisplayPreFlightChecklist: preFlightChecklistPopup.open()
......
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.actionListTitle
iconSource: "/res/action.svg"
visible: guidedController.showActionList
enabled: true
actionID: guidedController.actionActionList
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.landTitle
message: guidedController.landMessage
iconSource: "/res/land.svg"
visible: guidedController.showLand && !guidedController.showTakeoff
enabled: guidedController.showLand
actionID: guidedController.actionLand
}
...@@ -14,6 +14,7 @@ import QtQuick.Layouts 1.2 ...@@ -14,6 +14,7 @@ import QtQuick.Layouts 1.2
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
/// Dialog showing list of available guided actions /// Dialog showing list of available guided actions
...@@ -28,12 +29,41 @@ Rectangle { ...@@ -28,12 +29,41 @@ Rectangle {
property var guidedController property var guidedController
property var altitudeSlider property var altitudeSlider
property alias model: actionRepeater.model
function show() {
visible = true
}
property real _margins: Math.round(ScreenTools.defaultFontPixelHeight * 0.66) property real _margins: Math.round(ScreenTools.defaultFontPixelHeight * 0.66)
property real _actionWidth: ScreenTools.defaultFontPixelWidth * 25 property real _actionWidth: ScreenTools.defaultFontPixelWidth * 25
property real _actionHorizSpacing: ScreenTools.defaultFontPixelHeight * 2 property real _actionHorizSpacing: ScreenTools.defaultFontPixelHeight * 2
property var _model: [
{
title: guidedController.startMissionTitle,
text: guidedController.startMissionMessage,
action: guidedController.actionStartMission,
visible: guidedController.showStartMission
},
{
title: guidedController.continueMissionTitle,
text: guidedController.continueMissionMessage,
action: guidedController.actionContinueMission,
visible: guidedController.showContinueMission
},
{
title: guidedController.changeAltTitle,
text: guidedController.changeAltMessage,
action: guidedController.actionChangeAlt,
visible: guidedController.showChangeAlt
},
{
title: guidedController.landAbortTitle,
text: guidedController.landAbortMessage,
action: guidedController.actionLandAbort,
visible: guidedController.showLandAbort
}
]
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
...@@ -67,7 +97,8 @@ Rectangle { ...@@ -67,7 +97,8 @@ Rectangle {
spacing: _actionHorizSpacing spacing: _actionHorizSpacing
Repeater { Repeater {
id: actionRepeater id: actionRepeater
model: _model
ColumnLayout { ColumnLayout {
spacing: ScreenTools.defaultFontPixelHeight / 2 spacing: ScreenTools.defaultFontPixelHeight / 2
......
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.pauseTitle
iconSource: "/res/pause-mission.svg"
visible: guidedController.showPause
enabled: guidedController.showPause
actionID: guidedController.actionPause
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.rtlTitle
iconSource: "/res/rtl.svg"
visible: true
enabled: guidedController.showRTL
actionID: guidedController.actionRTL
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.FlightDisplay 1.0
GuidedToolStripAction {
text: guidedController.takeoffTitle
iconSource: "/res/takeoff.svg"
visible: guidedController.showTakeoff || !guidedController.showLand
enabled: guidedController.showTakeoff
actionID: guidedController.actionTakeoff
}
...@@ -52,6 +52,7 @@ Item { ...@@ -52,6 +52,7 @@ Item {
readonly property string gotoTitle: qsTr("Go To Location") readonly property string gotoTitle: qsTr("Go To Location")
readonly property string vtolTransitionTitle: qsTr("VTOL Transition") readonly property string vtolTransitionTitle: qsTr("VTOL Transition")
readonly property string roiTitle: qsTr("ROI") readonly property string roiTitle: qsTr("ROI")
readonly property string actionListTitle: qsTr("Action")
readonly property string armMessage: qsTr("Arm the vehicle.") readonly property string armMessage: qsTr("Arm the vehicle.")
readonly property string disarmMessage: qsTr("Disarm the vehicle") readonly property string disarmMessage: qsTr("Disarm the vehicle")
...@@ -95,6 +96,7 @@ Item { ...@@ -95,6 +96,7 @@ Item {
readonly property int actionVtolTransitionToFwdFlight: 20 readonly property int actionVtolTransitionToFwdFlight: 20
readonly property int actionVtolTransitionToMRFlight: 21 readonly property int actionVtolTransitionToMRFlight: 21
readonly property int actionROI: 22 readonly property int actionROI: 22
readonly property int actionActionList: 23
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
...@@ -114,6 +116,7 @@ Item { ...@@ -114,6 +116,7 @@ Item {
property bool showROI: _guidedActionsEnabled && !_hideROI && _vehicleFlying && activeVehicle.roiModeSupported && !_missionActive property bool showROI: _guidedActionsEnabled && !_hideROI && _vehicleFlying && activeVehicle.roiModeSupported && !_missionActive
property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _fixedWingOnApproach property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _fixedWingOnApproach
property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying
property bool showActionList: _guidedActionsEnabled && (showStartMission || showResumeMission || showChangeAlt || showLandAbort)
// Note: The '_missionItemCount - 2' is a hack to not trigger resume mission when a mission ends with an RTL item // Note: The '_missionItemCount - 2' is a hack to not trigger resume mission when a mission ends with an RTL item
property bool showResumeMission: activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < _missionItemCount - 2) property bool showResumeMission: activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < _missionItemCount - 2)
...@@ -412,6 +415,9 @@ Item { ...@@ -412,6 +415,9 @@ Item {
confirmDialog.message = roiMessage confirmDialog.message = roiMessage
confirmDialog.hideTrigger = Qt.binding(function() { return !showROI }) confirmDialog.hideTrigger = Qt.binding(function() { return !showROI })
break; break;
case actionActionList:
actionList.show()
return
default: default:
console.warn("Unknown actionCode", actionCode) console.warn("Unknown actionCode", actionCode)
return return
......
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl.Controls 1.0
ToolStripAction {
property var guidedController
property int actionID
property string message
onTriggered: {
guidedActionsController.closeAll()
if (actionID === -1) {
// FIXME: NYI
guidedActionList.model = _actionModel
guidedActionList.visible = true
} else {
guidedController.confirmAction(actionID)
}
}
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QGroundControl 1.0
import QGroundControl.Controls 1.0
ToolStripAction {
text: qsTr("Checklist")
iconSource: "/qmlimages/check.svg"
visible: _useChecklist
enabled: _useChecklist && _activeVehicle && !_activeVehicle.armed
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
}
This diff is collapsed.
...@@ -106,6 +106,8 @@ ...@@ -106,6 +106,8 @@
#include "RCToParamDialogController.h" #include "RCToParamDialogController.h"
#include "QGCImageProvider.h" #include "QGCImageProvider.h"
#include "TerrainProfile.h" #include "TerrainProfile.h"
#include "ToolStripAction.h"
#include "ToolStripActionList.h"
#if defined(QGC_ENABLE_PAIRING) #if defined(QGC_ENABLE_PAIRING)
#include "PairingManager.h" #include "PairingManager.h"
...@@ -559,6 +561,8 @@ void QGCApplication::_initCommon() ...@@ -559,6 +561,8 @@ void QGCApplication::_initCommon()
qmlRegisterType<RCToParamDialogController> (kQGCControllers, 1, 0, "RCToParamDialogController"); qmlRegisterType<RCToParamDialogController> (kQGCControllers, 1, 0, "RCToParamDialogController");
qmlRegisterType<TerrainProfile> ("QGroundControl.Controls", 1, 0, "TerrainProfile"); qmlRegisterType<TerrainProfile> ("QGroundControl.Controls", 1, 0, "TerrainProfile");
qmlRegisterType<ToolStripAction> ("QGroundControl.Controls", 1, 0, "ToolStripAction");
qmlRegisterType<ToolStripActionList> ("QGroundControl.Controls", 1, 0, "ToolStripActionList");
#ifndef __mobile__ #ifndef __mobile__
#ifndef NO_SERIAL_LINK #ifndef NO_SERIAL_LINK
......
...@@ -40,8 +40,10 @@ Item { ...@@ -40,8 +40,10 @@ Item {
property real _viewportMaxBottom: parent.parent.height - parent.y property real _viewportMaxBottom: parent.parent.height - parent.y
property real _viewportMaxHeight: _viewportMaxBottom - _viewportMaxTop property real _viewportMaxHeight: _viewportMaxBottom - _viewportMaxTop
property var _dropPanelCancel property var _dropPanelCancel
property var _parentButton
function show(panelEdgeTopPoint, panelComponent) { function show(panelEdgeTopPoint, panelComponent, parentButton) {
_parentButton = parentButton
_dropEdgeTopPoint = panelEdgeTopPoint _dropEdgeTopPoint = panelEdgeTopPoint
_dropDownComponent = panelComponent _dropDownComponent = panelComponent
_calcPositions() _calcPositions()
...@@ -52,13 +54,9 @@ Item { ...@@ -52,13 +54,9 @@ Item {
function hide() { function hide() {
if (_dropPanelCancel) { if (_dropPanelCancel) {
_dropPanelCancel.destroy() _dropPanelCancel.destroy()
} _parentButton.checked = false
if (visible) {
visible = false visible = false
_dropDownComponent = undefined _dropDownComponent = undefined
if (toolStrip.lastClickedButton) {
toolStrip.lastClickedButton.checked = false
}
} }
} }
......
...@@ -9,12 +9,19 @@ FlyViewMap 1.0 FlyViewMap.qml ...@@ -9,12 +9,19 @@ FlyViewMap 1.0 FlyViewMap.qml
FlyViewMissionCompleteDialog 1.0 FlyViewMissionCompleteDialog.qml FlyViewMissionCompleteDialog 1.0 FlyViewMissionCompleteDialog.qml
FlyViewPreFlightChecklistPopup 1.0 FlyViewPreFlightChecklistPopup.qml FlyViewPreFlightChecklistPopup 1.0 FlyViewPreFlightChecklistPopup.qml
FlyViewToolStrip 1.0 FlyViewToolStrip.qml FlyViewToolStrip 1.0 FlyViewToolStrip.qml
FlyViewToolStripActionList 1.0 FlyViewToolStripActionList.qml
FlyViewVideo 1.0 FlyViewVideo.qml FlyViewVideo 1.0 FlyViewVideo.qml
FlyViewWidgetLayer 1.0 FlyViewWidgetLayer.qml FlyViewWidgetLayer 1.0 FlyViewWidgetLayer.qml
GuidedActionActionList 1.0 GuidedActionActionList.qml
GuidedActionConfirm 1.0 GuidedActionConfirm.qml GuidedActionConfirm 1.0 GuidedActionConfirm.qml
GuidedActionList 1.0 GuidedActionList.qml
GuidedActionsController 1.0 GuidedActionsController.qml GuidedActionsController 1.0 GuidedActionsController.qml
GuidedActionLand 1.0 GuidedActionLand.qml
GuidedActionList 1.0 GuidedActionList.qml
GuidedActionPause 1.0 GuidedActionPause.qml
GuidedActionRTL 1.0 GuidedActionRTL.qml
GuidedAltitudeSlider 1.0 GuidedAltitudeSlider.qml GuidedAltitudeSlider 1.0 GuidedAltitudeSlider.qml
GuidedActionTakeoff 1.0 GuidedActionTakeoff.qml
GuidedToolStripAction 1.0 GuidedToolStripAction.qml
MultiVehicleList 1.0 MultiVehicleList.qml MultiVehicleList 1.0 MultiVehicleList.qml
MultiVehiclePanel 1.0 MultiVehiclePanel.qml MultiVehiclePanel 1.0 MultiVehiclePanel.qml
PreFlightBatteryCheck 1.0 PreFlightBatteryCheck.qml PreFlightBatteryCheck 1.0 PreFlightBatteryCheck.qml
......
...@@ -26,35 +26,16 @@ Rectangle { ...@@ -26,35 +26,16 @@ Rectangle {
property real maxHeight ///< Maximum height for control, determines whether text is hidden to make control shorter property real maxHeight ///< Maximum height for control, determines whether text is hidden to make control shorter
property alias title: titleLabel.text property alias title: titleLabel.text
property AbstractButton lastClickedButton: null
function simulateClick(buttonIndex) { function simulateClick(buttonIndex) {
buttonIndex = buttonIndex + 1 // skip over title buttonIndex = buttonIndex + 1 // skip over title
if (!toolStripColumn.children[buttonIndex].checked) { toolStripColumn.children[buttonIndex].clicked()
toolStripColumn.children[buttonIndex].checked = true
toolStripColumn.children[buttonIndex].clicked()
}
} }
// Ensure we don't get narrower than content // Ensure we don't get narrower than content
property real _idealWidth: (ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 8) + toolStripColumn.anchors.margins * 2 property real _idealWidth: (ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 8) + toolStripColumn.anchors.margins * 2
signal clicked(int index, bool checked)
signal dropped(int index) signal dropped(int index)
function setChecked(idx, check) {
repeater.itemAt(idx).checked = check
}
function getChecked(idx) {
return repeater.itemAt(idx).checked
}
ButtonGroup {
id: buttonGroup
buttons: toolStripColumn.children
}
DeadMouseArea { DeadMouseArea {
anchors.fill: parent anchors.fill: parent
} }
...@@ -98,27 +79,25 @@ Rectangle { ...@@ -98,27 +79,25 @@ Rectangle {
fontPointSize: ScreenTools.smallFontPointSize fontPointSize: ScreenTools.smallFontPointSize
autoExclusive: true autoExclusive: true
enabled: modelData.buttonEnabled enabled: modelData.enabled
visible: modelData.buttonVisible visible: modelData.visible
imageSource: modelData.showAlternateIcon ? modelData.alternateIconSource : modelData.iconSource imageSource: modelData.showAlternateIcon ? modelData.alternateIconSource : modelData.iconSource
text: modelData.name text: modelData.text
checked: modelData.checked !== undefined ? modelData.checked : checked checked: modelData.checked
checkable: modelData.dropPanelComponent || modelData.checkable
ButtonGroup.group: buttonGroup onCheckedChanged: modelData.checked = checked
// Only drop panel and toggleable are checkable
checkable: modelData.dropPanelComponent !== undefined || (modelData.toggle !== undefined && modelData.toggle)
onClicked: { onClicked: {
dropPanel.hide() // DropPanel will call hide on "lastClickedButton" dropPanel.hide()
if (modelData.dropPanelComponent === undefined) { if (!modelData.dropPanelComponent) {
_root.clicked(index, checked) modelData.triggered(this)
} else if (checked) { } else if (checked) {
var panelEdgeTopPoint = mapToItem(_root, width, 0) var panelEdgeTopPoint = mapToItem(_root, width, 0)
dropPanel.show(panelEdgeTopPoint, modelData.dropPanelComponent) dropPanel.show(panelEdgeTopPoint, modelData.dropPanelComponent, this)
checked = true
_root.dropped(index) _root.dropped(index)
} }
if(_root && buttonTemplate)
_root.lastClickedButton = buttonTemplate
} }
} }
} }
......
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "ToolStripAction.h"
ToolStripAction::ToolStripAction(QObject* parent)
: QObject(parent)
{
}
void ToolStripAction::setEnabled(bool enabled)
{
if (enabled != _enabled) {
_enabled = enabled;
emit enabledChanged(enabled);
}
}
void ToolStripAction::setVisible(bool visible)
{
if (visible != _visible) {
_visible = visible;
emit visibleChanged(visible);
}
}
void ToolStripAction::setCheckable(bool checkable)
{
if (checkable != _checkable) {
_checkable = checkable;
emit checkableChanged(checkable);
}
}
void ToolStripAction::setChecked(bool checked)
{
if (checked != _checked) {
_checked = checked;
emit checkedChanged(checked);
}
}
void ToolStripAction::setShowAlternateIcon(bool showAlternateIcon)
{
if (showAlternateIcon != _showAlternateIcon) {
_showAlternateIcon = showAlternateIcon;
emit showAlternateIconChanged(showAlternateIcon);
}
}
void ToolStripAction::setText(const QString& text)
{
if (text != _text) {
_text = text;
emit textChanged(text);
}
}
void ToolStripAction::setIconSource(const QString& iconSource)
{
if (iconSource != _iconSource) {
_iconSource = iconSource;
emit iconSourceChanged(iconSource);
}
}
void ToolStripAction::setAlternateIconSource(const QString& alternateIconSource)
{
if (alternateIconSource != _alternateIconSource) {
_alternateIconSource = alternateIconSource;
emit alternateIconSourceChanged(alternateIconSource);
}
}
void ToolStripAction::setDropPanelComponent(QQmlComponent* dropPanelComponent)
{
_dropPanelComponent = dropPanelComponent;
emit dropPanelComponentChanged();
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include <QObject>
#include <QVariant>
#include <QQmlComponent>
class ToolStripAction : public QObject
{
Q_OBJECT
public:
ToolStripAction(QObject* parent = nullptr);
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(bool checkable READ checkable WRITE setCheckable NOTIFY checkableChanged)
Q_PROPERTY(bool checked READ checked WRITE setChecked NOTIFY checkedChanged)
Q_PROPERTY(bool showAlternateIcon READ showAlternateIcon WRITE setShowAlternateIcon NOTIFY showAlternateIconChanged)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
Q_PROPERTY(QString iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged)
Q_PROPERTY(QString alternateIconSource READ alternateIconSource WRITE setAlternateIconSource NOTIFY alternateIconSourceChanged)
Q_PROPERTY(QQmlComponent* dropPanelComponent READ dropPanelComponent WRITE setDropPanelComponent NOTIFY dropPanelComponentChanged)
bool enabled (void) const { return _enabled; }
bool visible (void) const { return _visible; }
bool checkable (void) const { return _checkable; }
bool checked (void) const { return _checked; }
bool showAlternateIcon (void) const { return _showAlternateIcon; }
QString text (void) const { return _text; }
QString iconSource (void) const { return _iconSource; }
QString alternateIconSource (void) const { return _alternateIconSource; }
QQmlComponent* dropPanelComponent (void) const { return _dropPanelComponent; }
void setEnabled (bool enabled);
void setVisible (bool visible);
void setCheckable (bool checkable);
void setChecked (bool checked);
void setShowAlternateIcon (bool showAlternateIcon);
void setText (const QString& text);
void setIconSource (const QString& iconSource);
void setAlternateIconSource (const QString& alternateIconSource);
void setDropPanelComponent (QQmlComponent* dropPanelComponent);
signals:
void enabledChanged (bool enabled);
void visibleChanged (bool visible);
void checkableChanged (bool checkable);
void checkedChanged (bool checked);
void showAlternateIconChanged (bool showAlternateIcon);
void textChanged (QString text);
void iconSourceChanged (QString iconSource);
void alternateIconSourceChanged (QString alternateIconSource);
void triggered (QObject* source);
void dropPanelComponentChanged (void);
protected:
bool _enabled = true;
bool _visible = true;
bool _checkable = false;
bool _checked = false;
bool _showAlternateIcon = false;
QString _text;
QString _iconSource;
QString _alternateIconSource;
QQmlComponent* _dropPanelComponent = nullptr;
};
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "ToolStripActionList.h"
ToolStripActionList::ToolStripActionList(QObject* parent)
: QObject(parent)
{
}
QQmlListProperty<QObject> ToolStripActionList::model(void)
{
return QQmlListProperty<QObject>(this, this,
&ToolStripActionList::append,
&ToolStripActionList::count,
&ToolStripActionList::at,
&ToolStripActionList::clear);
}
void ToolStripActionList::append(QQmlListProperty<QObject>* qmlListProperty, QObject* value) {
reinterpret_cast<ToolStripActionList*>(qmlListProperty->data)->_objectList.append(value);
}
void ToolStripActionList::clear(QQmlListProperty<QObject>* qmlListProperty) {
reinterpret_cast<ToolStripActionList*>(qmlListProperty->data)->_objectList.clear();
}
QObject* ToolStripActionList::at(QQmlListProperty<QObject>* qmlListProperty, int index) {
return reinterpret_cast<ToolStripActionList*>(qmlListProperty->data)->_objectList[index];
}
int ToolStripActionList::count(QQmlListProperty<QObject>* qmlListProperty) {
return reinterpret_cast<ToolStripActionList*>(qmlListProperty->data)->_objectList.count();
}
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include <QObject>
#include <QQmlListProperty>
class ToolStripActionList : public QObject
{
Q_OBJECT
public:
ToolStripActionList(QObject* parent = nullptr);
Q_PROPERTY(QQmlListProperty<QObject> model READ model NOTIFY modelChanged)
QQmlListProperty<QObject> model();
signals:
void modelChanged(void);
private:
static void append (QQmlListProperty<QObject>* qmlListProperty, QObject* value);
static int count (QQmlListProperty<QObject>* qmlListProperty);
static QObject* at (QQmlListProperty<QObject>*, int index);
static void clear (QQmlListProperty<QObject>* qmlListProperty);
QList<QObject*> _objectList;
};
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