From 081d2ee9a45b51316810acd0923d7a934a30113f Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Sun, 3 Sep 2017 15:18:22 -0400 Subject: [PATCH] Toggle video stream full screen --- src/FlightDisplay/FlightDisplayView.qml | 15 ++++++------ src/FlightDisplay/FlightDisplayViewVideo.qml | 24 +++++++++++++++----- src/FlightDisplay/VideoManager.cc | 1 + src/FlightDisplay/VideoManager.h | 6 +++++ src/ui/MainWindowInner.qml | 5 ++-- src/ui/toolbar/MainToolBar.qml | 1 + 6 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index b4ebdd5d3..b1b2fceb1 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -222,7 +222,7 @@ QGCView { z: _mainIsMap ? _panel.z + 1 : _panel.z + 2 anchors.left: _panel.left anchors.bottom: _panel.bottom - visible: _mainIsMap || _isPipVisible + visible: _mainIsMap || _isPipVisible && !QGroundControl.videoManager.fullScreen width: _mainIsMap ? _panel.width : _pipSize height: _mainIsMap ? _panel.height : _pipSize * (9/16) states: [ @@ -300,7 +300,7 @@ QGCView { anchors.left: _panel.left anchors.bottom: _panel.bottom anchors.margins: ScreenTools.defaultFontPixelHeight - visible: QGroundControl.videoManager.hasVideo + visible: QGroundControl.videoManager.hasVideo && !QGroundControl.videoManager.fullScreen isHidden: !_isPipVisible isDark: isBackgroundDark onActivated: { @@ -349,7 +349,7 @@ QGCView { qgcView: root useLightColors: isBackgroundDark missionController: _missionController - visible: singleVehicleView.checked + visible: singleVehicleView.checked && !QGroundControl.videoManager.fullScreen } //------------------------------------------------------------------------- @@ -357,6 +357,7 @@ QGCView { Loader { id: flyViewOverlay z: flightDisplayViewWidgets.z + 1 + visible: !QGroundControl.videoManager.fullScreen height: ScreenTools.availableHeight anchors.left: parent.left anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right @@ -373,7 +374,7 @@ QGCView { anchors.right: _flightVideo.right height: ScreenTools.defaultFontPixelHeight * 2 width: height - visible: QGroundControl.videoManager.videoReceiver.videoRunning && QGroundControl.settingsManager.videoSettings.showRecControl.rawValue && !_isCamera + visible: QGroundControl.videoManager.videoReceiver.videoRunning && QGroundControl.settingsManager.videoSettings.showRecControl.rawValue && !_isCamera && !QGroundControl.videoManager.fullScreen opacity: 0.75 Rectangle { @@ -407,7 +408,7 @@ QGCView { anchors.right: parent.right anchors.bottom: parent.bottom width: ScreenTools.defaultFontPixelWidth * 30 - visible: !singleVehicleView.checked + visible: !singleVehicleView.checked && !QGroundControl.videoManager.fullScreen z: _panel.z + 4 } @@ -418,7 +419,7 @@ QGCView { z: _panel.z + 5 width: parent.width - (_flightVideoPipControl.width / 2) height: Math.min(ScreenTools.availableHeight * 0.25, ScreenTools.defaultFontPixelWidth * 16) - visible: _virtualJoystick ? _virtualJoystick.value : false + visible: (_virtualJoystick ? _virtualJoystick.value : false) && !QGroundControl.videoManager.fullScreen anchors.bottom: _flightVideoPipControl.top anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 2 anchors.horizontalCenter: flightDisplayViewWidgets.horizontalCenter @@ -431,7 +432,7 @@ QGCView { } ToolStrip { - visible: _activeVehicle ? _activeVehicle.guidedModeSupported : true + visible: (_activeVehicle ? _activeVehicle.guidedModeSupported : true) && !QGroundControl.videoManager.fullScreen id: toolStrip anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.left: _panel.left diff --git a/src/FlightDisplay/FlightDisplayViewVideo.qml b/src/FlightDisplay/FlightDisplayViewVideo.qml index d502a355c..aca14d164 100644 --- a/src/FlightDisplay/FlightDisplayViewVideo.qml +++ b/src/FlightDisplay/FlightDisplayViewVideo.qml @@ -39,6 +39,12 @@ Item { font.pointSize: _mainIsMap ? ScreenTools.smallFontPointSize : ScreenTools.largeFontPointSize anchors.centerIn: parent } + MouseArea { + anchors.fill: parent + onDoubleClicked: { + QGroundControl.videoManager.fullScreen = !QGroundControl.videoManager.fullScreen + } + } } Rectangle { anchors.fill: parent @@ -67,35 +73,41 @@ Item { height: parent.height width: 1 x: parent.width * 0.33 - visible: _showGrid + visible: _showGrid && !QGroundControl.videoManager.fullScreen } Rectangle { color: Qt.rgba(1,1,1,0.5) height: parent.height width: 1 x: parent.width * 0.66 - visible: _showGrid + visible: _showGrid && !QGroundControl.videoManager.fullScreen } Rectangle { color: Qt.rgba(1,1,1,0.5) width: parent.width height: 1 y: parent.height * 0.33 - visible: _showGrid + visible: _showGrid && !QGroundControl.videoManager.fullScreen } Rectangle { color: Qt.rgba(1,1,1,0.5) width: parent.width height: 1 y: parent.height * 0.66 - visible: _showGrid + visible: _showGrid && !QGroundControl.videoManager.fullScreen + } + } + MouseArea { + anchors.fill: parent + onDoubleClicked: { + QGroundControl.videoManager.fullScreen = !QGroundControl.videoManager.fullScreen } } } //-- Camera Controller Loader { - source: _dynamicCameras ? _dynamicCameras.controllerSource : "" - visible: !_mainIsMap && _dynamicCameras && _dynamicCameras.cameras.count && _connected + source: QGroundControl.videoManager.fullScreen ? "" : (_dynamicCameras ? _dynamicCameras.controllerSource : "") + visible: !_mainIsMap && _dynamicCameras && _dynamicCameras.cameras.count && _connected && !QGroundControl.videoManager.fullScreen anchors.right: parent.right anchors.rightMargin: ScreenTools.defaultFontPixelWidth anchors.bottom: parent.bottom diff --git a/src/FlightDisplay/VideoManager.cc b/src/FlightDisplay/VideoManager.cc index ed275e23d..6ad295330 100644 --- a/src/FlightDisplay/VideoManager.cc +++ b/src/FlightDisplay/VideoManager.cc @@ -34,6 +34,7 @@ VideoManager::VideoManager(QGCApplication* app, QGCToolbox* toolbox) : QGCTool(app, toolbox) , _videoReceiver(NULL) , _videoSettings(NULL) + , _fullScreen(false) { } diff --git a/src/FlightDisplay/VideoManager.h b/src/FlightDisplay/VideoManager.h index 375d71f21..90e93d7fc 100644 --- a/src/FlightDisplay/VideoManager.h +++ b/src/FlightDisplay/VideoManager.h @@ -35,10 +35,12 @@ public: Q_PROPERTY(bool isGStreamer READ isGStreamer NOTIFY isGStreamerChanged) Q_PROPERTY(QString videoSourceID READ videoSourceID NOTIFY videoSourceIDChanged) Q_PROPERTY(bool uvcEnabled READ uvcEnabled CONSTANT) + Q_PROPERTY(bool fullScreen READ fullScreen WRITE setfullScreen NOTIFY fullScreenChanged) Q_PROPERTY(VideoReceiver* videoReceiver READ videoReceiver CONSTANT) bool hasVideo (); bool isGStreamer (); + bool fullScreen () { return _fullScreen; } QString videoSourceID () { return _videoSourceID; } VideoReceiver* videoReceiver () { return _videoReceiver; } @@ -49,6 +51,8 @@ public: bool uvcEnabled (); #endif + void setfullScreen (bool f) { _fullScreen = f; emit fullScreenChanged(); } + // Override from QGCTool void setToolbox (QGCToolbox *toolbox); @@ -56,6 +60,7 @@ signals: void hasVideoChanged (); void isGStreamerChanged (); void videoSourceIDChanged (); + void fullScreenChanged (); private slots: void _videoSourceChanged (); @@ -69,6 +74,7 @@ private: VideoReceiver* _videoReceiver; VideoSettings* _videoSettings; QString _videoSourceID; + bool _fullScreen; }; #endif diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml index 69a12b94e..f742ab914 100644 --- a/src/ui/MainWindowInner.qml +++ b/src/ui/MainWindowInner.qml @@ -204,7 +204,7 @@ Item { property var messageQueue: [] function showMessage(message) { - if(criticalMmessageArea.visible) { + if(criticalMmessageArea.visible || QGroundControl.videoManager.fullScreen) { messageQueue.push(message) } else { criticalMessageText.text = message @@ -271,6 +271,7 @@ Item { MainToolBar { id: toolBar height: ScreenTools.toolbarHeight + visible: !QGroundControl.videoManager.fullScreen anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top @@ -593,7 +594,7 @@ Item { //-- Loader helper for any child, no matter how deep can display an element // in the middle of the main window. Loader { - id: rootLoader + id: rootLoader anchors.centerIn: parent } diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index aba0d72c2..2d2cb219d 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -21,6 +21,7 @@ import QGroundControl.Controllers 1.0 Rectangle { id: toolBar color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75) + visible: !QGroundControl.videoManager.fullScreen QGCPalette { id: qgcPal; colorGroupEnabled: true } -- 2.22.0