Commit c817fe77 authored by DonLakeFlyer's avatar DonLakeFlyer

parent 477602f5
...@@ -27,39 +27,103 @@ Rectangle { ...@@ -27,39 +27,103 @@ Rectangle {
height: mainLayout.height + (_margins * 2) height: mainLayout.height + (_margins * 2)
color: "#80000000" color: "#80000000"
radius: _margins radius: _margins
visible: !QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel.rawValue && (_camera || _anyVideoStreamAvailable) && multiVehiclePanelSelector.showSingleVehiclePanel visible: !QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel.rawValue && (_mavlinkCamera || _videoStreamAvailable) && multiVehiclePanelSelector.showSingleVehiclePanel
property real _margins: ScreenTools.defaultFontPixelHeight / 2 property real _margins: ScreenTools.defaultFontPixelHeight / 2
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _cameraManager: _activeVehicle ? _activeVehicle.cameraManager : null
property var _videoManager: QGroundControl.videoManager // The following properties relate to a simple video stream
property bool _noCameras: _cameraManager ? _cameraManager.cameras.count === 0 : true property bool _videoStreamAvailable: _videoStreamManager.hasVideo
property bool _multipleCameras: _cameraManager ? _cameraManager.cameras.count > 1 : false property var _videoStreamSettings: QGroundControl.settingsManager.videoSettings
property bool _noMavlinkCameraStreams: _camera ? _camera.streamLabels.length : true property var _videoStreamManager: QGroundControl.videoManager
property bool _multipleMavlinkCameraStreams: _camera ? _camera.streamLabels.length > 1 : false property bool _videoStreamAllowsPhotoWhileRecording: true
property bool _anyVideoStreamAvailable: _videoManager.hasVideo property bool _videoStreamIsStreaming: _videoStreamManager.streaming
property int _curCameraIndex: _cameraManager ? _cameraManager.currentCamera : -1 property bool _videoStreamPhotoCaptureIsIdle: true
property int _curStreamIndex: _camera ? _camera.currentStream : -1 property bool _videoStreamRecording: _videoStreamManager.recording
property var _camera: !_noCameras ? (_cameraManager.cameras.get(_curCameraIndex) && _cameraManager.cameras.get(_curCameraIndex).paramComplete ? _cameraManager.cameras.get(_curCameraIndex) : null) : null property bool _videoStreamCanShoot: _videoStreamIsStreaming
property string _cameraName: _camera ? (_multipleCameras ? _camera.modelName : "") : qsTr("Video Stream") property bool _videoStreamIsShootingInCurrentMode: _videoStreamInPhotoMode ? !_videoStreamPhotoCaptureIsIdle : _videoStreamRecording
property bool _hasThermalVideoStream: _camera ? _camera.thermalStreamInstance : false property bool _videoStreamInPhotoMode: false
property bool _cameraModeUndefined: _camera ? _camera.cameraMode === QGCCameraControl.CAM_MODE_UNDEFINED : true property bool _onlyVideoStreamAvailable: !_mavlinkCamera && _videoStreamManager.hasVideo
property bool _cameraInVideoMode: _camera ? _camera.cameraMode === QGCCameraControl.CAM_MODE_VIDEO : false
property bool _cameraInPhotoMode: _camera ? _camera.cameraMode === QGCCameraControl.CAM_MODE_PHOTO : false // The following properties relate to a mavlink protocol camera
property bool _cameraElapsedMode: _camera && _camera.cameraMode === QGCCameraControl.CAM_MODE_PHOTO && _camera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE property var _mavlinkCameraManager: _activeVehicle ? _activeVehicle.cameraManager : null
property real _spacers: ScreenTools.defaultFontPixelHeight * 0.5 property int _mavlinkCameraManagerCurCameraIndex: _mavlinkCameraManager ? _mavlinkCameraManager.currentCamera : -1
property real _labelFieldWidth: ScreenTools.defaultFontPixelWidth * 30 property bool _noMavlinkCameras: _mavlinkCameraManager ? _mavlinkCameraManager.cameras.count === 0 : true
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30 property var _mavlinkCamera: !_noMavlinkCameras ? (_mavlinkCameraManager.cameras.get(_mavlinkCameraManagerCurCameraIndex) && _mavlinkCameraManager.cameras.get(_mavlinkCameraManagerCurCameraIndex).paramComplete ? _mavlinkCameraManager.cameras.get(_mavlinkCameraManagerCurCameraIndex) : null) : null
property bool _communicationLost: _activeVehicle ? _activeVehicle.connectionLost : false property bool _multipleMavlinkCameras: _mavlinkCameraManager ? _mavlinkCameraManager.cameras.count > 1 : false
property bool _hasModes: _camera && _camera.hasModes property bool _noMavlinkCameraStreams: _mavlinkCamera ? _mavlinkCamera.streamLabels.length : true
property bool _videoRecording: _camera && _camera.videoStatus === QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING property bool _multipleMavlinkCameraStreams: _mavlinkCamera ? _mavlinkCamera.streamLabels.length > 1 : false
property bool _photoIdle: _camera && (_camera.photoStatus === QGCCameraControl.PHOTO_CAPTURE_IDLE || _camera.photoStatus >= QGCCameraControl.PHOTO_CAPTURE_LAST) property int _mavlinCameraCurStreamIndex: _mavlinkCamera ? _mavlinkCamera.currentStream : -1
property bool _storageReady: _camera && _camera.storageStatus === QGCCameraControl.STORAGE_READY property bool _mavlinkCameraHasThermalVideoStream: _mavlinkCamera ? _mavlinkCamera.thermalStreamInstance : false
property bool _batteryReady: _camera && _camera.batteryRemaining >= 0 property bool _mavlinkCameraModeUndefined: _mavlinkCamera ? _mavlinkCamera.cameraMode === QGCCameraControl.CAM_MODE_UNDEFINED : true
property bool _storageSupported: _camera && _camera.storageStatus === QGCCameraControl.STORAGE_NOT_SUPPORTED property bool _mavlinkCameraInVideoMode: _mavlinkCamera ? _mavlinkCamera.cameraMode === QGCCameraControl.CAM_MODE_VIDEO : false
property bool _canShoot: (!_cameraModeUndefined && ((_storageReady && _camera.storageFree > 0) || _storageSupported)) || _videoManager.streaming property bool _mavlinkCameraInPhotoMode: _mavlinkCamera ? _mavlinkCamera.cameraMode === QGCCameraControl.CAM_MODE_PHOTO : false
property bool _isShooting: ((_cameraInVideoMode && _videoRecording) || (_cameraInPhotoMode && !_photoIdle)) || _videoManager.recording property bool _mavlinkCameraElapsedMode: _mavlinkCamera && _mavlinkCamera.cameraMode === QGCCameraControl.CAM_MODE_PHOTO && _mavlinkCamera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE
property var _videoSettings: QGroundControl.settingsManager.videoSettings property bool _mavlinkCameraHasModes: _mavlinkCamera && _mavlinkCamera.hasModes
property bool _mavlinkCameraVideoIsRecording: _mavlinkCamera && _mavlinkCamera.videoStatus === QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING
property bool _mavlinkCameraPhotoCaptureIsIdle: _mavlinkCamera && (_mavlinkCamera.photoStatus === QGCCameraControl.PHOTO_CAPTURE_IDLE || _mavlinkCamera.photoStatus >= QGCCameraControl.PHOTO_CAPTURE_LAST)
property bool _mavlinkCameraStorageReady: _mavlinkCamera && _mavlinkCamera.storageStatus === QGCCameraControl.STORAGE_READY
property bool _mavlinkCameraBatteryReady: _mavlinkCamera && _mavlinkCamera.batteryRemaining >= 0
property bool _mavlinkCameraStorageSupported: _mavlinkCamera && _mavlinkCamera.storageStatus === QGCCameraControl.STORAGE_NOT_SUPPORTED
property bool _mavlinkCameraAllowsPhotoWhileRecording: false
property bool _mavlinkCameraCanShoot: (!_mavlinkCameraModeUndefined && ((_mavlinkCameraStorageReady && _mavlinkCamera.storageFree > 0) || _mavlinkCameraStorageSupported)) || _videoStreamManager.streaming
property bool _mavlinkCameraIsShooting: ((_mavlinkCameraInVideoMode && _mavlinkCameraVideoIsRecording) || (_mavlinkCameraInPhotoMode && !_mavlinkCameraPhotoCaptureIsIdle)) || _videoStreamManager.recording
// The following settings and functions unify between a mavlink camera and a simple video stream for simple access
property bool _anyVideoStreamAvailable: _videoStreamManager.hasVideo
property string _mavlinkCameraName: _mavlinkCamera ? (_multipleMavlinkCameras ? _mavlinkCamera.modelName : "") : qsTr("Video Stream")
property bool _showModeIndicator: _mavlinkCamera ? _mavlinkCameraHasModes : _onlyVideoStreamAvailable
property bool _modeIndicatorPhotoMode: _mavlinkCamera ? _mavlinkCameraInPhotoMode : _videoStreamInPhotoMode
property bool _allowsPhotoWhileRecording: _mavlinkCamera ? _mavlinkCameraAllowsPhotoWhileRecording : _videoStreamAllowsPhotoWhileRecording
property bool _switchToPhotoModeAllowed: !_modeIndicatorPhotoMode && (_mavlinkCamera ? !_mavlinkCameraIsShooting : true)
property bool _switchToVideoModeAllowed: _modeIndicatorPhotoMode && (_mavlinkCamera ? !_mavlinkCameraIsShooting : true)
property bool _videoIsRecording: _mavlinkCamera ? _mavlinkCameraIsShooting : _videoStreamRecording
property bool _canShootInCurrentMode: _mavlinkCamera ? _mavlinkCameraCanShoot : _videoStreamCanShoot
property bool _isShootingInCurrentMode: _mavlinkCamera ? _mavlinkCameraIsShooting : _videoStreamIsShootingInCurrentMode
function setCameraMode(photoMode) {
_videoStreamInPhotoMode = photoMode
if (_mavlinkCamera) {
if (_mavlinkCameraInPhotoMode) {
_mavlinkCamera.setVideoMode()
} else {
_mavlinkCamera.setPhotoMode()
}
}
}
function toggleShooting() {
if (_mavlinkCamera) {
if(_mavlinkCameraInVideoMode) {
_mavlinkCamera.toggleVideo()
} else {
if(_mavlinkCameraInPhotoMode && !_mavlinkCameraPhotoCaptureIsIdle && _mavlinkCameraElapsedMode) {
_mavlinkCamera.stopTakePhoto()
} else {
_mavlinkCamera.takePhoto()
}
}
} else {
if (_videoStreamInPhotoMode) {
_videoStreamPhotoCaptureIsIdle = false
_videoStreamManager.grabImage()
videoStreamPhotoCaptureTimer.start()
} else {
if (_videoStreamManager.recording) {
_videoStreamManager.stopRecording()
} else {
_videoStreamManager.startRecording()
}
}
}
}
Timer {
id: videoStreamPhotoCaptureTimer
interval: 500
onTriggered: _videoStreamPhotoCaptureIsIdle = true
}
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
...@@ -88,26 +152,28 @@ Rectangle { ...@@ -88,26 +152,28 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
spacing: ScreenTools.defaultFontPixelHeight / 2 spacing: ScreenTools.defaultFontPixelHeight / 2
//-- Photo/Video Mode Selector (Mavlink Cameras only) // Photo/Video Mode Selector
// IMPORTANT: This control supports both mavlink cameras and simple video streams. Do no reference anything here which is not
// using the unified properties/functions.
Rectangle { Rectangle {
id: camMode
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
width: _hasModes ? ScreenTools.defaultFontPixelWidth * 10 : 0 width: ScreenTools.defaultFontPixelWidth * 10
height: _hasModes ? width / 2 : 0 height: width / 2
color: qgcPal.windowShadeLight color: qgcPal.windowShadeLight
radius: height * 0.5 radius: height * 0.5
visible: _hasModes visible: _showModeIndicator
//-- Video Mode //-- Video Mode
Rectangle { Rectangle {
width: parent.height
height: parent.height
color: _cameraInVideoMode ? qgcPal.window : qgcPal.windowShadeLight
radius: height * 0.5
anchors.left: parent.left
border.color: qgcPal.text
border.width: _cameraInVideoMode ? 1 : 0
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: parent.height
height: parent.height
color: _modeIndicatorPhotoMode ? qgcPal.windowShadeLight : qgcPal.window
radius: height * 0.5
anchors.left: parent.left
border.color: qgcPal.text
border.width: _modeIndicatorPhotoMode ? 0 : 1
QGCColoredImage { QGCColoredImage {
height: parent.height * 0.5 height: parent.height * 0.5
width: height width: height
...@@ -115,26 +181,24 @@ Rectangle { ...@@ -115,26 +181,24 @@ Rectangle {
source: "/qmlimages/camera_video.svg" source: "/qmlimages/camera_video.svg"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.height: height sourceSize.height: height
color: _cameraInVideoMode ? qgcPal.colorGreen : qgcPal.text color: _modeIndicatorPhotoMode ? qgcPal.text : qgcPal.colorGreen
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: _cameraInPhotoMode && !_isShooting enabled: _switchToVideoModeAllowed
onClicked: { onClicked: setCameraMode(false)
_camera.setVideoMode()
}
} }
} }
} }
//-- Photo Mode //-- Photo Mode
Rectangle { Rectangle {
width: parent.height
height: parent.height
color: _cameraInPhotoMode ? qgcPal.window : qgcPal.windowShadeLight
radius: height * 0.5
anchors.right: parent.right
border.color: qgcPal.text
border.width: _cameraInPhotoMode ? 1 : 0
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: parent.height
height: parent.height
color: _modeIndicatorPhotoMode ? qgcPal.window : qgcPal.windowShadeLight
radius: height * 0.5
anchors.right: parent.right
border.color: qgcPal.text
border.width: _modeIndicatorPhotoMode ? 1 : 0
QGCColoredImage { QGCColoredImage {
height: parent.height * 0.5 height: parent.height * 0.5
width: height width: height
...@@ -142,59 +206,40 @@ Rectangle { ...@@ -142,59 +206,40 @@ Rectangle {
source: "/qmlimages/camera_photo.svg" source: "/qmlimages/camera_photo.svg"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.height: height sourceSize.height: height
color: _cameraInPhotoMode ? qgcPal.colorGreen : qgcPal.text color: _modeIndicatorPhotoMode ? qgcPal.colorGreen : qgcPal.text
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: _cameraInVideoMode && !_isShooting enabled: _switchToPhotoModeAllowed
onClicked: { onClicked: setCameraMode(true)
_camera.setPhotoMode()
}
} }
} }
} }
} }
// Take Photo, Start/Stop Video button // Take Photo, Start/Stop Video button
// IMPORTANT: This control supports both mavlink cameras and simple video streams. Do no reference anything here which is not
// using the unified properties/functions.
Rectangle { Rectangle {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
color: Qt.rgba(0,0,0,0) color: Qt.rgba(0,0,0,0)
width: ScreenTools.defaultFontPixelWidth * 6 width: ScreenTools.defaultFontPixelWidth * 6
height: width height: width
radius: width * 0.5 radius: width * 0.5
visible: _camera || _anyVideoStreamAvailable
border.color: qgcPal.buttonText border.color: qgcPal.buttonText
border.width: 3 border.width: 3
Rectangle { Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width * (_isShooting ? 0.5 : 0.75) width: parent.width * (_isShootingInCurrentMode ? 0.5 : 0.75)
height: width height: width
radius: _isShooting ? 0 : width * 0.5 radius: _isShootingInCurrentMode ? 0 : width * 0.5
color: _canShoot ? qgcPal.colorRed : qgcPal.colorGrey color: _canShootInCurrentMode ? qgcPal.colorRed : qgcPal.colorGrey
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: _canShoot enabled: _canShootInCurrentMode
onClicked: { onClicked: toggleShooting()
if (_camera) {
if(_cameraInVideoMode) {
_camera.toggleVideo()
} else {
if(_cameraInPhotoMode && !_photoIdle && _cameraElapsedMode) {
_camera.stopTakePhoto()
} else {
_camera.takePhoto()
}
}
} else {
if (_videoManager.recording) {
_videoManager.stopRecording()
} else {
_videoManager.startRecording()
}
}
}
} }
} }
...@@ -205,32 +250,32 @@ Rectangle { ...@@ -205,32 +250,32 @@ Rectangle {
QGCLabel { QGCLabel {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: _cameraName text: _mavlinkCameraName
visible: _cameraName !== "" visible: _mavlinkCameraName !== ""
} }
QGCLabel { QGCLabel {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: (_cameraInVideoMode && _camera.videoStatus === QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING) ? _camera.recordTimeStr : "00:00:00" text: (_mavlinkCameraInVideoMode && _mavlinkCamera.videoStatus === QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING) ? _mavlinkCamera.recordTimeStr : "00:00:00"
font.pointSize: ScreenTools.largeFontPointSize font.pointSize: ScreenTools.largeFontPointSize
visible: _cameraInVideoMode visible: _mavlinkCameraInVideoMode
} }
QGCLabel { QGCLabel {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: _activeVehicle && _cameraInPhotoMode ? ('00000' + _activeVehicle.cameraTriggerPoints.count).slice(-5) : "0000_cameraPhotoMode0" text: _activeVehicle && _mavlinkCameraInPhotoMode ? ('00000' + _activeVehicle.cameraTriggerPoints.count).slice(-5) : "0000_mavlinkCameraPhotoMode0"
font.pointSize: ScreenTools.largeFontPointSize font.pointSize: ScreenTools.largeFontPointSize
visible: _cameraInPhotoMode visible: _mavlinkCameraInPhotoMode
} }
QGCLabel { QGCLabel {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: _camera ? qsTr("Free Space: ") + _camera.storageFreeStr : "" text: _mavlinkCamera ? qsTr("Free Space: ") + _mavlinkCamera.storageFreeStr : ""
font.pointSize: ScreenTools.defaultFontPointSize font.pointSize: ScreenTools.defaultFontPointSize
visible: _storageReady visible: _mavlinkCameraStorageReady
} }
QGCLabel { QGCLabel {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: _camera ? qsTr("Battery: ") + _camera.batteryRemainingStr : "" text: _mavlinkCamera ? qsTr("Battery: ") + _mavlinkCamera.batteryRemainingStr : ""
font.pointSize: ScreenTools.defaultFontPointSize font.pointSize: ScreenTools.defaultFontPointSize
visible: _batteryReady visible: _mavlinkCameraBatteryReady
} }
} }
} }
...@@ -248,14 +293,14 @@ Rectangle { ...@@ -248,14 +293,14 @@ Rectangle {
GridLayout { GridLayout {
id: gridLayout id: gridLayout
flow: GridLayout.TopToBottom flow: GridLayout.TopToBottom
rows: dynamicRows + (_camera ? _camera.activeSettings.length : 0) rows: dynamicRows + (_mavlinkCamera ? _mavlinkCamera.activeSettings.length : 0)
property int dynamicRows: 10 property int dynamicRows: 10
// First column // First column
QGCLabel { QGCLabel {
text: qsTr("Camera") text: qsTr("Camera")
visible: _multipleCameras visible: _multipleMavlinkCameras
onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1 onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1
} }
...@@ -267,35 +312,34 @@ Rectangle { ...@@ -267,35 +312,34 @@ Rectangle {
QGCLabel { QGCLabel {
text: qsTr("Thermal View Mode") text: qsTr("Thermal View Mode")
visible: _hasThermalVideoStream visible: _mavlinkCameraHasThermalVideoStream
onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1 onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1
} }
QGCLabel { QGCLabel {
text: qsTr("Blend Opacity") text: qsTr("Blend Opacity")
visible: _hasThermalVideoStream && _camera.thermalMode === QGCCameraControl.THERMAL_BLEND visible: _mavlinkCameraHasThermalVideoStream && _mavlinkCamera.thermalMode === QGCCameraControl.THERMAL_BLEND
onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1 onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1
} }
// Mavlink Camera Protocol active settings // Mavlink Camera Protocol active settings
Repeater { Repeater {
model: _camera ? _camera.activeSettings : [] model: _mavlinkCamera ? _mavlinkCamera.activeSettings : []
QGCLabel { QGCLabel {
text: _camera.getFact(modelData).shortDescription text: _mavlinkCamera.getFact(modelData).shortDescription
} }
} }
QGCLabel { QGCLabel {
text: qsTr("Photo Mode") text: qsTr("Photo Mode")
visible: _hasModes visible: _mavlinkCameraHasModes
onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1 onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1
} }
QGCLabel { QGCLabel {
text: qsTr("Photo Interval (seconds)") text: qsTr("Photo Interval (seconds)")
width: _labelFieldWidth visible: _mavlinkCameraInPhotoMode && _mavlinkCamera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE
visible: _cameraInPhotoMode && _camera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE
onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1 onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1
} }
...@@ -313,13 +357,13 @@ Rectangle { ...@@ -313,13 +357,13 @@ Rectangle {
QGCLabel { QGCLabel {
text: qsTr("Reset Camera Defaults") text: qsTr("Reset Camera Defaults")
visible: _camera visible: _mavlinkCamera
onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1 onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1
} }
QGCLabel { QGCLabel {
text: qsTr("Storage") text: qsTr("Storage")
visible: _storageSupported visible: _mavlinkCameraStorageSupported
onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1 onVisibleChanged: gridLayout.dynamicRows += visible ? 1 : -1
} }
...@@ -327,49 +371,49 @@ Rectangle { ...@@ -327,49 +371,49 @@ Rectangle {
QGCComboBox { QGCComboBox {
Layout.fillWidth: true Layout.fillWidth: true
sizeToContents: true sizeToContents: true
model: _cameraManager ? _cameraManager.cameraLabels : [] model: _mavlinkCameraManager ? _mavlinkCameraManager.cameraLabels : []
currentIndex: _curCameraIndex currentIndex: _mavlinkCameraManagerCurCameraIndex
visible: _multipleCameras visible: _multipleMavlinkCameras
onActivated: _cameraManager.currentCamera = index onActivated: _mavlinkCameraManager.currentCamera = index
} }
QGCComboBox { QGCComboBox {
Layout.fillWidth: true Layout.fillWidth: true
sizeToContents: true sizeToContents: true
model: _camera ? _camera.streamLabels : [] model: _mavlinkCamera ? _mavlinkCamera.streamLabels : []
currentIndex: _curStreamIndex currentIndex: _mavlinCameraCurStreamIndex
visible: _multipleMavlinkCameraStreams visible: _multipleMavlinkCameraStreams
onActivated: _camera.currentStream = index onActivated: _mavlinkCamera.currentStream = index
} }
QGCComboBox { QGCComboBox {
Layout.fillWidth: true Layout.fillWidth: true
sizeToContents: true sizeToContents: true
model: [ qsTr("Off"), qsTr("Blend"), qsTr("Full"), qsTr("Picture In Picture") ] model: [ qsTr("Off"), qsTr("Blend"), qsTr("Full"), qsTr("Picture In Picture") ]
currentIndex: _camera ? _camera.thermalMode : -1 currentIndex: _mavlinkCamera ? _mavlinkCamera.thermalMode : -1
visible: _hasThermalVideoStream visible: _mavlinkCameraHasThermalVideoStream
onActivated: _camera.thermalMode = index onActivated: _mavlinkCamera.thermalMode = index
} }
QGCSlider { QGCSlider {
Layout.fillWidth: true Layout.fillWidth: true
maximumValue: 100 maximumValue: 100
minimumValue: 0 minimumValue: 0
value: _camera ? _camera.thermalOpacity : 0 value: _mavlinkCamera ? _mavlinkCamera.thermalOpacity : 0
updateValueWhileDragging: true updateValueWhileDragging: true
visible: _hasThermalVideoStream && _camera.thermalMode === QGCCameraControl.THERMAL_BLEND visible: _mavlinkCameraHasThermalVideoStream && _mavlinkCamera.thermalMode === QGCCameraControl.THERMAL_BLEND
onValueChanged: _camera.thermalOpacity = value onValueChanged: _mavlinkCamera.thermalOpacity = value
} }
// Mavlink Camera Protocol active settings // Mavlink Camera Protocol active settings
Repeater { Repeater {
model: _camera ? _camera.activeSettings : [] model: _mavlinkCamera ? _mavlinkCamera.activeSettings : []
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
property var _fact: _camera.getFact(modelData) property var _fact: _mavlinkCamera.getFact(modelData)
property bool _isBool: _fact.typeIsBool property bool _isBool: _fact.typeIsBool
property bool _isCombo: !_isBool && _fact.enumStrings.length > 0 property bool _isCombo: !_isBool && _fact.enumStrings.length > 0
property bool _isSlider: _fact && !isNaN(_fact.increment) property bool _isSlider: _fact && !isNaN(_fact.increment)
...@@ -409,9 +453,9 @@ Rectangle { ...@@ -409,9 +453,9 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
sizeToContents: true sizeToContents: true
model: [ qsTr("Single"), qsTr("Time Lapse") ] model: [ qsTr("Single"), qsTr("Time Lapse") ]
currentIndex: _camera ? _camera.photoMode : 0 currentIndex: _mavlinkCamera ? _mavlinkCamera.photoMode : 0
visible: _hasModes visible: _mavlinkCameraHasModes
onActivated: _camera.photoMode = index onActivated: _mavlinkCamera.photoMode = index
} }
QGCSlider { QGCSlider {
...@@ -419,27 +463,27 @@ Rectangle { ...@@ -419,27 +463,27 @@ Rectangle {
maximumValue: 60 maximumValue: 60
minimumValue: 1 minimumValue: 1
stepSize: 1 stepSize: 1
value: _camera ? _camera.photoLapse : 5 value: _mavlinkCamera ? _mavlinkCamera.photoLapse : 5
displayValue: true displayValue: true
updateValueWhileDragging: true updateValueWhileDragging: true
visible: _cameraInPhotoMode && _camera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE visible: _mavlinkCameraInPhotoMode && _mavlinkCamera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE
onValueChanged: { onValueChanged: {
if (_camera) { if (_mavlinkCamera) {
_camera.photoLapse = value _mavlinkCamera.photoLapse = value
} }
} }
} }
QGCSwitch { QGCSwitch {
checked: _videoSettings.gridLines.rawValue checked: _videoStreamSettings.gridLines.rawValue
visible: _anyVideoStreamAvailable visible: _anyVideoStreamAvailable
onClicked: _videoSettings.gridLines.rawValue = checked ? 1 : 0 onClicked: _videoStreamSettings.gridLines.rawValue = checked ? 1 : 0
} }
FactComboBox { FactComboBox {
Layout.fillWidth: true Layout.fillWidth: true
sizeToContents: true sizeToContents: true
fact: _videoSettings.videoFit fact: _videoStreamSettings.videoFit
indexModel: false indexModel: false
visible: _anyVideoStreamAvailable visible: _anyVideoStreamAvailable
} }
...@@ -447,7 +491,7 @@ Rectangle { ...@@ -447,7 +491,7 @@ Rectangle {
QGCButton { QGCButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Reset") text: qsTr("Reset")
visible: _camera visible: _mavlinkCamera
onClicked: resetPrompt.open() onClicked: resetPrompt.open()
MessageDialog { MessageDialog {
id: resetPrompt id: resetPrompt
...@@ -456,7 +500,7 @@ Rectangle { ...@@ -456,7 +500,7 @@ Rectangle {
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: StandardButton.Yes | StandardButton.No
onNo: resetPrompt.close() onNo: resetPrompt.close()
onYes: { onYes: {
_camera.resetSettings() _mavlinkCamera.resetSettings()
resetPrompt.close() resetPrompt.close()
} }
} }
...@@ -465,7 +509,7 @@ Rectangle { ...@@ -465,7 +509,7 @@ Rectangle {
QGCButton { QGCButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Format") text: qsTr("Format")
visible: _storageSupported visible: _mavlinkCameraStorageSupported
onClicked: formatPrompt.open() onClicked: formatPrompt.open()
MessageDialog { MessageDialog {
id: formatPrompt id: formatPrompt
...@@ -474,7 +518,7 @@ Rectangle { ...@@ -474,7 +518,7 @@ Rectangle {
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: StandardButton.Yes | StandardButton.No
onNo: formatPrompt.close() onNo: formatPrompt.close()
onYes: { onYes: {
_camera.formatCard() _mavlinkCamera.formatCard()
formatPrompt.close() formatPrompt.close()
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment