From 4d069c2c6eed91e4b67a2e438b8a1e8ade7f7f3c Mon Sep 17 00:00:00 2001 From: consti10 Date: Sun, 15 Oct 2023 22:50:55 +0200 Subject: [PATCH] wb link settings - better use available space and group things --- qml/qml.qrc | 9 +- .../DIaloqueStartChannelScan.qml | 211 -------- .../openhd_settings/DialoqueChangeTxPower.qml | 454 ------------------ .../DialoqueStartAnalyzeChannels.qml | 119 ----- .../MavlinkOpenHDWBParamPanel2.qml | 6 +- ...ChartView.qml => PopupAnalyzeChannels.qml} | 0 ...ProgressView.qml => PopupScanChannels.qml} | 0 ...xPowerPopup.qml => PopupTxPowerEditor.qml} | 28 ++ qml/ui/elements/WorkaroundMessageBox.qml | 12 +- 9 files changed, 42 insertions(+), 797 deletions(-) delete mode 100644 qml/ui/configpopup/openhd_settings/DIaloqueStartChannelScan.qml delete mode 100644 qml/ui/configpopup/openhd_settings/DialoqueChangeTxPower.qml delete mode 100644 qml/ui/configpopup/openhd_settings/DialoqueStartAnalyzeChannels.qml rename qml/ui/configpopup/openhd_settings/{PollutionChartView.qml => PopupAnalyzeChannels.qml} (100%) rename qml/ui/configpopup/openhd_settings/{ChannelScanProgressView.qml => PopupScanChannels.qml} (100%) rename qml/ui/configpopup/openhd_settings/{ChangeTxPowerPopup.qml => PopupTxPowerEditor.qml} (86%) diff --git a/qml/qml.qrc b/qml/qml.qrc index bd365b3df..8678af5be 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -213,8 +213,6 @@ ui/configpopup/openhd_settings/MavlinkOpenHDWBParamPanel.qml ui/configpopup/openhd_settings/MavlinkAllSettingsPanel.qml ui/configpopup/openhd_settings/DialoqueFreqChangeGndOnly.qml - ui/configpopup/openhd_settings/DialoqueStartAnalyzeChannels.qml - ui/configpopup/openhd_settings/DIaloqueStartChannelScan.qml ui/configpopup/ConfigPopupSidebarButton.qml ui/configpopup/rc/RcInfoScreen.qml ui/configpopup/rc/RcInfoPanel.qml @@ -228,7 +226,6 @@ ui/configpopup/dev/AppDeveloperStatsPanel.qml ui/configpopup/credits/Credits.qml ui/configpopup/connect/ConnectPanel.qml - ui/configpopup/openhd_settings/DialoqueChangeTxPower.qml ui/elements/RestartQOpenHDMessageBox.qml ui/widgets/map/MapWidgetForm.ui.qml ui/widgets/map/MapWidget.qml @@ -259,10 +256,10 @@ ui/configpopup/dev/QOpenHDServiceDialoque.qml ui/elements/ButtonDisconnected.qml ui/configpopup/status/DialoqueNotAlive.qml - ui/configpopup/openhd_settings/PollutionChartView.qml + ui/configpopup/openhd_settings/PopupAnalyzeChannels.qml ui/configpopup/log/LogMessagesView.qml ui/configpopup/openhd_settings/MavlinkOpenHDWBParamPanel2.qml - ui/configpopup/openhd_settings/ChannelScanProgressView.qml - ui/configpopup/openhd_settings/ChangeTxPowerPopup.qml + ui/configpopup/openhd_settings/PopupScanChannels.qml + ui/configpopup/openhd_settings/PopupTxPowerEditor.qml diff --git a/qml/ui/configpopup/openhd_settings/DIaloqueStartChannelScan.qml b/qml/ui/configpopup/openhd_settings/DIaloqueStartChannelScan.qml deleted file mode 100644 index 303540b28..000000000 --- a/qml/ui/configpopup/openhd_settings/DIaloqueStartChannelScan.qml +++ /dev/null @@ -1,211 +0,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 "../../elements" - -// I fucking hate writing UIs in QT -// Dialoque that initiates a channel scan once the user selected everything correctly / passed all the checks -Card { - id: dialoqueStartChannelScan - width: 360 - height: 340 - z: 5.0 - anchors.centerIn: parent - cardName: qsTr("Find Air Unit") - cardNameColor: "black" - visible: false - - property int m_curr_index: 0 - - function open_channel_scan_dialoque(){ - var is_armed= _fcMavlinkSystem.is_alive && _fcMavlinkSystem.armed - if(is_armed){ - m_curr_index=0; - }else{ - m_curr_index=1; - } - dialoqueStartChannelScan.visible=true - } - - ListModel{ - id: model_chann_2G_or_5G - //ListElement {title: "All 2.4G and 5.8G channels (slow)"; value: 0} - ListElement {title: "OpenHD [1-5] only (fast)"; value: 0} - ListElement {title: "All 2.4G channels (slow)"; value: 1} - ListElement {title: "All 5.8G channels (slow)"; value: 2} - } - - // like dji, we use 20 or 40Mhz bandwidth(s) but never 5 or 10 - ListModel{ - id: model_bandwidth_all_or_20_or_40 - ListElement {title: "20Mhz and 40Mhz (slow)"; value: 0} - ListElement {title: "20Mhz only"; value: 1} - ListElement {title: "40Mhz only"; value: 2} - } - - cardBody: Item{ - height: 200 - width: 320 - // warn if armed dialoque - Item{ - id: dialoque1 - visible: m_curr_index==0 - width: parent.width - height: parent.height - Text{ - text: "WARNING ! Performing a channel scan while armed is not recommended, you'l loose connecion !" - width: parent.width - height: parent.height-100 - leftPadding: 12 - rightPadding: 12 - wrapMode: Text.WordWrap - } - } - // select and then initiate dialoque - Item{ - id: dialoque2 - visible: m_curr_index==1 - width: parent.width - height: parent.height - Text { - id: dialoqueStartChannelScan_text - text: "Initiate Channel Scan (Find a running air unit). Might take more than 1 minute if you are not specifying the generic band below. Otherwise,it'l take - max 30 seconds, usually less" - width: parent.width - height: parent.height-100 - leftPadding: 12 - rightPadding: 12 - wrapMode: Text.WordWrap - - } - ComboBox { - width: parent.width - //height: 100 - anchors.top: dialoqueStartChannelScan_text.bottom - id: comboBoxWhichFrequencyToScan - model: model_chann_2G_or_5G - textRole: "title" - Material.background: { - (comboBoxWhichFrequencyToScan.currentIndex===0) ? Material.Orange : Material.Green - } - onCurrentIndexChanged: { - } - } - /*ComboBox { - width: parent.width - //height: 100 - anchors.top: comboBoxWhichFrequencyToScan.bottom - id: comboBoxWhichChannelWidthsToScan - model: model_bandwidth_all_or_20_or_40 - textRole: "title" - Material.background: { - (comboBoxWhichChannelWidthsToScan.currentIndex===0) ? Material.Orange : Material.Green - } - onCurrentIndexChanged: { - } - }*/ - } - // after initiate dialoque - Item{ - id: dialoque3 - visible: m_curr_index==2 - width: parent.width - height: parent.height - Text{ - id: dialoqueStartChannelScan_text2 - text: "Scanning channels, you can close this dialoque and go back to your OSD screen. PLEASE DO NOT CHANGE SETTINGS WHILE CHANNEL SCAN IS ACTIVE !" - width: parent.width - height: parent.height-100 - leftPadding: 12 - rightPadding: 12 - wrapMode: Text.WordWrap - } - } - - } - hasFooter: true - cardFooter: Item { - anchors.fill: parent - - // First dialoque - RowLayout{ - anchors.fill: parent - visible: m_curr_index==0 - ButtonRed{ - text: "PROCCEED ANYWAY" - /*Layout.fillWidth: true - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft*/ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - onClicked: { - m_curr_index++; - } - } - ButtonGreen{ - text: "CANCEL" - /*Layout.fillWidth: true - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight*/ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: 12 - onClicked: { - dialoqueStartChannelScan.visible=false; - } - } - } - // Second dialoque - RowLayout{ - anchors.fill: parent - visible: m_curr_index==1 - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - text: qsTr("Cancel") - visible: m_curr_index==1 - onPressed: { - dialoqueStartChannelScan.visible=false; - } - } - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: 12 - text: qsTr("Initiate") - onPressed: { - var how_many_freq_bands=comboBoxWhichFrequencyToScan.currentIndex - // Changed: We now (only) support scanning in 40Mhz mode, since this way, we are quicker and catch both 20Mhz and 40Mhz air unit(s) - //var how_many_bandwidths=comboBoxWhichChannelWidthsToScan.currentIndex - var how_many_bandwidths = 2; - console.log("Initate channel scan "+how_many_freq_bands+","+how_many_bandwidths) - var result = _wbLinkSettingsHelper.start_scan_channels(how_many_freq_bands,how_many_bandwidths) - if(result){ - m_curr_index=2; - }else{ - console.log("Cannot initiate channel scan"); - _qopenhd.show_toast("Busy,please try again later",true) - } - } - } - } - RowLayout{ - anchors.fill: parent - visible: m_curr_index==2 - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: 12 - text: qsTr("Close") - onPressed: { - dialoqueStartChannelScan.visible=false; - } - } - } - } -} diff --git a/qml/ui/configpopup/openhd_settings/DialoqueChangeTxPower.qml b/qml/ui/configpopup/openhd_settings/DialoqueChangeTxPower.qml deleted file mode 100644 index fcb041c60..000000000 --- a/qml/ui/configpopup/openhd_settings/DialoqueChangeTxPower.qml +++ /dev/null @@ -1,454 +0,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 "../../elements" - -// I fucking hate writing UIs in QT -// Dialoque that changes the tx power once the user selected everything correctly / passed all the checks -Card { - id: dialoqueTxPower - width: 360 - height: 340 - z: 5.0 - anchors.centerIn: parent - cardName: qsTr("Change TX PWR "+get_is_ground_as_string()) - cardNameColor: "black" - visible: false - - // check if all ground cards use the same chipset - otherwise, this wizard cannot be used - function gnd_check_all_active_cards_are_same_type(){ - var card0_type=_wifi_card_gnd0.card_type; - if(_wifi_card_gnd1.alive && (_wifi_card_gnd1.card_type != card0_type)){ - return false; - } - if(_wifi_card_gnd2.alive && (_wifi_card_gnd2.card_type != card0_type)){ - return false; - } - if(_wifi_card_gnd3.alive && (_wifi_card_gnd3.card_type != card0_type)){ - return false; - } - return true; - } - - function open_tx_power_dialoque(ground){ - var is_armed= _fcMavlinkSystem.is_alive && _fcMavlinkSystem.armed - if(is_armed){ - // User has to click proceed anyways on armed warning - m_curr_index=0; - }else{ - m_curr_index=1; - } - m_is_ground=ground; - m_card_chip_type=-1; - m_card_manufacturer_type=-1 - comboBoxSelectedArmedDisarmed.currentIndex=0 - comboBoxCardSelectTxPower.currentIndex=0 - comboBoxCardSelectManufacturer.currentIndex=0; - // We figure out the chip type automatcally (info from openhd) - var wifi_card_chip_type=-1; - if(m_is_ground){ - // Check if all cards are of the same type - if(!gnd_check_all_active_cards_are_same_type()){ - _messageBoxInstance.set_text_and_show("This wizard is only available when you use the same card(s) on ground. Please unify your gnd station cards. -You can still use the RAW OpenHD AIR / GROUND Parameters to change your tx power."); - return; - } - wifi_card_chip_type=_wifi_card_gnd0.card_type; - //wifi_card_chip_type=1 - }else{ - wifi_card_chip_type=_wifi_card_air.card_type; - } - if(!(wifi_card_chip_type==0 || wifi_card_chip_type==1)){ - _messageBoxInstance.set_text_and_show("Card type unknown / unsupported - please use a supported card. You can still change the tx power manually via the param set, but probably -the card driver and/or the linux kernel doesn't support changing it."); - return; - } - // 0 is RTL8812AU, 1 is RTL8812BU - m_card_chip_type=wifi_card_chip_type; - //m_card_chip_type=0; // RTL8812AU - dialoqueTxPower.visible=true - } - - property int m_curr_index: 0 - - property bool m_is_ground: true - function get_is_ground_as_string(){ - return m_is_ground ? "GND" : "AIR"; - } - - ListModel{ - id: armed_or_disarmed_model - ListElement {title: "NOT SELECTED"; value: -1} - ListElement {title: "DISARMED"; value: 0} - ListElement {title: "ARMED (RECOMMENDED)"; value: 0} - } - property bool m_change_armed: false - function get_change_armed_as_string(){ - return m_change_armed ? "ARMED" : "DISARMED"; - } - - // Chip type is automatically refered from OpenHD - property int m_card_chip_type: -1; - function get_card_chip_type_as_string(){ - if(m_card_chip_type==0) return "RTL88XXAU"; - if(m_card_chip_type==1) return "RTL88XXBU"; - return "UNKNOWN"; - } - - // Manufacturer the user has to select - property int m_card_manufacturer_type: -1 - function get_card_manufacturer_type_as_string(){ - if(m_card_chip_type==0){ - // RTL8812AU - if(m_card_manufacturer_type==0)return "ASUS"; - if(m_card_manufacturer_type==1)return "ALIEXPRESS"; - if(m_card_manufacturer_type==2)return "OTHER"; - }else{ - // RTL8812BU - if(m_card_manufacturer_type==0)return "COMFAST"; - if(m_card_manufacturer_type==1)return "OTHER"; - } - return "UNKNWON"; - } - - ListModel{ - id: plcaeholder_model - ListElement {title: "I should never appear"; value: -1} - } - - ListModel{ - id: model_rtl8812au_manufacturers - ListElement {title: "NOT SELECTED"; value: -1} - ListElement {title: "ASUS"; value: 0} - ListElement {title: "ALIEXPRESS"; value: 1} - ListElement {title: "OTHER"; value: 2} - } - ListModel{ - id: model_rtl8812bu_manufacturers - ListElement {title: "NOT SELECTED"; value: -1} - ListElement {title: "COMFAST"; value: 0} - ListElement {title: "OTHER"; value: 1} - } - - function get_model_manufacturer_for_chip_type(){ - if(m_card_chip_type==0){ - return model_rtl8812au_manufacturers; - }else if(m_card_chip_type==1){ - return model_rtl8812bu_manufacturers; - } - return plcaeholder_model; - } - - property int tx_power_index_or_mw: -1 - - ListModel{ - id: model_rtl8812au_manufacturer_asus_txpower - ListElement {title: "Please select"; value: -1} - ListElement {title: "LOW [22] ~20mW (DEFAULT) "; value: 22} - ListElement {title: "MEDIUM [37] ~100mW "; value: 37} - ListElement {title: "HIGH [53] ~320mW "; value: 53} - ListElement {title: "MAX1 [58] ~420mW (MCS<=2!)"; value: 58} - ListElement {title: "MAX2 [63] ~500mW (MCS<=2!)"; value: 63} - } - ListModel{ - id: model_rtl8812au_manufacturer_aliexpress_hp - ListElement {title: "Please select"; value: -1} - ListElement {title: "LOW [16]"; value: 16} - ListElement {title: "MEDIUM [22]"; value: 22} - ListElement {title: "HIGH [24]"; value: 24} - ListElement {title: "MAX [26]"; value: 26} - } - ListModel{ - id: model_rtl8812au_manufacturer_generic - ListElement {title: "Please select"; value: -1} - ListElement {title: "[22] (DANGER,ARBITRARY)"; value: 22} - ListElement {title: "[37] (DANGER,ARBITRARY)"; value: 37} - ListElement {title: "[53] (DANGER,ARBITRARY)"; value: 53} - ListElement {title: "[58] (DANGER,ARBITRARY)"; value: 58} - ListElement {title: "[63] (DANGER,ARBITRARY)"; value: 63} - } - // RTL8812BU begin - ListModel{ - id: model_rtl8812bu_manufacturer_comfast - ListElement {title: "Please select"; value: -1} - ListElement {title: "~25mW"; value: 25} - ListElement {title: "~100mW"; value: 100} - ListElement {title: "~200mW"; value: 200} - ListElement {title: "~300mW"; value: 300} - } - ListModel{ - id: model_rtl8812bu_manufacturer_generic - ListElement {title: "Please select"; value: -1} - ListElement {title: "25mW (maybe)"; value: 25} - ListElement {title: "100mW (maybe)"; value: 100} - ListElement {title: "<=300mW (maybe)"; value: 300} - ListElement {title: "<=1000mW (maybe)"; value: 1000} - ListElement {title: "<=20000mW (maybe)"; value: 2000} - } - - function get_model_select_tx_power_index_for_card_chip_type_and_manufacturer(){ - if(m_card_chip_type==0){ - // RTL8812AU - if(m_card_manufacturer_type==0){ - return model_rtl8812au_manufacturer_asus_txpower; - }else if(m_card_manufacturer_type==1){ - return model_rtl8812au_manufacturer_aliexpress_hp; - } - return model_rtl8812au_manufacturer_generic; - }else if(m_card_chip_type==1){ - // RTL8812BU - if(m_card_manufacturer_type==0){ - return model_rtl8812bu_manufacturer_comfast; - } - return model_rtl8812bu_manufacturer_generic; - } - return plcaeholder_model; - } - - function get_text_select_card_manufacturer(){ - var ret=""; - ret+="Your chipset: "+get_card_chip_type_as_string()+"\n"; - ret+="Please select your card manufacturer from the list below."; - if(m_card_chip_type==0){ - ret+="\nWARNING: IF YOU SELECT THE WRONG MANUFACTURER,YOU CAN EASILY DESTROY YOUR CARD - this card doesn't take tx power in mW, but a tx power index value "+ - "in arbitrary unit(s) depending on your manufacturer."; - }else if(m_card_chip_type==1){ - ret+="\nINFO: If you select any tx power in mW, depending on your manufacturer, your actual tx power will always be <= than the selected value."; - } - - return ret; - } - - function get_text_select_tx_power(){ - var ret=""; - ret += "Your chipset: "+get_card_chip_type_as_string()+"\n"; - ret += "Selected manufacturer: "+get_card_manufacturer_type_as_string()+"\n"; - ret+="Please select your wanted TX power applied when:\n"+get_change_armed_as_string()+" state"+"\n"; - return ret; - } - - cardBody: Rectangle{ - /*height: 340 - 100 - width: 360-10*/ - color: "orange" - //anchors.centerIn: parent - anchors.fill: parent - Item{ - width: parent.width - height: parent.height - visible: m_curr_index==0 - Text{ - text: ("WARNING ! Changing TX power while FC is armed is not recommended -\n"+ - " Validate / test your setup while disarmed, then set the apropate tx power for armed / disarmed state. !") - width: parent.width - height: parent.height / 2 - leftPadding: 12 - rightPadding: 12 - wrapMode: Text.WordWrap - } - } - ColumnLayout{ - width: parent.width - height: parent.height - visible: m_curr_index==1 - Text{ - Layout.fillWidth: true - leftPadding: 12 - rightPadding: 12 - id: card_select_manufcturer_description - text: get_text_select_card_manufacturer() - wrapMode: Text.WordWrap - } - ComboBox { - Layout.fillWidth: true - leftPadding: 12 - rightPadding: 12 - id: comboBoxCardSelectManufacturer - model: get_model_manufacturer_for_chip_type() - textRole: "title" - onCurrentIndexChanged: { - var manufacturer=comboBoxCardSelectManufacturer.model.get(comboBoxCardSelectManufacturer.currentIndex).value; - console.log("Selected manufacturerer "+get_card_chip_type_as_string()+" :"+manufacturer); - m_card_manufacturer_type=manufacturer; - } - } - } - ColumnLayout{ - width: parent.width - height: parent.height - visible: m_curr_index==2 - Text{ - Layout.fillWidth: true - leftPadding: 12 - rightPadding: 12 - text: ("Do you want to set the TX power in armed / disarmed state ?\n"+ -"NOTE: TX power armed is only applied when the FC is armed, TX power disarmed is applied when the FC is disarmed.") - wrapMode: Text.WordWrap - } - ComboBox { - Layout.fillWidth: true - leftPadding: 12 - rightPadding: 12 - id: comboBoxSelectedArmedDisarmed - model: armed_or_disarmed_model - textRole: "title" - onCurrentIndexChanged: { - if(comboBoxSelectedArmedDisarmed.currentIndex==1)m_change_armed=false; - if(comboBoxSelectedArmedDisarmed.currentIndex==2)m_change_armed=true; - } - } - } - - ColumnLayout{ - width: parent.width - height: parent.height - visible: m_curr_index==3 - Text{ - Layout.fillWidth: true - leftPadding: 12 - rightPadding: 12 - text: get_text_select_tx_power() - wrapMode: Text.WordWrap - } - ComboBox { - Layout.fillWidth: true - leftPadding: 12 - rightPadding: 12 - id: comboBoxCardSelectTxPower - model: get_model_select_tx_power_index_for_card_chip_type_and_manufacturer() - textRole: "title" - onCurrentIndexChanged: { - var tx_power=comboBoxCardSelectTxPower.model.get(comboBoxCardSelectTxPower.currentIndex).value; - tx_power_index_or_mw=tx_power; - console.log("Selected TX power (mW or index)"+tx_power_index_or_mw); - } - } - } - } - hasFooter: true - cardFooter: Item { - anchors.fill: parent - // change though armed - RowLayout{ - anchors.fill: parent - visible: m_curr_index==0 - ButtonRed{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - text: "CONTINUE ANYWAYS" - onClicked: { - m_curr_index=1 - } - } - ButtonGreen{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: 12 - text: "Cancel" - onClicked: { - txPowerDialoque.visible=false; - } - } - } - RowLayout{ - anchors.fill: parent - visible: m_curr_index==1 - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - text: "CANCEL" - onClicked: { - txPowerDialoque.visible=false; - } - } - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: 12 - text: "CONTINUE" - onClicked: { - if(m_card_manufacturer_type<0){ - _qopenhd.show_toast("Please select your card manufacturer",false); - }else{ - m_curr_index=2; - } - } - } - } - RowLayout{ - anchors.fill: parent - visible: m_curr_index==2 - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - text: "CANCEL" - onClicked: { - txPowerDialoque.visible=false; - } - } - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: 12 - text: "Continue" - onClicked: { - if(comboBoxSelectedArmedDisarmed.currentIndex<=0){ - _qopenhd.show_toast("Please specify armed / disarmed",false); - }else{ - m_curr_index=3; - } - } - } - } - RowLayout{ - anchors.fill: parent - visible: m_curr_index==3 - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - text: "CANCEL" - onClicked: { - txPowerDialoque.visible=false; - } - } - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: 12 - text: "APPLY" - onClicked: { - if(tx_power_index_or_mw<0){ - _qopenhd.show_toast("Please select a valid tx power",false); - return; - } - var success=false - var is_tx_power_index_unit = m_card_chip_type==0; - - success = _wbLinkSettingsHelper.set_param_tx_power(m_is_ground,is_tx_power_index_unit,m_change_armed,tx_power_index_or_mw) - if(success==true){ - txPowerDialoque.visible=false; - var message = "Set TX POWER "+get_change_armed_as_string()+" to "; - if(is_tx_power_index_unit){ - message += ""+tx_power_index_or_mw+" tx power index (unitless)" - }else{ - message += ""+tx_power_index_or_mw+" mW" - } - if(m_change_armed){ - message += "\nNOTE: Only applied once you arm your FC !"; - } - _messageBoxInstance.set_text_and_show(message, 10); - }else{ - _qopenhd.show_toast("Cannot change TX power, please try again",true); - } - } - } - } - } -} diff --git a/qml/ui/configpopup/openhd_settings/DialoqueStartAnalyzeChannels.qml b/qml/ui/configpopup/openhd_settings/DialoqueStartAnalyzeChannels.qml deleted file mode 100644 index 4aa8ce965..000000000 --- a/qml/ui/configpopup/openhd_settings/DialoqueStartAnalyzeChannels.qml +++ /dev/null @@ -1,119 +0,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 "../../elements" - -// I fucking hate writing UIs in QT -// Dialoque that initiates a channel/frequency analyze once the user selected everything correctly / passed all the checks -Card { - id: dialoqueAnalyzeChannels - width: 360 - height: 340 - z: 5.0 - anchors.centerIn: parent - cardName: qsTr("Analyze Channels") - cardNameColor: "black" - visible: false - - property int m_index: 0 - - function setup_and_show(){ - var is_armed= _fcMavlinkSystem.is_alive && _fcMavlinkSystem.armed - if(is_armed){ - m_index=0; - }else{ - m_index=1; - } - dialoqueAnalyzeChannels.visible=true; - } - - property string m_armed_warning: "WARNING ! Analyze channels while armed is not recommended, you'l loose connection for a significant amount of time !" - - property string m_info_string: "Analyze channels for pollution by wifi access points. -NOTE: This only gives a hint at free channels, using a proper channel analyzer (e.g. on the phone) is recommended. -PLEASE DO NOT CHANGE SETTINGS WHILE ANALYZING." - - - cardBody: Item{ - height: 200 - width: 320 - // Dialoque one - Text { - visible: m_index==0 - text: m_armed_warning - width: parent.width - height: parent.height-100 - leftPadding: 12 - rightPadding: 12 - wrapMode: Text.WordWrap - } - // Dialoque two - Text { - visible: m_index==1 - text: m_info_string - width: parent.width - height: parent.height-100 - leftPadding: 12 - rightPadding: 12 - wrapMode: Text.WordWrap - } - } - hasFooter: true - cardFooter: Item { - anchors.fill: parent - // Dialoque one - RowLayout{ - anchors.fill: parent - visible: m_index==0 - ButtonRed{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - text: qsTr("PROCEED ANYWAY") - onPressed: { - m_index=1 - } - } - ButtonGreen{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignRight - Layout.rightMargin: 12 - text: qsTr("CANCEL") - onPressed: { - dialoqueAnalyzeChannels.visible=false; - } - } - } - // Dialoque 2 - RowLayout{ - anchors.fill: parent - visible: m_index==1 - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - text: qsTr("CANCEL") - onPressed: { - dialoqueAnalyzeChannels.visible=false; - } - } - Button{ - Layout.preferredWidth: 140 - Layout.alignment: Qt.AlignLeft - Layout.leftMargin: 12 - text: qsTr("INITIATE") - onPressed: { - var result=_wbLinkSettingsHelper.start_analyze_channels() - if(result!==true){ - _qopenhd.show_toast("Busy,please try again later",true); - }else{ - dialoqueAnalyzeChannels.visible=false; - } - } - } - } - } -} diff --git a/qml/ui/configpopup/openhd_settings/MavlinkOpenHDWBParamPanel2.qml b/qml/ui/configpopup/openhd_settings/MavlinkOpenHDWBParamPanel2.qml index b14d51b0c..02d9595f2 100644 --- a/qml/ui/configpopup/openhd_settings/MavlinkOpenHDWBParamPanel2.qml +++ b/qml/ui/configpopup/openhd_settings/MavlinkOpenHDWBParamPanel2.qml @@ -447,15 +447,15 @@ Rectangle{ } } - PollutionChartView{ + PopupAnalyzeChannels{ id: pollution_chart_view } - ChannelScanProgressView{ + PopupScanChannels{ id: channel_scan_progress_view } - ChangeTxPowerPopup{ + PopupTxPowerEditor{ id: change_tx_power_popup } diff --git a/qml/ui/configpopup/openhd_settings/PollutionChartView.qml b/qml/ui/configpopup/openhd_settings/PopupAnalyzeChannels.qml similarity index 100% rename from qml/ui/configpopup/openhd_settings/PollutionChartView.qml rename to qml/ui/configpopup/openhd_settings/PopupAnalyzeChannels.qml diff --git a/qml/ui/configpopup/openhd_settings/ChannelScanProgressView.qml b/qml/ui/configpopup/openhd_settings/PopupScanChannels.qml similarity index 100% rename from qml/ui/configpopup/openhd_settings/ChannelScanProgressView.qml rename to qml/ui/configpopup/openhd_settings/PopupScanChannels.qml diff --git a/qml/ui/configpopup/openhd_settings/ChangeTxPowerPopup.qml b/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml similarity index 86% rename from qml/ui/configpopup/openhd_settings/ChangeTxPowerPopup.qml rename to qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml index dc3f86fc1..6fff3ba9a 100644 --- a/qml/ui/configpopup/openhd_settings/ChangeTxPowerPopup.qml +++ b/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml @@ -240,6 +240,20 @@ Rectangle{ Button{ text: "APPLY" enabled: m_user_selected_card_manufacturer>=0; + onClicked: { + var tx_power_index_or_mw = combo_box_txpower_disarmed.model.get(combo_box_txpower_disarmed.currentIndex).value; + if(tx_power_index_or_mw<0){ + _qopenhd.show_toast("Please select a valid tx power",false); + return; + } + var is_tx_power_index_unit = get_chipset_type()==0; + var success = _wbLinkSettingsHelper.set_param_tx_power(m_is_ground,is_tx_power_index_unit,m_change_armed,tx_power_index_or_mw) + if(success==true){ + _qopenhd.show_toast("SUCCESS"); + }else{ + _qopenhd.show_toast("Cannot change TX power, please try again",true); + } + } } } ColumnLayout{ @@ -269,6 +283,20 @@ Rectangle{ Button{ text: "APPLY" enabled: m_user_selected_card_manufacturer>=0; + onClicked: { + var tx_power_index_or_mw = combo_box_txpower_armed.model.get(combo_box_txpower_armed.currentIndex).value; + if(tx_power_index_or_mw<0){ + _qopenhd.show_toast("Please select a valid tx power",false); + return; + } + var is_tx_power_index_unit = get_chipset_type()==0; + var success = _wbLinkSettingsHelper.set_param_tx_power(m_is_ground,is_tx_power_index_unit,m_change_armed,tx_power_index_or_mw) + if(success==true){ + _qopenhd.show_toast("SUCCESS"); + }else{ + _qopenhd.show_toast("Cannot change TX power, please try again",true); + } + } } } diff --git a/qml/ui/elements/WorkaroundMessageBox.qml b/qml/ui/elements/WorkaroundMessageBox.qml index 191fcf253..54063cb21 100644 --- a/qml/ui/elements/WorkaroundMessageBox.qml +++ b/qml/ui/elements/WorkaroundMessageBox.qml @@ -21,14 +21,18 @@ Card { cardName: qsTr("QOpenHD")+(_messageBoxInstance.remaining_time_seconds==-1 ? "" : (" "+_messageBoxInstance.remaining_time_seconds+"s")) cardNameColor: "black" visible: _messageBoxInstance.visible - cardBody: Column { + cardBody: ScrollView { + contentHeight: workaroundMessageBox_text.height + contentWidth: workaroundMessageBox_text.width + ScrollBar.vertical.interactive: true height: 200 - width: 320 + width: 350 + clip:true + anchors.centerIn: parent.Center Text { id: workaroundMessageBox_text + width: 320 text: _messageBoxInstance.text - width: parent.width-24 - height:parent.height leftPadding: 12 rightPadding: 12 wrapMode: Text.WordWrap