From fed816bc93f31f6a81f2194dede25a1a1032e878 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Tue, 16 Apr 2019 14:37:02 -0300 Subject: [PATCH] Add Plan/Fly switch to ToolStrip --- src/FlightDisplay/FlightDisplayView.qml | 28 ++++++++---- src/PlanView/PlanView.qml | 57 ++++++++++++++----------- 2 files changed, 52 insertions(+), 33 deletions(-) diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 3c0ada586..c14e84b1c 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -570,8 +570,9 @@ Item { anchors.top: _mapAndVideo.top z: _mapAndVideo.z + 4 maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y - buttonVisible: [_useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, _guidedController.showPause, !_guidedController.showPause ] - buttonEnabled: [_useChecklist && activeVehicle, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ] + + buttonVisible: [true, _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, _guidedController.showPause, !_guidedController.showPause ] + buttonEnabled: [true, _useChecklist && activeVehicle, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ] property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort property var _actionModel: [ @@ -609,8 +610,12 @@ Item { model: [ { - name: "Checklist", - iconSource: "/qmlimages/check.svg", + name: "Plan", + iconSource: "/qmlimages/Plan.svg", + }, + { + name: "Checklist", + iconSource: "/qmlimages/check.svg", dropPanelComponent: checklistDropPanel }, { @@ -642,13 +647,18 @@ Item { onClicked: { guidedActionsController.closeAll() - var action = model[index].action - if (action === -1) { - guidedActionList.model = _actionModel - guidedActionList.visible = true + if(index === 0) { + mainWindow.showPlanView() } else { - _guidedController.confirmAction(action) + var action = model[index].action + if (action === -1) { + guidedActionList.model = _actionModel + guidedActionList.visible = true + } else { + _guidedController.confirmAction(action) + } } + } } diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index bee5fd752..5aa5d1609 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -544,15 +544,21 @@ Item { anchors.topMargin: _toolButtonTopMargin + anchors.leftMargin anchors.top: parent.top z: QGroundControl.zOrderWidgets - showAlternateIcon: [ _planMasterController.dirty, false, false, false, false, false, false ] - rotateImage: [ _planMasterController.syncInProgress, false, false, false, false, false, false ] - animateImage: [ _planMasterController.dirty, false, false, false, false, false, false ] - buttonEnabled: [ !_planMasterController.syncInProgress, true, true, true, true, true, true ] - buttonVisible: [ true, true, _waypointsOnlyMode, true, true, _showZoom, _showZoom ] + + showAlternateIcon: [ false, _planMasterController.dirty, false, false, false, false, false, false ] + rotateImage: [ false, _planMasterController.syncInProgress, false, false, false, false, false, false ] + animateImage: [ false, _planMasterController.dirty, false, false, false, false, false, false ] + buttonEnabled: [ true, !_planMasterController.syncInProgress, true, true, true, true, true, true ] + buttonVisible: [ true, true, true, _waypointsOnlyMode, true, true, false, false ] maxHeight: mapScale.y - toolStrip.y + property bool _showZoom: !ScreenTools.isMobile model: [ + { + name: qsTr("Fly"), + iconSource: "/qmlimages/PaperPlane.svg", + }, { name: qsTr("File"), iconSource: "/qmlimages/MapSync.svg", @@ -591,25 +597,28 @@ Item { onClicked: { switch (index) { - case 1: - _addWaypointOnClick = checked - _addROIOnClick = false - break - case 2: - _addROIOnClick = checked - _addWaypointOnClick = false - break - case 3: - if (_singleComplexItem) { - addComplexItem(_missionController.complexMissionItemNames[0]) - } - break - case 5: - editorMap.zoomLevel += 0.5 - break - case 6: - editorMap.zoomLevel -= 0.5 - break + case 0: + mainWindow.showFlyView() + break; + case 2: + _addWaypointOnClick = checked + _addROIOnClick = false + break + case 3: + _addROIOnClick = checked + _addWaypointOnClick = false + break + case 4: + if (_singleComplexItem) { + addComplexItem(_missionController.complexMissionItemNames[0]) + } + break + case 6: + editorMap.zoomLevel += 0.5 + break + case 7: + editorMap.zoomLevel -= 0.5 + break } } } -- 2.22.0