From b42493b74a72571e0d510a48a085c77a119509a6 Mon Sep 17 00:00:00 2001 From: consti10 Date: Tue, 6 Feb 2024 12:20:44 +0100 Subject: [PATCH] improve joystick menu, allow changing frequency on air only --- .../settings/wblinksettingshelper.cpp | 4 +- qml/qml.qrc | 1 - .../openhd_settings/LinkQuickPanel.qml | 37 ++------------- .../openhd_settings/PopupSelectBitrate.qml | 35 -------------- .../configpopup/quick/BaseJoyEditElement.qml | 21 ++------- .../quick/EditFrequencyElement.qml | 14 ++---- .../quick/EditResolutionElement.qml | 9 ++-- qml/ui/configpopup/quick/GoBackElement.qml | 1 + qml/ui/configpopup/quick/PanelQuick.qml | 19 ++++---- qml/ui/configpopup/quick/TriangleButton.qml | 46 ++++++++++++++----- qml/ui/widgets/VideoBitrateWidgetGeneric.qml | 6 +-- 11 files changed, 71 insertions(+), 122 deletions(-) delete mode 100644 qml/ui/configpopup/openhd_settings/PopupSelectBitrate.qml diff --git a/app/telemetry/settings/wblinksettingshelper.cpp b/app/telemetry/settings/wblinksettingshelper.cpp index 75a8eae08..afd9c1bba 100644 --- a/app/telemetry/settings/wblinksettingshelper.cpp +++ b/app/telemetry/settings/wblinksettingshelper.cpp @@ -196,14 +196,14 @@ int WBLinkSettingsHelper::change_param_air_and_ground_blocking(QString param_id, // we have changed the value on air, now change the ground // It is highly unlikely that fauls - if it does, we have an issue ! // But since qopenhd <-> openhd ground is either localhost or tcp, that should never be an issue - const auto command_gnd=XParam::create_cmd_set_int(OHD_SYS_ID_GROUND,OHD_COMP_ID_LINK_PARAM,param_id.toStdString(),value); + /*const auto command_gnd=XParam::create_cmd_set_int(OHD_SYS_ID_GROUND,OHD_COMP_ID_LINK_PARAM,param_id.toStdString(),value); const bool ground_success=XParam::instance().try_set_param_blocking(command_gnd,std::chrono::milliseconds(200),5); if(!ground_success){ std::stringstream ss; ss<<"Cannot change "<ui/elements/SmallHeaderInfoRow.qml ui/elements/SettingsCategory.qml ui/elements/BaseHeaderItem2.qml - ui/configpopup/openhd_settings/PopupSelectBitrate.qml ui/configpopup/openhd_settings/ChooseCameraDialoque.qml ui/elements/SettingBaseElement2.qml ui/configpopup/openhd_settings/ChooseResolutionDialoque.qml diff --git a/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml b/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml index ed57b2875..9ba0b9424 100644 --- a/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml +++ b/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml @@ -97,7 +97,6 @@ Rectangle{ dialoqueFreqChangeGndOnly.close(); dialoqueFreqChangeAirGnd.close(); popup_enable_stbc_ldpc.close(); - popup_select_bitrate.close(); } function get_text_stbc_ldpc(air){ @@ -133,7 +132,7 @@ Rectangle{ //contentWidth: main_column_layout.width //ScrollBar.vertical.policy: ScrollBar.AlwaysOn ScrollBar.vertical.interactive: true - visible: (!popup_analyze_channels.visible && !popup_enable_stbc_ldpc.visible && !popup_change_tx_power.visible && !popup_scan_channels.visible && !popup_select_bitrate.visible) + visible: (!popup_analyze_channels.visible && !popup_enable_stbc_ldpc.visible && !popup_change_tx_power.visible && !popup_scan_channels.visible) clip: true Item { @@ -147,7 +146,7 @@ Rectangle{ SettingsCategory{ m_description: "FREQUENCY / TOOLKIT" spacing: 1 - m_hide_elements: true; + m_hide_elements: false; Row{ anchors.horizontalCenter: parent.horizontalCenter @@ -358,7 +357,7 @@ Rectangle{ SettingsCategory{ m_description: "TX POWER"; - m_hide_elements: true; + m_hide_elements: false; Row{ anchors.horizontalCenter: parent.horizontalCenter Text{ @@ -405,7 +404,7 @@ Rectangle{ SettingsCategory{ m_description: "ADVANCED (STBC,LDPC)" - m_hide_elements: true; + m_hide_elements: false; Row{ anchors.horizontalCenter: parent.horizontalCenter Text{ @@ -438,31 +437,6 @@ Rectangle{ } } } - - SettingsCategory{ - m_description: "BITRATE SELECTOR"; - m_hide_elements: true; - Row{ - Text{ - width: m_small_width*2 - height: m_small_height - text: "Current Bitrate:\n"+"20Mhz, 14MBit/s"; - verticalAlignment: Qt.AlignVCenter - horizontalAlignment: Qt.AlignHCenter - font.bold: false - font.pixelSize: settings.qopenhd_general_font_pixel_size - } - Button{ - text: "EDIT"; - //enabled: true - enabled: true// _ohdSystemAir.is_alive - onClicked: { - close_all_dialoques(); - popup_select_bitrate.open(); - } - } - } - } } } } @@ -480,9 +454,6 @@ Rectangle{ PopupEnableSTBCLDPC{ id: popup_enable_stbc_ldpc } - PopupSelectBitrate{ - id: popup_select_bitrate - } DialoqueFreqChangeGndOnly{ id: dialoqueFreqChangeGndOnly diff --git a/qml/ui/configpopup/openhd_settings/PopupSelectBitrate.qml b/qml/ui/configpopup/openhd_settings/PopupSelectBitrate.qml deleted file mode 100644 index 9ae4c3275..000000000 --- a/qml/ui/configpopup/openhd_settings/PopupSelectBitrate.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick 2.0 - -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 -import QtQuick.Dialogs 1.0 -import QtQuick.Controls.Material 2.12 -import QtQuick.Controls.Styles 1.4 - -import Qt.labs.settings 1.0 - -import OpenHD 1.0 - -import "../../../ui" as Ui -import "../../elements" - -PopupBigGeneric{ - - m_title: "Bitrate Selector" - onCloseButtonClicked: { - close(); - } - - - function open(){ - visible=true - enabled=true - } - function close(){ - visible=false; - enabled=false; - } - - -} diff --git a/qml/ui/configpopup/quick/BaseJoyEditElement.qml b/qml/ui/configpopup/quick/BaseJoyEditElement.qml index a0f4a2a01..c7f153e1f 100644 --- a/qml/ui/configpopup/quick/BaseJoyEditElement.qml +++ b/qml/ui/configpopup/quick/BaseJoyEditElement.qml @@ -95,6 +95,7 @@ Item{ height: 50 anchors.top: title_str.bottom Rectangle{ + id: main_selector color: "white" width: parent.width /2; height: parent.height @@ -114,35 +115,23 @@ Item{ TriangleButton{ m_point_right: false id: button_left - text: "L" - anchors.left: parent.left + anchors.right: main_selector.left height: parent.height width: height onClicked: choice_left() enabled: m_button_left_activated - m_fill_color: { - if(enabled){ - return "green" - } - return "black" - } + m_is_enabled: enabled } TriangleButton{ m_point_right: true id: button_right - text: "R" - anchors.right: parent.right + anchors.left: main_selector.right height: parent.height width: height onClicked: choice_right() enabled: m_button_right_activated - m_fill_color: { - if(enabled){ - return "green" - } - return "black" - } + m_is_enabled: enabled } } diff --git a/qml/ui/configpopup/quick/EditFrequencyElement.qml b/qml/ui/configpopup/quick/EditFrequencyElement.qml index 5fc2f5ffc..001c4ef2b 100644 --- a/qml/ui/configpopup/quick/EditFrequencyElement.qml +++ b/qml/ui/configpopup/quick/EditFrequencyElement.qml @@ -26,11 +26,7 @@ BaseJoyEditElement{ property int m_model_index: -1; function update_model_index(){ - if(!_ohdSystemAir.is_alive){ - m_model_index=-1; - return; - } - const curr_frequency=5700; + const curr_frequency=curr_air_frequency; for(var i=0;i { diff --git a/qml/ui/configpopup/quick/PanelQuick.qml b/qml/ui/configpopup/quick/PanelQuick.qml index b06e56f35..5e9c852bd 100644 --- a/qml/ui/configpopup/quick/PanelQuick.qml +++ b/qml/ui/configpopup/quick/PanelQuick.qml @@ -21,20 +21,21 @@ Item { function gain_focus(){ + m_currently_selected_item=0; set_focus_to_selected_item(); } function set_focus_to_selected_item(){ if(m_currently_selected_item==0){ - edit_frequency_element.focus=true; + go_back_element.focus=true; }else if(m_currently_selected_item==1){ - edit_channel_width_element.focus=true; + edit_frequency_element.focus=true; }else if(m_currently_selected_item==2){ - edit_rate_element.focus=true; + edit_channel_width_element.focus=true; }else if(m_currently_selected_item==3){ + edit_rate_element.focus=true; + }else if(m_currently_selected_item==4){ edit_resolution_element.focus=true; - }else{ - go_back_element.focus=true; } } @@ -128,6 +129,10 @@ Item { id: middle_element width: 200 + GoBackElement{ + id: go_back_element + } + EditFrequencyElement{ id: edit_frequency_element } @@ -143,9 +148,7 @@ Item { EditResolutionElement{ id: edit_resolution_element } - GoBackElement{ - id: go_back_element - } + } } diff --git a/qml/ui/configpopup/quick/TriangleButton.qml b/qml/ui/configpopup/quick/TriangleButton.qml index 2a9a218e2..be674f48e 100644 --- a/qml/ui/configpopup/quick/TriangleButton.qml +++ b/qml/ui/configpopup/quick/TriangleButton.qml @@ -6,24 +6,48 @@ import QtQuick.Shapes 1.15 Button{ id: triangle_button - property bool m_is_active: false + property bool m_is_enabled: false property bool m_point_right: true property color m_fill_color: "green" - background: Shape { + //text: "L" + text: "" + + background: Item{ width: triangle_button.width height: triangle_button.height - id: shape - antialiasing: true - ShapePath { - fillColor: m_fill_color - strokeWidth: 0 - startX: m_point_right ? 0 : shape.width - PathLine { x: (m_point_right ? 0 : shape.width) ; y: 0 } - PathLine { x: (m_point_right ? shape.width : 0) ; y: shape.height/2 } - PathLine { x: (m_point_right ? 0 : shape.width) ; y: shape.height } + Rectangle{ + width: parent.width + height: parent.height + color: { + if(triangle_button.hovered){ + if(m_is_enabled){ + return "gray"; + } + return "red"; + } + return "transparent"; + } + } + Shape { + anchors.fill: parent + anchors.margins: 10 + id: shape + antialiasing: true + opacity: m_is_enabled ? 1.0 : 0.3; + ShapePath { + fillColor: { + return "white" + } + strokeWidth: 0 + strokeColor: fillColor + startX: m_point_right ? 0 : shape.width + PathLine { x: (m_point_right ? 0 : shape.width) ; y: 0 } + PathLine { x: (m_point_right ? shape.width : 0) ; y: shape.height/2 } + PathLine { x: (m_point_right ? 0 : shape.width) ; y: shape.height } + } } } } diff --git a/qml/ui/widgets/VideoBitrateWidgetGeneric.qml b/qml/ui/widgets/VideoBitrateWidgetGeneric.qml index bbdecf748..fa49295e4 100644 --- a/qml/ui/widgets/VideoBitrateWidgetGeneric.qml +++ b/qml/ui/widgets/VideoBitrateWidgetGeneric.qml @@ -81,7 +81,7 @@ BaseWidget { return; } if(mode===0){ //mode off - var result=camModel.try_update_parameter_int("V_AIR_RECORDING",0)==="" + var result=camModel.try_update_parameter_int("AIR_RECORDING_E",0)==="" if(result){ _hudLogMessagesModel.signalAddLogMessage(6,"recording "+camString+" disabled") m_camera_recording_mode=0; @@ -90,7 +90,7 @@ BaseWidget { } } if(mode===1){ //mode on - var result=camModel.try_update_parameter_int("V_AIR_RECORDING",1)==="" + var result=camModel.try_update_parameter_int("AIR_RECORDING_E",1)==="" if(result){ _hudLogMessagesModel.signalAddLogMessage(6,"recording "+camString+" enabled") m_camera_recording_mode=1; @@ -99,7 +99,7 @@ BaseWidget { } } if(mode==2){ //mode auto - var result=camModel.try_update_parameter_int("V_AIR_RECORDING",2)==="" + var result=camModel.try_update_parameter_int("AIR_RECORDING_E",2)==="" if(result){ _hudLogMessagesModel.signalAddLogMessage(6,"recording "+camString+" auto enabled") m_camera_recording_mode=2;