diff --git a/qml/main.qml b/qml/main.qml
index dfbefe530..4c31079be 100755
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -93,26 +93,6 @@ ApplicationWindow {
}
}
- // Loads the proper (platform-dependent) video widget for the secondary video, if enabled.
- // r.n we only have a gstreamer - qmlglsink implementation for it
- Loader {
- anchors.fill: parent
- z: 2.0
- anchors.bottom: parent.bottom
- source: {
- if(settings.dev_qopenhd_n_cameras>1){
- // R.N the only implementation for secondary video
- if (QOPENHD_ENABLE_GSTREAMER_QMLGLSINK){
- return "../video/SecondaryVideoGStreamer.qml";
- }else{
- console.warn("No secondary video implementation")
- }
- }else{
- console.debug("Scondary video disabled");
- }
- return "";
- }
- }
ColorPicker {
id: colorPicker
diff --git a/qml/qml.qrc b/qml/qml.qrc
index 94655f70c..7bcddbe5b 100644
--- a/qml/qml.qrc
+++ b/qml/qml.qrc
@@ -259,5 +259,6 @@
ui/widgets/PerformanceHorizonWidget2.qml
ui/configpopup/status/StatusCardsColumn.qml
ui/elements/SimpleLeftRightText.qml
+ video/SecondaryVideoGstreamerPane.qml
diff --git a/qml/ui/HUDOverlayGrid.qml b/qml/ui/HUDOverlayGrid.qml
index f97e40870..6cafca85b 100644
--- a/qml/ui/HUDOverlayGrid.qml
+++ b/qml/ui/HUDOverlayGrid.qml
@@ -13,6 +13,8 @@ import "./widgets/map"
import "../resources" as Resources
import "./elements"
+import "../video"
+
Item {
id: hudOverlayGrid
focus: true
@@ -199,29 +201,29 @@ Item {
}
Keys.onPressed: (event)=> {
- console.log("HUDOverlayGrid::Key was pressed:"+event);
- if (event.key == Qt.Key_Return) {
- //console.log("enter was pressed");
- event.accepted = true;
- dummy_joystick_enter()
- }else if(event.key == Qt.Key_Left){
- //console.log("left was pressed")
- event.accepted=true;
- dummy_joystick_left();
- }else if(event.key == Qt.Key_Right){
- //console.log("right was pressed")
- event.accepted=true;
- dummy_joystick_right();
- }else if(event.key == Qt.Key_Up){
- //console.log("up was pressed")
- event.accepted=true;
- dummy_joystick_up()
- }else if(event.key == Qt.Key_Down){
- //console.log("down was pressed")
- event.accepted=true;
- dummy_joystick_down()
- }
- }
+ console.log("HUDOverlayGrid::Key was pressed:"+event);
+ if (event.key == Qt.Key_Return) {
+ //console.log("enter was pressed");
+ event.accepted = true;
+ dummy_joystick_enter()
+ }else if(event.key == Qt.Key_Left){
+ //console.log("left was pressed")
+ event.accepted=true;
+ dummy_joystick_left();
+ }else if(event.key == Qt.Key_Right){
+ //console.log("right was pressed")
+ event.accepted=true;
+ dummy_joystick_right();
+ }else if(event.key == Qt.Key_Up){
+ //console.log("up was pressed")
+ event.accepted=true;
+ dummy_joystick_up()
+ }else if(event.key == Qt.Key_Down){
+ //console.log("down was pressed")
+ event.accepted=true;
+ dummy_joystick_down()
+ }
+ }
Image {
id: settingsButton
@@ -252,224 +254,227 @@ Item {
color: "transparent"
}
}
+ SecondaryVideoGStreamer{
+ id: secondary_video
+ }
Item{
id: actual_hud_elements
width: parent.width
height: parent.height
- // By default on top row
- // --------------------------------------------------------------------------
- LinkDownRSSIWidget {
- id: downlink
- m_next_item: record_video_widget
- }
- RecordVideoWidget {
- id: record_video_widget
- }
- WBLinkRateControlWidget{
- id: wBLinkRateControlWidget
- }
- // exp
- QRenderStatsWidget {
- id: qRenderStatsWidget
- }
- VideoBitrateWidgetPrimary {
- id: bitrate1
- }
- VideoBitrateWidgetSecondary {
- id: bitrate2
- }
- SOCStatusWidgetAir {
- id: air_status
- }
- SOCStatusWidgetGround {
- id: ground_status
- }
- LinkUpRSSIWidget {
- id: uplink
- }
- Sidebar{
- id: sidebar
- }
- // ----------------------------------------------------------------------------
- // TODO SORT ME
+ // By default on top row
+ // --------------------------------------------------------------------------
+ LinkDownRSSIWidget {
+ id: downlink
+ m_next_item: record_video_widget
+ }
+ RecordVideoWidget {
+ id: record_video_widget
+ }
+ WBLinkRateControlWidget{
+ id: wBLinkRateControlWidget
+ }
+ // exp
+ QRenderStatsWidget {
+ id: qRenderStatsWidget
+ }
+ VideoBitrateWidgetPrimary {
+ id: bitrate1
+ }
+ VideoBitrateWidgetSecondary {
+ id: bitrate2
+ }
+ SOCStatusWidgetAir {
+ id: air_status
+ }
+ SOCStatusWidgetGround {
+ id: ground_status
+ }
+ LinkUpRSSIWidget {
+ id: uplink
+ }
+ Sidebar{
+ id: sidebar
+ }
+ // ----------------------------------------------------------------------------
+ // TODO SORT ME
- // + 0% cpu
- MessageHUD {
- id: messageHUD
- }
+ // + 0% cpu
+ MessageHUD {
+ id: messageHUD
+ }
- GroundPowerWidget {
- id: groundPowerWidget
- }
+ GroundPowerWidget {
+ id: groundPowerWidget
+ }
- // + 0% cpu
- AirBatteryWidget {
- id: air_battery
- }
+ // + 0% cpu
+ AirBatteryWidget {
+ id: air_battery
+ }
- // + 0% cpu
- FlightModeWidget {
- id: flight_mode
- }
+ // + 0% cpu
+ FlightModeWidget {
+ id: flight_mode
+ }
- // + 0% cpu
- GPSWidget {
- id: gps
- }
+ // + 0% cpu
+ GPSWidget {
+ id: gps
+ }
- // + 0% cpu
- HomeDistanceWidget {
- id: home_distance
- }
+ // + 0% cpu
+ HomeDistanceWidget {
+ id: home_distance
+ }
- // + 0% cpu
- FlightTimeWidget {
- id: flight_timer
- }
+ // + 0% cpu
+ FlightTimeWidget {
+ id: flight_timer
+ }
- // + 0% cpu
- FlightDistanceWidget {
- id: flight_distance
- }
+ // + 0% cpu
+ FlightDistanceWidget {
+ id: flight_distance
+ }
- // + 0% cpu
- FlightMahWidget {
- id: flight_mah
- }
+ // + 0% cpu
+ FlightMahWidget {
+ id: flight_mah
+ }
- // + 0% cpu
- FlightMahKmWidget {
- id: flight_mah_km
- }
+ // + 0% cpu
+ FlightMahKmWidget {
+ id: flight_mah_km
+ }
- // + 0% cpu
- ImuTempWidget {
- id: imu_temp
- }
+ // + 0% cpu
+ ImuTempWidget {
+ id: imu_temp
+ }
- // + 0% cpu
- PressTempWidget {
- id: press_temp
- }
- RCRssiWidget {
- id: rc_rssi_widget
- }
+ // + 0% cpu
+ PressTempWidget {
+ id: press_temp
+ }
+ RCRssiWidget {
+ id: rc_rssi_widget
+ }
- AirspeedTempWidget {
- id: airspeed_temp
- }
+ AirspeedTempWidget {
+ id: airspeed_temp
+ }
- // + 0% cpu
- EscTempWidget {
- id: esc_temp
- }
+ // + 0% cpu
+ EscTempWidget {
+ id: esc_temp
+ }
- // + 12% cpu
- HorizonWidget {
- id: horizonWidget
- }
+ // + 12% cpu
+ HorizonWidget {
+ id: horizonWidget
+ }
- PerformanceHorizonWidget2{
- id: performanceHorizonWidget
- }
+ PerformanceHorizonWidget2{
+ id: performanceHorizonWidget
+ }
- // + 7% cpu
- FpvWidget {
- id: fpvWidget
- }
+ // + 7% cpu
+ FpvWidget {
+ id: fpvWidget
+ }
- // + 4% cpu
- AltitudeWidget {
- id: altitudeWidget
- }
+ // + 4% cpu
+ AltitudeWidget {
+ id: altitudeWidget
+ }
- // + 0% cpu
- AltitudeSecondWidget {
- id: altitudesecondWidget
- }
+ // + 0% cpu
+ AltitudeSecondWidget {
+ id: altitudesecondWidget
+ }
- // + 17% cpu
- SpeedWidget {
- id: speedWidget
- }
+ // + 17% cpu
+ SpeedWidget {
+ id: speedWidget
+ }
- SpeedSecondWidget {
- id: speedSecondWidget
- }
+ SpeedSecondWidget {
+ id: speedSecondWidget
+ }
- // +3% cpu
- HeadingWidget {
- id: headingWidget
- }
+ // +3% cpu
+ HeadingWidget {
+ id: headingWidget
+ }
- // + 0% cpu
- ArrowWidget {
- id: arrowWidget
- }
+ // + 0% cpu
+ ArrowWidget {
+ id: arrowWidget
+ }
- // + 0% cpu
- ThrottleWidget {
- id: throttleWidget
- scale: 0.7
- }
+ // + 0% cpu
+ ThrottleWidget {
+ id: throttleWidget
+ scale: 0.7
+ }
- // + 0% cpu
- ControlWidget {
- id: controlWidget
- // scale: 0.7
- }
+ // + 0% cpu
+ ControlWidget {
+ id: controlWidget
+ // scale: 0.7
+ }
- // + 0% cpu
- GPIOWidget {
- id: gpioWidget
- }
+ // + 0% cpu
+ GPIOWidget {
+ id: gpioWidget
+ }
- // + 3% cpu
- VibrationWidget {
- id: vibrationWidget
- }
+ // + 3% cpu
+ VibrationWidget {
+ id: vibrationWidget
+ }
- VerticalSpeedSimpleWidget{
- id: vssimpleWidget
- }
- VerticalSpeedGaugeWidget{
- id: vsgaugewidget
- }
+ VerticalSpeedSimpleWidget{
+ id: vssimpleWidget
+ }
+ VerticalSpeedGaugeWidget{
+ id: vsgaugewidget
+ }
- // + 0% cpu
- WindWidget {
- id: windWidget
- }
+ // + 0% cpu
+ WindWidget {
+ id: windWidget
+ }
- // + 3% cpu
- RollWidget {
- id: rollWidget
- }
+ // + 3% cpu
+ RollWidget {
+ id: rollWidget
+ }
- MissionWidget {
- id: missionWidget
- }
+ MissionWidget {
+ id: missionWidget
+ }
- AoaWidget {
- id: aoaWidget
- }
+ AoaWidget {
+ id: aoaWidget
+ }
- MapWidget {
- id: mapWidget
- }
+ MapWidget {
+ id: mapWidget
+ }
- ExampleWidget {
- id: exampleWidget
- }
+ ExampleWidget {
+ id: exampleWidget
+ }
- DistanceSensorWidget{
- id: distancesensorwidget
- }
+ DistanceSensorWidget{
+ id: distancesensorwidget
+ }
- UAVTimeWiget{
- id: uavtimewidget
- }
+ UAVTimeWiget{
+ id: uavtimewidget
+ }
}
// Extra element - allows customizing the OSD color(s) and more
diff --git a/qml/video/SecondaryVideoGStreamer.qml b/qml/video/SecondaryVideoGStreamer.qml
index 49af6a844..245cc0507 100644
--- a/qml/video/SecondaryVideoGStreamer.qml
+++ b/qml/video/SecondaryVideoGStreamer.qml
@@ -3,9 +3,6 @@ import QtGraphicalEffects 1.12
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
-// QT creator might show "not found" on this import, this is okay, annoying qt specifics
-import org.freedesktop.gstreamer.GLVideoItem 1.0;
-
import OpenHD 1.0
import "../ui/elements"
@@ -16,6 +13,7 @@ import "../ui/elements"
// Also, it is nice to automatically have all features needed for the secondary video like scaling, resizing ...
Item {
+ visible: settings.dev_qopenhd_n_cameras>1
// We use the full screen since while usually small in the lower left corner, the secondary video can be resized
anchors.fill: parent
anchors.left: parent.left
@@ -41,44 +39,116 @@ Item {
// This is for debugging / showing the video widget area at run time
Rectangle{
+ z: 0.0
id: video_holder
width: get_video_width()
height: get_video_height()
anchors.bottom: parent.bottom
- anchors.left: parent.left
- color: "red"
- visible: popup.visible
+ //width: get_video_width()
+ //height: get_video_height()
+ //anchors.bottom: parent.bottom
+ //anchors.left: parent.left
+ //color: "red"
+ //color: popup.opened ? "red" : "transparent"
+ color: "gray"
+ opacity: 0.1
+ //visible: popup.visible
}
- GstGLVideoItem {
- id: secondaryVideoGStreamer
- objectName: "secondaryVideoGStreamer"
-
- width: get_video_width()
- height: get_video_height()
- // We are always anchored to the lower left corner
- anchors.bottom: parent.bottom
- anchors.left: parent.left
+ Text{
+ anchors.fill: video_holder
+ text: {
+ if (QOPENHD_ENABLE_GSTREAMER_QMLGLSINK){
+ return "WAITING FOR\nSECONDARY VIDEO";
+ }
+ return "NOT\nAVAILABLE";
+ }
+ verticalAlignment: Qt.AlignVCenter
+ horizontalAlignment: Qt.AlignHCenter
+ font.pixelSize: 12
+ color: "black"
+ }
- Component.onCompleted: {
- console.log("secondaryVideoGStreamer (Qmlglsink) created")
- _secondary_video_gstreamer_qml.check_common_mistakes_then_init(secondaryVideoGStreamer)
+ Loader {
+ z: 0.0
+ anchors.fill: video_holder
+ source: {
+ if(settings.dev_qopenhd_n_cameras>1){
+ // R.N the only implementation for secondary video
+ if (QOPENHD_ENABLE_GSTREAMER_QMLGLSINK){
+ return "SecondaryVideoGstreamerPane.qml";
+ }else{
+ console.warn("No secondary video implementation")
+ }
+ }else{
+ console.debug("Scondary video disabled");
+ }
+ return "";
}
+ }
+ /*Button{
+ id: button_maximize
+ text: "\uf31e";
+ width: 24
+ height: 24
+ anchors.right: video_holder.right
+ anchors.top: video_holder.top
+ onClicked: {
+ console.log("Button clicked");
+ has_been_maximized = !has_been_maximized;
+ }
+ }*/
+ /*Button{
+ text:"S"
+ anchors.right: button_maximize.left
+ anchors.rightMargin: 2
+ anchors.top: button_maximize.top
+ onClicked: {
+ popup.open()
+ }
+ visible: has_been_maximized
+ }*/
+ Text{
+ id: button_maximize
+ color: "white"
+ text: "\uf31e"
+ font.family: "Font Awesome 5 Free"
+ width: 40
+ height: 40
+ anchors.right: video_holder.right
+ anchors.top: video_holder.top
+ font.pixelSize: 19
+ verticalAlignment: Qt.AlignVCenter
+ horizontalAlignment: Qt.AlignHCenter
MouseArea {
anchors.fill: parent
onClicked: {
- //console.log("Clicked")
- // Toggle between maximized and minimized
has_been_maximized = !has_been_maximized;
}
- onPressAndHold: {
- console.log("onPressAndHold");
- // open the popup containing the settings
+ }
+ }
+ Text{
+ id: button_settings
+ color: "white"
+ text: "\uf013"
+ font.family: "Font Awesome 5 Free"
+ width: 40
+ height: 40
+ anchors.right: button_maximize.left
+ anchors.rightMargin: 2
+ anchors.top: button_maximize.top
+ font.pixelSize: 19
+ verticalAlignment: Qt.AlignVCenter
+ horizontalAlignment: Qt.AlignHCenter
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
popup.open()
}
}
}
+
property int rowHeight: 64
// This popup allows changing the settings for this element
Popup {
@@ -88,12 +158,7 @@ Item {
width: 500
height: 300
modal: true
- //focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
- /*background: Rectangle {
- color: "gray"
- border.color: "black"
- }*/
Pane{
ColumnLayout {
anchors.fill: parent
diff --git a/qml/video/SecondaryVideoGstreamerPane.qml b/qml/video/SecondaryVideoGstreamerPane.qml
new file mode 100644
index 000000000..4b7b2df0a
--- /dev/null
+++ b/qml/video/SecondaryVideoGstreamerPane.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.12
+import QtGraphicalEffects 1.12
+import QtQuick.Controls 2.15
+import QtQuick.Layouts 1.15
+
+// QT creator might show "not found" on this import, this is okay, annoying qt specifics
+import org.freedesktop.gstreamer.GLVideoItem 1.0;
+
+import OpenHD 1.0
+
+import "../ui/elements"
+
+GstGLVideoItem {
+ id: secondaryVideoGStreamer
+ objectName: "secondaryVideoGStreamer"
+ z: 0.0
+
+ Component.onCompleted: {
+ console.log("secondaryVideoGStreamer (Qmlglsink) created")
+ _secondary_video_gstreamer_qml.check_common_mistakes_then_init(secondaryVideoGStreamer)
+ }
+}