Update widget view switches to show widget color

This commit is contained in:
Alex Spataru 2024-09-26 10:47:36 -05:00
parent 65e865eb21
commit 06f854389c
5 changed files with 45 additions and 34 deletions

View File

@ -255,6 +255,7 @@ Widgets.Pane {
// Groups
//
ViewOptionsDelegate {
colorfulSwitches: false
title: qsTr("Data Grids")
count: Cpp_UI_Dashboard.datagridCount
titles: Cpp_UI_Dashboard.datagridTitles
@ -266,6 +267,7 @@ Widgets.Pane {
// Multiplots
//
ViewOptionsDelegate {
colorfulSwitches: false
title: qsTr("Multiple Data Plots")
count: Cpp_UI_Dashboard.multiPlotCount
titles: Cpp_UI_Dashboard.multiPlotTitles
@ -277,6 +279,7 @@ Widgets.Pane {
// LEDs
//
ViewOptionsDelegate {
colorfulSwitches: false
title: qsTr("LED Panels")
count: Cpp_UI_Dashboard.ledCount
titles: Cpp_UI_Dashboard.ledTitles
@ -343,6 +346,7 @@ Widgets.Pane {
// Gyroscopes
//
ViewOptionsDelegate {
colorfulSwitches: false
title: qsTr("Gyroscopes")
count: Cpp_UI_Dashboard.gyroscopeCount
titles: Cpp_UI_Dashboard.gyroscopeTitles
@ -354,6 +358,7 @@ Widgets.Pane {
// Accelerometers
//
ViewOptionsDelegate {
colorfulSwitches: false
title: qsTr("Accelerometers")
count: Cpp_UI_Dashboard.accelerometerCount
titles: Cpp_UI_Dashboard.accelerometerTitles
@ -366,6 +371,7 @@ Widgets.Pane {
//
ViewOptionsDelegate {
title: qsTr("GPS")
colorfulSwitches: false
count: Cpp_UI_Dashboard.gpsCount
titles: Cpp_UI_Dashboard.gpsTitles
icon: "qrc:/rcc/icons/dashboard/gps.svg"

View File

@ -11,6 +11,8 @@ ColumnLayout {
property var titles:[""]
property string icon: ""
property string title: ""
property bool colorfulSwitches: true
readonly property var widgetColors: Cpp_ThemeManager.colors["widget_colors"]
signal checkedChanged(var index, var checked)
@ -56,7 +58,7 @@ ColumnLayout {
Layout.rightMargin: -6
icon.color: "transparent"
icon.source: !checked ? "qrc:/rcc/icons/dashboard/show-all.svg" :
"qrc:/rcc/icons/dashboard/hide-all.svg"
"qrc:/rcc/icons/dashboard/hide-all.svg"
onCheckedChanged: {
for (var i = 0; i < root.count; ++i)
root.checkedChanged(i, !checked)
@ -73,7 +75,9 @@ ColumnLayout {
text: root.titles[index]
Layout.maximumHeight: 24
onCheckedChanged: root.checkedChanged(index, checked)
palette.highlight: Cpp_ThemeManager.colors["view_switch"]
palette.highlight: root.colorfulSwitches ?
root.widgetColors[index % root.widgetColors.length] :
Cpp_ThemeManager.colors["view_switch"]
}
}

View File

@ -86,16 +86,17 @@
"table_separator_header": "#55595e",
"widget_colors": [
"#3571c6",
"#cc6666",
"#cc9930",
"#4d996f",
"#bb5c9e",
"#db5ea2",
"#6a6a6a",
"#2a9999",
"#e5944d",
"#7a53a0"
"#61afef",
"#98c379",
"#e06c75",
"#d19a66",
"#c678dd",
"#ffcc00",
"#ff2d55",
"#7a7c80",
"#8e8e93",
"#b16286",
"#56b6c2"
]
}
}

View File

@ -86,17 +86,17 @@
"table_separator_header": "#FFD74A",
"widget_colors": [
"#1f76b4",
"#ff7f0f",
"#2aa02b",
"#d62628",
"#9467bd",
"#8c564c",
"#e377c1",
"#7f7f7f",
"#bcbd21",
"#19bdcf",
"#1955fe"
"#007aff",
"#ff9500",
"#34c759",
"#ff3b30",
"#af52de",
"#ffcc00",
"#ff2d55",
"#c7c7cc",
"#8e8e93",
"#007aff",
"#5856d6"
]
}
}

View File

@ -86,17 +86,17 @@
"alarm": "#ba252e",
"widget_colors": [
"#1f76b4",
"#ff7f0f",
"#2aa02b",
"#d62628",
"#9467bd",
"#8c564c",
"#e377c1",
"#7f7f7f",
"#bcbd21",
"#19bdcf",
"#1955fe"
"#007aff",
"#ff9500",
"#34c759",
"#ff3b30",
"#af52de",
"#ffcc00",
"#ff2d55",
"#c7c7cc",
"#8e8e93",
"#007aff",
"#5856d6"
]
}
}