From 29f03bba663be90cc5786089e576cea37bf857b0 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Sun, 3 Jun 2018 10:06:03 -0700 Subject: [PATCH] More PreFlight control reorganization --- qgroundcontrol.qrc | 6 +- src/FlightDisplay/FlightDisplayView.qml | 58 +-------- src/FlightDisplay/PreFlightCheckList.qml | 110 ------------------ src/FlightDisplay/PreFlightCheckModel.qml | 95 +++++++++++++++ src/FlightDisplay/qmldir | 2 +- src/QGCPalette.cc | 2 +- src/QmlControls/PreFlightCheckButton.qml | 19 ++- src/QmlControls/PreFlightCheckGroup.qml | 69 +++++++++++ src/QmlControls/PreFlightCheckList.qml | 93 +++++++++++++++ src/QmlControls/QGCLabel.qml | 2 - .../QGroundControl.Controls.qmldir | 2 + .../SectionHeader.qml | 2 +- 12 files changed, 284 insertions(+), 176 deletions(-) delete mode 100644 src/FlightDisplay/PreFlightCheckList.qml create mode 100644 src/FlightDisplay/PreFlightCheckModel.qml create mode 100644 src/QmlControls/PreFlightCheckGroup.qml create mode 100644 src/QmlControls/PreFlightCheckList.qml rename src/{PlanView => QmlControls}/SectionHeader.qml (97%) diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index f6ac32a32..ef33ca4bd 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -89,6 +89,8 @@ src/QmlControls/PIDTuning.qml src/PlanView/PlanToolBar.qml src/QmlControls/PreFlightCheckButton.qml + src/QmlControls/PreFlightCheckGroup.qml + src/QmlControls/PreFlightCheckList.qml src/QmlControls/QGCButton.qml src/QmlControls/QGCCheckBox.qml src/QmlControls/QGCColoredImage.qml @@ -121,7 +123,7 @@ src/PlanView/RallyPointMapVisuals.qml src/QmlControls/RCChannelMonitor.qml src/QmlControls/RoundButton.qml - src/PlanView/SectionHeader.qml + src/QmlControls/SectionHeader.qml src/AutoPilotPlugins/Common/SetupPage.qml src/ui/toolbar/SignalStrength.qml src/PlanView/SimpleItemMapVisual.qml @@ -154,7 +156,7 @@ src/FlightDisplay/MultiVehicleList.qml src/FlightDisplay/PreFlightAHRSCheck.qml src/FlightDisplay/PreFlightBatteryCheck.qml - src/FlightDisplay/PreFlightCheckList.qml + src/FlightDisplay/PreFlightCheckModel.qml src/FlightDisplay/PreFlightRCCheck.qml src/FlightDisplay/PreFlightSensorsCheck.qml src/FlightDisplay/PreFlightSoundCheck.qml diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index cee59e8fb..8212ac80a 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -112,8 +112,8 @@ QGCView { Component.onCompleted: start(true /* flyView */) } - PreFlightCheckList { - id: preFlightCheckList + PreFlightCheckModel { + id: preFlightCheckModel } Connections { @@ -691,56 +691,8 @@ QGCView { Component { id: checklistDropPanel - Rectangle { - id: checklistRect - visible: true - width: mainColumn.width + 3*ScreenTools.defaultFontPixelWidth - height: mainColumn.height + ScreenTools.defaultFontPixelHeight - color: qgcPal.windowShade - radius: 3 - enabled: QGroundControl.multiVehicleManager.vehicles.count > 0; - - Column { - id: mainColumn - width: 40*ScreenTools.defaultFontPixelWidth - spacing: 0.8*ScreenTools.defaultFontPixelWidth - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: 0.6*ScreenTools.defaultFontPixelWidth - anchors.leftMargin: 1.5*ScreenTools.defaultFontPixelWidth - - // Header/title of checklist - Item { - width: parent.width - height: 1.75*ScreenTools.defaultFontPixelHeight - - QGCLabel { - text: _activeVehicle ? qsTr("Pre-Flight Checklist") : qsTr("Pre-flight checklist (no vehicle)") - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - font.pointSize: ScreenTools.mediumFontPointSize - } - QGCButton { - width: 1.2*ScreenTools.defaultFontPixelHeight - height: 1.2*ScreenTools.defaultFontPixelHeight - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - opacity : 0.2+0.8*(QGroundControl.multiVehicleManager.vehicles.count > 0) - tooltip: qsTr("Reset the checklist (e.g. after a vehicle reboot)") - - onClicked: preFlightCheckList.reset() - - Image { source:"/qmlimages/MapSyncBlack.svg" ; anchors.fill: parent } - } - } - - Rectangle {width:parent.width ; height:1 ; color:qgcPal.text} - - // All check list items - Repeater { - model: preFlightCheckList.checkListItems - } - } // Column - } //Rectangle + PreFlightCheckList { + model: preFlightCheckModel + } } //Component } //QGC View diff --git a/src/FlightDisplay/PreFlightCheckList.qml b/src/FlightDisplay/PreFlightCheckList.qml deleted file mode 100644 index f4ebfbeaa..000000000 --- a/src/FlightDisplay/PreFlightCheckList.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -import QtQuick 2.3 -import QtQml.Models 2.1 - -import QGroundControl 1.0 -import QGroundControl.FlightDisplay 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.Vehicle 1.0 - -// This class stores the data and functions of the check list but NOT the GUI (which is handled somewhere else). -Item { - // Properties - property ObjectModel checkListItems: _checkListItems - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - property int _checkState: _activeVehicle ? (_activeVehicle.armed ? 1 + (buttonActuators.state + buttonMotors.state + buttonMission.state + buttonSoundOutput.state) / 4 / 4 : 0) : 0 ; // Shows progress of checks inside the checklist - unlocks next check steps in groups - - function reset() { - buttonHardware.reset(); - buttonBattery.reset(); - buttonRC.reset(); - buttonActuators.reset(); - buttonMotors.reset(); - buttonMission.reset(); - buttonSoundOutput.reset(); - buttonPayload.reset(); - buttonWeather.reset(); - buttonFlightAreaFree.reset(); - } - - // Check list item data - ObjectModel { - id: _checkListItems - - // Standard check list items (group 0) - Available from the start - PreFlightCheckButton { - id: buttonHardware - name: qsTr("Hardware") - manualText: qsTr("Props mounted? Wings secured? Tail secured?") - } - PreFlightBatteryCheck { - id: buttonBattery - failureVoltage: 40 - } - PreFlightSensorsCheck { - id: buttonSensors - } - PreFlightRCCheck { - id: buttonRC - } - PreFlightAHRSCheck { - id: buttonEstimator - } - - // Check list item group 1 - Require arming - QGCLabel {text:qsTr("Please arm the vehicle here.") ; opacity: 0.2+0.8*(QGroundControl.multiVehicleManager.vehicles.count > 0) ; anchors.horizontalCenter:buttonHardware.horizontalCenter ; anchors.topMargin:40 ; anchors.bottomMargin:40;} - PreFlightCheckButton { - id: buttonActuators - name: qsTr("Actuators") - group: 1 - manualText: qsTr("Move all control surfaces. Did they work properly?") - } - PreFlightCheckButton { - id: buttonMotors - name: qsTr("Motors") - group: 1 - manualText: qsTr("Propellers free? Then throttle up gently. Working properly?") - } - PreFlightCheckButton { - id: buttonMission - name: qsTr("Mission") - group: 1 - manualText: qsTr("Please confirm mission is valid (waypoints valid, no terrain collision).") - } - PreFlightSoundCheck { - id: buttonSoundOutput - group: 1 - } - - // Check list item group 2 - Final checks before launch - QGCLabel {text:qsTr("Last preparations before launch") ; opacity : 0.2+0.8*(_checkState >= 2); anchors.horizontalCenter:buttonHardware.horizontalCenter} - PreFlightCheckButton { - id: buttonPayload - name: qsTr("Payload") - group: 2 - manualText: qsTr("Configured and started? Payload lid closed?") - } - PreFlightCheckButton { - id: buttonWeather - name: "Wind & weather" - group: 2 - manualText: qsTr("OK for your platform? Lauching into the wind?") - } - PreFlightCheckButton { - id: buttonFlightAreaFree - name: qsTr("Flight area") - group: 2 - manualText: qsTr("Launch area and path free of obstacles/people?") - } - } // Object Model -} diff --git a/src/FlightDisplay/PreFlightCheckModel.qml b/src/FlightDisplay/PreFlightCheckModel.qml new file mode 100644 index 000000000..db55e2e75 --- /dev/null +++ b/src/FlightDisplay/PreFlightCheckModel.qml @@ -0,0 +1,95 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.3 +import QtQml.Models 2.1 + +import QGroundControl 1.0 +import QGroundControl.FlightDisplay 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Vehicle 1.0 + +ObjectModel { + PreFlightCheckGroup { + name: qsTr("Initial checks") + + // Standard check list items (group 0) - Available from the start + PreFlightCheckButton { + id: buttonHardware + name: qsTr("Hardware") + manualText: qsTr("Props mounted? Wings secured? Tail secured?") + } + PreFlightBatteryCheck { + id: buttonBattery + failureVoltage: 40 + } + PreFlightSensorsCheck { + id: buttonSensors + } + PreFlightRCCheck { + id: buttonRC + } + PreFlightAHRSCheck { + id: buttonEstimator + } + } + + PreFlightCheckGroup { + name: qsTr("Please arm the vehicle here") + + PreFlightCheckButton { + id: buttonActuators + name: qsTr("Actuators") + group: 1 + manualText: qsTr("Move all control surfaces. Did they work properly?") + } + PreFlightCheckButton { + id: buttonMotors + name: qsTr("Motors") + group: 1 + manualText: qsTr("Propellers free? Then throttle up gently. Working properly?") + } + PreFlightCheckButton { + id: buttonMission + name: qsTr("Mission") + group: 1 + manualText: qsTr("Please confirm mission is valid (waypoints valid, no terrain collision).") + } + PreFlightSoundCheck { + id: buttonSoundOutput + group: 1 + } + } + + PreFlightCheckGroup { + name: qsTr("Last preparations before launch") + + // Check list item group 2 - Final checks before launch + PreFlightCheckButton { + id: buttonPayload + name: qsTr("Payload") + group: 2 + manualText: qsTr("Configured and started? Payload lid closed?") + } + PreFlightCheckButton { + id: buttonWeather + name: "Wind & weather" + group: 2 + manualText: qsTr("OK for your platform? Lauching into the wind?") + } + PreFlightCheckButton { + id: buttonFlightAreaFree + name: qsTr("Flight area") + group: 2 + manualText: qsTr("Launch area and path free of obstacles/people?") + } + } +} // Object Model diff --git a/src/FlightDisplay/qmldir b/src/FlightDisplay/qmldir index c77b04753..d25637f55 100644 --- a/src/FlightDisplay/qmldir +++ b/src/FlightDisplay/qmldir @@ -11,7 +11,7 @@ GuidedAltitudeSlider 1.0 GuidedAltitudeSlider.qml MultiVehicleList 1.0 MultiVehicleList.qml PreFlightBatteryCheck 1.0 PreFlightBatteryCheck.qml PreFlightAHRSCheck 1.0 PreFlightAHRSCheck.qml -PreFlightCheckList 1.0 PreFlightCheckList.qml +PreFlightCheckModel 1.0 PreFlightCheckModel.qml PreFlightRCCheck 1.0 PreFlightRCCheck.qml PreFlightSensorsCheck 1.0 PreFlightSensorsCheck.qml PreFlightSoundCheck 1.0 PreFlightSoundCheck.qml diff --git a/src/QGCPalette.cc b/src/QGCPalette.cc index ec5ac8fa7..90635f521 100644 --- a/src/QGCPalette.cc +++ b/src/QGCPalette.cc @@ -51,7 +51,7 @@ void QGCPalette::_buildMap(void) DECLARE_QGC_COLOR(window, "#ffffff", "#ffffff", "#222222", "#222222") DECLARE_QGC_COLOR(windowShade, "#d9d9d9", "#d9d9d9", "#333333", "#333333") DECLARE_QGC_COLOR(windowShadeDark, "#bdbdbd", "#bdbdbd", "#282828", "#282828") - DECLARE_QGC_COLOR(text, "#9d9d9d", "#000000", "#a0a0a0", "#ffffff") + DECLARE_QGC_COLOR(text, "#9d9d9d", "#000000", "#707070", "#ffffff") DECLARE_QGC_COLOR(warningText, "#cc0808", "#cc0808", "#f85761", "#f85761") DECLARE_QGC_COLOR(button, "#ffffff", "#ffffff", "#707070", "#626270") DECLARE_QGC_COLOR(buttonText, "#9d9d9d", "#000000", "#202020", "#ffffff") diff --git a/src/QmlControls/PreFlightCheckButton.qml b/src/QmlControls/PreFlightCheckButton.qml index 45a62552f..3a5ca14b7 100644 --- a/src/QmlControls/PreFlightCheckButton.qml +++ b/src/QmlControls/PreFlightCheckButton.qml @@ -15,8 +15,9 @@ import QGroundControl 1.0 import QGroundControl.Palette 1.0 import QGroundControl.ScreenTools 1.0 -/// The PreFlightCheckButtons supports creating a button which the user then has to verify/click to confirm a check. -/// It also supports failing the check based on values from within the system: telemetry or QGC app values. +/// The PreFlightCheckButton supports creating a button which the user then has to verify/click to confirm a check. +/// It also supports failing the check based on values from within the system: telemetry or QGC app values. These +/// controls are normally placed within a PreFlightCheckGroup. /// /// Two types of checks may be included on the button: /// Manual - This is simply a check which the user must verify and confirm. It is not based on any system state. @@ -62,8 +63,6 @@ QGCButton { property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _allowTelemetryFailureOverride: telemetryTextOverride !== "" - enabled: preFlightCheckList._checkState >= group - opacity: 0.2 + (0.8 * (preFlightCheckList._checkState >= group)) width: 40 * ScreenTools.defaultFontPixelWidth style: ButtonStyle { @@ -77,7 +76,6 @@ QGCButton { background: Rectangle { color: qgcPal.button border.color: qgcPal.button; - radius: 3 Rectangle { color: _color @@ -121,8 +119,17 @@ QGCButton { } } + onPassedChanged: callButtonPassedChanged() + onParentChanged: callButtonPassedChanged() + + function callButtonPassedChanged() { + if (typeof parent.buttonPassedChanged === "function") { + parent.buttonPassedChanged() + } + } + function reset() { - _manualState = manualText === "" ? statePass : _statePending + _manualState = manualText === "" ? _statePassed : _statePending if (telemetryFailure) { _telemetryState = _allowTelemetryFailureOverride ? _statePending : _stateFailed } else { diff --git a/src/QmlControls/PreFlightCheckGroup.qml b/src/QmlControls/PreFlightCheckGroup.qml new file mode 100644 index 000000000..0cb9c2845 --- /dev/null +++ b/src/QmlControls/PreFlightCheckGroup.qml @@ -0,0 +1,69 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.3 +import QtQml.Models 2.1 + +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 + +/// A PreFlightCheckGroup manages a set of PreFlightCheckButtons as a single entity. +Column { + property string name + property bool passed: false + + spacing: ScreenTools.defaultFontPixelHeight / 2 + + property alias _checked: header.checked + + onPassedChanged: { + parent.groupPassedChanged(ObjectModel.index) + if (passed) { + header.checked = false + } + } + + Component.onCompleted: { + enabled = _checked + var moveList = [] + for (var i=2; i + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQml.Models 2.1 + +import QGroundControl 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Controls 1.0 + +Rectangle { + width: mainColumn.width + 3*ScreenTools.defaultFontPixelWidth + height: mainColumn.height + ScreenTools.defaultFontPixelHeight + color: qgcPal.windowShade + radius: 3 + + property alias model: checkListRepeater.model + + property bool _passed: false + + function reset() { + for (var i=0; i 0) + tooltip: qsTr("Reset the checklist (e.g. after a vehicle reboot)") + + onClicked: reset() + + Image { source:"/qmlimages/MapSyncBlack.svg" ; anchors.fill: parent } + } + } + + // All check list items + Repeater { + id: checkListRepeater + } + } // Column +} //Rectangle diff --git a/src/QmlControls/QGCLabel.qml b/src/QmlControls/QGCLabel.qml index 32176837c..2700e02d9 100644 --- a/src/QmlControls/QGCLabel.qml +++ b/src/QmlControls/QGCLabel.qml @@ -8,8 +8,6 @@ import QGroundControl.ScreenTools 1.0 Text { QGCPalette { id: __qgcPal; colorGroupEnabled: enabled } - property bool enabled: true - font.pointSize: ScreenTools.defaultFontPointSize font.family: ScreenTools.normalFontFamily color: __qgcPal.text diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir index 25a33440c..963168263 100644 --- a/src/QmlControls/QGroundControl.Controls.qmldir +++ b/src/QmlControls/QGroundControl.Controls.qmldir @@ -35,6 +35,8 @@ ParameterEditorDialog 1.0 ParameterEditorDialog.qml PIDTuning 1.0 PIDTuning.qml PlanToolBar 1.0 PlanToolBar.qml PreFlightCheckButton 1.0 PreFlightCheckButton.qml +PreFlightCheckGroup 1.0 PreFlightCheckGroup.qml +PreFlightCheckList 1.0 PreFlightCheckList.qml QGCButton 1.0 QGCButton.qml QGCCheckBox 1.0 QGCCheckBox.qml QGCColoredImage 1.0 QGCColoredImage.qml diff --git a/src/PlanView/SectionHeader.qml b/src/QmlControls/SectionHeader.qml similarity index 97% rename from src/PlanView/SectionHeader.qml rename to src/QmlControls/SectionHeader.qml index 55527010b..06c9a2ca5 100644 --- a/src/PlanView/SectionHeader.qml +++ b/src/QmlControls/SectionHeader.qml @@ -24,7 +24,7 @@ FocusScope { exclusiveGroup.bindCheckable(_root) } - QGCPalette { id: qgcPal; colorGroupEnabled: true } + QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCMouseArea { anchors.fill: parent -- 2.22.0