diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 1000a4d3965a33468a92913e091f58af854dffe7..be541ec65424cf10079c3d589962ce3593dd710e 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -245,7 +245,7 @@ QGCView { anchors.right: parent.right anchors.bottom: parent.bottom qgcView: root - isBackgroundDark: root.isBackgroundDark + useLightColors: isBackgroundDark visible: singleVehicleView.checked } @@ -302,14 +302,14 @@ QGCView { z: _panel.z + 5 width: parent.width - (_flightVideoPipControl.width / 2) height: Math.min(ScreenTools.availableHeight * 0.25, ScreenTools.defaultFontPixelWidth * 16) - visible: _virtualJoystick.value + visible: _virtualJoystick ? _virtualJoystick.value : false anchors.bottom: _flightVideoPipControl.top anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 2 anchors.horizontalCenter: flightDisplayViewWidgets.horizontalCenter source: "qrc:/qml/VirtualJoystick.qml" - active: _virtualJoystick.value + active: _virtualJoystick ? _virtualJoystick.value : false - property bool useLightColors: root.isBackgroundDark + property bool useLightColors: isBackgroundDark property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick } diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index 952c07eaecbee078789327edf65810f1d621db4a..520a1bcb15ccb54f2e622e01da98bb9ada354c1b 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -28,7 +28,7 @@ Item { property alias guidedModeBar: _guidedModeBar property bool gotoEnabled: _activeVehicle && _activeVehicle.guidedMode && _activeVehicle.flying property var qgcView - property bool isBackgroundDark + property bool useLightColors property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true @@ -36,7 +36,7 @@ Item { readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5 - QGCMapPalette { id: mapPal; lightColors: isBackgroundDark } + QGCMapPalette { id: mapPal; lightColors: useLightColors } QGCPalette { id: qgcPal } function getPreferredInstrumentWidth() { diff --git a/src/QGCPalette.h b/src/QGCPalette.h index 8a7ff1ec13b450b00fee45f394d828c02786dbee..5330ff11abb28323e828970460963773fcc806e8 100644 --- a/src/QGCPalette.h +++ b/src/QGCPalette.h @@ -60,6 +60,13 @@ class QGCPalette : public QObject Q_PROPERTY(QColor brandingPurple READ brandingPurple NOTIFY paletteChanged) Q_PROPERTY(QColor brandingBlue READ brandingBlue NOTIFY paletteChanged) + Q_PROPERTY(QColor colorGreen READ colorGreen CONSTANT) + Q_PROPERTY(QColor colorOrange READ colorOrange CONSTANT) + Q_PROPERTY(QColor colorRed READ colorRed CONSTANT) + Q_PROPERTY(QColor colorGrey READ colorGrey CONSTANT) + Q_PROPERTY(QColor colorBlue READ colorBlue CONSTANT) + Q_PROPERTY(QColor colorWhite READ colorWhite CONSTANT) + public: enum ColorGroup { Disabled = 0, @@ -135,6 +142,13 @@ public: /// Blue color from branding guidelines QColor brandingBlue(void) const { return _brandingBlue[_theme][_colorGroupEnabled ? 1 : 0]; } + QColor colorGreen () { return QColor("#05f068"); } + QColor colorOrange () { return QColor("#f0ab06"); } + QColor colorRed () { return QColor("#fc4638"); } + QColor colorGrey () { return QColor("#7f7f7f"); } + QColor colorBlue () { return QColor("#636efe"); } + QColor colorWhite () { return QColor("#ffffff"); } + void setWindow(QColor& color) { _window[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); } void setWindowShade(QColor& color) { _windowShade[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); } void setWindowShadeDark(QColor& color) { _windowShadeDark[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); } diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml index 6e5d2d9958b76704d5413ce3c50f9d18be222d32..15793b907c34a4ac5e2fc7b7aa8bf033283af793 100644 --- a/src/ui/MainWindowInner.qml +++ b/src/ui/MainWindowInner.qml @@ -259,7 +259,6 @@ Item { anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - isBackgroundDark: flightView.isBackgroundDark z: QGroundControl.zOrderTopMost Component.onCompleted: ScreenTools.availableHeight = parent.height - toolBar.height diff --git a/src/ui/toolbar/BatteryIndicator.qml b/src/ui/toolbar/BatteryIndicator.qml index 564756b11c929797626c7c5f4f8caef54ba5b4c1..ab1abdc6aecc66fe1747f2b52bf35fcdd9fc7765 100644 --- a/src/ui/toolbar/BatteryIndicator.qml +++ b/src/ui/toolbar/BatteryIndicator.qml @@ -33,13 +33,13 @@ Item { return qgcPal.text } if(_activeVehicle.battery.percentRemaining.value > 50) { - return colorOrange + return qgcPal.colorOrange } if(_activeVehicle.battery.percentRemaining.value > 0.1) { - return colorRed + return qgcPal.colorRed } } - return colorGrey + return qgcPal.colorGrey } function getBatteryPercentageText() { diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index 694f73013bc1e2d42fd6869d350a58d20042dc9d..bd51817ef771c8284ebca28186ab23964ccfda29 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -24,17 +24,7 @@ Rectangle { QGCPalette { id: qgcPal; colorGroupEnabled: true } - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - property bool isMessageImportant: _activeVehicle ? !_activeVehicle.messageTypeNormal && !_activeVehicle.messageTypeNone : false - property bool isBackgroundDark: true - property bool opaqueBackground: false - - readonly property color colorGreen: "#05f068" - readonly property color colorOrange: "#f0ab06" - readonly property color colorRed: "#fc4638" - readonly property color colorGrey: "#7f7f7f" - readonly property color colorBlue: "#636efe" - readonly property color colorWhite: "#ffffff" + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle signal showSettingsView signal showSetupView @@ -74,7 +64,7 @@ Rectangle { anchors.bottom: parent.bottom height: 1 color: "black" - visible: qgcPal.globalTheme == QGCPalette.Light + visible: qgcPal.globalTheme === QGCPalette.Light } RowLayout { @@ -217,7 +207,7 @@ Rectangle { anchors.bottom: parent.bottom height: toolBar.height * 0.05 width: _activeVehicle ? _activeVehicle.parameterManager.loadProgress * parent.width : 0 - color: colorGreen + color: qgcPal.colorGreen } } diff --git a/src/ui/toolbar/MainToolBarIndicators.qml b/src/ui/toolbar/MainToolBarIndicators.qml index 9680e039e0cc397de61f13a2da035bf765872c93..4c245192cd6b8f3f9a9e4b68a63b4013cd5e26d1 100644 --- a/src/ui/toolbar/MainToolBarIndicators.qml +++ b/src/ui/toolbar/MainToolBarIndicators.qml @@ -53,7 +53,7 @@ Item { text: qsTr("Waiting For Vehicle Connection") font.pointSize: ScreenTools.mediumFontPointSize font.family: ScreenTools.demiboldFontFamily - color: colorRed + color: qgcPal.colorRed visible: !_activeVehicle } @@ -108,7 +108,7 @@ Item { text: qsTr("COMMUNICATION LOST") font.pointSize: ScreenTools.largeFontPointSize font.family: ScreenTools.demiboldFontFamily - color: colorRed + color: qgcPal.colorRed } } } diff --git a/src/ui/toolbar/MessageIndicator.qml b/src/ui/toolbar/MessageIndicator.qml index 93f4024a23fe1a9e050ca00c00a2401234de8c3d..cbe149aa143a538c4e5ed1d0dec39d1b80776dba 100644 --- a/src/ui/toolbar/MessageIndicator.qml +++ b/src/ui/toolbar/MessageIndicator.qml @@ -25,18 +25,19 @@ Item { anchors.top: parent.top anchors.bottom: parent.bottom - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + property bool _isMessageImportant: _activeVehicle ? !_activeVehicle.messageTypeNormal && !_activeVehicle.messageTypeNone : false function getMessageColor() { if (_activeVehicle) { if (_activeVehicle.messageTypeNone) - return colorGrey + return qgcPal.colorGrey if (_activeVehicle.messageTypeNormal) - return colorBlue; + return qgcPal.colorBlue; if (_activeVehicle.messageTypeWarning) - return colorOrange; + return qgcPal.colorOrange; if (_activeVehicle.messageTypeError) - return colorRed; + return qgcPal.colorRed; // Cannot be so make make it obnoxious to show error console.log("Invalid vehicle message type") return "purple"; @@ -52,7 +53,7 @@ Item { sourceSize.height: height fillMode: Image.PreserveAspectFit cache: false - visible: _activeVehicle && _activeVehicle.messageCount > 0 && isMessageImportant + visible: _activeVehicle && _activeVehicle.messageCount > 0 && _isMessageImportant } QGCColoredImage {