Commit c62c006b authored by Gus Grubba's avatar Gus Grubba

Eliminating dependencies from MainToolBar

parent 019e06d4
......@@ -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
}
......
......@@ -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() {
......
......@@ -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(); }
......
......@@ -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
......
......@@ -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() {
......
......@@ -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
}
}
......@@ -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
}
}
}
......@@ -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 {
......
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