From 3e95a8528a9292de752dfb883ffc1bb699cb2041 Mon Sep 17 00:00:00 2001 From: Yasen Date: Sun, 28 Jul 2019 20:02:30 +0200 Subject: [PATCH] Custom example theme fixes - Dark theme update This is a small experiment into creating a custom theme for QGC. --- asset_catalog_compiler.Info.plist | 5 +++ custom | 1 + custom-example/custom-example | 1 + .../Custom/Widgets/CustomToolBarButton.qml | 4 +-- custom-example/res/CustomCameraControl.qml | 8 ++--- custom-example/res/CustomFlyView.qml | 6 ++-- custom-example/src/CustomPlugin.cc | 36 +++++++++---------- src/QmlControls/ToolStrip.qml | 2 +- 8 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 asset_catalog_compiler.Info.plist create mode 120000 custom create mode 120000 custom-example/custom-example diff --git a/asset_catalog_compiler.Info.plist b/asset_catalog_compiler.Info.plist new file mode 100644 index 000000000..0c67376eb --- /dev/null +++ b/asset_catalog_compiler.Info.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/custom b/custom new file mode 120000 index 000000000..5d5699b3f --- /dev/null +++ b/custom @@ -0,0 +1 @@ +custom-example \ No newline at end of file diff --git a/custom-example/custom-example b/custom-example/custom-example new file mode 120000 index 000000000..5d5699b3f --- /dev/null +++ b/custom-example/custom-example @@ -0,0 +1 @@ +custom-example \ No newline at end of file diff --git a/custom-example/res/Custom/Widgets/CustomToolBarButton.qml b/custom-example/res/Custom/Widgets/CustomToolBarButton.qml index a9eed915d..cff1a0e80 100644 --- a/custom-example/res/Custom/Widgets/CustomToolBarButton.qml +++ b/custom-example/res/Custom/Widgets/CustomToolBarButton.qml @@ -40,7 +40,7 @@ Button { width: height sourceSize.height: parent.height fillMode: Image.PreserveAspectFit - color: (mouseArea.pressed || button.checked) ? qgcPal.colorOrange : qgcPal.buttonText + color: (mouseArea.pressed || button.checked) ? qgcPal.primaryButton : qgcPal.buttonText source: button.icon.source anchors.verticalCenter: parent.verticalCenter } @@ -48,7 +48,7 @@ Button { id: _label visible: text !== "" text: button.text - color: (mouseArea.pressed || button.checked) ? qgcPal.colorOrange : qgcPal.buttonText + color: (mouseArea.pressed || button.checked) ? qgcPal.primaryButton : qgcPal.buttonText anchors.verticalCenter: parent.verticalCenter } } diff --git a/custom-example/res/CustomCameraControl.qml b/custom-example/res/CustomCameraControl.qml index cc011d15b..28f9f1758 100644 --- a/custom-example/res/CustomCameraControl.qml +++ b/custom-example/res/CustomCameraControl.qml @@ -88,7 +88,7 @@ Item { id: backgroundRect width: buttonsRow.width + (ScreenTools.defaultFontPixelWidth * 4) height: buttonsRow.height + (ScreenTools.defaultFontPixelHeight) - color: qgcPal.windowShade + color: qgcPal.window radius: height * 0.5 visible: _camera && _camera.modelName === "DSC-QX30" && QGroundControl.videoManager.hasThermal anchors.horizontalCenter: parent.horizontalCenter @@ -198,7 +198,7 @@ Item { id: cameraRect height: cameraCol.height width: cameraCol.width + (ScreenTools.defaultFontPixelWidth * 4) - color: qgcPal.windowShade + color: qgcPal.window radius: ScreenTools.defaultFontPixelWidth * 0.5 anchors.horizontalCenter: parent.horizontalCenter Column { @@ -274,7 +274,7 @@ Item { fillMode: Image.PreserveAspectFit mipmap: true smooth: true - color: qgcPal.windowShade + color: qgcPal.window visible: { if(_cameraPhotoMode && !_cameraPhotoIdle && !_cameraElapsedMode) { return true @@ -426,7 +426,7 @@ Item { ZoomControl { id: zoomControl visible: _hasZoom - mainColor: qgcPal.windowShade + mainColor: qgcPal.window contentColor: qgcPal.text fontPointSize: ScreenTools.defaultFontPointSize * 1.25 zoomLevelVisible: false diff --git a/custom-example/res/CustomFlyView.qml b/custom-example/res/CustomFlyView.qml index 548aafd61..461d64d17 100644 --- a/custom-example/res/CustomFlyView.qml +++ b/custom-example/res/CustomFlyView.qml @@ -251,7 +251,7 @@ Item { //-- Vehicle Indicator Rectangle { id: vehicleIndicator - color: qgcPal.windowShade + color: qgcPal.window width: vehicleStatusGrid.width + (ScreenTools.defaultFontPixelWidth * 3) height: vehicleStatusGrid.height + (ScreenTools.defaultFontPixelHeight * 1.5) radius: 2 @@ -460,7 +460,7 @@ Item { //-- Attitude Indicator Rectangle { - color: qgcPal.windowShade + color: qgcPal.window width: attitudeIndicator.width * 0.5 height: vehicleIndicator.height visible: _showAttitude @@ -581,7 +581,7 @@ Item { } QGCLabel { text: qsTr("The vehicle will automatically cancel the flight and return to land. Ensure a clear line of sight between transmitter and vehicle. Ensure the takeoff location is clear.") - width: connectionLostArmed.width * 0.75 + width: connectionLostArmed.width * 0.75 wrapMode: Text.WordWrap color: qgcPal.alertText font.family: ScreenTools.demiboldFontFamily diff --git a/custom-example/src/CustomPlugin.cc b/custom-example/src/CustomPlugin.cc index ed8332687..9f64af30f 100644 --- a/custom-example/src/CustomPlugin.cc +++ b/custom-example/src/CustomPlugin.cc @@ -233,27 +233,27 @@ CustomPlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& const QColor CustomPlugin::_windowShadeEnabledLightColor("#FFFFFF"); -const QColor CustomPlugin::_windowShadeEnabledDarkColor("#0B1420"); +const QColor CustomPlugin::_windowShadeEnabledDarkColor("#212529"); //----------------------------------------------------------------------------- void CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo) { if (colorName == QStringLiteral("window")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#0b1420"); - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#0b1420"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#212529"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#212529"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#ffffff"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#ffffff"); } else if (colorName == QStringLiteral("windowShade")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#342926"); - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#342926"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#343A40"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#343A40"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#d9d9d9"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#d9d9d9"); } else if (colorName == QStringLiteral("windowShadeDark")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#40332e"); - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#080f18"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#1A1C1F"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#1A1C1F"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#bdbdbd"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#bdbdbd"); } @@ -270,7 +270,7 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#cc0808"); } else if (colorName == QStringLiteral("button")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#594e4c"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#495057"); colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#313d4d"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#ffffff"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#ffffff"); @@ -282,26 +282,26 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#9d9d9d"); } else if (colorName == QStringLiteral("buttonHighlight")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#F3BC5E"); - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#222a35"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#07916D"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#313d4d"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#edcfb4"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#e4e4e4"); } else if (colorName == QStringLiteral("buttonHighlightText")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#1d3c20"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#FFFFFF"); colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#777c89"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#211b1b"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#2c2c2c"); } else if (colorName == QStringLiteral("primaryButton")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#24dc09"); - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#29313a"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#12B886"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#313d4d"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#8e5e54"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#585858"); } else if (colorName == QStringLiteral("primaryButtonText")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#29313A"); - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#777c89"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#FFFFFF"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#FFFFFF"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#29313A"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#cad0d0"); } @@ -324,7 +324,7 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#585858"); } else if (colorName == QStringLiteral("mapButtonHighlight")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#84c448"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#07916D"); colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#585858"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#be781c"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#585858"); @@ -396,8 +396,8 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#585858"); } else if (colorName == QStringLiteral("hoverColor")) { - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#746D59"); - colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#746D59"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#07916D"); + colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled] = QColor("#33C494"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled] = QColor("#464f5a"); colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#464f5a"); } diff --git a/src/QmlControls/ToolStrip.qml b/src/QmlControls/ToolStrip.qml index a293dd6e7..a49b0c6f7 100644 --- a/src/QmlControls/ToolStrip.qml +++ b/src/QmlControls/ToolStrip.qml @@ -16,7 +16,7 @@ import QGroundControl.Controls 1.0 Rectangle { id: _root - color: qgcPal.windowShade + color: qgcPal.window width: _idealWidth < repeater.contentWidth ? repeater.contentWidth : _idealWidth height: toolStripColumn.height + (toolStripColumn.anchors.margins * 2) radius: ScreenTools.defaultFontPixelWidth / 2 -- 2.22.0