Skip to content

Commit 55d3043

Browse files
sidebar
1 parent e02d98c commit 55d3043

24 files changed

+762
-140
lines changed

app/telemetry/settings/documentedparam.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ static std::vector<std::shared_ptr<XParam>> get_parameters_list(){
7979
"Enable passive mode if you want to use your GCS as a passive listener to an existing openhd air-ground link. E.g. if you want to tune into"
8080
"someone elses openhd link (if encryption is enabled, you need his encryption key) but not interfere with any RC/MAVLINK control."
8181
);
82+
append_int(ret,openhd::WB_PIT_MODE,
83+
ImprovedIntSetting::createEnumEnableDisable(),
84+
"Pit mode for TX power levels: when enabled and TX power level mode is active, disarmed uses LOWEST and armed uses the selected level."
85+
);
8286
append_int(ret,openhd::WB_DEV_AIR_SET_HIGH_RETRANSMIT_COUNT,
8387
ImprovedIntSetting::createEnumEnableDisable(),
8488
"DEV ONLY - DO NOT TOUCH (LEAVE DISABLED). Sets a wifi param that needs to be investigated."

app/telemetry/settings/param_names.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ static constexpr auto WB_MCS_INDEX_VIA_RC_CHANNEL="MCS_VIA_RC";
3131
static constexpr auto WB_POWER_VIA_RC_CHANNEL="PWR_VIA_RC";
3232
static constexpr auto WB_BW_VIA_RC_CHANNEL = "BW_VIA_RC";
3333
static constexpr auto WB_PASSIVE_MODE ="WB_PASSIVE_MODE";
34+
static constexpr auto WB_PIT_MODE ="WB_PIT_MODE";
3435
static constexpr auto WB_DEV_AIR_SET_HIGH_RETRANSMIT_COUNT="DEV_HIGH_RETR";
3536
static constexpr auto WB_ENABLE_RETRANSMISSION="WB_ENABLE_RETRA";
3637
static constexpr auto WB_ENABLE_RETRANSMISSION_VIDEO="WB_RTX_VIDEO";

app/telemetry/settings/wblinksettingshelper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ class WBLinkSettingsHelper : public QObject
9292
Q_INVOKABLE bool change_param_ground_only_frequency(int value){
9393
return change_param_ground_only_blocking(PARAM_ID_WB_FREQ,value);
9494
}
95+
Q_INVOKABLE bool change_param_ground_only_channel_width(int value){
96+
return change_param_ground_only_blocking(PARAM_ID_WB_CHANNEL_WIDTH,value);
97+
}
9598
// These params can be changed "on the fly" and are additionally their value(s) are broadcasted
9699
// so we can update them completely async, log the result to the user
97100
// and use the broadcasted value(s) to update the UI

qml/qml.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@
304304
<file>ui/sidebar/BaseJoyEditElement2.qml</file>
305305
<file>ui/sidebar/MavlinkChoiceElement2.qml</file>
306306
<file>ui/sidebar/MappedMavlinkChoices.qml</file>
307+
<file>ui/sidebar/PowerChoiceElement.qml</file>
308+
<file>ui/sidebar/PitModeElement.qml</file>
307309
<file>ui/widgets/X20OverheatWidget.qml</file>
308310
<file>ui/sidebar/ActionElement.qml</file>
309311
<file>ui/widgets/BatteryTempWidget.qml</file>

qml/ui/sidebar/BaseJoyEditElement.qml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,32 @@ Item{
8080
}
8181

8282
function takeover_control(){
83-
focus=true;
83+
forceActiveFocus();
84+
}
85+
86+
function ensure_visible_in_panel(){
87+
var p = parent;
88+
while(p && !p.ensure_body_item_visible){
89+
p = p.parent;
90+
}
91+
if(p){
92+
p.ensure_body_item_visible(base_joy_edit_element);
93+
}
94+
}
95+
96+
onActiveFocusChanged: {
97+
if(activeFocus){
98+
ensure_visible_in_panel();
99+
}
84100
}
85101

86102
Rectangle{
87103
width: parent.width
88104
height:parent.height
89105
border.color: "white"
90-
border.width: base_joy_edit_element.focus ? 3 : 0;
106+
border.width: base_joy_edit_element.activeFocus ? 3 : 0;
91107
color: "#333c4c"
92-
opacity: base_joy_edit_element.focus ? 1.0 : 0.3;
108+
opacity: base_joy_edit_element.activeFocus ? 1.0 : 0.3;
93109
}
94110

95111
Text {

qml/ui/sidebar/BaseJoyEditElement2.qml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,32 @@ Item{
4343
signal base_joy_edit_element_clicked();
4444

4545
function takeover_control(){
46-
focus=true;
46+
forceActiveFocus();
47+
}
48+
49+
function ensure_visible_in_panel(){
50+
var p = parent;
51+
while(p && !p.ensure_body_item_visible){
52+
p = p.parent;
53+
}
54+
if(p){
55+
p.ensure_body_item_visible(base_joy_edit_element);
56+
}
57+
}
58+
59+
onActiveFocusChanged: {
60+
if(activeFocus){
61+
ensure_visible_in_panel();
62+
}
4763
}
4864

4965
Rectangle{
5066
width: parent.width
5167
height:parent.height
5268
border.color: "white"
53-
border.width: base_joy_edit_element.focus ? 3 : 0;
69+
border.width: base_joy_edit_element.activeFocus ? 3 : 0;
5470
color: "#333c4c"
55-
opacity: base_joy_edit_element.focus ? 1.0 : 0.3;
71+
opacity: base_joy_edit_element.activeFocus ? 1.0 : 0.3;
5672
}
5773

5874

@@ -78,6 +94,7 @@ Item{
7894
font.pixelSize: 13
7995
color: override_show_red_text? "red" : "white"
8096
anchors.right: parent.right
97+
wrapMode: Text.Wrap
8198
}
8299

83100

qml/ui/sidebar/ChoiceSelector.qml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ Rectangle{
1515
property int m_current_user_selected_index: -1;
1616
// We are only 'clickable' if no joystick usage
1717
property bool m_allow_clickable: false
18+
property bool m_force_callback: false
19+
property string m_close_reason: ""
1820

1921
property var m_parent
2022

2123
function open_choices(x_model,current_value,parent){
2224
// First, find the current selection inside the model
2325
availableChociesModel.clear();
26+
m_close_reason="";
2427
var current_value_index=0
2528
var current_value_found_in_model=false;
2629
for(var i=0;i<x_model.count;i++){
@@ -55,9 +58,17 @@ Rectangle{
5558
m_allow_clickable=clickable;
5659
}
5760

61+
function set_force_callback(force){
62+
m_force_callback=force;
63+
}
64+
5865
// Calls the parent's update method if there is any change and closes
5966
function close_choices(){
60-
if(m_current_user_selected_index!=m_initial_index){
67+
var should_callback = (m_current_user_selected_index!=m_initial_index);
68+
if(m_force_callback && m_close_reason!=="cancel" && m_close_reason!=="discard"){
69+
should_callback = true;
70+
}
71+
if(should_callback){
6172
const value_old=availableChociesModel.get(m_initial_index).value;
6273
const value_new=availableChociesModel.get(m_current_user_selected_index).value;
6374
console.log("Changed from ["+m_initial_index+":"+value_old+"] to ["+m_current_user_selected_index+":"+value_new+"]");
@@ -67,6 +78,8 @@ Rectangle{
6778
m_initial_index=-1;
6879
visible=false;
6980
focus=false;
81+
m_force_callback=false;
82+
m_close_reason="";
7083
m_parent.takeover_control();
7184
}
7285

@@ -76,6 +89,8 @@ Rectangle{
7689
m_initial_index=-1;
7790
visible=false;
7891
focus=false;
92+
m_force_callback=false;
93+
m_close_reason="discard";
7994
}
8095

8196

@@ -84,6 +99,7 @@ Rectangle{
8499
if(event.key == Qt.Key_Left){
85100
// Either close immediately or go back to the initial choice (don't save)
86101
if(m_current_user_selected_index==m_initial_index){
102+
m_close_reason="cancel";
87103
close_choices();
88104
}else{
89105
m_current_user_selected_index=m_initial_index;
@@ -92,8 +108,12 @@ Rectangle{
92108
}else if(event.key == Qt.Key_Right){
93109
// Save and close or do nothing
94110
if(m_current_user_selected_index==m_initial_index){
95-
// Do nothing
111+
if(m_force_callback){
112+
m_close_reason="accept";
113+
close_choices();
114+
}
96115
}else{
116+
m_close_reason="accept";
97117
close_choices();
98118
}
99119
event.accepted=true;
@@ -112,6 +132,7 @@ Rectangle{
112132
}
113133
event.accepted=true;
114134
}else if(event.key==Qt.Key_Enter || event.key==Qt.Key_Return){
135+
m_close_reason="accept";
115136
close_choices();
116137
event.accepted=true;
117138
}
@@ -165,6 +186,7 @@ Rectangle{
165186
anchors.fill: parent
166187
onClicked: {
167188
if(m_allow_clickable){
189+
m_close_reason="accept";
168190
m_current_user_selected_index=index;
169191
close_choices();
170192
}

qml/ui/sidebar/GoBackElement.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ Item{
1717
width: parent.width
1818
height: parent.height
1919
border.color: "black"
20-
border.width: go_back_element.focus ? 3 : 0;
20+
border.width: go_back_element.activeFocus ? 3 : 0;
2121
color: "#333c4c"
22-
opacity: go_back_element.focus ? 1.0 : 0.3;
22+
opacity: go_back_element.activeFocus ? 1.0 : 0.3;
2323
}
2424
Text{
2525
text: qsTr("BACK")

qml/ui/sidebar/InfoElement2.qml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@ RowLayout {
1515
property string override_text_left: "TODO"
1616
property string override_text_right: "TODO"
1717
property string override_color_right: "#fff"
18+
Layout.fillWidth: true
19+
spacing: 8
1820

1921
Text {
20-
width: 150
22+
Layout.preferredWidth: 160
2123
text: override_text_left
2224
font.pixelSize: 14
2325
font.bold: true
2426
font.family: "AvantGarde-Medium"
2527
color: "#ffffff"
2628
smooth: true
29+
verticalAlignment: Qt.AlignVCenter
30+
horizontalAlignment: Text.AlignLeft
2731
}
2832

2933
Text {
@@ -32,6 +36,10 @@ RowLayout {
3236
font.family: "AvantGarde-Medium"
3337
color: override_color_right
3438
smooth: true
39+
Layout.fillWidth: true
40+
verticalAlignment: Qt.AlignVCenter
41+
horizontalAlignment: Text.AlignRight
42+
elide: Text.ElideRight
3543

3644
}
3745
}

0 commit comments

Comments
 (0)