diff --git a/qml/qml.qrc b/qml/qml.qrc index 7bcddbe5b..09d76a5bc 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -182,7 +182,6 @@ video/SecondaryVideoGStreamer.qml video/MainVideoQSG.qml ui/widgets/VideoBitrateWidgetSecondary.qml - ui/widgets/RecordVideoWidget.qml ui/widgets/RCRssiWidget.qml video/ExpMainVideoAndroid.qml ui/elements/WorkaroundMessageBox.qml @@ -260,5 +259,7 @@ ui/configpopup/status/StatusCardsColumn.qml ui/elements/SimpleLeftRightText.qml video/SecondaryVideoGstreamerPane.qml + ui/elements/SettingsHeaderElement.qml + ui/configpopup/qopenhd_settings/AppWidgetStyleSettingsView.qml diff --git a/qml/ui/HUDOverlayGrid.qml b/qml/ui/HUDOverlayGrid.qml index 24a974371..1f43ea202 100644 --- a/qml/ui/HUDOverlayGrid.qml +++ b/qml/ui/HUDOverlayGrid.qml @@ -151,20 +151,19 @@ Item { var ret=downlink if(index==0)return settingsButtonHighlight; if(index==1)return downlink; - if(index==2)return record_video_widget; - if(index==3)return wBLinkRateControlWidget; - if(index==4)return qRenderStatsWidget; - if(index==5)return bitrate1; - if(index==6)return bitrate2; - if(index==7)return air_status; - if(index==8)return ground_status; - if(index==9)return uplink; - if(index==10)return air_battery; - if(index==11)return flight_mode; - if(index==12)return throttleWidget; - if(index==13)return missionWidget; - if(index==14)return gps; - if(index==15)return home_distance; + if(index==2)return wBLinkRateControlWidget; + if(index==3)return qRenderStatsWidget; + if(index==4)return bitrate1; + if(index==5)return bitrate2; + if(index==6)return air_status; + if(index==7)return ground_status; + if(index==8)return uplink; + if(index==9)return air_battery; + if(index==10)return flight_mode; + if(index==11)return throttleWidget; + if(index==12)return missionWidget; + if(index==13)return gps; + if(index==14)return home_distance; //if(index==13)return uplink; console.log("Invalid index"); return ret; @@ -272,9 +271,6 @@ Item { id: downlink m_next_item: record_video_widget } - RecordVideoWidget { - id: record_video_widget - } WBLinkRateControlWidget{ id: wBLinkRateControlWidget } diff --git a/qml/ui/configpopup/qopenhd_settings/AppGeneralSettingsView.qml b/qml/ui/configpopup/qopenhd_settings/AppGeneralSettingsView.qml index 5c4b53972..b7a6c13c6 100755 --- a/qml/ui/configpopup/qopenhd_settings/AppGeneralSettingsView.qml +++ b/qml/ui/configpopup/qopenhd_settings/AppGeneralSettingsView.qml @@ -72,6 +72,56 @@ ScrollView { } } + Rectangle { + width: parent.width + height: rowHeight + color: (Positioner.index % 2 == 0) ? "#8cbfd7f3" : "#00000000" + + Text { + text: qsTr("Animation Smoothing,0 to disable") + font.weight: Font.Bold + font.pixelSize: 13 + anchors.leftMargin: 8 + verticalAlignment: Text.AlignVCenter + anchors.verticalCenter: parent.verticalCenter + width: 224 + height: elementHeight + anchors.left: parent.left + } + + Text { + text: Number(settings.smoothing).toLocaleString(Qt.locale(), 'f', 0) + "ms"; + font.pixelSize: 16 + anchors.right: smoothing_Slider.left + anchors.rightMargin: 12 + verticalAlignment: Text.AlignVCenter + anchors.verticalCenter: parent.verticalCenter + width: 32 + height: elementHeight + + } + + Slider { + id: smoothing_Slider + height: elementHeight + width: 210 + font.pixelSize: 14 + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + to : 1000 + from : 0 + stepSize: 25 + anchors.rightMargin: Qt.inputMethod.visible ? 78 : 18 + value: settings.smoothing + + // @disable-check M223 + onValueChanged: { + // @disable-check M222 + settings.smoothing = smoothing_Slider.value + } + } + } + Rectangle { width: parent.width diff --git a/qml/ui/configpopup/qopenhd_settings/AppSettingsPanel.qml b/qml/ui/configpopup/qopenhd_settings/AppSettingsPanel.qml index 3929af780..4c112a200 100755 --- a/qml/ui/configpopup/qopenhd_settings/AppSettingsPanel.qml +++ b/qml/ui/configpopup/qopenhd_settings/AppSettingsPanel.qml @@ -55,6 +55,13 @@ Rectangle { font.pixelSize: 13 } + TabButton { + text: qsTr("Style") + width: implicitWidth + height: 48 + font.pixelSize: 13 + } + TabButton { y: 0 text: qsTr("General") @@ -109,6 +116,9 @@ Rectangle { AppWidgetSettingsView{ id: appWidgetSettingsView } + AppWidgetStyleSettingsView{ + id: appWidgetStyleSettingsView + } AppGeneralSettingsView{ id: appGeneralSettingsView } diff --git a/qml/ui/configpopup/qopenhd_settings/AppWidgetSettingsView.qml b/qml/ui/configpopup/qopenhd_settings/AppWidgetSettingsView.qml index a8a075b9b..993766a0e 100755 --- a/qml/ui/configpopup/qopenhd_settings/AppWidgetSettingsView.qml +++ b/qml/ui/configpopup/qopenhd_settings/AppWidgetSettingsView.qml @@ -28,231 +28,13 @@ ScrollView { anchors.left: parent.left anchors.right: parent.right - Rectangle { - width: parent.width - height: rowHeight - color: (Positioner.index % 2 == 0) ? "#8cbfd7f3" : "#00000000" - - Text { - text: qsTr("Shape Color") - font.weight: Font.Bold - font.pixelSize: 13 - anchors.leftMargin: 8 - verticalAlignment: Text.AlignVCenter - anchors.verticalCenter: parent.verticalCenter - width: 224 - height: elementHeight - anchors.left: parent.left - } - - RoundButton { - //text: "Open" - - height: elementHeight - anchors.right: parent.right - anchors.rightMargin: Qt.inputMethod.visible ? 96 : 36 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizonatalCenter - onClicked: { - colorPicker.previousColor = settings.color_shape - colorPicker.currentColorType = ColorPicker.ColorType.ShapeColor - colorPicker.visible = true - } - - Rectangle { - anchors.centerIn: parent - width: ((parent.width fetched from @property m_short_description +// Optional info popup -> icon visible when @property m_long_description!=="none" +// actuall seting element -> fill with e.g. your QT settings element, e.g. a Switch +Rectangle { + width: parent.width + height: rowHeight*2 / 3; + //color: "green" + //color: "#8cbfd7f3" + color: (Positioner.index % 2 == 0) ? "#8cbfd7f3" : "#00000000" + + Rectangle{ + width: parent.width + height: 2 + color: "black" + anchors.bottom: parent.bottom + anchors.left: parent.left + } + + property string m_description: "FILL ME" + + + Text { + id: description + text: qsTr(m_description) + font.weight: Font.Bold + font.pixelSize: 13 + anchors.leftMargin: 8 + anchors.rightMargin: 8 + anchors.fill: parent + + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + } +} diff --git a/qml/ui/widgets/RecordVideoWidget.qml b/qml/ui/widgets/RecordVideoWidget.qml deleted file mode 100644 index c8d1f3147..000000000 --- a/qml/ui/widgets/RecordVideoWidget.qml +++ /dev/null @@ -1,427 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 -import QtGraphicalEffects 1.12 -import QtQuick.Shapes 1.0 - -import Qt.labs.settings 1.0 - -import OpenHD 1.0 - -import "../elements" - -BaseWidget { - // width: 140*settings.recordTextSize/14 - // height: 48 - - function get_width(){ - if(settings.show_minimal_record_widget){ - if(settings.dev_qopenhd_n_cameras>1){ - return 35*2; - } - return 35; - } - return 150; - } - function get_height(){ - if(settings.show_minimal_record_widget){ - return 25; - } - return 48; - } - - width: get_width() - height: get_height() - visible: settings.show_record_widget - - widgetIdentifier: "record_video_widget" - bw_verbose_name: "AIR RECORDING" - - defaultAlignment: 0 - defaultXOffset: 200 - defaultYOffset: 2 - defaultHCenter: false - defaultVCenter: false - - hasWidgetDetail: true - hasWidgetAction: true - widgetActionWidth: 250 - widgetActionHeight: (settings.dev_qopenhd_n_cameras > 1) ? 230 : 130 - widgetDetailWidth:275 - widgetDetailHeight:175 - - // Set to true if the camera is currently doing recordng (the UI element(s) turn red in this case) - property bool m_camera1_is_currently_recording: _cameraStreamModelPrimary.air_recording_active - property bool m_camera2_is_currently_recording: _cameraStreamModelSecondary.air_recording_active - - // THIS IS A MAVLINK PARAM, SYNCHRONIZATION THEREFORE IS HARD AND HERE NOT WORTH IT - property int m_camera1_recording_mode: -1 - property int m_camera2_recording_mode: -1 - - function set_recording_mode_for_camera(cam_idx,mode){ - if(cam_idx===1){ - m_camera1_recording_mode=mode - }else{ - m_camera2_recording_mode=mode - } - } - - function try_set_recording_mode(camera_idx,mode){ - console.log("try_set_recording_mode "+camera_idx+" "+mode) - var camModel=_airCameraSettingsModel; - var camString="CAM1" - if(camera_idx===2){ - camModel=_airCameraSettingsModel2; - camString="CAM2" - } - if(!_ohdSystemAir.is_alive){ - _hudLogMessagesModel.signalAddLogMessage(6,"Air unit not alive, cannot set recording for "+camString) - return; - } - if(mode===0){ //mode off - var result=camModel.try_update_parameter_int("V_AIR_RECORDING",0)==="" - if(result){ - _hudLogMessagesModel.signalAddLogMessage(6,"recording "+camString+" disabled") - set_recording_mode_for_camera(camera_idx,0) - }else{ - _hudLogMessagesModel.signalAddLogMessage(6,"update "+camString+" failed") - } - } - if(mode===1){ //mode on - var result=camModel.try_update_parameter_int("V_AIR_RECORDING",1)==="" - if(result){ - _hudLogMessagesModel.signalAddLogMessage(6,"recording "+camString+" enabled") - set_recording_mode_for_camera(camera_idx,1) - }else{ - _hudLogMessagesModel.signalAddLogMessage(6,"update "+camString+" failed") - } - } - if(mode==2){ //mode auto - var result=camModel.try_update_parameter_int("V_AIR_RECORDING",2)==="" - if(result){ - _hudLogMessagesModel.signalAddLogMessage(6,"recording "+camString+" auto enabled") - set_recording_mode_for_camera(camera_idx,2) - }else{ - _hudLogMessagesModel.signalAddLogMessage(6,"update "+camString+" failed") - } - } - } - - widgetDetailComponent: ScrollView { - - contentHeight: idBaseWidgetDefaultUiControlElements.height - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - clip: true - - BaseWidgetDefaultUiControlElements{ - id: idBaseWidgetDefaultUiControlElements - - Item { - width: parent.width - height: 32 - Text { - text: qsTr("Minimal Layout") - color: "white" - height: parent.height - font.bold: true - font.pixelSize: detailPanelFontPixels - anchors.left: parent.left - verticalAlignment: Text.AlignVCenter - } - Switch { - height: parent.height - anchors.rightMargin: 0 - anchors.right: parent.right - width: parent.width - 96 - checked: settings.show_minimal_record_widget - onCheckedChanged:{ - if (checked) { - settings.show_minimal_record_widget = true - } - else{ - settings.show_minimal_record_widget = false - } - - } - - } - - } - Item { - //dummy for layout - width: 230 - height: 32 - } - - } - } - - widgetActionComponent: Item{ - - //color:"red" - width: parent.width-30 - height: parent.height - - ColumnLayout{ - id:recID - width: parent.width - height: parent.height - // - Text { - visible:true - id:airVideoSpaceLeft_minimal - text: "Free: "+_ohdSystemAir.curr_space_left_mb+" MB" - color: (_ohdSystemAir.curr_space_left_mb < 500) ? "red" : "green" - elide: Text.ElideNone - wrapMode: Text.NoWrap - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - onTextChanged: { - if (m_camera1_is_currently_recording || m_camera2_is_currently_recording ==true ) { - if (_ohdSystemAir.curr_space_left_mb < 500 && _ohdSystemAir.curr_space_left_mb > 200 && _ohdSystemAir.curr_space_left_mb % 10 == 0) { - _hudLogMessagesModel.signalAddLogMessage(4,"SD-Card getting full.") - } - } - } - } - Text { - text: qsTr("(Air) Record Camera 1"); - color: settings.color_text - elide: Text.ElideNone - wrapMode: Text.NoWrap - horizontalAlignment: Text.AlignLeft - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow - visible: true - } - Item{ - width: parent.width - height: 50 - //color:"green" - GridLayout{ - width: parent.width - height: parent.height - rows: 1 - columns: 3 - Button{ - text: "OFF" - onClicked: { - try_set_recording_mode(1,0) - } - highlighted: m_camera1_recording_mode==0 - } - Button{ - text: "ON" - onClicked: { - try_set_recording_mode(1,1) - } - highlighted: m_camera1_recording_mode==1 - } - Button{ - text: "AUTO" - onClicked: { - try_set_recording_mode(1,2) - } - highlighted: m_camera1_recording_mode==2 - } - } - } - Text { - text: qsTr("(Air) Record Camera 2"); - color: settings.color_text - elide: Text.ElideNone - wrapMode: Text.NoWrap - horizontalAlignment: Text.AlignLeft - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow - visible: settings.dev_qopenhd_n_cameras > 1 - } - Item{ - width: parent.width - height: 50 - //color:"green" - visible: settings.dev_qopenhd_n_cameras > 1 - GridLayout{ - width: parent.width - height: parent.height - rows: 1 - columns: 3 - Button{ - text: "OFF" - onClicked: { - try_set_recording_mode(2,0) - } - highlighted: m_camera2_recording_mode==0 - } - Button{ - text: "ON" - onClicked: { - try_set_recording_mode(2,1) - } - highlighted: m_camera2_recording_mode==1 - } - Button{ - text: "AUTO" - onClicked: { - try_set_recording_mode(2,2) - } - highlighted: m_camera2_recording_mode==2 - } - } - } - } - } - - - Item { - id: recordWidgetBig - visible: !settings.show_minimal_record_widget - anchors.fill: parent - Text { - text: qsTr("Record Video"); - color: settings.color_text - anchors.fill: parent - anchors.topMargin: 5*settings.recordTextSize/12 - verticalAlignment: Text.AlignVCenter - elide: Text.ElideNone - wrapMode: Text.NoWrap - horizontalAlignment: Text.AlignLeft - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow - visible: true - } - Text { - id:record_status_cam1 - text: "CAM1" - color: (m_camera1_is_currently_recording == true) ? "green" : "red" - anchors.fill: parent - anchors.leftMargin: 95*settings.recordTextSize/14 - anchors.topMargin: 5*settings.recordTextSize/12 - verticalAlignment: Text.AlignVCenter - elide: Text.ElideNone - wrapMode: Text.NoWrap - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow - visible: true - } - Text { - id:record_status_cam2 - text: "CAM2" - color: (m_camera2_is_currently_recording == true) ? "green" : "red" - anchors.fill: parent - anchors.leftMargin: 140*settings.recordTextSize/14 - anchors.topMargin: 5*settings.recordTextSize/12 - verticalAlignment: Text.AlignVCenter - elide: Text.ElideNone - wrapMode: Text.NoWrap - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow - visible: settings.dev_qopenhd_n_cameras > 1 - } - Text { - text: qsTr("Free Space"); - color: settings.color_text - anchors.leftMargin: 90 - elide: Text.ElideNone - wrapMode: Text.NoWrap - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow - visible: true - } - Text { - id:airVideoSpaceLeft - text: _ohdSystemAir.curr_space_left_mb+" MB" - color: (_ohdSystemAir.curr_space_left_mb < 500) ? "red" : "green" - anchors.fill: parent - anchors.leftMargin: 95*settings.recordTextSize/14 - anchors.topMargin: -30 - verticalAlignment: Text.AlignVCenter - elide: Text.ElideNone - wrapMode: Text.NoWrap - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow - visible: true - onTextChanged: { - if (m_camera1_is_currently_recording ==true || m_camera2_is_currently_recording ==true ) { - if (_ohdSystemAir.curr_space_left_mb < 500 && _ohdSystemAir.curr_space_left_mb > 200 && _ohdSystemAir.curr_space_left_mb % 10 == 0) { - _hudLogMessagesModel.signalAddLogMessage(4,"SD-Card getting full.") - } - } - } - } } - Item { - id: recordWidgetMinimal - visible: settings.show_minimal_record_widget - anchors.fill: parent - Text { - id:record_status_cam1_min - text: "\uf03d" - font.family: "Font Awesome 5 Free" - color: (m_camera1_is_currently_recording == true) ? "red" : "white" - anchors.fill: parent - anchors.leftMargin: 5*settings.recordTextSize/14 - anchors.topMargin: 5*settings.recordTextSize/12 - verticalAlignment: Text.AlignVCenter - elide: Text.ElideNone - wrapMode: Text.NoWrap - font.pixelSize: settings.recordTextSize*1.5 - style: Text.Outline - styleColor: settings.color_glow - visible: true - } - Text { - id:record_status_cam2_min - text: " \uf03d" - font.family: "Font Awesome 5 Free" - color: (m_camera2_is_currently_recording == true) ? "red" : "white" - anchors.fill: parent - anchors.leftMargin: 25*settings.recordTextSize/14 - anchors.topMargin: 5*settings.recordTextSize/12 - verticalAlignment: Text.AlignVCenter - elide: Text.ElideNone - wrapMode: Text.NoWrap - font.pixelSize: settings.recordTextSize*1.5 - style: Text.Outline - styleColor: settings.color_glow - visible: settings.dev_qopenhd_n_cameras > 1 - } - Text { - id:airVideoSpaceLeft_min - text: _ohdSystemAir.curr_space_left_mb+" MB" - color: (_ohdSystemAir.curr_space_left_mb < 500) ? "red" : "green" - anchors.fill: parent - anchors.leftMargin: 95*settings.recordTextSize/14 - anchors.topMargin: -30 - verticalAlignment: Text.AlignVCenter - elide: Text.ElideNone - wrapMode: Text.NoWrap - font.pixelSize: settings.recordTextSize - font.family: settings.font_text - style: Text.Outline - styleColor: settings.color_glow - visible: !settings.show_minimal_record_widget - onTextChanged: { - if (m_camera1_is_currently_recording ==true || m_camera2_is_currently_recording ==true ) { - if (_ohdSystemAir.curr_space_left_mb < 500 && _ohdSystemAir.curr_space_left_mb > 200 && _ohdSystemAir.curr_space_left_mb % 10 == 0) { - _hudLogMessagesModel.signalAddLogMessage(4,"SD-Card getting full.") - } - } - } - } - } -}