Commit 1388ac3a authored by dogmaphobic's avatar dogmaphobic

Adding a palette for map buttons.

parent 6d20e85d
......@@ -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)
......
......@@ -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<QGCPalette*> _paletteObjects; ///< List of all active QGCPalette objects
......
......@@ -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
......
......@@ -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
......
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