diff --git a/src/QGCPalette.cc b/src/QGCPalette.cc index 6abd89938b517fec3e805f05150d8755954cd952..69986af82f6b2e6617ff2a33afbd07e3c2f780a0 100644 --- a/src/QGCPalette.cc +++ b/src/QGCPalette.cc @@ -81,11 +81,15 @@ void QGCPalette::_buildMap() DECLARE_QGC_COLOR(statusPassedText, "#9d9d9d", "#000000", "#707070", "#ffffff") DECLARE_QGC_COLOR(statusPendingText, "#9d9d9d", "#000000", "#707070", "#ffffff") - // Colors are not affecting by theming - DECLARE_QGC_COLOR(mapWidgetBorderLight, "#ffffff", "#ffffff", "#ffffff", "#ffffff") - DECLARE_QGC_COLOR(mapWidgetBorderDark, "#000000", "#000000", "#000000", "#000000") - DECLARE_QGC_COLOR(brandingPurple, "#4A2C6D", "#4A2C6D", "#4A2C6D", "#4A2C6D") - DECLARE_QGC_COLOR(brandingBlue, "#48D6FF", "#6045c5", "#48D6FF", "#6045c5") + // Colors not affecting by theming + // Disabled Enabled + DECLARE_QGC_NONTHEMED_COLOR(brandingPurple, "#4A2C6D", "#4A2C6D") + DECLARE_QGC_NONTHEMED_COLOR(brandingBlue, "#48D6FF", "#6045c5") + + // Colors not affecting by theming or enable/disable + DECLARE_QGC_SINGLE_COLOR(mapWidgetBorderLight, "#ffffff") + DECLARE_QGC_SINGLE_COLOR(mapWidgetBorderDark, "#000000") + DECLARE_QGC_SINGLE_COLOR(mapMissionTrajectory, "#be781c") } void QGCPalette::setColorGroupEnabled(bool enabled) diff --git a/src/QGCPalette.h b/src/QGCPalette.h index 91f597ef9a2ec6c58662913689611a3cc5ec31b4..62fbf5a5e00403157f6ca43650c65687d240ba4f 100644 --- a/src/QGCPalette.h +++ b/src/QGCPalette.h @@ -28,6 +28,34 @@ _colors << #name; \ } +#define DECLARE_QGC_NONTHEMED_COLOR(name, disabledColor, enabledColor) \ + { \ + PaletteColorInfo_t colorInfo = { \ + { QColor(disabledColor), QColor(enabledColor) }, \ + { QColor(disabledColor), QColor(enabledColor) } \ + }; \ + qgcApp()->toolbox()->corePlugin()->paletteOverride(#name, colorInfo); \ + _colorInfoMap[Light][ColorGroupEnabled][QStringLiteral(#name)] = colorInfo[Light][ColorGroupEnabled]; \ + _colorInfoMap[Light][ColorGroupDisabled][QStringLiteral(#name)] = colorInfo[Light][ColorGroupDisabled]; \ + _colorInfoMap[Dark][ColorGroupEnabled][QStringLiteral(#name)] = colorInfo[Dark][ColorGroupEnabled]; \ + _colorInfoMap[Dark][ColorGroupDisabled][QStringLiteral(#name)] = colorInfo[Dark][ColorGroupDisabled]; \ + _colors << #name; \ + } + +#define DECLARE_QGC_SINGLE_COLOR(name, color) \ + { \ + PaletteColorInfo_t colorInfo = { \ + { QColor(color), QColor(color) }, \ + { QColor(color), QColor(color) } \ + }; \ + qgcApp()->toolbox()->corePlugin()->paletteOverride(#name, colorInfo); \ + _colorInfoMap[Light][ColorGroupEnabled][QStringLiteral(#name)] = colorInfo[Light][ColorGroupEnabled]; \ + _colorInfoMap[Light][ColorGroupDisabled][QStringLiteral(#name)] = colorInfo[Light][ColorGroupDisabled]; \ + _colorInfoMap[Dark][ColorGroupEnabled][QStringLiteral(#name)] = colorInfo[Dark][ColorGroupEnabled]; \ + _colorInfoMap[Dark][ColorGroupDisabled][QStringLiteral(#name)] = colorInfo[Dark][ColorGroupDisabled]; \ + _colors << #name; \ + } + #define DEFINE_QGC_COLOR(NAME, SETNAME) \ Q_PROPERTY(QColor NAME READ NAME WRITE SETNAME NOTIFY paletteChanged) \ Q_PROPERTY(QStringList NAME ## Colors READ NAME ## Colors NOTIFY paletteChanged) \ @@ -103,6 +131,7 @@ public: DEFINE_QGC_COLOR(mapIndicatorChild, setMapIndicatorChild) DEFINE_QGC_COLOR(mapWidgetBorderLight, setMapWidgetBorderLight) DEFINE_QGC_COLOR(mapWidgetBorderDark, setMapWidgetBorderDark) + DEFINE_QGC_COLOR(mapMissionTrajectory, setMapMissionTrajectory) DEFINE_QGC_COLOR(brandingPurple, setBrandingPurple) DEFINE_QGC_COLOR(brandingBlue, setBrandingBlue) DEFINE_QGC_COLOR(colorGreen, setColorGreen) diff --git a/src/QmlControls/QGroundControlQmlGlobal.cc b/src/QmlControls/QGroundControlQmlGlobal.cc index c89fa1676a2a77bb397dfa4a0c0653c8a1a62bbb..20ac868a18fa35972fefbcbbae3e67cd196fa04c 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.cc +++ b/src/QmlControls/QGroundControlQmlGlobal.cc @@ -67,6 +67,7 @@ void QGroundControlQmlGlobal::setToolbox(QGCToolbox* toolbox) _gpsRtkFactGroup = qgcApp()->gpsRtkFactGroup(); _airspaceManager = toolbox->airspaceManager(); _adsbVehicleManager = toolbox->adsbVehicleManager(); + _globalPalette = new QGCPalette(this); #if defined(QGC_ENABLE_PAIRING) _pairingManager = toolbox->pairingManager(); #endif diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index 1028a0b0ff789f9600dbba3c29c06afc6fe1404b..a3ebcf4d6ffe8d4276e2008c1612dd0b957cf37e 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -24,6 +24,7 @@ #include "AppSettings.h" #include "AirspaceManager.h" #include "ADSBVehicleManager.h" +#include "QGCPalette.h" #if defined(QGC_ENABLE_PAIRING) #include "PairingManager.h" #endif @@ -81,6 +82,7 @@ public: Q_PROPERTY(MicrohardManager* microhardManager READ microhardManager CONSTANT) Q_PROPERTY(bool microhardSupported READ microhardSupported CONSTANT) Q_PROPERTY(bool supportsPairing READ supportsPairing CONSTANT) + Q_PROPERTY(QGCPalette* globalPalette MEMBER _globalPalette CONSTANT) // This palette will always return enabled colors #if defined(QGC_ENABLE_PAIRING) Q_PROPERTY(PairingManager* pairingManager READ pairingManager CONSTANT) #endif @@ -280,6 +282,7 @@ private: TaisyncManager* _taisyncManager = nullptr; MicrohardManager* _microhardManager = nullptr; ADSBVehicleManager* _adsbVehicleManager = nullptr; + QGCPalette* _globalPalette = nullptr; #if defined(QGC_ENABLE_PAIRING) PairingManager* _pairingManager = nullptr; #endif