Unverified Commit f6e72014 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #7676 from mavlink/noVehicleNoFullScreen

Disable full screen video if no vehicle or connection lost
parents 397c66ce 80926470
......@@ -271,6 +271,20 @@ VideoManager::uvcEnabled()
}
#endif
//-----------------------------------------------------------------------------
void
VideoManager::setfullScreen(bool f)
{
if(f) {
//-- No can do if no vehicle or connection lost
if(!_activeVehicle || _activeVehicle->connectionLost()) {
f = false;
}
}
_fullScreen = f;
emit fullScreenChanged();
}
//-----------------------------------------------------------------------------
void
VideoManager::_updateSettings()
......@@ -357,6 +371,7 @@ void
VideoManager::_setActiveVehicle(Vehicle* vehicle)
{
if(_activeVehicle) {
disconnect(_activeVehicle, &Vehicle::connectionLostChanged, this, &VideoManager::_connectionLostChanged);
if(_activeVehicle->dynamicCameras()) {
QGCCameraControl* pCamera = _activeVehicle->dynamicCameras()->currentCameraInstance();
if(pCamera) {
......@@ -367,6 +382,7 @@ VideoManager::_setActiveVehicle(Vehicle* vehicle)
}
_activeVehicle = vehicle;
if(_activeVehicle) {
connect(_activeVehicle, &Vehicle::connectionLostChanged, this, &VideoManager::_connectionLostChanged);
if(_activeVehicle->dynamicCameras()) {
connect(_activeVehicle->dynamicCameras(), &QGCCameraManager::streamChanged, this, &VideoManager::restartVideo);
QGCCameraControl* pCamera = _activeVehicle->dynamicCameras()->currentCameraInstance();
......@@ -374,11 +390,24 @@ VideoManager::_setActiveVehicle(Vehicle* vehicle)
pCamera->resumeStream();
}
}
} else {
//-- Disable full screen video if vehicle is gone
setfullScreen(false);
}
emit autoStreamConfiguredChanged();
restartVideo();
}
//----------------------------------------------------------------------------------------
void
VideoManager::_connectionLostChanged(bool connectionLost)
{
if(connectionLost) {
//-- Disable full screen video if connection is lost
setfullScreen(false);
}
}
//----------------------------------------------------------------------------------------
void
VideoManager::_aspectRatioChanged()
......
......@@ -73,7 +73,7 @@ public:
virtual bool uvcEnabled ();
#endif
virtual void setfullScreen (bool f) { _fullScreen = f; emit fullScreenChanged(); }
virtual void setfullScreen (bool f);
virtual void setIsTaisync (bool t) { _isTaisync = t; emit isTaisyncChanged(); }
// Override from QGCTool
......@@ -100,6 +100,7 @@ protected slots:
void _updateUVC ();
void _setActiveVehicle (Vehicle* vehicle);
void _aspectRatioChanged ();
void _connectionLostChanged (bool connectionLost);
protected:
void _updateSettings ();
......
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