Browse Source

Flight display: Fixed TypeErrors on startup without gstream installed

QGC4.4
dheideman 8 years ago
parent
commit
256fed269b
  1. 16
      src/FlightDisplay/FlightDisplayViewVideo.qml

16
src/FlightDisplay/FlightDisplayViewVideo.qml

@ -25,11 +25,13 @@ Item {
id: root id: root
property double _ar: QGroundControl.settingsManager.videoSettings.aspectRatio.rawValue property double _ar: QGroundControl.settingsManager.videoSettings.aspectRatio.rawValue
property bool _showGrid: QGroundControl.settingsManager.videoSettings.gridLines.rawValue > 0 property bool _showGrid: QGroundControl.settingsManager.videoSettings.gridLines.rawValue > 0
property var _videoReceiver: QGroundControl.videoManager.videoReceiver
Rectangle { Rectangle {
id: noVideo id: noVideo
anchors.fill: parent anchors.fill: parent
color: Qt.rgba(0,0,0,0.75) color: Qt.rgba(0,0,0,0.75)
visible: !QGroundControl.videoManager.videoReceiver.videoRunning visible: !(_videoReceiver && _videoReceiver.videoRunning)
QGCLabel { QGCLabel {
text: qsTr("WAITING FOR VIDEO") text: qsTr("WAITING FOR VIDEO")
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
@ -41,20 +43,20 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: "black" color: "black"
visible: QGroundControl.videoManager.videoReceiver.videoRunning visible: _videoReceiver && _videoReceiver.videoRunning
QGCVideoBackground { QGCVideoBackground {
id: videoContent id: videoContent
height: parent.height height: parent.height
width: _ar != 0.0 ? height * _ar : parent.width width: _ar != 0.0 ? height * _ar : parent.width
anchors.centerIn: parent anchors.centerIn: parent
receiver: QGroundControl.videoManager.videoReceiver receiver: _videoReceiver
display: QGroundControl.videoManager.videoReceiver.videoSurface display: _videoReceiver && _videoReceiver.videoSurface
visible: QGroundControl.videoManager.videoReceiver.videoRunning visible: _videoReceiver && _videoReceiver.videoRunning
Connections { Connections {
target: QGroundControl.videoManager.videoReceiver target: _videoReceiver
onImageFileChanged: { onImageFileChanged: {
videoContent.grabToImage(function(result) { videoContent.grabToImage(function(result) {
if (!result.saveToFile(QGroundControl.videoManager.videoReceiver.imageFile)) { if (!result.saveToFile(_videoReceiver.imageFile)) {
console.error('Error capturing video frame'); console.error('Error capturing video frame');
} }
}); });

Loading…
Cancel
Save