diff --git a/src/FlyView/FlyView.qml b/src/FlyView/FlyView.qml index 371dbe2a1c7..65da98492d6 100644 --- a/src/FlyView/FlyView.qml +++ b/src/FlyView/FlyView.qml @@ -130,7 +130,6 @@ Item { parentToolInsets: _toolInsets mapControl: _mapControl visible: !QGroundControl.videoManager.fullScreen - utmspActTrigger: utmspSendActTrigger isViewer3DOpen: viewer3DWindow.isOpen } @@ -189,7 +188,9 @@ Item { } FlyViewToolBar { - id: toolbar - visible: !QGroundControl.videoManager.fullScreen + id: toolbar + guidedValueSlider: _guidedValueSlider + utmspSliderTrigger: utmspSendActTrigger + visible: !QGroundControl.videoManager.fullScreen } } diff --git a/src/FlyView/FlyViewWidgetLayer.qml b/src/FlyView/FlyViewWidgetLayer.qml index 540eec18e33..46cfe41b1a3 100644 --- a/src/FlyView/FlyViewWidgetLayer.qml +++ b/src/FlyView/FlyViewWidgetLayer.qml @@ -46,8 +46,6 @@ Item { property bool _layoutSpacing: ScreenTools.defaultFontPixelWidth property bool _showSingleVehicleUI: true - property bool utmspActTrigger - QGCToolInsets { id: _totalToolInsets leftEdgeTopInset: toolStrip.leftEdgeTopInset @@ -105,15 +103,6 @@ Item { rallyPointController: _rallyPointController } - GuidedActionConfirm { - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - z: QGroundControl.zOrderTopMost - guidedController: _guidedController - guidedValueSlider: _guidedValueSlider - utmspSliderTrigger: utmspActTrigger - } - //-- Virtual Joystick Loader { id: virtualJoystickMultiTouch diff --git a/src/FlyView/GuidedActionConfirm.qml b/src/FlyView/GuidedActionConfirm.qml index 60f500e35d1..db6a739957f 100644 --- a/src/FlyView/GuidedActionConfirm.qml +++ b/src/FlyView/GuidedActionConfirm.qml @@ -12,21 +12,17 @@ import QtQuick.Controls import QtQuick.Layouts import QGroundControl - import QGroundControl.Controls - import QGroundControl.UTMSP -Rectangle { +Item { id: control - width: mainLayout.width + (_margins * 2) - height: mainLayout.height + (_margins * 2) - radius: ScreenTools.defaultFontPixelWidth / 2 - color: qgcPal.window + width: mainLayout.width visible: _utmspEnabled === true ? utmspSliderTrigger: false property var guidedController property var guidedValueSlider + property var messageDisplay property string title property string message property int action @@ -36,7 +32,7 @@ Rectangle { property alias optionText: optionCheckBox.text property alias optionChecked: optionCheckBox.checked - property real _margins: ScreenTools.defaultFontPixelHeight / 2 + property real _margins: 2 property bool _emergencyAction: action === guidedController.actionEmergencyStop // Properties of UTM adapter @@ -53,7 +49,7 @@ Rectangle { function show(immediate) { if (immediate) { - visible = true + _reallyShow() } else { // We delay showing the confirmation for a small amount in order for any other state // changes to propogate through the system. This way only the final state shows up. @@ -66,44 +62,37 @@ Rectangle { visible = false hideTrigger = false visibleTimer.stop() + messageDisplay.opacity = 1.0 + messageFadeTimer.stop() + messageOpacityAnimation.stop() if (mapIndicator) { mapIndicator.actionCancelled() mapIndicator = undefined } } + function _reallyShow() { + visible = true + messageDisplay.opacity = 1.0 + messageFadeTimer.start() + } + Timer { id: visibleTimer interval: 1000 repeat: false - onTriggered: visible = true + onTriggered: _reallyShow() } QGCPalette { id: qgcPal } - ColumnLayout { + RowLayout { id: mainLayout - x: control._margins - y: control._margins - spacing: control._margins - - QGCLabel { - Layout.fillWidth: true - Layout.leftMargin: closeButton.width + closeButton.anchors.rightMargin - Layout.rightMargin: Layout.leftMargin - text: control.message - horizontalAlignment: Text.AlignHCenter - } - - QGCCheckBox { - id: optionCheckBox - Layout.alignment: Qt.AlignHCenter - text: "" - visible: text !== "" - } + y: 2 + height: parent.height - 4 + spacing: ScreenTools.defaultFontPixelWidth QGCDelayButton { - Layout.fillWidth: true text: control.title enabled: _utmspEnabled === true? utmspSliderTrigger : true opacity: if(_utmspEnabled){utmspSliderTrigger === true ? 1 : 0.5} else{1} @@ -127,23 +116,25 @@ Rectangle { UTMSPStateStorage.currentStateIndex = 3 } } - } - QGCColoredImage { - id: closeButton - anchors.topMargin: _margins / 2 - anchors.rightMargin: _margins / 2 - anchors.top: parent.top - anchors.right: parent.right - height: ScreenTools.defaultFontPixelHeight * 0.5 - width: height - source: "/res/XDelete.svg" - fillMode: Image.PreserveAspectFit - color: qgcPal.text - - QGCMouseArea { - fillItem: parent - onClicked: confirmCancelled() + QGCCheckBox { + id: optionCheckBox + visible: text !== "" + } + + QGCColoredImage { + id: closeButton + Layout.alignment: Qt.AlignTop + width: height + height: ScreenTools.defaultFontPixelHeight * 0.5 + source: "/res/XDelete.svg" + fillMode: Image.PreserveAspectFit + color: qgcPal.text + + QGCMouseArea { + fillItem: parent + onClicked: confirmCancelled() + } } } } diff --git a/src/FlyView/GuidedActionsController.qml b/src/FlyView/GuidedActionsController.qml index e3232cbba26..3746b6d66a9 100644 --- a/src/FlyView/GuidedActionsController.qml +++ b/src/FlyView/GuidedActionsController.qml @@ -57,7 +57,7 @@ Item { readonly property string gotoTitle: qsTr("Go To Location") readonly property string roiTitle: qsTr("ROI") readonly property string setHomeTitle: qsTr("Set Home") - readonly property string setEstimatorOriginTitle: qsTr("Set Estimator origin") + readonly property string setEstimatorOriginTitle: qsTr("Set Estimator Origin") readonly property string setFlightMode: qsTr("Set Flight Mode") readonly property string changeHeadingTitle: qsTr("Change Heading") @@ -67,28 +67,28 @@ Item { readonly property string disarmMessage: qsTr("Disarm the vehicle") readonly property string mvDisarmMessage: qsTr("Disarm selected vehicles.") readonly property string emergencyStopMessage: qsTr("WARNING: THIS WILL STOP ALL MOTORS. IF VEHICLE IS CURRENTLY IN THE AIR IT WILL CRASH.") - readonly property string takeoffMessage: qsTr("Takeoff from ground and hold position.") - readonly property string startMissionMessage: qsTr("Takeoff from ground and start the current mission.") - readonly property string mvStartMissionMessage: qsTr("Takeoff from ground and start the current mission for selected vehicles.") - readonly property string continueMissionMessage: qsTr("Continue the mission from the current waypoint.") + readonly property string takeoffMessage: qsTr("Takeoff and hold position") + readonly property string startMissionMessage: qsTr("Takeoff and start the current mission") + readonly property string mvStartMissionMessage: qsTr("Takeoff and start the current mission for selected vehicles") + readonly property string continueMissionMessage: qsTr("Continue the mission from the current waypoint") readonly property string resumeMissionUploadFailMessage: qsTr("Upload of resume mission failed. Confirm to retry upload") - readonly property string landMessage: qsTr("Land the vehicle at the current position.") - readonly property string rtlMessage: qsTr("Return to the launch position of the vehicle.") - readonly property string changeAltMessage: qsTr("Change the altitude of the vehicle up or down.") - readonly property string changeLoiterRadiusMessage: qsTr("Change the forward flight loiter radius.") - readonly property string changeCruiseSpeedMessage: qsTr("Change the maximum horizontal cruise speed.") - readonly property string changeAirspeedMessage: qsTr("Change the equivalent airspeed setpoint.") - readonly property string gotoMessage: qsTr("Move the vehicle to the specified location.") - property string setWaypointMessage: qsTr("Adjust current waypoint to %1.").arg(_actionData) - readonly property string orbitMessage: qsTr("Orbit the vehicle around the specified location.") - readonly property string landAbortMessage: qsTr("Abort the landing sequence.") - readonly property string pauseMessage: qsTr("Pause the vehicle at it's current position, adjusting altitude up or down as needed.") - readonly property string mvPauseMessage: qsTr("Pause selected vehicles at their current position.") - readonly property string roiMessage: qsTr("Make the specified location a Region Of Interest.") + readonly property string landMessage: qsTr("Land the vehicle at the current position") + readonly property string rtlMessage: qsTr("Return to the launch position of the vehicle") + readonly property string changeAltMessage: qsTr("Change the altitude of the vehicle up or down") + readonly property string changeLoiterRadiusMessage: qsTr("Change the forward flight loiter radius") + readonly property string changeCruiseSpeedMessage: qsTr("Change the maximum horizontal cruise speed") + readonly property string changeAirspeedMessage: qsTr("Change the equivalent airspeed setpoint") + readonly property string gotoMessage: qsTr("Move the vehicle to the specified location") + property string setWaypointMessage: qsTr("Adjust current waypoint to %1").arg(_actionData) + readonly property string orbitMessage: qsTr("Orbit the vehicle around the specified location") + readonly property string landAbortMessage: qsTr("Abort the landing sequence") + readonly property string pauseMessage: qsTr("Pause at current position") + readonly property string mvPauseMessage: qsTr("Pause selected vehicles at their current position") + readonly property string roiMessage: qsTr("Make the specified location a Region Of Interest") readonly property string setHomeMessage: qsTr("Set vehicle home as the specified location. This will affect Return to Home position") - readonly property string setEstimatorOriginMessage: qsTr("Make the specified location the estimator origin.") + readonly property string setEstimatorOriginMessage: qsTr("Make the specified location the estimator origin") readonly property string setFlightModeMessage: qsTr("Set the vehicle flight mode to %1").arg(_actionData) - readonly property string changeHeadingMessage: qsTr("Set the vehicle heading towards the specified location.") + readonly property string changeHeadingMessage: qsTr("Set the vehicle heading towards the specified location") readonly property int actionRTL: 1 readonly property int actionLand: 2 diff --git a/src/QmlControls/FlyViewToolBar.qml b/src/QmlControls/FlyViewToolBar.qml index 97b016486c1..0f72a8eb810 100644 --- a/src/QmlControls/FlyViewToolBar.qml +++ b/src/QmlControls/FlyViewToolBar.qml @@ -14,17 +14,21 @@ import QtQuick.Dialogs import QGroundControl import QGroundControl.Controls +import QGroundControl.FlyView + +Item { + required property var guidedValueSlider + required property bool utmspSliderTrigger -Rectangle { id: control width: parent.width height: ScreenTools.toolbarHeight - color: "transparent" property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _communicationLost: _activeVehicle ? _activeVehicle.vehicleLinkManager.communicationLost : false property color _mainStatusBGColor: qgcPal.brandingPurple property real _leftRightMargin: ScreenTools.defaultFontPixelWidth * 0.75 + property var _guidedController: globals.guidedControllerFlyView function dropMainStatusIndicatorTool() { mainStatusIndicator.dropMainStatusIndicator(); @@ -32,98 +36,156 @@ Rectangle { QGCPalette { id: qgcPal } - /// Bottom single pixel divider - Rectangle { - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 1 - color: qgcPal.toolbarDivider - } - - Rectangle { - id: gradientBackground - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - width: mainStatusLayout.width - opacity: qgcPal.windowTransparent.a - - gradient: Gradient { - orientation: Gradient.Horizontal - GradientStop { position: 0; color: _mainStatusBGColor } - //GradientStop { position: qgcButton.x + qgcButton.width; color: _mainStatusBGColor } - GradientStop { position: 1; color: qgcPal.window } - } - } - - Rectangle { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: gradientBackground.right - anchors.right: parent.right - color: qgcPal.windowTransparent - } + QGCFlickable { + anchors.fill: parent + contentWidth: toolBarLayout.width + flickableDirection: Flickable.HorizontalFlick + + Row { + id: toolBarLayout + height: parent.height + spacing: 0 + + Item { + id: leftPanel + width: leftPanelLayout.implicitWidth + height: parent.height + + // Gradient background behind Q button and main status indicator + Rectangle { + id: gradientBackground + height: parent.height + width: mainStatusLayout.width + opacity: qgcPal.windowTransparent.a + + gradient: Gradient { + orientation: Gradient.Horizontal + GradientStop { position: 0; color: _mainStatusBGColor } + //GradientStop { position: qgcButton.x + qgcButton.width; color: _mainStatusBGColor } + GradientStop { position: 1; color: qgcPal.window } + } + } - RowLayout { - id: mainLayout - anchors.bottomMargin: 1 - anchors.rightMargin: control._leftRightMargin - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - spacing: ScreenTools.defaultFontPixelWidth - - RowLayout { - id: leftStatusLayout - Layout.fillHeight: true - Layout.alignment: Qt.AlignLeft - spacing: ScreenTools.defaultFontPixelWidth * 2 - - RowLayout { - id: mainStatusLayout - Layout.fillHeight: true - spacing: 0 - - QGCToolBarButton { - id: qgcButton - Layout.fillHeight: true - icon.source: "/res/QGCLogoFull.svg" - logo: true - onClicked: mainWindow.showToolSelectDialog() + // Standard toolbar background to the right of the gradient + Rectangle { + anchors.left: gradientBackground.right + anchors.right: parent.right + height: parent.height + color: qgcPal.windowTransparent } - MainStatusIndicator { - id: mainStatusIndicator - Layout.fillHeight: true + RowLayout { + id: leftPanelLayout + height: parent.height + spacing: ScreenTools.defaultFontPixelWidth * 2 + + RowLayout { + id: mainStatusLayout + height: parent.height + spacing: 0 + + QGCToolBarButton { + id: qgcButton + Layout.fillHeight: true + icon.source: "/res/QGCLogoFull.svg" + logo: true + onClicked: mainWindow.showToolSelectDialog() + } + + MainStatusIndicator { + id: mainStatusIndicator + Layout.fillHeight: true + } + } + + QGCButton { + id: disconnectButton + text: qsTr("Disconnect") + onClicked: _activeVehicle.closeVehicle() + visible: _activeVehicle && _communicationLost + } + + FlightModeIndicator { + Layout.fillHeight: true + visible: _activeVehicle + } } } + Item { + id: centerPanel + // center panel takes up all remaining space in toolbar between left and right panels + width: Math.max(guidedActionConfirm.visible ? guidedActionConfirm.width : 0, control.width - (leftPanel.width + rightPanel.width)) + height: parent.height + + Rectangle { + anchors.fill: parent + color: qgcPal.windowTransparent + } - QGCButton { - id: disconnectButton - text: qsTr("Disconnect") - onClicked: _activeVehicle.closeVehicle() - visible: _activeVehicle && _communicationLost + GuidedActionConfirm { + id: guidedActionConfirm + height: parent.height + anchors.horizontalCenter: parent.horizontalCenter + guidedController: control._guidedController + guidedValueSlider: control.guidedValueSlider + utmspSliderTrigger: control.utmspSliderTrigger + messageDisplay: guidedActionMessageDisplay + } } - FlightModeIndicator { - Layout.fillHeight: true - visible: _activeVehicle + Item { + id: rightPanel + width: flyViewIndicators.width + height: parent.height + + Rectangle { + anchors.fill: parent + color: qgcPal.windowTransparent + } + + FlyViewToolBarIndicators { + id: flyViewIndicators + height: parent.height + } } } + } - QGCFlickable { - id: indicatorsFlickable - Layout.alignment: Qt.AlignRight - Layout.fillHeight: true - Layout.preferredWidth: Math.min(contentWidth, availableWidth) - contentWidth: toolIndicators.width - flickableDirection: Flickable.HorizontalFlick + // The guided action message display is outside of the GuidedActionConfirm control so that it doesn't end up as + // part of the Flickable + Rectangle { + id: guidedActionMessageDisplay + anchors.top: control.bottom + anchors.topMargin: _margins + x: control.mapFromItem(guidedActionConfirm.parent, guidedActionConfirm.x, 0).x + (guidedActionConfirm.width - guidedActionMessageDisplay.width) / 2 + width: messageLabel.contentWidth + (_margins * 2) + height: messageLabel.contentHeight + (_margins * 2) + color: qgcPal.windowTransparent + radius: ScreenTools.defaultBorderRadius + visible: guidedActionConfirm.visible + + QGCLabel { + id: messageLabel + x: _margins + y: _margins + width: ScreenTools.defaultFontPixelWidth * 30 + wrapMode: Text.WordWrap + text: guidedActionConfirm.message + } - property real availableWidth: mainLayout.width - leftStatusLayout.width + PropertyAnimation { + id: messageOpacityAnimation + target: guidedActionMessageDisplay + property: "opacity" + from: 1 + to: 0 + duration: 500 + } - FlyViewToolBarIndicators { id: toolIndicators } + Timer { + id: messageFadeTimer + interval: 4000 + onTriggered: messageOpacityAnimation.start() } } diff --git a/src/QmlControls/FlyViewToolBarIndicators.qml b/src/QmlControls/FlyViewToolBarIndicators.qml index afa00d6d749..4bd4c85a315 100644 --- a/src/QmlControls/FlyViewToolBarIndicators.qml +++ b/src/QmlControls/FlyViewToolBarIndicators.qml @@ -14,9 +14,7 @@ import QGroundControl.Controls import QGroundControl.Toolbar Item { - anchors.top: parent.top - anchors.bottom: parent.bottom - width: mainLayout.width + _widthMargin + implicitWidth: mainLayout.width + _widthMargin property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property real _toolIndicatorMargins: ScreenTools.defaultFontPixelHeight * 0.66 diff --git a/src/QmlControls/MainStatusIndicator.qml b/src/QmlControls/MainStatusIndicator.qml index 07b3bee1585..3a55ea68fc9 100644 --- a/src/QmlControls/MainStatusIndicator.qml +++ b/src/QmlControls/MainStatusIndicator.qml @@ -44,7 +44,7 @@ RowLayout { font.pointSize: ScreenTools.largeFontPointSize property string _commLostText: qsTr("Comms Lost") - property string _readyToFlyText: control._vehicleFlies ? qsTr("Ready To Fly") : qsTr("Ready") + property string _readyToFlyText: qsTr("Ready") property string _notReadyToFlyText: qsTr("Not Ready") property string _disconnectedText: qsTr("Disconnected - Click to manually connect") property string _armedText: qsTr("Armed") diff --git a/src/QmlControls/QGCCheckBox.qml b/src/QmlControls/QGCCheckBox.qml index f1dede99679..050b5c29462 100644 --- a/src/QmlControls/QGCCheckBox.qml +++ b/src/QmlControls/QGCCheckBox.qml @@ -4,7 +4,6 @@ import QtQuick.Controls import QGroundControl import QGroundControl.Controls - CheckBox { id: control spacing: _noText ? 0 : ScreenTools.defaultFontPixelWidth @@ -17,14 +16,14 @@ CheckBox { } } - property color textColor: qgcPal.text + property color textColor: qgcPal.buttonText property bool textBold: false property real textFontPointSize: ScreenTools.defaultFontPointSize property ButtonGroup buttonGroup: null property bool _noText: text === "" - QGCPalette { id: qgcPal; colorGroupEnabled: enabled } + QGCPalette { id: qgcPal; colorGroupEnabled: control.enabled } onButtonGroupChanged: { if (buttonGroup) { diff --git a/src/QmlControls/QGCPalette.cc b/src/QmlControls/QGCPalette.cc index 42555a17a7f..0862a362ed3 100644 --- a/src/QmlControls/QGCPalette.cc +++ b/src/QmlControls/QGCPalette.cc @@ -85,7 +85,6 @@ void QGCPalette::_buildMap() DECLARE_QGC_COLOR(statusPassedText, "#9d9d9d", "#000000", "#707070", "#ffffff") DECLARE_QGC_COLOR(statusPendingText, "#9d9d9d", "#000000", "#707070", "#ffffff") DECLARE_QGC_COLOR(toolbarBackground, "#00ffffff", "#00ffffff", "#00222222", "#00222222") - DECLARE_QGC_COLOR(toolbarDivider, "#00000000", "#00000000", "#00000000", "#00000000") DECLARE_QGC_COLOR(groupBorder, "#bbbbbb", "#3A9BDC", "#707070", "#707070") // Colors not affecting by theming diff --git a/src/QmlControls/QGCPalette.h b/src/QmlControls/QGCPalette.h index 924bf406e69..59de1a85c62 100644 --- a/src/QmlControls/QGCPalette.h +++ b/src/QmlControls/QGCPalette.h @@ -156,7 +156,6 @@ class QGCPalette : public QObject DEFINE_QGC_COLOR(surveyPolygonInterior, setSurveyPolygonInterior) DEFINE_QGC_COLOR(surveyPolygonTerrainCollision, setSurveyPolygonTerrainCollision) DEFINE_QGC_COLOR(toolbarBackground, setToolbarBackground) - DEFINE_QGC_COLOR(toolbarDivider, setToolbarDivider) DEFINE_QGC_COLOR(toolStripFGColor, setToolStripFGColor) DEFINE_QGC_COLOR(toolStripHoverColor, setToolStripHoverColor) DEFINE_QGC_COLOR(groupBorder, setGroupBorder)