Skip to content

Commit

Permalink
PhotoVideoControl.qml: Fixed if bug based on odd qt qml behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jnomikos authored and DonLakeFlyer committed Nov 21, 2023
1 parent ff77e1f commit db48478
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/FlightMap/Widgets/PhotoVideoControl.qml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ Rectangle {

function toggleShooting() {
console.log("toggleShooting", _anyVideoStreamAvailable)
if (_mavlinkCamera && (_mavlinkCamera.capturesVideo || _mavlinkCamera.capturesPhotos) ) {

// This whole mavlinkCameraCaptureVideoOrPhotos stuff is to work around some strange qml boolean testing
// behavior which wasn't working correctly. This should work:
// if (_mavlinkCamera && (_mavlinkCamera.capturesVideo || _mavlinkCamera.capturesPhotos) ) {
// but it doesn't for some strange reason. Hence all the stuff below...
var mavlinkCameraCaptureVideoOrPhotos = false
if (_mavlinkCamera) {
if (_mavlinkCamera.capturesVideo || _mavlinkCamera.capturesPhotos) {
mavlinkCameraCaptureVideoOrPhotos = true
}
}

if (mavlinkCameraCaptureVideoOrPhotos) {
if(_mavlinkCameraInVideoMode) {
_mavlinkCamera.toggleVideo()
} else {
Expand Down

0 comments on commit db48478

Please sign in to comment.