Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
7ab6707e
Commit
7ab6707e
authored
Mar 28, 2017
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding macros for color definition.
parent
b80a810a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
323 deletions
+95
-323
QGCPalette.cc
src/QGCPalette.cc
+33
-134
QGCPalette.h
src/QGCPalette.h
+62
-189
No files found.
src/QGCPalette.cc
View file @
7ab6707e
...
...
@@ -20,137 +20,37 @@ QList<QGCPalette*> QGCPalette::_paletteObjects;
QGCPalette
::
Theme
QGCPalette
::
_theme
=
QGCPalette
::
Dark
;
QColor
QGCPalette
::
_window
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#ffffff"
),
QColor
(
"#ffffff"
)
},
{
QColor
(
0x22
,
0x22
,
0x22
),
QColor
(
0x22
,
0x22
,
0x22
)
}
};
QColor
QGCPalette
::
_windowShade
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#d9d9d9"
),
QColor
(
"#d9d9d9"
)
},
{
QColor
(
51
,
51
,
51
),
QColor
(
51
,
51
,
51
)
}
};
QColor
QGCPalette
::
_windowShadeDark
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#bdbdbd"
),
QColor
(
"#bdbdbd"
)
},
{
QColor
(
40
,
40
,
40
),
QColor
(
40
,
40
,
40
)
}
};
QColor
QGCPalette
::
_text
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#9d9d9d"
),
QColor
(
"#000000"
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
}
};
QColor
QGCPalette
::
_warningText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#cc0808"
),
QColor
(
"#cc0808"
)
},
{
QColor
(
"#f85761"
),
QColor
(
"#f85761"
)
}
};
QColor
QGCPalette
::
_button
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#ffffff"
),
QColor
(
"#ffffff"
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
98
,
98
,
100
)
},
};
QColor
QGCPalette
::
_buttonText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#9d9d9d"
),
QColor
(
"#000000"
)
},
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
},
};
QColor
QGCPalette
::
_buttonHighlight
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#e4e4e4"
),
QColor
(
"#946120"
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
"#fff291"
)
},
};
QColor
QGCPalette
::
_buttonHighlightText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
"#ffffff"
)
},
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
};
QColor
QGCPalette
::
_primaryButton
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
"#8cb3be"
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
"#8cb3be"
)
},
};
QColor
QGCPalette
::
_primaryButtonText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
};
QColor
QGCPalette
::
_textField
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#ffffff"
),
QColor
(
"#ffffff"
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
255
,
255
,
255
)
},
};
QColor
QGCPalette
::
_textFieldText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#dedede"
),
QColor
(
"#000000"
)
},
{
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
)
},
};
// Map widget colors are not affecting by theming
QColor
QGCPalette
::
_mapWidgetBorderLight
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
255
,
255
,
255
),
QColor
(
255
,
255
,
255
)
},
{
QColor
(
255
,
255
,
255
),
QColor
(
255
,
255
,
255
)
},
};
QColor
QGCPalette
::
_mapWidgetBorderDark
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0
,
0
,
0
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0
,
0
,
0
),
QColor
(
0
,
0
,
0
)
},
};
QColor
QGCPalette
::
_brandingPurple
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#4A2C6D"
),
QColor
(
"#4A2C6D"
)
},
{
QColor
(
"#4A2C6D"
),
QColor
(
"#4A2C6D"
)
},
};
QColor
QGCPalette
::
_brandingBlue
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#48D6FF"
),
QColor
(
"#48D6FF"
)
},
{
QColor
(
"#48D6FF"
),
QColor
(
"#48D6FF"
)
},
};
QColor
QGCPalette
::
_colorGreen
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#009431"
),
QColor
(
"#009431"
)
},
//-- Light
{
QColor
(
"#00e04b"
),
QColor
(
"#00e04b"
)
},
//-- Dark
};
QColor
QGCPalette
::
_colorOrange
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#b95604"
),
QColor
(
"#b95604"
)
},
{
QColor
(
"#de8500"
),
QColor
(
"#de8500"
)
},
};
QColor
QGCPalette
::
_colorRed
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#ed3939"
),
QColor
(
"#ed3939"
)
},
{
QColor
(
"#f32836"
),
QColor
(
"#f32836"
)
},
};
QColor
QGCPalette
::
_colorGrey
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#808080"
),
QColor
(
"#808080"
)
},
{
QColor
(
"#bfbfbf"
),
QColor
(
"#bfbfbf"
)
},
};
QColor
QGCPalette
::
_colorBlue
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#1a72ff"
),
QColor
(
"#1a72ff"
)
},
{
QColor
(
"#536dff"
),
QColor
(
"#536dff"
)
},
};
QColor
QGCPalette
::
_alertBackground
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#eecc44"
),
QColor
(
"#eecc44"
)
},
{
QColor
(
"#eecc44"
),
QColor
(
"#eecc44"
)
},
};
QColor
QGCPalette
::
_alertBorder
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
"#808080"
),
QColor
(
"#808080"
)
},
{
QColor
(
"#808080"
),
QColor
(
"#808080"
)
},
};
QColor
QGCPalette
::
_alertText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0
,
0
,
0
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0
,
0
,
0
),
QColor
(
0
,
0
,
0
)
},
};
// Light Dark
// Disabled Enabled Disabled Enabled
DECLARE_QGC_COLOR
(
window
,
"#ffffff"
,
"#ffffff"
,
"#222222"
,
"#222222"
)
DECLARE_QGC_COLOR
(
windowShade
,
"#d9d9d9"
,
"#d9d9d9"
,
"#333333"
,
"#333333"
)
DECLARE_QGC_COLOR
(
windowShadeDark
,
"#bdbdbd"
,
"#bdbdbd"
,
"#282828"
,
"#282828"
)
DECLARE_QGC_COLOR
(
text
,
"#9d9d9d"
,
"#000000"
,
"#3a3a3a"
,
"#ffffff"
)
DECLARE_QGC_COLOR
(
warningText
,
"#cc0808"
,
"#cc0808"
,
"#f85761"
,
"#f85761"
)
DECLARE_QGC_COLOR
(
button
,
"#ffffff"
,
"#ffffff"
,
"#606060"
,
"#626270"
)
DECLARE_QGC_COLOR
(
buttonText
,
"#9d9d9d"
,
"#000000"
,
"#2c2c2c"
,
"#ffffff"
)
DECLARE_QGC_COLOR
(
buttonHighlight
,
"#e4e4e4"
,
"#946120"
,
"#3a3a3a"
,
"#fff291"
)
DECLARE_QGC_COLOR
(
buttonHighlightText
,
"#2c2c2c"
,
"#ffffff"
,
"#2c2c2c"
,
"#000000"
)
DECLARE_QGC_COLOR
(
primaryButton
,
"#585858"
,
"#8cb3be"
,
"#585858"
,
"#8cb3be"
)
DECLARE_QGC_COLOR
(
primaryButtonText
,
"#2c2c2c"
,
"#000000"
,
"#2c2c2c"
,
"#000000"
)
DECLARE_QGC_COLOR
(
textField
,
"#ffffff"
,
"#ffffff"
,
"#585858"
,
"#ffffff"
)
DECLARE_QGC_COLOR
(
textFieldText
,
"#dedede"
,
"#000000"
,
"#2c2c2c"
,
"#000000"
)
DECLARE_QGC_COLOR
(
mapButton
,
"#585858"
,
"#000000"
,
"#585858"
,
"#000000"
)
DECLARE_QGC_COLOR
(
mapButtonHighlight
,
"#585858"
,
"#be781c"
,
"#585858"
,
"#be781c"
)
DECLARE_QGC_COLOR
(
colorGreen
,
"#009431"
,
"#009431"
,
"#00e04b"
,
"#00e04b"
)
DECLARE_QGC_COLOR
(
colorOrange
,
"#b95604"
,
"#b95604"
,
"#de8500"
,
"#de8500"
)
DECLARE_QGC_COLOR
(
colorRed
,
"#ed3939"
,
"#ed3939"
,
"#f32836"
,
"#f32836"
)
DECLARE_QGC_COLOR
(
colorGrey
,
"#808080"
,
"#808080"
,
"#bfbfbf"
,
"#bfbfbf"
)
DECLARE_QGC_COLOR
(
colorBlue
,
"#1a72ff"
,
"#1a72ff"
,
"#536dff"
,
"#536dff"
)
DECLARE_QGC_COLOR
(
alertBackground
,
"#eecc44"
,
"#eecc44"
,
"#eecc44"
,
"#eecc44"
)
DECLARE_QGC_COLOR
(
alertBorder
,
"#808080"
,
"#808080"
,
"#808080"
,
"#808080"
)
DECLARE_QGC_COLOR
(
alertText
,
"#000000"
,
"#000000"
,
"#000000"
,
"#000000"
)
// 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"
,
"#48D6FF"
,
"#48D6FF"
,
"#48D6FF"
)
QGCPalette
::
QGCPalette
(
QObject
*
parent
)
:
QObject
(
parent
),
...
...
@@ -182,7 +82,7 @@ void QGCPalette::setGlobalTheme(Theme newTheme)
}
}
void
QGCPalette
::
_signalPaletteChangeToAll
(
void
)
void
QGCPalette
::
_signalPaletteChangeToAll
()
{
// Notify all objects of the new theme
foreach
(
QGCPalette
*
palette
,
_paletteObjects
)
{
...
...
@@ -190,8 +90,7 @@ void QGCPalette::_signalPaletteChangeToAll(void)
}
}
void
QGCPalette
::
_signalPaletteChanged
(
void
)
void
QGCPalette
::
_signalPaletteChanged
()
{
emit
paletteChanged
();
}
src/QGCPalette.h
View file @
7ab6707e
...
...
@@ -13,6 +13,22 @@
#include <QObject>
#include <QColor>
#define QGCColorThemes 2
#define QGCColorGroups 2
#define DECLARE_QGC_COLOR(name, lightEnabled, lightDisabled, darkEnabled, darkDisabled) \
QColor QGCPalette::_##name[QGCColorThemes][QGCColorGroups] = { \
{ QColor(lightEnabled), QColor(lightDisabled) }, \
{ QColor(darkEnabled), QColor(darkDisabled) }, \
};
#define DEFINE_QGC_COLOR(name, setName) \
Q_PROPERTY(QColor name READ name WRITE setName NOTIFY paletteChanged) \
QColor name() const { return _##name[_theme][_colorGroupEnabled ? 1 : 0]; } \
void setName(QColor& color) { _##name[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); } \
static QColor _##name[QGCColorThemes][QGCColorGroups];
/*!
QGCPalette is used in QML ui to expose color properties for the QGC palette. There are two
separate palettes in QGC, light and dark. The light palette is for outdoor use and the dark
...
...
@@ -30,47 +46,14 @@
QGCPalette { id: qgcPal: colorGroupEnabled: enabled }
}
*/
class
QGCPalette
:
public
QObject
{
Q_OBJECT
Q_ENUMS
(
Theme
)
Q_PROPERTY
(
Theme
globalTheme
READ
globalTheme
WRITE
setGlobalTheme
NOTIFY
paletteChanged
)
Q_PROPERTY
(
bool
colorGroupEnabled
READ
colorGroupEnabled
WRITE
setColorGroupEnabled
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
window
READ
window
WRITE
setWindow
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
windowShade
READ
windowShade
WRITE
setWindowShade
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
windowShadeDark
READ
windowShadeDark
WRITE
setWindowShadeDark
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
text
READ
text
WRITE
setText
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
warningText
READ
warningText
WRITE
setWarningText
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
button
READ
button
WRITE
setButton
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
buttonText
READ
buttonText
WRITE
setButtonText
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
buttonHighlight
READ
buttonHighlight
WRITE
setButtonHighlight
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
buttonHighlightText
READ
buttonHighlightText
WRITE
setButtonHighlightText
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
primaryButton
READ
primaryButton
WRITE
setPrimaryButton
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
primaryButtonText
READ
primaryButtonText
WRITE
setPrimaryButtonText
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
textField
READ
textField
WRITE
setTextField
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
textFieldText
READ
textFieldText
WRITE
setTextFieldText
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
mapButton
READ
mapButton
WRITE
setMapButton
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
mapButtonHighlight
READ
mapButtonHighlight
WRITE
setMapButtonHighlight
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
mapWidgetBorderLight
READ
mapWidgetBorderLight
WRITE
setMapWidgetBorderLight
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
mapWidgetBorderDark
READ
mapWidgetBorderDark
WRITE
setMapWidgetBorderDark
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
brandingPurple
READ
brandingPurple
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
brandingBlue
READ
brandingBlue
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
colorGreen
READ
colorGreen
WRITE
setColorGreen
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
colorOrange
READ
colorOrange
WRITE
setColorOrange
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
colorRed
READ
colorRed
WRITE
setColorRed
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
colorGrey
READ
colorGrey
WRITE
setColorGrey
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
colorBlue
READ
colorBlue
WRITE
setColorBlue
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
alertBackground
READ
alertBackground
WRITE
setAlertBackground
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
alertBorder
READ
alertBorder
WRITE
setAlertBorder
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
alertText
READ
alertText
WRITE
setAlertText
NOTIFY
paletteChanged
)
public:
enum
ColorGroup
{
Disabled
=
0
,
Enabled
...
...
@@ -81,166 +64,56 @@ public:
Dark
};
QGCPalette
(
QObject
*
parent
=
NULL
);
~
QGCPalette
();
bool
colorGroupEnabled
(
void
)
const
{
return
_colorGroupEnabled
;
}
void
setColorGroupEnabled
(
bool
enabled
);
/// Background color for windows
QColor
window
(
void
)
const
{
return
_window
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Color for shaded areas within a window. The windowShade color is a color between window and button.
QColor
windowShade
(
void
)
const
{
return
_windowShade
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Color for darker shared areas within a window. The windowShadeDark color is a color between window and windowShade.
QColor
windowShadeDark
(
void
)
const
{
return
_windowShadeDark
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Text color
QColor
text
(
void
)
const
{
return
_text
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Color for warning text
QColor
warningText
(
void
)
const
{
return
_warningText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Background color for buttons
QColor
button
(
void
)
const
{
return
_button
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Text color for buttons
QColor
buttonText
(
void
)
const
{
return
_buttonText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Background color for button in selected or hover state
QColor
buttonHighlight
(
void
)
const
{
return
_buttonHighlight
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Text color for button in selected or hover state
QColor
buttonHighlightText
(
void
)
const
{
return
_buttonHighlightText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Background color for primary buttons. A primary button is the button which would be the normal default button to press.
/// For example in an Ok/Cancel situation where Ok would normally be pressed, Ok is the primary button.
QColor
primaryButton
(
void
)
const
{
return
_primaryButton
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Text color for primary buttons
QColor
primaryButtonText
(
void
)
const
{
return
_primaryButtonText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Background color for TextFields
QColor
textField
(
void
)
const
{
return
_textField
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Text color for TextFields
QColor
textFieldText
(
void
)
const
{
return
_textFieldText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Background color for map buttons
QColor
mapButton
(
void
)
const
{
return
_mapButton
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Background color for map button in selected or hover state
QColor
mapButtonHighlight
(
void
)
const
{
return
_mapButtonHighlight
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Widget border color which will stand out against light map tiles
QColor
mapWidgetBorderLight
(
void
)
const
{
return
_mapWidgetBorderLight
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Widget border color which will stand out against dark map tiles
QColor
mapWidgetBorderDark
(
void
)
const
{
return
_mapWidgetBorderDark
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Purple color from branding guidelines
QColor
brandingPurple
(
void
)
const
{
return
_brandingPurple
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Blue color from branding guidelines
QColor
brandingBlue
(
void
)
const
{
return
_brandingBlue
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Arbitrary colors used for UI elements. Usually over _window and _windowShade.
QColor
colorGreen
()
const
{
return
_colorGreen
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
colorOrange
()
const
{
return
_colorOrange
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
colorRed
()
const
{
return
_colorRed
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
colorGrey
()
const
{
return
_colorGrey
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
colorBlue
()
const
{
return
_colorBlue
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
/// Alert and important message dialogs
QColor
alertBackground
()
const
{
return
_alertBackground
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
alertBorder
()
const
{
return
_alertBorder
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
alertText
()
const
{
return
_alertText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
Q_PROPERTY
(
Theme
globalTheme
READ
globalTheme
WRITE
setGlobalTheme
NOTIFY
paletteChanged
)
Q_PROPERTY
(
bool
colorGroupEnabled
READ
colorGroupEnabled
WRITE
setColorGroupEnabled
NOTIFY
paletteChanged
)
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
();
}
void
setText
(
QColor
&
color
)
{
_text
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setWarningText
(
QColor
&
color
)
{
_warningText
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setButton
(
QColor
&
color
)
{
_button
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setButtonText
(
QColor
&
color
)
{
_buttonText
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setButtonHighlight
(
QColor
&
color
)
{
_buttonHighlight
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setButtonHighlightText
(
QColor
&
color
)
{
_buttonHighlightText
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setPrimaryButton
(
QColor
&
color
)
{
_primaryButton
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setPrimaryButtonText
(
QColor
&
color
)
{
_primaryButtonText
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setTextField
(
QColor
&
color
)
{
_textField
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setTextFieldText
(
QColor
&
color
)
{
_textFieldText
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setMapButton
(
QColor
&
color
)
{
_mapButton
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setMapButtonHighlight
(
QColor
&
color
)
{
_mapButtonHighlight
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setMapWidgetBorderLight
(
QColor
&
color
)
{
_mapWidgetBorderLight
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setMapWidgetBorderDark
(
QColor
&
color
)
{
_mapWidgetBorderDark
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
DEFINE_QGC_COLOR
(
window
,
setWindow
)
DEFINE_QGC_COLOR
(
windowShade
,
setWindowShade
)
DEFINE_QGC_COLOR
(
windowShadeDark
,
setWindowShadeDark
)
DEFINE_QGC_COLOR
(
text
,
setText
)
DEFINE_QGC_COLOR
(
warningText
,
setWarningText
)
DEFINE_QGC_COLOR
(
button
,
setButton
)
DEFINE_QGC_COLOR
(
buttonText
,
setButtonText
)
DEFINE_QGC_COLOR
(
buttonHighlight
,
setButtonHighlight
)
DEFINE_QGC_COLOR
(
buttonHighlightText
,
setButtonHighlightText
)
DEFINE_QGC_COLOR
(
primaryButton
,
setPrimaryButton
)
DEFINE_QGC_COLOR
(
primaryButtonText
,
setPrimaryButtonText
)
DEFINE_QGC_COLOR
(
textField
,
setTextField
)
DEFINE_QGC_COLOR
(
textFieldText
,
setTextFieldText
)
DEFINE_QGC_COLOR
(
mapButton
,
setMapButton
)
DEFINE_QGC_COLOR
(
mapButtonHighlight
,
setMapButtonHighlight
)
DEFINE_QGC_COLOR
(
mapWidgetBorderLight
,
setMapWidgetBorderLight
)
DEFINE_QGC_COLOR
(
mapWidgetBorderDark
,
setMapWidgetBorderDark
)
DEFINE_QGC_COLOR
(
brandingPurple
,
setBrandingPurple
)
DEFINE_QGC_COLOR
(
brandingBlue
,
setBrandingBlue
)
DEFINE_QGC_COLOR
(
colorGreen
,
setColorGreen
)
DEFINE_QGC_COLOR
(
colorOrange
,
setColorOrange
)
DEFINE_QGC_COLOR
(
colorRed
,
setColorRed
)
DEFINE_QGC_COLOR
(
colorGrey
,
setColorGrey
)
DEFINE_QGC_COLOR
(
colorBlue
,
setColorBlue
)
DEFINE_QGC_COLOR
(
alertBackground
,
setAlertBackground
)
DEFINE_QGC_COLOR
(
alertBorder
,
setAlertBorder
)
DEFINE_QGC_COLOR
(
alertText
,
setAlertText
)
void
setColorGreen
(
QColor
&
color
)
{
_colorGreen
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setColorOrange
(
QColor
&
color
)
{
_colorOrange
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setColorRed
(
QColor
&
color
)
{
_colorRed
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setColorGrey
(
QColor
&
color
)
{
_colorGrey
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setColorBlue
(
QColor
&
color
)
{
_colorBlue
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
QGCPalette
(
QObject
*
parent
=
NULL
);
~
QGCPalette
();
void
setAlertBackground
(
QColor
&
color
)
{
_alertBackground
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setAlertBorder
(
QColor
&
color
)
{
_alertBorder
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
void
setAlertText
(
QColor
&
color
)
{
_alertText
[
_theme
][
_colorGroupEnabled
?
1
:
0
]
=
color
;
_signalPaletteChangeToAll
();
}
bool
colorGroupEnabled
()
const
{
return
_colorGroupEnabled
;
}
void
setColorGroupEnabled
(
bool
enabled
);
static
Theme
globalTheme
(
void
)
{
return
_theme
;
}
static
void
setGlobalTheme
(
Theme
newTheme
);
static
Theme
globalTheme
(
)
{
return
_theme
;
}
static
void
setGlobalTheme
(
Theme
newTheme
);
signals:
void
paletteChanged
(
void
);
void
paletteChanged
(
);
private:
static
void
_signalPaletteChangeToAll
(
void
);
void
_signalPaletteChanged
(
void
);
static
void
_signalPaletteChangeToAll
();
void
_signalPaletteChanged
();
void
_themeChanged
();
static
Theme
_theme
;
///< There is a single theme for all palettes
bool
_colorGroupEnabled
;
///< Currently selected ColorGroup. true: enabled, false: disabled
static
const
int
_cThemes
=
2
;
static
const
int
_cColorGroups
=
2
;
static
QColor
_window
[
_cThemes
][
_cColorGroups
];
static
QColor
_windowShade
[
_cThemes
][
_cColorGroups
];
static
QColor
_windowShadeDark
[
_cThemes
][
_cColorGroups
];
static
QColor
_warningText
[
_cThemes
][
_cColorGroups
];
static
QColor
_text
[
_cThemes
][
_cColorGroups
];
static
QColor
_button
[
_cThemes
][
_cColorGroups
];
static
QColor
_buttonText
[
_cThemes
][
_cColorGroups
];
static
QColor
_buttonHighlight
[
_cThemes
][
_cColorGroups
];
static
QColor
_buttonHighlightText
[
_cThemes
][
_cColorGroups
];
static
QColor
_primaryButton
[
_cThemes
][
_cColorGroups
];
static
QColor
_primaryButtonText
[
_cThemes
][
_cColorGroups
];
static
QColor
_primaryButtonHighlight
[
_cThemes
][
_cColorGroups
];
static
QColor
_primaryButtonHighlightText
[
_cThemes
][
_cColorGroups
];
static
QColor
_textField
[
_cThemes
][
_cColorGroups
];
static
QColor
_textFieldText
[
_cThemes
][
_cColorGroups
];
static
QColor
_mapButton
[
_cThemes
][
_cColorGroups
];
static
QColor
_mapButtonHighlight
[
_cThemes
][
_cColorGroups
];
static
QColor
_mapWidgetBorderLight
[
_cThemes
][
_cColorGroups
];
static
QColor
_mapWidgetBorderDark
[
_cThemes
][
_cColorGroups
];
static
QColor
_brandingPurple
[
_cThemes
][
_cColorGroups
];
static
QColor
_brandingBlue
[
_cThemes
][
_cColorGroups
];
static
QColor
_colorGreen
[
_cThemes
][
_cColorGroups
];
static
QColor
_colorOrange
[
_cThemes
][
_cColorGroups
];
static
QColor
_colorRed
[
_cThemes
][
_cColorGroups
];
static
QColor
_colorGrey
[
_cThemes
][
_cColorGroups
];
static
QColor
_colorBlue
[
_cThemes
][
_cColorGroups
];
static
QColor
_alertBackground
[
_cThemes
][
_cColorGroups
];
static
QColor
_alertBorder
[
_cThemes
][
_cColorGroups
];
static
QColor
_alertText
[
_cThemes
][
_cColorGroups
];
void
_themeChanged
(
void
);
static
QList
<
QGCPalette
*>
_paletteObjects
;
///< List of all active QGCPalette objects
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment