diff --git a/src/QGCPalette.cc b/src/QGCPalette.cc index 12dce3af33301aac353205a44a93691f37b0af43..0a5c3fd0ac7de89dce9e4e4a78260cc14245c635 100644 --- a/src/QGCPalette.cc +++ b/src/QGCPalette.cc @@ -98,6 +98,16 @@ QColor QGCPalette::_textFieldText[QGCPalette::_cThemes][QGCPalette::_cColorGroup { QColor(0x2c, 0x2c, 0x2c), QColor(0, 0, 0) }, }; +QColor QGCPalette::_mapButton[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { + { QColor(0x58, 0x58, 0x58), QColor(0, 0, 0) }, + { QColor(0x58, 0x58, 0x58), QColor(0, 0, 0) }, +}; + +QColor QGCPalette::_mapButtonHighlight[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { + { QColor(0x58, 0x58, 0x58), QColor(190, 120, 28) }, + { QColor(0x58, 0x58, 0x58), QColor(190, 120, 28) }, +}; + QGCPalette::QGCPalette(QObject* parent) : QObject(parent), _colorGroupEnabled(true) diff --git a/src/QGCPalette.h b/src/QGCPalette.h index ceaf5adda6b7273ee2454638ca8224fd3cc1e104..99cea6bbceefbed3f3add06feedaebf80d6500e7 100644 --- a/src/QGCPalette.h +++ b/src/QGCPalette.h @@ -86,6 +86,12 @@ class QGCPalette : public QObject // Text color for TextFields Q_PROPERTY(QColor textFieldText READ textFieldText NOTIFY paletteChanged) + /// Background color for map buttons + Q_PROPERTY(QColor mapButton READ mapButton NOTIFY paletteChanged) + + /// Background color for map button in selected or hover state + Q_PROPERTY(QColor mapButtonHighlight READ mapButtonHighlight NOTIFY paletteChanged) + public: enum ColorGroup { Disabled = 0, @@ -121,6 +127,9 @@ public: QColor textField(void) const { return _textField[_theme][_colorGroupEnabled ? 1 : 0]; } QColor textFieldText(void) const { return _textFieldText[_theme][_colorGroupEnabled ? 1 : 0]; } + QColor mapButton(void) const { return _mapButton[_theme][_colorGroupEnabled ? 1 : 0]; } + QColor mapButtonHighlight(void) const { return _mapButtonHighlight[_theme][_colorGroupEnabled ? 1 : 0]; } + static Theme globalTheme(void) { return _theme; } static void setGlobalTheme(Theme newTheme); @@ -154,6 +163,9 @@ private: static QColor _textField[_cThemes][_cColorGroups]; static QColor _textFieldText[_cThemes][_cColorGroups]; + static QColor _mapButton[_cThemes][_cColorGroups]; + static QColor _mapButtonHighlight[_cThemes][_cColorGroups]; + void _themeChanged(void); static QList _paletteObjects; ///< List of all active QGCPalette objects diff --git a/src/QmlControls/DropButton.qml b/src/QmlControls/DropButton.qml index 4a782bc76480c87f0a21d2d5ae416b4df95c8942..acd67352d94fdce6e426cdd80afec0f5ddfa455b 100644 --- a/src/QmlControls/DropButton.qml +++ b/src/QmlControls/DropButton.qml @@ -162,7 +162,7 @@ Item { border.width: 2 border.color: "white" opacity: checked ? 0.95 : 0.65 - color: checked ? "orange" : "black" + color: checked ? qgcPal.mapButtonHighlight : qgcPal.mapButton Image { id: button diff --git a/src/QmlControls/RoundButton.qml b/src/QmlControls/RoundButton.qml index f32b274eaec2531b948753336ff5902958283d98..93afe5a0798d05b43feb901a3c1e6c49df25e3f0 100644 --- a/src/QmlControls/RoundButton.qml +++ b/src/QmlControls/RoundButton.qml @@ -3,6 +3,7 @@ import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 import QGroundControl.ScreenTools 1.0 +import QGroundControl.Palette 1.0 Item { id: _root @@ -17,6 +18,8 @@ Item { property bool checked: false property ExclusiveGroup exclusiveGroup: null + QGCPalette { id: qgcPal } + onExclusiveGroupChanged: { if (exclusiveGroup) { exclusiveGroup.bindCheckable(_root) @@ -29,7 +32,7 @@ Item { border.width: 2 border.color: "white" opacity: checked ? 0.95 : 0.65 - color: checked ? "orange" : "black" + color: checked ? qgcPal.mapButtonHighlight : qgcPal.mapButton Image { id: button anchors.fill: parent