Browse Source

Merge pull request #4866 from dogmaphobic/paletteAdjustments

Palette adjustments
QGC4.4
Gus Grubba 8 years ago committed by GitHub
parent
commit
62fb732c4e
  1. 10
      src/AutoPilotPlugins/PX4/SafetyComponent.qml
  2. 2
      src/FactSystem/FactControls/FactTextField.qml
  3. 10
      src/PlanView/MissionItemEditor.qml
  4. 33
      src/QGCPalette.cc
  5. 35
      src/QGCPalette.h
  6. 262
      src/QmlControls/QmlTest.qml

10
src/AutoPilotPlugins/PX4/SafetyComponent.qml

@ -330,7 +330,7 @@ SetupPage { @@ -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 { @@ -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 { @@ -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

2
src/FactSystem/FactControls/FactTextField.qml

@ -21,7 +21,7 @@ QGCTextField { @@ -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

10
src/PlanView/MissionItemEditor.qml

@ -15,7 +15,7 @@ Rectangle { @@ -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 { @@ -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

33
src/QGCPalette.cc

@ -42,7 +42,7 @@ QColor QGCPalette::_text[QGCPalette::_cThemes][QGCPalette::_cColorGroups] = { @@ -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] @@ -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 @@ -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)

35
src/QGCPalette.h

@ -60,12 +60,11 @@ class QGCPalette : public QObject @@ -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: @@ -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: @@ -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: @@ -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

262
src/QmlControls/QmlTest.qml

@ -1,15 +1,88 @@ @@ -1,15 +1,88 @@
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.2
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Rectangle {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
property var palette: QGCPalette { colorGroupEnabled: true }
color: "white"
Component {
id: arbBox
Rectangle {
width: arbGrid.width * 1.5
height: arbGrid.height * 1.5
color: backgroundColor
border.color: qgcPal.text
border.width: 1
anchors.horizontalCenter: parent.horizontalCenter
GridLayout {
id: arbGrid
columns: 4
rowSpacing: 10
anchors.centerIn: parent
QGCColoredImage {
color: qgcPal.colorGreen
width: ScreenTools.defaultFontPixelWidth * 2
height: width
sourceSize.height: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: "/qmlimages/Gears.svg"
}
Label { text: "colorGreen"; color: qgcPal.colorGreen; }
QGCColoredImage {
color: qgcPal.colorOrange
width: ScreenTools.defaultFontPixelWidth * 2
height: width
sourceSize.height: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: "/qmlimages/Gears.svg"
}
Label { text: "colorOrange"; color: qgcPal.colorOrange; }
QGCColoredImage {
color: qgcPal.colorRed
width: ScreenTools.defaultFontPixelWidth * 2
height: width
sourceSize.height: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: "/qmlimages/Gears.svg"
}
Label { text: "colorRed"; color: qgcPal.colorRed; }
QGCColoredImage {
color: qgcPal.colorGrey
width: ScreenTools.defaultFontPixelWidth * 2
height: width
sourceSize.height: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: "/qmlimages/Gears.svg"
}
Label { text: "colorGrey"; color: qgcPal.colorGrey; }
QGCColoredImage {
color: qgcPal.colorBlue
width: ScreenTools.defaultFontPixelWidth * 2
height: width
sourceSize.height: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: "/qmlimages/Gears.svg"
}
Label { text: "colorBlue"; color: qgcPal.colorBlue; }
}
}
}
Column {
Rectangle {
@ -20,7 +93,6 @@ Rectangle { @@ -20,7 +93,6 @@ Rectangle {
text: qsTr("Window Color")
anchors.left: parent.left
anchors.leftMargin: 20
anchors.verticalCenter: parent.horizontalCenter
}
Row {
id: themeChoice
@ -512,6 +584,167 @@ Rectangle { @@ -512,6 +584,167 @@ Rectangle {
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.warningText
}
// colorGreen
Loader {
sourceComponent: rowHeader
property var text: "colorGreen"
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: false }
color: palette.colorGreen
onColorSelected: palette.colorGreen = color
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: true }
color: palette.colorGreen
onColorSelected: palette.colorGreen = color
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: false }
text: palette.colorGreen
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.colorGreen
}
// colorOrange
Loader {
sourceComponent: rowHeader
property var text: "colorOrange"
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: false }
color: palette.colorOrange
onColorSelected: palette.colorOrange = color
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: true }
color: palette.colorOrange
onColorSelected: palette.colorOrange = color
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: false }
text: palette.colorOrange
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.colorOrange
}
// colorRed
Loader {
sourceComponent: rowHeader
property var text: "colorRed"
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: false }
color: palette.colorRed
onColorSelected: palette.colorRed = color
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: true }
color: palette.colorRed
onColorSelected: palette.colorRed = color
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: false }
text: palette.colorRed
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.colorRed
}
// colorGrey
Loader {
sourceComponent: rowHeader
property var text: "colorGrey"
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: false }
color: palette.colorGrey
onColorSelected: palette.colorGrey = color
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: true }
color: palette.colorGrey
onColorSelected: palette.colorGrey = color
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: false }
text: palette.colorGrey
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.colorGrey
}
// colorBlue
Loader {
sourceComponent: rowHeader
property var text: "colorBlue"
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: false }
color: palette.colorBlue
onColorSelected: palette.colorBlue = color
}
ClickableColor {
property var palette: QGCPalette { colorGroupEnabled: true }
color: palette.colorBlue
onColorSelected: palette.colorBlue = color
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: false }
text: palette.colorBlue
}
Text {
width: 80
height: 20
color: "black"
horizontalAlignment: Text.AlignHCenter
property var palette: QGCPalette { colorGroupEnabled: true }
text: palette.colorBlue
}
}
Grid {
@ -722,5 +955,28 @@ Rectangle { @@ -722,5 +955,28 @@ Rectangle {
}
}
}
Item{
height: 10;
width: 1;
}
Row {
spacing: 10
anchors.horizontalCenter: parent.horizontalCenter
Loader {
property var backgroundColor: qgcPal.window
sourceComponent: arbBox
}
Loader {
property var backgroundColor: qgcPal.windowShade
sourceComponent: arbBox
}
Loader {
property var backgroundColor: qgcPal.windowShadeDark
sourceComponent: arbBox
}
}
}
}

Loading…
Cancel
Save