|
|
@ -8,8 +8,8 @@ |
|
|
|
****************************************************************************/ |
|
|
|
****************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import QtQuick 2.3 |
|
|
|
import QtQuick 2.11 |
|
|
|
import QtQuick.Controls 1.2 |
|
|
|
import QtQuick.Controls 2.4 |
|
|
|
|
|
|
|
|
|
|
|
import QGroundControl 1.0 |
|
|
|
import QGroundControl 1.0 |
|
|
|
import QGroundControl.FlightDisplay 1.0 |
|
|
|
import QGroundControl.FlightDisplay 1.0 |
|
|
@ -28,6 +28,13 @@ Item { |
|
|
|
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle |
|
|
|
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle |
|
|
|
property var _dynamicCameras: _activeVehicle ? _activeVehicle.dynamicCameras : null |
|
|
|
property var _dynamicCameras: _activeVehicle ? _activeVehicle.dynamicCameras : null |
|
|
|
property bool _connected: _activeVehicle ? !_activeVehicle.connectionLost : false |
|
|
|
property bool _connected: _activeVehicle ? !_activeVehicle.connectionLost : false |
|
|
|
|
|
|
|
property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0 |
|
|
|
|
|
|
|
property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false |
|
|
|
|
|
|
|
property var _camera: _isCamera ? _dynamicCameras.cameras.get(_curCameraIndex) : null |
|
|
|
|
|
|
|
property bool _hasCameraZoom: _camera && _camera.hasZoom |
|
|
|
|
|
|
|
property bool _hasVideoZoom: QGroundControl.videoManager.hasZoom |
|
|
|
|
|
|
|
property bool _hasZoom: _hasCameraZoom || _hasVideoZoom |
|
|
|
|
|
|
|
property int _fitMode: QGroundControl.settingsManager.videoSettings.videoFit.rawValue |
|
|
|
Rectangle { |
|
|
|
Rectangle { |
|
|
|
id: noVideo |
|
|
|
id: noVideo |
|
|
|
anchors.fill: parent |
|
|
|
anchors.fill: parent |
|
|
@ -51,10 +58,26 @@ Item { |
|
|
|
anchors.fill: parent |
|
|
|
anchors.fill: parent |
|
|
|
color: "black" |
|
|
|
color: "black" |
|
|
|
visible: _videoReceiver && _videoReceiver.videoRunning |
|
|
|
visible: _videoReceiver && _videoReceiver.videoRunning |
|
|
|
|
|
|
|
function getWidth() { |
|
|
|
|
|
|
|
//-- Fit Width or Stretch |
|
|
|
|
|
|
|
if(_fitMode === 0 || _fitMode === 2) { |
|
|
|
|
|
|
|
return parent.width |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//-- Fit Height |
|
|
|
|
|
|
|
return _ar != 0.0 ? parent.height * _ar : parent.width |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function getHeight() { |
|
|
|
|
|
|
|
//-- Fit Height or Stretch |
|
|
|
|
|
|
|
if(_fitMode === 1 || _fitMode === 2) { |
|
|
|
|
|
|
|
return parent.height |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//-- Fit Width |
|
|
|
|
|
|
|
return _ar != 0.0 ? parent.width * (1 / _ar) : parent.height |
|
|
|
|
|
|
|
} |
|
|
|
QGCVideoBackground { |
|
|
|
QGCVideoBackground { |
|
|
|
id: videoContent |
|
|
|
id: videoContent |
|
|
|
height: parent.height |
|
|
|
height: parent.getHeight() |
|
|
|
width: _ar != 0.0 ? height * _ar : parent.width |
|
|
|
width: parent.getWidth() |
|
|
|
anchors.centerIn: parent |
|
|
|
anchors.centerIn: parent |
|
|
|
receiver: _videoReceiver |
|
|
|
receiver: _videoReceiver |
|
|
|
display: _videoReceiver && _videoReceiver.videoSurface |
|
|
|
display: _videoReceiver && _videoReceiver.videoSurface |
|
|
@ -104,5 +127,31 @@ Item { |
|
|
|
QGroundControl.videoManager.fullScreen = !QGroundControl.videoManager.fullScreen |
|
|
|
QGroundControl.videoManager.fullScreen = !QGroundControl.videoManager.fullScreen |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
PinchArea { |
|
|
|
|
|
|
|
id: pinchZoom |
|
|
|
|
|
|
|
enabled: _hasZoom |
|
|
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
|
|
onPinchStarted: pinchZoom.zoom = 0 |
|
|
|
|
|
|
|
onPinchUpdated: { |
|
|
|
|
|
|
|
if(_hasZoom) { |
|
|
|
|
|
|
|
var z = 0 |
|
|
|
|
|
|
|
if(pinch.scale < 1) { |
|
|
|
|
|
|
|
z = Math.round(pinch.scale * -10) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
z = Math.round(pinch.scale) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(pinchZoom.zoom != z) { |
|
|
|
|
|
|
|
//-- Camera zoom takes predence |
|
|
|
|
|
|
|
if(_hasCameraZoom) { |
|
|
|
|
|
|
|
_camera.stepZoom(z) |
|
|
|
|
|
|
|
} else if (_hasVideoZoom) { |
|
|
|
|
|
|
|
//-- Video zoom is for dumb cameras that only stream (do not present a camera interface) |
|
|
|
|
|
|
|
QGroundControl.videoManager.stepZoom(z) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
property int zoom: 0 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|