Browse Source

Merge pull request #3983 from dogmaphobic/uvcVideo

Video Source Options
QGC4.4
Gus Grubba 9 years ago committed by GitHub
parent
commit
ac1c8f9d2e
  1. 5
      qgroundcontrol.pro
  2. 36
      src/FlightDisplay/FlightDisplayView.qml
  3. 94
      src/FlightDisplay/FlightDisplayViewController.cc
  4. 58
      src/FlightDisplay/FlightDisplayViewController.h
  5. 8
      src/FlightDisplay/FlightDisplayViewVideo.qml
  6. 171
      src/FlightDisplay/VideoManager.cc
  7. 75
      src/FlightDisplay/VideoManager.h
  8. 3
      src/QGCApplication.cc
  9. 5
      src/QGCToolbox.cc
  10. 3
      src/QGCToolbox.h
  11. 2
      src/QmlControls/QGroundControlQmlGlobal.cc
  12. 3
      src/QmlControls/QGroundControlQmlGlobal.h
  13. 4
      src/comm/MockLink.cc
  14. 30
      src/ui/preferences/GeneralSettings.qml

5
qgroundcontrol.pro

@ -79,6 +79,7 @@ QT += \
svg \ svg \
widgets \ widgets \
xml \ xml \
multimedia
!MobileBuild { !MobileBuild {
QT += \ QT += \
@ -258,7 +259,7 @@ HEADERS += \
src/comm/QGCMAVLink.h \ src/comm/QGCMAVLink.h \
src/comm/TCPLink.h \ src/comm/TCPLink.h \
src/comm/UDPLink.h \ src/comm/UDPLink.h \
src/FlightDisplay/FlightDisplayViewController.h \ src/FlightDisplay/VideoManager.h \
src/FlightMap/FlightMapSettings.h \ src/FlightMap/FlightMapSettings.h \
src/FlightMap/Widgets/ValuesWidgetController.h \ src/FlightMap/Widgets/ValuesWidgetController.h \
src/GAudioOutput.h \ src/GAudioOutput.h \
@ -420,7 +421,7 @@ SOURCES += \
src/comm/QGCMAVLink.cc \ src/comm/QGCMAVLink.cc \
src/comm/TCPLink.cc \ src/comm/TCPLink.cc \
src/comm/UDPLink.cc \ src/comm/UDPLink.cc \
src/FlightDisplay/FlightDisplayViewController.cc \ src/FlightDisplay/VideoManager.cc \
src/FlightMap/FlightMapSettings.cc \ src/FlightMap/FlightMapSettings.cc \
src/FlightMap/Widgets/ValuesWidgetController.cc \ src/FlightMap/Widgets/ValuesWidgetController.cc \
src/GAudioOutput.cc \ src/GAudioOutput.cc \

36
src/FlightDisplay/FlightDisplayView.qml

@ -14,6 +14,7 @@ import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtLocation 5.3 import QtLocation 5.3
import QtPositioning 5.2 import QtPositioning 5.2
import QtMultimedia 5.5
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.FlightDisplay 1.0 import QGroundControl.FlightDisplay 1.0
@ -33,8 +34,8 @@ QGCView {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _mainIsMap: _controller.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) : true property bool _mainIsMap: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) : true
property bool _isPipVisible: _controller.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false
property real _roll: _activeVehicle ? _activeVehicle.roll.value : _defaultRoll property real _roll: _activeVehicle ? _activeVehicle.roll.value : _defaultRoll
property real _pitch: _activeVehicle ? _activeVehicle.pitch.value : _defaultPitch property real _pitch: _activeVehicle ? _activeVehicle.pitch.value : _defaultPitch
@ -63,8 +64,6 @@ QGCView {
readonly property string _mainIsMapKey: "MainFlyWindowIsMap" readonly property string _mainIsMapKey: "MainFlyWindowIsMap"
readonly property string _PIPVisibleKey: "IsPIPVisible" readonly property string _PIPVisibleKey: "IsPIPVisible"
FlightDisplayViewController { id: _controller }
function setStates() { function setStates() {
QGroundControl.saveBoolGlobalSetting(_mainIsMapKey, _mainIsMap) QGroundControl.saveBoolGlobalSetting(_mainIsMapKey, _mainIsMap)
if(_mainIsMap) { if(_mainIsMap) {
@ -161,14 +160,14 @@ QGCView {
} }
//-- Video View //-- Video View
FlightDisplayViewVideo { Item {
id: _flightVideo id: _flightVideo
z: _mainIsMap ? _panel.z + 2 : _panel.z + 1 z: _mainIsMap ? _panel.z + 2 : _panel.z + 1
width: !_mainIsMap ? _panel.width : pipSize width: !_mainIsMap ? _panel.width : pipSize
height: !_mainIsMap ? _panel.height : pipSize * (9/16) height: !_mainIsMap ? _panel.height : pipSize * (9/16)
anchors.left: _panel.left anchors.left: _panel.left
anchors.bottom: _panel.bottom anchors.bottom: _panel.bottom
visible: _controller.hasVideo && (!_mainIsMap || _isPipVisible) visible: QGroundControl.videoManager.hasVideo && (!_mainIsMap || _isPipVisible)
states: [ states: [
State { State {
name: "pipMode" name: "pipMode"
@ -185,6 +184,29 @@ QGCView {
} }
} }
] ]
//-- UDP Video Streaming
FlightDisplayViewVideo {
anchors.fill: parent
visible: QGroundControl.videoManager.isGStreamer
}
//-- UVC Video (USB Camera or Video Device)
Rectangle {
id: noVideo
anchors.fill: parent
color: Qt.rgba(0,0,0,0.75)
visible: !QGroundControl.videoManager.isGStreamer
Camera {
id: camera
deviceId: QGroundControl.videoManager.videoSourceID
captureMode: Camera.CaptureViewfinder
}
VideoOutput {
id: viewFinder
source: camera
anchors.fill: parent
visible: !QGroundControl.videoManager.isGStreamer
}
}
} }
QGCPipable { QGCPipable {
@ -195,7 +217,7 @@ QGCView {
anchors.left: _panel.left anchors.left: _panel.left
anchors.bottom: _panel.bottom anchors.bottom: _panel.bottom
anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight
visible: _controller.hasVideo visible: QGroundControl.videoManager.hasVideo
isHidden: !_isPipVisible isHidden: !_isPipVisible
isDark: isBackgroundDark isDark: isBackgroundDark
onActivated: { onActivated: {

94
src/FlightDisplay/FlightDisplayViewController.cc

@ -1,94 +0,0 @@
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include <QQmlContext>
#include <QQmlEngine>
#include <QSettings>
#include <VideoItem.h>
#include "ScreenToolsController.h"
#include "FlightDisplayViewController.h"
const char* kMainFlightDisplayViewControllerGroup = "FlightDisplayViewController";
FlightDisplayViewController::FlightDisplayViewController(QObject *parent)
: QObject(parent)
, _videoRunning(false)
{
/*
* This is the receiving end of an UDP RTP stream. The sender can be setup with this command:
*
* gst-launch-1.0 uvch264src initial-bitrate=1000000 average-bitrate=1000000 iframe-period=1000 name=src auto-start=true src.vidsrc ! \
* video/x-h264,width=1280,height=720,framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=192.168.1.9 port=5600
*
* Where the main parameters are:
*
* uvch264src: Your h264 video source (the example above uses a Logitech C920 on an Raspberry PI 2+ or Odroid C1
* host=192.168.1.9 This is the IP address of QGC. You can use Avahi/Zeroconf to find QGC using the "_qgroundcontrol._udp" service.
*
* Advanced settings (you should probably read the gstreamer documentation before changing these):
*
* initial-bitrate=1000000 average-bitrate=1000000
* The bit rate to use. The greater, the better quality at the cost of higher bandwidth.
*
* width=1280,height=720,framerate=24/1
* The video resolution and frame rate. This depends on the camera used.
*
* iframe-period=1000
* Interval between iFrames. The greater the interval the lesser bandwidth at the cost of a longer time to recover from lost packets.
*
* Do not change anything else unless you know what you are doing. Any other change will require a matching change on the receiving end.
*
*/
_videoSurface = new VideoSurface;
_videoReceiver = new VideoReceiver(this);
_videoReceiver->setUri(QLatin1Literal("udp://0.0.0.0:5600")); // Port 5600=Solo UDP port, if you change you will break Solo video support
#if defined(QGC_GST_STREAMING)
_videoReceiver->setVideoSink(_videoSurface->videoSink());
connect(&_frameTimer, &QTimer::timeout, this, &FlightDisplayViewController::_updateTimer);
_frameTimer.start(1000);
#endif
}
FlightDisplayViewController::~FlightDisplayViewController()
{
}
#if defined(QGC_GST_STREAMING)
void FlightDisplayViewController::_updateTimer(void)
{
if(_videoRunning)
{
time_t elapsed = 0;
if(_videoSurface)
{
elapsed = time(0) - _videoSurface->lastFrame();
}
if(elapsed > 2)
{
_videoRunning = false;
_videoSurface->setLastFrame(0);
emit videoRunningChanged();
}
}
else
{
if(_videoSurface && _videoSurface->lastFrame()) {
if(!_videoRunning)
{
_videoRunning = true;
emit videoRunningChanged();
}
}
}
}
#endif

58
src/FlightDisplay/FlightDisplayViewController.h

@ -1,58 +0,0 @@
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#ifndef FlightDisplayViewController_H
#define FlightDisplayViewController_H
#include <QObject>
#include <QTimer>
#include "VideoSurface.h"
#include "VideoReceiver.h"
class FlightDisplayViewController : public QObject
{
Q_OBJECT
public:
FlightDisplayViewController(QObject* parent = NULL);
~FlightDisplayViewController();
Q_PROPERTY(bool hasVideo READ hasVideo CONSTANT)
Q_PROPERTY(VideoSurface* videoSurface MEMBER _videoSurface CONSTANT);
Q_PROPERTY(VideoReceiver* videoReceiver MEMBER _videoReceiver CONSTANT);
Q_PROPERTY(bool videoRunning READ videoRunning NOTIFY videoRunningChanged)
#if defined(QGC_GST_STREAMING)
bool hasVideo () { return true; }
#else
bool hasVideo () { return false; }
#endif
bool videoRunning() { return _videoRunning; }
signals:
void videoRunningChanged();
private:
void _updateTimer(void);
private:
VideoSurface* _videoSurface;
VideoReceiver* _videoReceiver;
bool _videoRunning;
#if defined(QGC_GST_STREAMING)
QTimer _frameTimer;
#endif
};
#endif

8
src/FlightDisplay/FlightDisplayViewVideo.qml

@ -27,7 +27,7 @@ Item {
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: !_controller.videoRunning visible: !QGroundControl.videoManager.videoRunning
QGCLabel { QGCLabel {
text: qsTr("NO VIDEO") text: qsTr("NO VIDEO")
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
@ -38,9 +38,9 @@ Item {
} }
QGCVideoBackground { QGCVideoBackground {
anchors.fill: parent anchors.fill: parent
display: _controller.videoSurface display: QGroundControl.videoManager.videoSurface
receiver: _controller.videoReceiver receiver: QGroundControl.videoManager.videoReceiver
visible: _controller.videoRunning visible: QGroundControl.videoManager.videoRunning
runVideo: true runVideo: true
/* TODO: Come up with a way to make this an option /* TODO: Come up with a way to make this an option
QGCAttitudeHUD { QGCAttitudeHUD {

171
src/FlightDisplay/VideoManager.cc

@ -0,0 +1,171 @@
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include <QQmlContext>
#include <QQmlEngine>
#include <QSettings>
#include <QCameraInfo>
#include <VideoItem.h>
#include "ScreenToolsController.h"
#include "VideoManager.h"
static const char* kVideoSourceKey = "VideoSource";
static const char* kGStreamerSource = "UDP Video Stream";
QGC_LOGGING_CATEGORY(VideoManagerLog, "VideoManagerLog")
//-----------------------------------------------------------------------------
VideoManager::VideoManager(QGCApplication* app)
: QGCTool(app)
, _videoRunning(false)
{
/*
* This is the receiving end of an UDP RTP stream. The sender can be setup with this command:
*
* gst-launch-1.0 uvch264src initial-bitrate=1000000 average-bitrate=1000000 iframe-period=1000 name=src auto-start=true src.vidsrc ! \
* video/x-h264,width=1280,height=720,framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=192.168.1.9 port=5600
*
* Where the main parameters are:
*
* uvch264src: Your h264 video source (the example above uses a Logitech C920 on an Raspberry PI 2+ or Odroid C1
* host=192.168.1.9 This is the IP address of QGC. You can use Avahi/Zeroconf to find QGC using the "_qgroundcontrol._udp" service.
*
* Advanced settings (you should probably read the gstreamer documentation before changing these):
*
* initial-bitrate=1000000 average-bitrate=1000000
* The bit rate to use. The greater, the better quality at the cost of higher bandwidth.
*
* width=1280,height=720,framerate=24/1
* The video resolution and frame rate. This depends on the camera used.
*
* iframe-period=1000
* Interval between iFrames. The greater the interval the lesser bandwidth at the cost of a longer time to recover from lost packets.
*
* Do not change anything else unless you know what you are doing. Any other change will require a matching change on the receiving end.
*
*/
_videoSurface = new VideoSurface;
_videoReceiver = new VideoReceiver(this);
_videoReceiver->setUri(QLatin1Literal("udp://0.0.0.0:5600")); // Port 5600=Solo UDP port, if you change it, you will break Solo video support
#if defined(QGC_GST_STREAMING)
_videoReceiver->setVideoSink(_videoSurface->videoSink());
connect(&_frameTimer, &QTimer::timeout, this, &VideoManager::_updateTimer);
_frameTimer.start(1000);
#endif
//-- Get saved video source
QSettings settings;
setVideoSource(settings.value(kVideoSourceKey, kGStreamerSource).toString());
}
//-----------------------------------------------------------------------------
VideoManager::~VideoManager()
{
}
//-----------------------------------------------------------------------------
void
VideoManager::setToolbox(QGCToolbox *toolbox)
{
QGCTool::setToolbox(toolbox);
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<VideoManager>("QGroundControl.VideoManager", 1, 0, "VideoManager", "Reference only");
}
//-----------------------------------------------------------------------------
bool
VideoManager::hasVideo()
{
#if defined(QGC_GST_STREAMING)
return true;
#endif
return !_videoSource.isEmpty();
}
//-----------------------------------------------------------------------------
bool
VideoManager::isGStreamer()
{
#if defined(QGC_GST_STREAMING)
return _videoSource == kGStreamerSource;
#else
return false;
#endif
}
//-----------------------------------------------------------------------------
void
VideoManager::setVideoSource(QString vSource)
{
_videoSource = vSource;
QSettings settings;
settings.setValue(kVideoSourceKey, vSource);
emit videoSourceChanged();
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
foreach (const QCameraInfo &cameraInfo, cameras) {
if(cameraInfo.description() == vSource) {
_videoSourceID = cameraInfo.deviceName();
emit videoSourceIDChanged();
qCDebug(VideoManagerLog) << "Found USB source:" << _videoSourceID << " Name:" << _videoSource;
break;
}
}
emit isGStreamerChanged();
qCDebug(VideoManagerLog) << "New Video Source:" << vSource;
}
//-----------------------------------------------------------------------------
QStringList
VideoManager::videoSourceList()
{
_videoSourceList.clear();
#if defined(QGC_GST_STREAMING)
_videoSourceList.append(kGStreamerSource);
#endif
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
foreach (const QCameraInfo &cameraInfo, cameras) {
qCDebug(VideoManagerLog) << "UVC Video source ID:" << cameraInfo.deviceName() << " Name:" << cameraInfo.description();
_videoSourceList.append(cameraInfo.description());
}
return _videoSourceList;
}
//-----------------------------------------------------------------------------
#if defined(QGC_GST_STREAMING)
void VideoManager::_updateTimer(void)
{
if(_videoRunning)
{
time_t elapsed = 0;
if(_videoSurface)
{
elapsed = time(0) - _videoSurface->lastFrame();
}
if(elapsed > 2)
{
_videoRunning = false;
_videoSurface->setLastFrame(0);
emit videoRunningChanged();
}
}
else
{
if(_videoSurface && _videoSurface->lastFrame()) {
if(!_videoRunning)
{
_videoRunning = true;
emit videoRunningChanged();
}
}
}
}
#endif

75
src/FlightDisplay/VideoManager.h

@ -0,0 +1,75 @@
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#ifndef VideoManager_H
#define VideoManager_H
#include <QObject>
#include <QTimer>
#include "QGCLoggingCategory.h"
#include "VideoSurface.h"
#include "VideoReceiver.h"
#include "QGCToolbox.h"
Q_DECLARE_LOGGING_CATEGORY(VideoManagerLog)
class VideoManager : public QGCTool
{
Q_OBJECT
public:
VideoManager (QGCApplication* app);
~VideoManager ();
Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged)
Q_PROPERTY(bool isGStreamer READ isGStreamer NOTIFY isGStreamerChanged)
Q_PROPERTY(QString videoSourceID READ videoSource NOTIFY videoSourceIDChanged)
Q_PROPERTY(QString videoSource READ videoSource WRITE setVideoSource NOTIFY videoSourceChanged)
Q_PROPERTY(QStringList videoSourceList READ videoSourceList NOTIFY videoSourceListChanged)
Q_PROPERTY(bool videoRunning READ videoRunning NOTIFY videoRunningChanged)
Q_PROPERTY(VideoSurface* videoSurface MEMBER _videoSurface CONSTANT)
Q_PROPERTY(VideoReceiver* videoReceiver MEMBER _videoReceiver CONSTANT)
bool hasVideo ();
bool isGStreamer ();
bool videoRunning () { return _videoRunning; }
QString videoSourceID () { return _videoSourceID; }
QString videoSource () { return _videoSource; }
QStringList videoSourceList ();
void setVideoSource (QString vSource);
// Override from QGCTool
void setToolbox (QGCToolbox *toolbox);
signals:
void hasVideoChanged ();
void videoRunningChanged ();
void videoSourceChanged ();
void videoSourceListChanged ();
void isGStreamerChanged ();
void videoSourceIDChanged ();
private:
void _updateTimer(void);
private:
VideoSurface* _videoSurface;
VideoReceiver* _videoReceiver;
bool _videoRunning;
#if defined(QGC_GST_STREAMING)
QTimer _frameTimer;
#endif
QString _videoSource;
QString _videoSourceID;
QStringList _videoSourceList;
};
#endif

3
src/QGCApplication.cc

@ -82,7 +82,7 @@
#include "CoordinateVector.h" #include "CoordinateVector.h"
#include "MainToolBarController.h" #include "MainToolBarController.h"
#include "MissionController.h" #include "MissionController.h"
#include "FlightDisplayViewController.h" #include "VideoManager.h"
#include "VideoSurface.h" #include "VideoSurface.h"
#include "VideoReceiver.h" #include "VideoReceiver.h"
#include "LogDownloadController.h" #include "LogDownloadController.h"
@ -393,7 +393,6 @@ void QGCApplication::_initCommon(void)
qmlRegisterType<ScreenToolsController> ("QGroundControl.Controllers", 1, 0, "ScreenToolsController"); qmlRegisterType<ScreenToolsController> ("QGroundControl.Controllers", 1, 0, "ScreenToolsController");
qmlRegisterType<MainToolBarController> ("QGroundControl.Controllers", 1, 0, "MainToolBarController"); qmlRegisterType<MainToolBarController> ("QGroundControl.Controllers", 1, 0, "MainToolBarController");
qmlRegisterType<MissionController> ("QGroundControl.Controllers", 1, 0, "MissionController"); qmlRegisterType<MissionController> ("QGroundControl.Controllers", 1, 0, "MissionController");
qmlRegisterType<FlightDisplayViewController> ("QGroundControl.Controllers", 1, 0, "FlightDisplayViewController");
qmlRegisterType<ValuesWidgetController> ("QGroundControl.Controllers", 1, 0, "ValuesWidgetController"); qmlRegisterType<ValuesWidgetController> ("QGroundControl.Controllers", 1, 0, "ValuesWidgetController");
qmlRegisterType<QGCMobileFileDialogController> ("QGroundControl.Controllers", 1, 0, "QGCMobileFileDialogController"); qmlRegisterType<QGCMobileFileDialogController> ("QGroundControl.Controllers", 1, 0, "QGCMobileFileDialogController");
qmlRegisterType<RCChannelMonitorController> ("QGroundControl.Controllers", 1, 0, "RCChannelMonitorController"); qmlRegisterType<RCChannelMonitorController> ("QGroundControl.Controllers", 1, 0, "RCChannelMonitorController");

5
src/QGCToolbox.cc

@ -27,6 +27,7 @@
#include "QGCMapEngineManager.h" #include "QGCMapEngineManager.h"
#include "FollowMe.h" #include "FollowMe.h"
#include "PositionManager.h" #include "PositionManager.h"
#include "VideoManager.h"
QGCToolbox::QGCToolbox(QGCApplication* app) QGCToolbox::QGCToolbox(QGCApplication* app)
: _audioOutput(NULL) : _audioOutput(NULL)
@ -48,6 +49,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
, _uasMessageHandler(NULL) , _uasMessageHandler(NULL)
, _followMe(NULL) , _followMe(NULL)
, _qgcPositionManager(NULL) , _qgcPositionManager(NULL)
, _videoManager(NULL)
{ {
_audioOutput = new GAudioOutput(app); _audioOutput = new GAudioOutput(app);
_autopilotPluginManager = new AutoPilotPluginManager(app); _autopilotPluginManager = new AutoPilotPluginManager(app);
@ -68,6 +70,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
_uasMessageHandler = new UASMessageHandler(app); _uasMessageHandler = new UASMessageHandler(app);
_qgcPositionManager = new QGCPositionManager(app); _qgcPositionManager = new QGCPositionManager(app);
_followMe = new FollowMe(app); _followMe = new FollowMe(app);
_videoManager = new VideoManager(app);
_audioOutput->setToolbox(this); _audioOutput->setToolbox(this);
_autopilotPluginManager->setToolbox(this); _autopilotPluginManager->setToolbox(this);
@ -88,10 +91,12 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
_uasMessageHandler->setToolbox(this); _uasMessageHandler->setToolbox(this);
_followMe->setToolbox(this); _followMe->setToolbox(this);
_qgcPositionManager->setToolbox(this); _qgcPositionManager->setToolbox(this);
_videoManager->setToolbox(this);
} }
QGCToolbox::~QGCToolbox() QGCToolbox::~QGCToolbox()
{ {
delete _videoManager;
delete _audioOutput; delete _audioOutput;
delete _autopilotPluginManager; delete _autopilotPluginManager;
delete _factSystem; delete _factSystem;

3
src/QGCToolbox.h

@ -31,6 +31,7 @@ class QGCApplication;
class QGCImageProvider; class QGCImageProvider;
class UASMessageHandler; class UASMessageHandler;
class QGCPositionManager; class QGCPositionManager;
class VideoManager;
/// This is used to manage all of our top level services/tools /// This is used to manage all of our top level services/tools
class QGCToolbox { class QGCToolbox {
@ -54,6 +55,7 @@ public:
UASMessageHandler* uasMessageHandler(void) { return _uasMessageHandler; } UASMessageHandler* uasMessageHandler(void) { return _uasMessageHandler; }
FollowMe* followMe(void) { return _followMe; } FollowMe* followMe(void) { return _followMe; }
QGCPositionManager* qgcPositionManager(void) { return _qgcPositionManager; } QGCPositionManager* qgcPositionManager(void) { return _qgcPositionManager; }
VideoManager* videoManager(void) { return _videoManager; }
#ifndef __mobile__ #ifndef __mobile__
GPSManager* gpsManager(void) { return _gpsManager; } GPSManager* gpsManager(void) { return _gpsManager; }
#endif #endif
@ -78,6 +80,7 @@ private:
UASMessageHandler* _uasMessageHandler; UASMessageHandler* _uasMessageHandler;
FollowMe* _followMe; FollowMe* _followMe;
QGCPositionManager* _qgcPositionManager; QGCPositionManager* _qgcPositionManager;
VideoManager* _videoManager;
}; };
/// This is the base class for all tools /// This is the base class for all tools

2
src/QmlControls/QGroundControlQmlGlobal.cc

@ -46,6 +46,7 @@ QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app)
, _mapEngineManager(NULL) , _mapEngineManager(NULL)
, _qgcPositionManager(NULL) , _qgcPositionManager(NULL)
, _missionCommandTree(NULL) , _missionCommandTree(NULL)
, _videoManager(NULL)
, _virtualTabletJoystick(false) , _virtualTabletJoystick(false)
, _baseFontPointSize(0.0) , _baseFontPointSize(0.0)
{ {
@ -73,6 +74,7 @@ void QGroundControlQmlGlobal::setToolbox(QGCToolbox* toolbox)
_mapEngineManager = toolbox->mapEngineManager(); _mapEngineManager = toolbox->mapEngineManager();
_qgcPositionManager = toolbox->qgcPositionManager(); _qgcPositionManager = toolbox->qgcPositionManager();
_missionCommandTree = toolbox->missionCommandTree(); _missionCommandTree = toolbox->missionCommandTree();
_videoManager = toolbox->videoManager();
} }

3
src/QmlControls/QGroundControlQmlGlobal.h

@ -71,6 +71,7 @@ public:
Q_PROPERTY(QGCMapEngineManager* mapEngineManager READ mapEngineManager CONSTANT) Q_PROPERTY(QGCMapEngineManager* mapEngineManager READ mapEngineManager CONSTANT)
Q_PROPERTY(QGCPositionManager* qgcPositionManger READ qgcPositionManger CONSTANT) Q_PROPERTY(QGCPositionManager* qgcPositionManger READ qgcPositionManger CONSTANT)
Q_PROPERTY(MissionCommandTree* missionCommandTree READ missionCommandTree CONSTANT) Q_PROPERTY(MissionCommandTree* missionCommandTree READ missionCommandTree CONSTANT)
Q_PROPERTY(VideoManager* videoManager READ videoManager CONSTANT)
Q_PROPERTY(qreal zOrderTopMost READ zOrderTopMost CONSTANT) ///< z order for top most items, toolbar, main window sub view Q_PROPERTY(qreal zOrderTopMost READ zOrderTopMost CONSTANT) ///< z order for top most items, toolbar, main window sub view
Q_PROPERTY(qreal zOrderWidgets READ zOrderWidgets CONSTANT) ///< z order value to widgets, for example: zoom controls, hud widgetss Q_PROPERTY(qreal zOrderWidgets READ zOrderWidgets CONSTANT) ///< z order value to widgets, for example: zoom controls, hud widgetss
@ -165,6 +166,7 @@ public:
QGCMapEngineManager* mapEngineManager () { return _mapEngineManager; } QGCMapEngineManager* mapEngineManager () { return _mapEngineManager; }
QGCPositionManager* qgcPositionManger () { return _qgcPositionManager; } QGCPositionManager* qgcPositionManger () { return _qgcPositionManager; }
MissionCommandTree* missionCommandTree () { return _missionCommandTree; } MissionCommandTree* missionCommandTree () { return _missionCommandTree; }
VideoManager* videoManager () { return _videoManager; }
qreal zOrderTopMost () { return 1000; } qreal zOrderTopMost () { return 1000; }
qreal zOrderWidgets () { return 100; } qreal zOrderWidgets () { return 100; }
@ -234,6 +236,7 @@ private:
QGCMapEngineManager* _mapEngineManager; QGCMapEngineManager* _mapEngineManager;
QGCPositionManager* _qgcPositionManager; QGCPositionManager* _qgcPositionManager;
MissionCommandTree* _missionCommandTree; MissionCommandTree* _missionCommandTree;
VideoManager* _videoManager;
bool _virtualTabletJoystick; bool _virtualTabletJoystick;
qreal _baseFontPointSize; qreal _baseFontPointSize;

4
src/comm/MockLink.cc

@ -11,7 +11,9 @@
#include "MockLink.h" #include "MockLink.h"
#include "QGCLoggingCategory.h" #include "QGCLoggingCategory.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#ifndef __mobile__
#include "UnitTest.h" #include "UnitTest.h"
#endif
#include <QTimer> #include <QTimer>
#include <QDebug> #include <QDebug>
@ -1142,7 +1144,9 @@ void MockLink::_handleLogRequestData(const mavlink_message_t& msg)
mavlink_msg_log_request_data_decode(&msg, &request); mavlink_msg_log_request_data_decode(&msg, &request);
if (_logDownloadFilename.isEmpty()) { if (_logDownloadFilename.isEmpty()) {
#ifndef __mobile__
_logDownloadFilename = UnitTest::createRandomFile(_logDownloadFileSize); _logDownloadFilename = UnitTest::createRandomFile(_logDownloadFileSize);
#endif
} }
if (request.id != 0) { if (request.id != 0) {

30
src/ui/preferences/GeneralSettings.qml

@ -12,6 +12,7 @@ import QtQuick 2.5
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import QtMultimedia 5.5
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.FactSystem 1.0 import QGroundControl.FactSystem 1.0
@ -20,6 +21,7 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0 import QGroundControl.MultiVehicleManager 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.Controllers 1.0
QGCView { QGCView {
id: qgcView id: qgcView
@ -29,7 +31,7 @@ QGCView {
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
property Fact _percentRemainingAnnounce: QGroundControl.batteryPercentRemainingAnnounce property Fact _percentRemainingAnnounce: QGroundControl.batteryPercentRemainingAnnounce
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 15 property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 20
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
@ -278,6 +280,32 @@ QGCView {
} }
//----------------------------------------------------------------- //-----------------------------------------------------------------
//-- Video Source
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
anchors.baseline: videoSource.baseline
text: qsTr("Video Source:")
}
QGCComboBox {
id: videoSource
width: _editFieldWidth
model: QGroundControl.videoManager.videoSourceList
Component.onCompleted: {
var index = videoSource.find(QGroundControl.videoManager.videoSource)
if (index >= 0) {
videoSource.currentIndex = index
}
}
onActivated: {
if (index != -1) {
currentIndex = index
QGroundControl.videoManager.videoSource = model[index]
}
}
}
}
//-----------------------------------------------------------------
//-- Map Providers //-- Map Providers
Row { Row {

Loading…
Cancel
Save