Commit b80a810a authored by Gus Grubba's avatar Gus Grubba

Adding alert message colors

parent d5e12680
......@@ -137,6 +137,21 @@ QColor QGCPalette::_colorBlue[QGCPalette::_cThemes][QGCPalette::_cColorGroups] =
{ 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) },
};
QGCPalette::QGCPalette(QObject* parent) :
QObject(parent),
_colorGroupEnabled(true)
......
......@@ -66,6 +66,10 @@ class QGCPalette : public QObject
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,
......@@ -148,6 +152,11 @@ public:
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]; }
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(); }
......@@ -172,6 +181,10 @@ public:
void setColorGrey (QColor& color) { _colorGrey[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); }
void setColorBlue (QColor& color) { _colorBlue[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); }
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(); }
static Theme globalTheme(void) { return _theme; }
static void setGlobalTheme(Theme newTheme);
......@@ -222,6 +235,10 @@ private:
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
......
......@@ -745,9 +745,109 @@ Rectangle {
text: palette.colorBlue
}
// alertBackground
Loader {
sourceComponent: rowHeader
property var text: "alertBackground"
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: false }
color: palette.alertBackground
onColorSelected: palette.alertBackground = color
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: true }
color: palette.alertBackground
onColorSelected: palette.alertBackground = color
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: false }
text: palette.alertBackground
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.alertBackground
}
// alertBorder
Loader {
sourceComponent: rowHeader
property var text: "alertBorder"
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: false }
color: palette.alertBorder
onColorSelected: palette.alertBorder = color
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: true }
color: palette.alertBorder
onColorSelected: palette.alertBorder = color
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: false }
text: palette.alertBorder
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.alertBorder
}
// alertText
Loader {
sourceComponent: rowHeader
property var text: "alertText"
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: false }
color: palette.alertText
onColorSelected: palette.alertText = color
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: true }
color: palette.alertText
onColorSelected: palette.alertText = color
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: false }
text: palette.alertText
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.alertText
}
}
Column {
spacing: 10
width: leftGrid.width
Grid {
id: leftGrid
columns: 3
spacing: 10
......@@ -954,6 +1054,20 @@ Rectangle {
enabled: false
}
}
Rectangle {
width: leftGrid.width
height: 60
radius: 3
color: palette.alertBackground
border.color: palette.alertBorder
anchors.horizontalCenter: parent.horizontalCenter
Label {
text: "Alert Message"
color: palette.alertText
anchors.centerIn: parent
}
}
}
}
Item{
......
......@@ -429,13 +429,13 @@ Item {
id: criticalMmessageArea
width: mainWindow.width * 0.55
height: Math.min(criticalMessageText.height + _textMargins * 2, ScreenTools.defaultFontPixelHeight * 6)
color: "#eecc44"
color: qgcPal.alertBackground
visible: false
radius: ScreenTools.defaultFontPixelHeight * 0.5
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: toolBar.height + ScreenTools.defaultFontPixelHeight / 2
border.color: "#808080"
border.color: qgcPal.alertBorder
border.width: 2
readonly property real _textMargins: ScreenTools.defaultFontPixelHeight
......@@ -484,7 +484,7 @@ Item {
font.pointSize: ScreenTools.defaultFontPointSize
font.family: ScreenTools.demiboldFontFamily
wrapMode: TextEdit.WordWrap
color: "black"
color: qgcPal.alertText
}
}
......@@ -499,7 +499,7 @@ Item {
sourceSize.height: width
source: "/res/XDelete.svg"
fillMode: Image.PreserveAspectFit
color: "black"
color: qgcPal.alertText
MouseArea {
anchors.fill: parent
anchors.margins: ScreenTools.isMobile ? -ScreenTools.defaultFontPixelHeight : 0
......@@ -520,7 +520,7 @@ Item {
source: "/res/ArrowDown.svg"
fillMode: Image.PreserveAspectFit
visible: criticalMessageText.lineCount > 5
color: "black"
color: qgcPal.alertText
MouseArea {
anchors.fill: parent
onClicked: {
......
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