diff --git a/app/util/qopenhd.cpp b/app/util/qopenhd.cpp index 114dc60c9..71de3c43e 100644 --- a/app/util/qopenhd.cpp +++ b/app/util/qopenhd.cpp @@ -344,6 +344,14 @@ void QOpenHD::show_toast(QString message,bool long_toast) emit signal_toast_add(message,long_toast); } +void QOpenHD::set_busy_for_milliseconds(int milliseconds,QString reason) +{ + set_is_busy(true); + set_busy_reason(reason); + const int timeout_ms = milliseconds; + QTimer::singleShot(timeout_ms, this, &QOpenHD::handle_busy_timeout); +} + void QOpenHD::handle_toast_timeout() { @@ -357,6 +365,12 @@ void QOpenHD::handle_toast_timeout() } } +void QOpenHD::handle_busy_timeout() +{ + set_is_busy(false); + set_busy_reason(""); +} + void QOpenHD::do_not_call_toast_add(QString text,bool long_toast) { qDebug()<<"do_not_call_toast_add"< m_toast_message_queue; void handle_toast_timeout(); + void handle_busy_timeout(); public: signals: void signal_toast_add(QString text,bool long_toast); diff --git a/qml/main.qml b/qml/main.qml index 52a15476c..b2d99398c 100755 --- a/qml/main.qml +++ b/qml/main.qml @@ -152,25 +152,9 @@ ApplicationWindow { _qopenhd.disable_service_and_quit() } } - BusyIndicator{ - id: any_param_busy_indiscator - width: 96 - height: 96 - anchors.centerIn: parent - running: _airCameraSettingsModel.ui_is_busy || _airCameraSettingsModel2.ui_is_busy || _ohdSystemAirSettingsModel.ui_is_busy || _ohdSystemGroundSettings.ui_is_busy - //visible: _xParamUI.is_busy - } - Text{ - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: any_param_busy_indiscator.bottom - text: "FETCHING PARAMETERS.." - visible: any_param_busy_indiscator.running - font.pixelSize: 15 - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow + AnyParamBusyIndicator{ + z: 10 } - /*Rectangle { width: 800 height: 600 diff --git a/qml/qml.qrc b/qml/qml.qrc index 15ba1133d..bae0cd23c 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -288,5 +288,6 @@ ui/configpopup/quick/InfoElement.qml ui/configpopup/quick/EditFrequencyElement.qml ui/configpopup/quick/TriangleButton.qml + ui/AnyParamBusyIndicator.qml diff --git a/qml/ui/AnyParamBusyIndicator.qml b/qml/ui/AnyParamBusyIndicator.qml new file mode 100644 index 000000000..f095a815e --- /dev/null +++ b/qml/ui/AnyParamBusyIndicator.qml @@ -0,0 +1,42 @@ + +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls.Material 2.12 +import QtQuick.Layouts 1.0 +import QtGraphicalEffects 1.12 +import Qt.labs.settings 1.0 + +import OpenHD 1.0 + +Item{ + width: parent.width + height: parent.height + + BusyIndicator{ + id: any_param_busy_indiscator + width: 96 + height: 96 + anchors.centerIn: parent + running: _airCameraSettingsModel.ui_is_busy || _airCameraSettingsModel2.ui_is_busy || _ohdSystemAirSettingsModel.ui_is_busy || _ohdSystemGroundSettings.ui_is_busy || + _qopenhd.is_busy + //visible: _xParamUI.is_busy + } + Text{ + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: any_param_busy_indiscator.bottom + text: { + if(_qopenhd.is_busy){ + return _qopenhd.busy_reason; + } + return "FETCHING PARAMETERS.." + } + visible: any_param_busy_indiscator.running + font.pixelSize: 15 + font.family: settings.font_text + style: Text.Outline + styleColor: settings.color_glow + } +} + + diff --git a/qml/ui/configpopup/openhd_settings/MavlinkParamPanel.qml b/qml/ui/configpopup/openhd_settings/MavlinkParamPanel.qml index 6c237ccee..74c293b75 100644 --- a/qml/ui/configpopup/openhd_settings/MavlinkParamPanel.qml +++ b/qml/ui/configpopup/openhd_settings/MavlinkParamPanel.qml @@ -323,12 +323,4 @@ Rectangle { ChooseResolutionDialoque{ id: dialoque_choose_resolution } - - BusyIndicator{ - width: 96 - height: 96 - anchors.centerIn: parent - running: m_instanceMavlinkSettingsModel.ui_is_busy - //visible: _xParamUI.is_busy - } } diff --git a/qml/ui/configpopup/quick/EditChannelWidthElement.qml b/qml/ui/configpopup/quick/EditChannelWidthElement.qml index bde5c3362..2dd88f6cd 100644 --- a/qml/ui/configpopup/quick/EditChannelWidthElement.qml +++ b/qml/ui/configpopup/quick/EditChannelWidthElement.qml @@ -31,6 +31,7 @@ BaseJoyEditElement{ _hudLogMessagesModel.add_message_warning("Cannot change BW:"+channel_width_mhz+"Mhz, AIR not alive"); return; } + _qopenhd.set_busy_for_milliseconds(2000,"CHANGING BW"); _wbLinkSettingsHelper.change_param_air_channel_width_async(channel_width_mhz,true); } diff --git a/qml/ui/configpopup/quick/EditFrequencyElement.qml b/qml/ui/configpopup/quick/EditFrequencyElement.qml index 001c4ef2b..ffe134448 100644 --- a/qml/ui/configpopup/quick/EditFrequencyElement.qml +++ b/qml/ui/configpopup/quick/EditFrequencyElement.qml @@ -71,6 +71,7 @@ BaseJoyEditElement{ new_model_index-=1; } const new_frequency=frequencies_model.get(new_model_index).frequency + _qopenhd.set_busy_for_milliseconds(2000,"CHANGING FREQUENCY"); _wbLinkSettingsHelper.change_param_air_and_ground_frequency(new_frequency) } diff --git a/qml/ui/configpopup/quick/EditRateElement.qml b/qml/ui/configpopup/quick/EditRateElement.qml index 9628996f6..97e0a91be 100644 --- a/qml/ui/configpopup/quick/EditRateElement.qml +++ b/qml/ui/configpopup/quick/EditRateElement.qml @@ -35,6 +35,7 @@ BaseJoyEditElement{ } function set_air_only_mcs(mcs_index){ + _qopenhd.set_busy_for_milliseconds(2000,"CHANGING RATE"); _wbLinkSettingsHelper.set_param_air_only_mcs_async(mcs_index) } diff --git a/qml/ui/configpopup/quick/EditResolutionElement.qml b/qml/ui/configpopup/quick/EditResolutionElement.qml index 6843c32ef..8ca323895 100644 --- a/qml/ui/configpopup/quick/EditResolutionElement.qml +++ b/qml/ui/configpopup/quick/EditResolutionElement.qml @@ -59,6 +59,7 @@ BaseJoyEditElement{ new_model_index-=1; } var new_resolution_string=resolutions_model.get(new_model_index).title; + _qopenhd.set_busy_for_milliseconds(1000,"CHANGING RESOLUTION"); _wbLinkSettingsHelper.set_param_video_resolution_framerate_async(true,new_resolution_string) } diff --git a/qml/ui/widgets/MessageHUD.qml b/qml/ui/widgets/MessageHUD.qml index ae4a21053..be6343909 100644 --- a/qml/ui/widgets/MessageHUD.qml +++ b/qml/ui/widgets/MessageHUD.qml @@ -31,6 +31,7 @@ BaseWidget { // We do not want this widget to be dragable / touchable, it needs to be "hidden" otherwise // clicking the secondary video becomes impossible disable_dragging : true + z: 20 Item { id: widgetInner