Skip to content

Commit b4394be

Browse files
styling
1 parent c0f4622 commit b4394be

File tree

11 files changed

+630
-271
lines changed

11 files changed

+630
-271
lines changed

qml/main.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ ApplicationWindow {
9898
id: hudOverlayGrid
9999
anchors.fill: parent
100100
z: 3.0
101+
colorPicker: colorPicker
101102
//onSettingsButtonClicked: {
102103
// settings_panel.openSettings();
103104
//}

qml/ui/HUDOverlayGrid.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Item {
2323
// used by BaseWidget
2424
property bool m_show_vertical_center_indicator: false
2525
property bool m_show_horizontal_center_indicator: false
26+
property Item colorPicker: null
2627

2728
//scale: settings.dev_some_scale
2829

qml/ui/configpopup/qopenhd_settings/AppWidgetSettingsView.qml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,21 @@ ScrollView {
193193
}
194194
}
195195

196+
SettingBaseElement{
197+
m_short_description: qsTr("Show Bottom Link Bar")
198+
m_long_description: qsTr("Hide the bottom link sidebar without disabling other link widgets.")
199+
Switch {
200+
width: 32
201+
height: elementHeight
202+
anchors.rightMargin: Qt.inputMethod.visible ? 96 : 36
203+
204+
anchors.right: parent.right
205+
anchors.verticalCenter: parent.verticalCenter
206+
checked: settings.show_link_overview_widget_bottom
207+
onCheckedChanged: settings.show_link_overview_widget_bottom = checked
208+
}
209+
}
210+
196211
}
197212
SettingsCategory{
198213
m_description: "UAV (FC) WIDGETS"

qml/ui/elements/AppSettings.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Settings {
128128
property bool show_retransmission_stats: false
129129
property bool show_downlink_rssi: false
130130
property bool show_link_overview_widget: true
131+
property bool show_link_overview_widget_bottom: true
131132
property int link_snr_min_db: 0
132133
property int link_snr_max_db: 40
133134
//Const10
@@ -184,8 +185,8 @@ Settings {
184185
property int ground_voltage_in_percent: 0
185186

186187

187-
property bool show_gps: false
188-
property bool gps_show_all: false
188+
property bool show_gps: true
189+
property bool gps_show_all: true
189190
property bool gps_hide_identity_using_offset: false
190191
property bool gps_declutter: false
191192
property double gps_warn: 3

qml/ui/elements/ColorPicker.qml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ Card {
1919
enum ColorType {
2020
ShapeColor,
2121
GlowColor,
22-
TextColor
22+
TextColor,
23+
CustomColor
2324
}
2425

2526
property int currentColorType: ColorPicker.ColorType.ShapeColor
2627

28+
property var customTarget: null
29+
property string customProperty: ""
30+
property color customPreviousColor
31+
2732
property alias color: colorWheel.color
2833

2934
signal cancelled
@@ -44,6 +49,11 @@ Card {
4449
if (colorPicker.currentColorType == ColorPicker.ColorType.TextColor) {
4550
settings.color_text = colorPicker.previousColor
4651
}
52+
if (colorPicker.currentColorType == ColorPicker.ColorType.CustomColor) {
53+
if (colorPicker.customTarget && colorPicker.customProperty !== "") {
54+
colorPicker.customTarget[colorPicker.customProperty] = colorPicker.customPreviousColor
55+
}
56+
}
4757
}
4858

4959
Connections {
@@ -59,6 +69,11 @@ Card {
5969
if (colorPicker.currentColorType == ColorPicker.ColorType.TextColor) {
6070
settings.color_text = colorPicker.color
6171
}
72+
if (colorPicker.currentColorType == ColorPicker.ColorType.CustomColor) {
73+
if (colorPicker.customTarget && colorPicker.customProperty !== "") {
74+
colorPicker.customTarget[colorPicker.customProperty] = colorPicker.color
75+
}
76+
}
6277
}
6378

6479
}

qml/ui/widgets/BaseWidget.qml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,46 @@ BaseWidgetForm {
6565
}
6666
// Feature persist scale end --------------------------------------------------------------------------------------
6767

68+
// Feature persist background color begin --------------------------------------------------------------------------
69+
property string bw_background_color_identifier: "%1_bg_color".arg(widgetIdentifier);
70+
property string bw_current_background_color: settings.value(bw_background_color_identifier, "#000000");
71+
property bool bw_background_color_normalizing: false
72+
function bw_normalize_background_color(value){
73+
if (typeof value === "string") {
74+
if (value.length === 9 && value[0] === "#") {
75+
return "#" + value.substr(3);
76+
}
77+
return value;
78+
}
79+
if (value && typeof value === "object"
80+
&& value.r !== undefined
81+
&& value.g !== undefined
82+
&& value.b !== undefined) {
83+
var r = Math.round(value.r * 255).toString(16);
84+
var g = Math.round(value.g * 255).toString(16);
85+
var b = Math.round(value.b * 255).toString(16);
86+
if (r.length < 2) r = "0" + r;
87+
if (g.length < 2) g = "0" + g;
88+
if (b.length < 2) b = "0" + b;
89+
return "#" + r + g + b;
90+
}
91+
return value;
92+
}
93+
onBw_current_background_colorChanged: {
94+
if (bw_background_color_normalizing) {
95+
return;
96+
}
97+
bw_background_color_normalizing = true;
98+
var normalized = bw_normalize_background_color(bw_current_background_color);
99+
if (normalized !== bw_current_background_color) {
100+
bw_current_background_color = normalized;
101+
}
102+
settings.setValue(bw_background_color_identifier, normalized);
103+
settings.sync();
104+
bw_background_color_normalizing = false;
105+
}
106+
// Feature persist background color end ----------------------------------------------------------------------------
107+
68108
// Feature persist opacity begin ------------------------------------------------------------------------------------
69109
property string bw_opacity_identifier: "%1_opacity".arg(widgetIdentifier);
70110
// Default opacity is 1, the value is persistent

qml/ui/widgets/BaseWidgetDefaultUiControlElements.qml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import QtQuick.Controls 2.12
33
import QtQuick.Layouts 1.12
44

55
import Qt.labs.settings 1.0
6+
import "../elements"
67

78
// Can be used to quickly add the right UI elements for (persistently) setting scale and opacity for a HUD element (e.g. an element extending BaseWidget)
89
// By default, placed in one of the popups, and more values can be added manually if needed
@@ -18,6 +19,8 @@ ColumnLayout{
1819
property bool show_vertical_lock: false
1920
property bool show_horizontal_lock: false
2021
property bool show_transparency: true
22+
property bool show_background_color: false
23+
property var background_color_target: null
2124

2225
property bool show_quickpainteditem_font_scale: false
2326

@@ -105,6 +108,47 @@ ColumnLayout{
105108
}
106109
}
107110
}
111+
Item {
112+
width: parent.width
113+
height: 32
114+
visible: show_background_color
115+
Text {
116+
text: qsTr("Background Color")
117+
color: "white"
118+
height: parent.height
119+
font.bold: true
120+
font.pixelSize: detailPanelFontPixels
121+
anchors.left: parent.left
122+
verticalAlignment: Text.AlignVCenter
123+
}
124+
Rectangle {
125+
id: background_color_preview
126+
width: 22
127+
height: 22
128+
radius: 11
129+
color: background_color_target ? background_color_target.bw_current_background_color : bw_current_background_color
130+
border.color: "white"
131+
anchors.right: parent.right
132+
anchors.rightMargin: 6
133+
anchors.verticalCenter: parent.verticalCenter
134+
135+
MouseArea {
136+
anchors.fill: parent
137+
onClicked: {
138+
var picker = hudOverlayGrid ? hudOverlayGrid.colorPicker : null;
139+
if (!picker || !background_color_target) {
140+
return;
141+
}
142+
picker.customTarget = background_color_target
143+
picker.customProperty = "bw_current_background_color"
144+
picker.customPreviousColor = background_color_target.bw_current_background_color
145+
picker.currentColorType = ColorPicker.ColorType.CustomColor
146+
picker.color = background_color_target.bw_current_background_color
147+
picker.visible = true
148+
}
149+
}
150+
}
151+
}
108152
Item {
109153
width: parent.width
110154
height: 32

0 commit comments

Comments
 (0)