Skip to content

Commit

Permalink
improve joystick menu, allow changing frequency on air only
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Feb 6, 2024
1 parent 71c38dc commit b42493b
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 122 deletions.
4 changes: 2 additions & 2 deletions app/telemetry/settings/wblinksettingshelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<<param_id.toStdString()<<" to "<<value<<" (gnd failed)";
qWarning("%s", ss.str().c_str());
return -3;
}
}*/
std::stringstream ss;
ss<<"Successfully changed "<<param_id.toStdString()<<" to "<<value<<" ,might take up to 3 seconds until applied";
qDebug()<<ss.str().c_str();
Expand Down
1 change: 0 additions & 1 deletion qml/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@
<file>ui/elements/SmallHeaderInfoRow.qml</file>
<file>ui/elements/SettingsCategory.qml</file>
<file>ui/elements/BaseHeaderItem2.qml</file>
<file>ui/configpopup/openhd_settings/PopupSelectBitrate.qml</file>
<file>ui/configpopup/openhd_settings/ChooseCameraDialoque.qml</file>
<file>ui/elements/SettingBaseElement2.qml</file>
<file>ui/configpopup/openhd_settings/ChooseResolutionDialoque.qml</file>
Expand Down
37 changes: 4 additions & 33 deletions qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ Rectangle{
dialoqueFreqChangeGndOnly.close();
dialoqueFreqChangeAirGnd.close();
popup_enable_stbc_ldpc.close();
popup_select_bitrate.close();
}

function get_text_stbc_ldpc(air){
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -358,7 +357,7 @@ Rectangle{

SettingsCategory{
m_description: "TX POWER";
m_hide_elements: true;
m_hide_elements: false;
Row{
anchors.horizontalCenter: parent.horizontalCenter
Text{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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();
}
}
}
}
}
}
}
Expand All @@ -480,9 +454,6 @@ Rectangle{
PopupEnableSTBCLDPC{
id: popup_enable_stbc_ldpc
}
PopupSelectBitrate{
id: popup_select_bitrate
}

DialoqueFreqChangeGndOnly{
id: dialoqueFreqChangeGndOnly
Expand Down
35 changes: 0 additions & 35 deletions qml/ui/configpopup/openhd_settings/PopupSelectBitrate.qml

This file was deleted.

21 changes: 5 additions & 16 deletions qml/ui/configpopup/quick/BaseJoyEditElement.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}

Expand Down
14 changes: 5 additions & 9 deletions qml/ui/configpopup/quick/EditFrequencyElement.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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<frequencies_model.count;i++){
const tmp=frequencies_model.get(i).frequency;
if(curr_frequency==tmp){
Expand All @@ -41,7 +37,7 @@ BaseJoyEditElement{
m_model_index=-1;
}

property int curr_air_frequency: 5700
property int curr_air_frequency: _ohdSystemAir.curr_channel_mhz

onCurr_air_frequencyChanged: {
update_model_index()
Expand All @@ -60,7 +56,7 @@ BaseJoyEditElement{
m_displayed_value: {
if(!_ohdSystemAir.is_alive)return "N/A";
if(m_model_index==-1){
return "CUSTOM";
return "CUSTOM\n"+curr_air_frequency+"Mhz";
}
return frequencies_model.get(m_model_index).verbose;
}
Expand All @@ -74,12 +70,12 @@ BaseJoyEditElement{
}else{
new_model_index-=1;
}
// TODO
const new_frequency=frequencies_model.get(new_model_index).frequency
_wbLinkSettingsHelper.change_param_air_and_ground_frequency(new_frequency)
}

onChoice_left: {
set_air_frequency(false);
set_air_primary_camera_resolution(false);
}

onChoice_right: {
Expand Down
9 changes: 5 additions & 4 deletions qml/ui/configpopup/quick/EditResolutionElement.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ BaseJoyEditElement{

ListModel{
id: resolutions_model
ListElement {title: "640x480@60"; info:"640x480@60\nVGA 4:3"}
ListElement {title: "1280x720@60"; info:"1280x720@60\nHD 16:9"}
ListElement {title: "1920x1080@30"; info:"1920x1080@30\nFHD 16:9"}
ListElement {title: "0x0@0"; info:"AUTO\n"}
ListElement {title: "640x480@60"; info:"VGA 4:3\n60fps"}
ListElement {title: "1280x720@60"; info:"HD 16:9\n60fps"}
ListElement {title: "1920x1080@30"; info:"FHD 16:9\n30fps"}
}

property int m_model_index: -1;
Expand Down Expand Up @@ -43,7 +44,7 @@ BaseJoyEditElement{
m_displayed_value: {
if(!_ohdSystemAir.is_alive)return "N/A";
if(m_model_index==-1){
return "CUSTOM";
return "CUSTOM\n"+_cameraStreamModelPrimary.curr_set_video_format;
}
return resolutions_model.get(m_model_index).info;
}
Expand Down
1 change: 1 addition & 0 deletions qml/ui/configpopup/quick/GoBackElement.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Rectangle{
color: "white"
verticalAlignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignHCenter
anchors.fill: parent
}

Keys.onPressed: (event)=> {
Expand Down
19 changes: 11 additions & 8 deletions qml/ui/configpopup/quick/PanelQuick.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -128,6 +129,10 @@ Item {
id: middle_element
width: 200

GoBackElement{
id: go_back_element
}

EditFrequencyElement{
id: edit_frequency_element
}
Expand All @@ -143,9 +148,7 @@ Item {
EditResolutionElement{
id: edit_resolution_element
}
GoBackElement{
id: go_back_element
}

}

}
46 changes: 35 additions & 11 deletions qml/ui/configpopup/quick/TriangleButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}
}
}
Loading

0 comments on commit b42493b

Please sign in to comment.