Commit 62fb732c authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #4866 from dogmaphobic/paletteAdjustments

Palette adjustments
parents 926fa895 74dc5416
......@@ -330,7 +330,7 @@ SetupPage {
id: fenceAltMaxCheckBox
anchors.baseline: fenceAltMaxField.baseline
text: qsTr("Max altitude:")
checked: _fenceAlt.value > 0
checked: _fenceAlt ? _fenceAlt.value > 0 : false
onClicked: _fenceAlt.value = checked ? 100 : 0
width: _middleRowWidth
}
......@@ -408,21 +408,21 @@ SetupPage {
ExclusiveGroup { id: homeLoiterGroup }
QGCRadioButton {
id: homeLandRadio
checked: _rtlLandDelay.value === 0
checked: _rtlLandDelay ? _rtlLandDelay.value === 0 : false
exclusiveGroup: homeLoiterGroup
text: "Land immediately"
onClicked: _rtlLandDelay.value = 0
}
QGCRadioButton {
id: homeLoiterNoLandRadio
checked: _rtlLandDelay.value < 0
checked: _rtlLandDelay ? _rtlLandDelay.value < 0 : false
exclusiveGroup: homeLoiterGroup
text: "Loiter and do not land"
onClicked: _rtlLandDelay.value = -1
}
QGCRadioButton {
id: homeLoiterLandRadio
checked: _rtlLandDelay.value > 0
checked: _rtlLandDelay ? _rtlLandDelay.value > 0 : false
exclusiveGroup: homeLoiterGroup
text: qsTr("Loiter and land after specified time")
onClicked: _rtlLandDelay.value = 60
......@@ -504,7 +504,7 @@ SetupPage {
spacing: _margins * 0.5
anchors.verticalCenter: parent.verticalCenter
Row {
visible: !controller.vehicle.fixedWing && (_landSpeedMC !== -1)
visible: controller.vehicle ? (!controller.vehicle.fixedWing && (_landSpeedMC !== -1)) : false
QGCLabel {
anchors.baseline: landVelField.baseline
width: _middleRowWidth
......
......@@ -21,7 +21,7 @@ QGCTextField {
property string _validateString
// At this point all Facts are numeric
inputMethodHints: (fact.typeIsString || ScreenTools.isiOS) ?
inputMethodHints: (fact || fact.typeIsString || ScreenTools.isiOS) ?
Qt.ImhNone : // iOS numeric keyboard has no done button, we can't use it
Qt.ImhFormattedNumbersOnly // Forces use of virtual numeric keyboard
......
......@@ -15,7 +15,7 @@ Rectangle {
id: _root
height: editorLoader.y + editorLoader.height + (_margin * 2)
color: _currentItem ? qgcPal.buttonHighlight : qgcPal.windowShade
color: _currentItem ? qgcPal.primaryButton : qgcPal.windowShade
radius: _radius
property var map ///< Map control
......@@ -26,10 +26,10 @@ Rectangle {
signal remove
signal insert
property bool _currentItem: missionItem.isCurrentItem
property color _outerTextColor: _currentItem ? "black" : qgcPal.text
property bool _noMissionItemsAdded: ListView.view.model.count === 1
property real _sectionSpacer: ScreenTools.defaultFontPixelWidth / 2 // spacing between section headings
property bool _currentItem: missionItem.isCurrentItem
property color _outerTextColor: _currentItem ? qgcPal.primaryButtonText : qgcPal.text
property bool _noMissionItemsAdded: ListView.view.model.count === 1
property real _sectionSpacer: ScreenTools.defaultFontPixelWidth / 2 // spacing between section headings
readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 12)
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
......
......@@ -42,7 +42,7 @@ QColor QGCPalette::_text[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = {
QColor QGCPalette::_warningText[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = {
{ QColor("#cc0808"), QColor("#cc0808") },
{ QColor("#fd5d13"), QColor("#fd5d13") }
{ QColor("#f85761"), QColor("#f85761") }
};
QColor QGCPalette::_button[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = {
......@@ -56,18 +56,18 @@ QColor QGCPalette::_buttonText[QGCPalette::_cThemes][QGCPalette::_cColorGroups]
};
QColor QGCPalette::_buttonHighlight[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = {
{ QColor("#e4e4e4"), QColor("#33b5e5") },
{ QColor(0x58, 0x58, 0x58), QColor(0xed, 0xd4, 0x69) },
{ QColor("#e4e4e4"), QColor("#946120") },
{ QColor(0x58, 0x58, 0x58), QColor("#fff291") },
};
QColor QGCPalette::_buttonHighlightText[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = {
{ QColor(0x2c, 0x2c, 0x2c), QColor(0, 0, 0) },
{ 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("#badec5") },
{ QColor(0x58, 0x58, 0x58), QColor("#badec5") },
{ QColor(0x58, 0x58, 0x58), QColor("#8cb3be") },
{ QColor(0x58, 0x58, 0x58), QColor("#8cb3be") },
};
QColor QGCPalette::_primaryButtonText[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = {
......@@ -116,6 +116,27 @@ QColor QGCPalette::_brandingBlue[QGCPalette::_cThemes][QGCPalette::_cColorGroups
{ 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") },
};
QGCPalette::QGCPalette(QObject* parent) :
QObject(parent),
_colorGroupEnabled(true)
......
......@@ -60,12 +60,11 @@ class QGCPalette : public QObject
Q_PROPERTY(QColor brandingPurple READ brandingPurple NOTIFY paletteChanged)
Q_PROPERTY(QColor brandingBlue READ brandingBlue NOTIFY paletteChanged)
Q_PROPERTY(QColor colorGreen READ colorGreen CONSTANT)
Q_PROPERTY(QColor colorOrange READ colorOrange CONSTANT)
Q_PROPERTY(QColor colorRed READ colorRed CONSTANT)
Q_PROPERTY(QColor colorGrey READ colorGrey CONSTANT)
Q_PROPERTY(QColor colorBlue READ colorBlue CONSTANT)
Q_PROPERTY(QColor colorWhite READ colorWhite CONSTANT)
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)
public:
enum ColorGroup {
......@@ -142,12 +141,12 @@ public:
/// Blue color from branding guidelines
QColor brandingBlue(void) const { return _brandingBlue[_theme][_colorGroupEnabled ? 1 : 0]; }
QColor colorGreen () { return QColor("#05f068"); }
QColor colorOrange () { return QColor("#f0ab06"); }
QColor colorRed () { return QColor("#fc4638"); }
QColor colorGrey () { return QColor("#7f7f7f"); }
QColor colorBlue () { return QColor("#636efe"); }
QColor colorWhite () { return QColor("#ffffff"); }
/// 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]; }
void setWindow(QColor& color) { _window[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); }
void setWindowShade(QColor& color) { _windowShade[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); }
......@@ -167,6 +166,12 @@ public:
void setMapWidgetBorderLight(QColor& color) { _mapWidgetBorderLight[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); }
void setMapWidgetBorderDark(QColor& color) { _mapWidgetBorderDark[_theme][_colorGroupEnabled ? 1 : 0] = color; _signalPaletteChangeToAll(); }
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(); }
static Theme globalTheme(void) { return _theme; }
static void setGlobalTheme(Theme newTheme);
......@@ -211,6 +216,12 @@ private:
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];
void _themeChanged(void);
static QList<QGCPalette*> _paletteObjects; ///< List of all active QGCPalette objects
......
This diff is collapsed.
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