diff --git a/qgcresources.qrc b/qgcresources.qrc index e638acf3f5657dfed59c061092206a25c64b76cc..5b6fa54b53d55297f9774605cfbb30482e0a7eb5 100644 --- a/qgcresources.qrc +++ b/qgcresources.qrc @@ -109,6 +109,7 @@ src/FlightMap/Images/compassInstrumentDial.svg src/FlightMap/Images/crossHair.svg src/FlightMap/Images/PiP.svg + src/FlightMap/Images/pipHide.svg src/FlightMap/Images/pipResize.svg src/FlightMap/Images/rollDialWhite.svg src/FlightMap/Images/rollPointerWhite.svg diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index e2ff0b2348db9aac725d564c915d67363258ca0c..9daed693ef3a6cf14502e980bc63e1d08f8c101b 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -16,6 +16,7 @@ import QtLocation 5.3 import QtPositioning 5.3 import QtMultimedia 5.5 import QtQuick.Layouts 1.2 +import QtQuick.Window 2.2 import QGroundControl 1.0 import QGroundControl.FlightDisplay 1.0 @@ -182,6 +183,24 @@ QGCView { } } + Window { + id: videoWindow + width: !_mainIsMap ? _panel.width : _pipSize + height: !_mainIsMap ? _panel.height : _pipSize * (9/16) + visible: false + + Item { + id: videoItem + anchors.fill: parent + } + + onClosing: { + _flightVideo.state = "unpopup" + videoWindow.visible = false + } + + } + QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true } QGCViewPanel { @@ -242,7 +261,11 @@ QGCView { name: "pipMode" PropertyChanges { target: _flightVideo - anchors.margins: ScreenTools.defaultFontPixelHeight + anchors.margins: ScreenTools.defaultFontPixelHeight + } + PropertyChanges { + target: _flightVideoPipControl + inPopup: false } }, State { @@ -251,10 +274,53 @@ QGCView { target: _flightVideo anchors.margins: 0 } + PropertyChanges { + target: _flightVideoPipControl + inPopup: false + } + }, + State { + name: "popup" + StateChangeScript { + script: QGroundControl.videoManager.stopVideo() + } + ParentChange { + target: _flightVideo + parent: videoItem + x: 0 + y: 0 + width: videoWindow.width + height: videoWindow.height + } + PropertyChanges { + target: _flightVideoPipControl + inPopup: true + } + }, + State { + name: "unpopup" + StateChangeScript { + script: QGroundControl.videoManager.stopVideo() + } + ParentChange { + target: _flightVideo + parent: _panel + } + PropertyChanges { + target: _flightVideo + anchors.left: _panel.left + anchors.bottom: _panel.bottom + anchors.margins: ScreenTools.defaultFontPixelHeight + } + PropertyChanges { + target: _flightVideoPipControl + inPopup: false + } } ] //-- Video Streaming FlightDisplayViewVideo { + id: videoStreaming anchors.fill: parent visible: QGroundControl.videoManager.isGStreamer } @@ -285,6 +351,10 @@ QGCView { onHideIt: { setPipVisibility(!state) } + onPopup: { + videoWindow.visible = true + _flightVideo.state = "popup" + } onNewWidth: { _pipSize = newWidth } diff --git a/src/FlightDisplay/VideoManager.h b/src/FlightDisplay/VideoManager.h index 2db9e8aa1bcce848161a1caa00cdf2ada4bacfa4..f419af90a281a1889feba1642979e35ca930dde4 100644 --- a/src/FlightDisplay/VideoManager.h +++ b/src/FlightDisplay/VideoManager.h @@ -56,6 +56,9 @@ public: // Override from QGCTool void setToolbox (QGCToolbox *toolbox); + Q_INVOKABLE void startVideo() {_videoReceiver->stop();}; + Q_INVOKABLE void stopVideo() {_videoReceiver->stop();}; + signals: void hasVideoChanged (); void isGStreamerChanged (); diff --git a/src/FlightMap/Images/PiP.svg b/src/FlightMap/Images/PiP.svg index f73f1e577fe4f979208a214e584fdc662cffae2c..84739056bd0f4f1f50ac7e5e26c0a227ab7fbe70 100644 --- a/src/FlightMap/Images/PiP.svg +++ b/src/FlightMap/Images/PiP.svg @@ -1,10 +1,63 @@ - - - - - - - - - + + + +image/svg+xml \ No newline at end of file diff --git a/src/FlightMap/Images/pipHide.svg b/src/FlightMap/Images/pipHide.svg new file mode 100644 index 0000000000000000000000000000000000000000..73200628f91579bd399296ac50db57d043bde77e --- /dev/null +++ b/src/FlightMap/Images/pipHide.svg @@ -0,0 +1,84 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/QmlControls/QGCPipable.qml b/src/QmlControls/QGCPipable.qml index 3a84d47b81306bd46bf9c2a69002b88a4900e18e..dfcd10be1194ed49e2597c9068532ad0b2915a5d 100644 --- a/src/QmlControls/QGCPipable.qml +++ b/src/QmlControls/QGCPipable.qml @@ -26,9 +26,12 @@ Item { property real maxSize: 0.75 property real minSize: 0.10 + property bool inPopup: false + signal activated() signal hideIt(bool state) signal newWidth(real newWidth) + signal popup() MouseArea { id: pipMouseArea @@ -87,7 +90,7 @@ Item { mipmap: true anchors.right: parent.right anchors.top: parent.top - visible: !isHidden && (ScreenTools.isMobile || pipMouseArea.containsMouse) + visible: !isHidden && (ScreenTools.isMobile || pipMouseArea.containsMouse) && !inPopup height: ScreenTools.defaultFontPixelHeight * 2.5 width: ScreenTools.defaultFontPixelHeight * 2.5 sourceSize.height: height @@ -116,10 +119,31 @@ Item { } } + //-- PIP Popup Indicator + Image { + id: popupPIP + source: "/qmlimages/PiP.svg" + mipmap: true + fillMode: Image.PreserveAspectFit + anchors.left: parent.left + anchors.top: parent.top + visible: !isHidden && (ScreenTools.isMobile || pipMouseArea.containsMouse) && !inPopup && !ScreenTools.isMobile + height: ScreenTools.defaultFontPixelHeight * 2.5 + width: ScreenTools.defaultFontPixelHeight * 2.5 + sourceSize.height: height + MouseArea { + anchors.fill: parent + onClicked: { + inPopup = true + pip.popup() + } + } + } + //-- PIP Corner Indicator Image { id: closePIP - source: "/qmlimages/PiP.svg" + source: "/qmlimages/pipHide.svg" mipmap: true fillMode: Image.PreserveAspectFit anchors.left: parent.left