diff --git a/src/FlightDisplay/VideoManager.cc b/src/FlightDisplay/VideoManager.cc index 09a7c3216f7f9c67282fb9f1f8789e6159317484..e2cf39875c77b7f110c09279be3a07d3c5f223ba 100644 --- a/src/FlightDisplay/VideoManager.cc +++ b/src/FlightDisplay/VideoManager.cc @@ -25,19 +25,7 @@ #include "QGCToolbox.h" #include "QGCCorePlugin.h" #include "QGCOptions.h" - -static const char* kVideoSourceKey = "VideoSource"; -static const char* kVideoUDPPortKey = "VideoUDPPort"; -static const char* kVideoRTSPUrlKey = "VideoRTSPUrl"; -static const char* kNoVideo = "No Video Available"; - -#if defined(QGC_GST_STREAMING) -#if defined(QGC_ENABLE_VIDEORECORDING) -static const char* kVideoSavePathKey= "VideoSavePath"; -#endif -static const char* kUDPStream = "UDP Video Stream"; -static const char* kRTSPStream = "RTSP Video Stream"; -#endif +#include "Settings/SettingsManager.h" QGC_LOGGING_CATEGORY(VideoManagerLog, "VideoManagerLog") @@ -47,8 +35,8 @@ VideoManager::VideoManager(QGCApplication* app) , _videoSurface(NULL) , _videoReceiver(NULL) , _videoRunning(false) - , _udpPort(5600) //-- Defalut Port 5600 == Solo UDP Port , _init(false) + , _videoSettings(NULL) { } @@ -65,31 +53,36 @@ VideoManager::setToolbox(QGCToolbox *toolbox) QGCTool::setToolbox(toolbox); QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); qmlRegisterUncreatableType("QGroundControl.VideoManager", 1, 0, "VideoManager", "Reference only"); - //-- Get saved settings + + _videoSettings = toolbox->settingsManager()->videoSettings(); + QString videoSource = _videoSettings->videoSource()->rawValue().toString(); + #if defined(QGC_GST_STREAMING) - QSettings settings; -#if defined(NO_UDP_VIDEO) - setVideoSource(settings.value(kVideoSourceKey, kRTSPStream).toString()); -#else - setVideoSource(settings.value(kVideoSourceKey, kUDPStream).toString()); -#endif - //-- Check if core plugin defines its own video requirements - if(qgcApp()->toolbox()->corePlugin()->options()->definesVideo()) { - if(qgcApp()->toolbox()->corePlugin()->options()->videoUDPPort()) { - setUdpPort(qgcApp()->toolbox()->corePlugin()->options()->videoUDPPort()); - setVideoSource(kUDPStream); - } else { - setVideoSource(kRTSPStream); - setRtspURL(qgcApp()->toolbox()->corePlugin()->options()->videoRSTPUrl()); - } - } else { - setUdpPort(settings.value(kVideoUDPPortKey, 5600).toUInt()); - setRtspURL(settings.value(kVideoRTSPUrlKey, "rtsp://192.168.42.1:554/live").toString()); //-- Example RTSP URL - } -#if defined(QGC_ENABLE_VIDEORECORDING) - setVideoSavePath(settings.value(kVideoSavePathKey, QDir::homePath()).toString()); +#ifndef QGC_DISABLE_UVC + // If we are using a UVC camera setup the device name + QList cameras = QCameraInfo::availableCameras(); + foreach (const QCameraInfo &cameraInfo, cameras) { + if(cameraInfo.description() == videoSource) { + _videoSourceID = cameraInfo.deviceName(); + emit videoSourceIDChanged(); + qCDebug(VideoManagerLog) << "Found USB source:" << _videoSourceID << " Name:" << videoSource; + break; + } + } #endif + + emit isGStreamerChanged(); + qCDebug(VideoManagerLog) << "New Video Source:" << videoSource; + + if(_videoReceiver) { + if(isGStreamer()) { + _videoReceiver->start(); + } else { + _videoReceiver->stop(); + } + } #endif + _init = true; #if defined(QGC_GST_STREAMING) _updateVideo(); @@ -105,7 +98,8 @@ VideoManager::hasVideo() #if defined(QGC_GST_STREAMING) return true; #endif - return !_videoSource.isEmpty(); + QString videoSource = _videoSettings->videoSource()->rawValue().toString(); + return !videoSource.isEmpty() && videoSource != VideoSettings::videoSourceNoVideo; } //----------------------------------------------------------------------------- @@ -113,7 +107,8 @@ bool VideoManager::isGStreamer() { #if defined(QGC_GST_STREAMING) - return _videoSource == kUDPStream || _videoSource == kRTSPStream; + QString videoSource = _videoSettings->videoSource()->rawValue().toString(); + return videoSource == VideoSettings::videoSourceUDP || videoSource == VideoSettings::videoSourceRTSP; #else return false; #endif @@ -128,118 +123,6 @@ VideoManager::uvcEnabled() } #endif -//----------------------------------------------------------------------------- -void -VideoManager::setVideoSource(QString vSource) -{ - if(vSource == kNoVideo) - return; - _videoSource = vSource; - QSettings settings; - settings.setValue(kVideoSourceKey, vSource); - emit videoSourceChanged(); -#ifndef QGC_DISABLE_UVC - QList 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; - } - } -#endif - emit isGStreamerChanged(); - qCDebug(VideoManagerLog) << "New Video Source:" << vSource; - /* - * Not working. Requires restart for now. (Undef KRTSP/kUDP above when enabling this) - if(isGStreamer()) - _updateVideo(); - */ - if(_videoReceiver) { - if(isGStreamer()) { - _videoReceiver->start(); - } else { - _videoReceiver->stop(); - } - } -} - -//----------------------------------------------------------------------------- -void -VideoManager::setUdpPort(quint16 port) -{ - _udpPort = port; - QSettings settings; - settings.setValue(kVideoUDPPortKey, port); - emit udpPortChanged(); - /* - * Not working. Requires restart for now. (Undef KRTSP/kUDP above when enabling this) - if(_videoSource == kUDPStream) - _updateVideo(); - */ -} - -//----------------------------------------------------------------------------- -void -VideoManager::setRtspURL(QString url) -{ - _rtspURL = url; - QSettings settings; - settings.setValue(kVideoRTSPUrlKey, url); - emit rtspURLChanged(); - /* - * Not working. Requires restart for now. (Undef KRTSP/kUDP above when enabling this) - if(_videoSource == kRTSPStream) - _updateVideo(); - */ -} - -void -VideoManager::setVideoSavePathByUrl(QUrl url) { -#if defined(QGC_ENABLE_VIDEORECORDING) - setVideoSavePath(url.toLocalFile()); -#else - Q_UNUSED(url); -#endif -} - -void -VideoManager::setVideoSavePath(QString path) -{ -#if defined(QGC_ENABLE_VIDEORECORDING) - _videoSavePath = path; - QSettings settings; - settings.setValue(kVideoSavePathKey, path); - if(_videoReceiver) - _videoReceiver->setVideoSavePath(_videoSavePath); - emit videoSavePathChanged(); -#else - Q_UNUSED(path); -#endif -} - -//----------------------------------------------------------------------------- -QStringList -VideoManager::videoSourceList() -{ - _videoSourceList.clear(); -#if defined(QGC_GST_STREAMING) - _videoSourceList.append(kUDPStream); - _videoSourceList.append(kRTSPStream); -#endif -#ifndef QGC_DISABLE_UVC - QList cameras = QCameraInfo::availableCameras(); - foreach (const QCameraInfo &cameraInfo, cameras) { - qCDebug(VideoManagerLog) << "UVC Video source ID:" << cameraInfo.deviceName() << " Name:" << cameraInfo.description(); - _videoSourceList.append(cameraInfo.description()); - } -#endif - if(_videoSourceList.count() == 0) - _videoSourceList.append(kNoVideo); - return _videoSourceList; -} - //----------------------------------------------------------------------------- void VideoManager::_updateTimer() { @@ -292,13 +175,11 @@ void VideoManager::_updateVideo() _videoReceiver = new VideoReceiver(this); #if defined(QGC_GST_STREAMING) _videoReceiver->setVideoSink(_videoSurface->videoSink()); - if(_videoSource == kUDPStream) - _videoReceiver->setUri(QStringLiteral("udp://0.0.0.0:%1").arg(_udpPort)); + QString videoSource = _videoSettings->videoSource()->rawValue().toString(); + if (_videoSettings->videoSource()->rawValue().toString() == VideoSettings::videoSourceUDP) + _videoReceiver->setUri(QStringLiteral("udp://0.0.0.0:%1").arg(_videoSettings->udpPort()->rawValue().toInt())); else - _videoReceiver->setUri(_rtspURL); -#if defined(QGC_ENABLE_VIDEORECORDING) - _videoReceiver->setVideoSavePath(_videoSavePath); -#endif + _videoReceiver->setUri(_videoSettings->rtspUrl()->rawValue().toString()); #endif _videoReceiver->start(); } diff --git a/src/FlightDisplay/VideoManager.h b/src/FlightDisplay/VideoManager.h index 912e577157b910c4a46d45b0b5fbf562bfb72fe5..f96f1acb09731a2bfe92525d0764cb77d8a0ebc4 100644 --- a/src/FlightDisplay/VideoManager.h +++ b/src/FlightDisplay/VideoManager.h @@ -22,6 +22,8 @@ Q_DECLARE_LOGGING_CATEGORY(VideoManagerLog) +class VideoSettings; + class VideoManager : public QGCTool { Q_OBJECT @@ -33,28 +35,16 @@ public: Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged) Q_PROPERTY(bool isGStreamer READ isGStreamer NOTIFY isGStreamerChanged) Q_PROPERTY(QString videoSourceID READ videoSourceID 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(quint16 udpPort READ udpPort WRITE setUdpPort NOTIFY udpPortChanged) - Q_PROPERTY(QString rtspURL READ rtspURL WRITE setRtspURL NOTIFY rtspURLChanged) - Q_PROPERTY(QString videoSavePath READ videoSavePath NOTIFY videoSavePathChanged) Q_PROPERTY(bool uvcEnabled READ uvcEnabled CONSTANT) Q_PROPERTY(VideoSurface* videoSurface MEMBER _videoSurface CONSTANT) Q_PROPERTY(VideoReceiver* videoReceiver MEMBER _videoReceiver CONSTANT) Q_PROPERTY(bool recordingEnabled READ recordingEnabled CONSTANT) - Q_INVOKABLE void setVideoSavePathByUrl (QUrl url); - bool hasVideo (); bool isGStreamer (); bool videoRunning () { return _videoRunning; } QString videoSourceID () { return _videoSourceID; } - QString videoSource () { return _videoSource; } - QStringList videoSourceList (); - quint16 udpPort () { return _udpPort; } - QString rtspURL () { return _rtspURL; } - QString videoSavePath () { return _videoSavePath; } #if defined(QGC_DISABLE_UVC) bool uvcEnabled () { return false; } @@ -68,43 +58,29 @@ public: bool recordingEnabled () { return false; } #endif - void setVideoSource (QString vSource); - void setUdpPort (quint16 port); - void setRtspURL (QString url); - void setVideoSavePath (QString path); - // Override from QGCTool void setToolbox (QGCToolbox *toolbox); signals: void hasVideoChanged (); void videoRunningChanged (); - void videoSourceChanged (); - void videoSourceListChanged (); void isGStreamerChanged (); void videoSourceIDChanged (); - void udpPortChanged (); - void rtspURLChanged (); - void videoSavePathChanged (); private: void _updateTimer (); void _updateVideo (); private: - VideoSurface* _videoSurface; - VideoReceiver* _videoReceiver; - bool _videoRunning; + VideoSurface* _videoSurface; + VideoReceiver* _videoReceiver; + bool _videoRunning; #if defined(QGC_GST_STREAMING) - QTimer _frameTimer; + QTimer _frameTimer; #endif - QString _videoSource; - QString _videoSourceID; - QStringList _videoSourceList; - quint16 _udpPort; - QString _rtspURL; - QString _videoSavePath; - bool _init; + QString _videoSourceID; + bool _init; + VideoSettings* _videoSettings; }; #endif diff --git a/src/Settings/SettingsGroup.video.json b/src/Settings/SettingsGroup.video.json deleted file mode 100644 index 0d4f101c7a37a4c875e6999bee1a287fdb733380..0000000000000000000000000000000000000000 --- a/src/Settings/SettingsGroup.video.json +++ /dev/null @@ -1,2 +0,0 @@ -[ -] diff --git a/src/Settings/Video.SettingsGroup.json b/src/Settings/Video.SettingsGroup.json new file mode 100644 index 0000000000000000000000000000000000000000..c9835ee0567129b141d8c071267a2420b93944e7 --- /dev/null +++ b/src/Settings/Video.SettingsGroup.json @@ -0,0 +1,31 @@ +[ +{ + "name": "VideoSource", + "shortDescription": "Video source", + "longDescription": "Source for video. UDP, RTSP and UVC Cameras may be supported supported depending on Vehicle and QGroundControl version.", + "type": "string", + "defaultValue": "" +}, +{ + "name": "VideoUDPPort", + "shortDescription": "Video UDP Port", + "longDescription": "UDP port to bind to for video stream.", + "type": "uint16", + "min": 1025, + "defaultValue": 5600 +}, +{ + "name": "VideoRTSPUrl", + "shortDescription": "Video RTSP Url", + "longDescription": "RTSP url address and port to bind to for video stream. Example: rtsp://192.168.42.1:554/live", + "type": "string", + "defaultValue": "" +}, +{ + "name": "VideoSavePath", + "shortDescription": "Video save directory", + "longDescription": "Directory to save videos to.", + "type": "string", + "defaultValue": "" +} +] diff --git a/src/Settings/VideoSettings.cc b/src/Settings/VideoSettings.cc index cd0228e57ce2f9688092af713226e74b8d203786..ca2a9edbe69486df8aea9f88ed016296a24425cf 100644 --- a/src/Settings/VideoSettings.cc +++ b/src/Settings/VideoSettings.cc @@ -11,12 +11,93 @@ #include #include +#include +#include -const char* VideoSettings::videoSettingsGroupName = "video"; +const char* VideoSettings::videoSettingsGroupName = "Video"; + +const char* VideoSettings::videoSourceName = "VideoSource"; +const char* VideoSettings::udpPortName = "VideoUDPPort"; +const char* VideoSettings::rtspUrlName = "VideoRTSPUrl"; +const char* VideoSettings::videoSavePathName = "VideoSavePath"; + +const char* VideoSettings::videoSourceNoVideo = "No Video Available"; +const char* VideoSettings::videoSourceUDP = "UDP Video Stream"; +const char* VideoSettings::videoSourceRTSP = "RTSP Video Stream"; VideoSettings::VideoSettings(QObject* parent) : SettingsGroup(videoSettingsGroupName, QString() /* root settings group */, parent) + , _videoSourceFact(NULL) + , _udpPortFact(NULL) + , _rtspUrlFact(NULL) + , _videoSavePathFact(NULL) { QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); qmlRegisterUncreatableType("QGroundControl.SettingsManager", 1, 0, "VideoSettings", "Reference only"); + + // Setup enum values for videoSource settings into meta data + QStringList videoSourceList; +#ifdef QGC_GST_STREAMING +#ifndef NO_UDP_VIDEO + videoSourceList.append(videoSourceUDP); +#endif + videoSourceList.append(videoSourceRTSP); +#endif +#ifndef QGC_DISABLE_UVC + QList cameras = QCameraInfo::availableCameras(); + foreach (const QCameraInfo &cameraInfo, cameras) { + videoSourceList.append(cameraInfo.description()); + } +#endif + if (videoSourceList.count() == 0) { + videoSourceList.append(videoSourceNoVideo); + } + QVariantList videoSourceVarList; + foreach (const QString& videoSource, videoSourceList) { + videoSourceVarList.append(QVariant::fromValue(videoSource)); + } + _nameToMetaDataMap[videoSourceName]->setEnumInfo(videoSourceList, videoSourceVarList); + + // Set default value for videoSource +#if defined(NO_UDP_VIDEO) + _nameToMetaDataMap[videoSourceName]->setRawDefaultValue(videoSourceRTSP); +#else + _nameToMetaDataMap[videoSourceName]->setRawDefaultValue(videoSourceUDP); +#endif +} + +Fact* VideoSettings::videoSource(void) +{ + if (!_videoSourceFact) { + _videoSourceFact = _createSettingsFact(videoSourceName); + } + + return _videoSourceFact; +} + +Fact* VideoSettings::udpPort(void) +{ + if (!_udpPortFact) { + _udpPortFact = _createSettingsFact(udpPortName); + } + + return _udpPortFact; +} + +Fact* VideoSettings::rtspUrl(void) +{ + if (!_rtspUrlFact) { + _rtspUrlFact = _createSettingsFact(rtspUrlName); + } + + return _rtspUrlFact; +} + +Fact* VideoSettings::videoSavePath(void) +{ + if (!_videoSavePathFact) { + _videoSavePathFact = _createSettingsFact(videoSavePathName); + } + + return _videoSavePathFact; } diff --git a/src/Settings/VideoSettings.h b/src/Settings/VideoSettings.h index 04bfc6bf82f310b3cc9dcf74e40b5949a1e0d3f8..df3821720d0916bf0d3270d338e0b069f91a9e65 100644 --- a/src/Settings/VideoSettings.h +++ b/src/Settings/VideoSettings.h @@ -19,9 +19,32 @@ class VideoSettings : public SettingsGroup public: VideoSettings(QObject* parent = NULL); + Q_PROPERTY(Fact* videoSource READ videoSource CONSTANT) + Q_PROPERTY(Fact* udpPort READ udpPort CONSTANT) + Q_PROPERTY(Fact* rtspUrl READ rtspUrl CONSTANT) + Q_PROPERTY(Fact* videoSavePath READ videoSavePath CONSTANT) + + Fact* videoSource (void); + Fact* udpPort (void); + Fact* rtspUrl (void); + Fact* videoSavePath (void); + static const char* videoSettingsGroupName; + static const char* videoSourceName; + static const char* udpPortName; + static const char* rtspUrlName; + static const char* videoSavePathName; + + static const char* videoSourceNoVideo; + static const char* videoSourceUDP; + static const char* videoSourceRTSP; + private: + SettingsFact* _videoSourceFact; + SettingsFact* _udpPortFact; + SettingsFact* _rtspUrlFact; + SettingsFact* _videoSavePathFact; }; #endif diff --git a/src/VideoStreaming/VideoReceiver.cc b/src/VideoStreaming/VideoReceiver.cc index 0a58ff8d02a2743562332c3230dd69a92405f9d3..383f92b6664f39e68010a4baa8c04229629bdfff 100644 --- a/src/VideoStreaming/VideoReceiver.cc +++ b/src/VideoStreaming/VideoReceiver.cc @@ -15,6 +15,9 @@ */ #include "VideoReceiver.h" +#include "SettingsManager.h" +#include "QGCApplication.h" + #include #include #include @@ -348,16 +351,6 @@ void VideoReceiver::setUri(const QString & uri) _uri = uri; } -void VideoReceiver::setVideoSavePath(const QString& path) -{ -#if defined(QGC_ENABLE_VIDEORECORDING) - _path = path; - qCDebug(VideoReceiverLog) << "New Path:" << _path; -#else - Q_UNUSED(path); -#endif -} - #if defined(QGC_GST_STREAMING) void VideoReceiver::_shutdownPipeline() { if(!_pipeline) { @@ -467,8 +460,9 @@ void VideoReceiver::startRecording(void) return; } - if(_path.isEmpty()) { - qWarning() << "VideoReceiver::startRecording Empty Path!"; + QString savePath = qgcApp()->toolbox()->settingsManager()->videoSettings()->videoSavePath()->rawValue().toString(); + if(savePath.isEmpty()) { + qgcApp()->showMessage("Unabled to record video. Video save path must be specified in Settings."); return; } @@ -485,7 +479,7 @@ void VideoReceiver::startRecording(void) } QString videoFile; - videoFile = _path + "/QGC-" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss") + ".mkv"; + videoFile = savePath + "/QGC-" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss") + ".mkv"; g_object_set(G_OBJECT(_sink->filesink), "location", qPrintable(videoFile), NULL); qCDebug(VideoReceiverLog) << "New video file:" << videoFile; diff --git a/src/VideoStreaming/VideoReceiver.h b/src/VideoStreaming/VideoReceiver.h index 9ec600fedb3296ad41da2eecc47c097c42f28753..2c294cf2444cb10b348d885a9ad11ed9af2cf6c4 100644 --- a/src/VideoStreaming/VideoReceiver.h +++ b/src/VideoStreaming/VideoReceiver.h @@ -62,7 +62,6 @@ public slots: void start (); void stop (); void setUri (const QString& uri); - void setVideoSavePath (const QString& path); void stopRecording (); void startRecording (); @@ -105,7 +104,6 @@ private: #endif QString _uri; - QString _path; #if defined(QGC_GST_STREAMING) GstElement* _pipeline; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 94f1968214c991c25263628ed31e02794e821f3b..a83ceb588b5c6c1b54113e88fd8d026e0aaf82b3 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -453,84 +453,68 @@ QGCView { anchors.margins: ScreenTools.defaultFontPixelWidth anchors.horizontalCenter: parent.horizontalCenter visible: QGroundControl.settingsManager.videoSettings.visible + Column { id: videoCol spacing: ScreenTools.defaultFontPixelWidth anchors.centerIn: parent + + Row { spacing: ScreenTools.defaultFontPixelWidth + visible: QGroundControl.settingsManager.videoSettings.videoSource.visible QGCLabel { anchors.baseline: videoSource.baseline text: qsTr("Video Source:") width: _labelWidth } - 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] - } - } + FactComboBox { + id: videoSource + width: _editFieldWidth + indexModel: false + fact: QGroundControl.settingsManager.videoSettings.videoSource } } Row { spacing: ScreenTools.defaultFontPixelWidth - visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 0 + visible: QGroundControl.settingsManager.videoSettings.udpPort.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 0 QGCLabel { anchors.baseline: udpField.baseline text: qsTr("UDP Port:") width: _labelWidth } - QGCTextField { + FactTextField { id: udpField width: _editFieldWidth - text: QGroundControl.videoManager.udpPort - validator: IntValidator {bottom: 1024; top: 65535;} - inputMethodHints: Qt.ImhDigitsOnly - onEditingFinished: { - QGroundControl.videoManager.udpPort = parseInt(text) - } + fact: QGroundControl.settingsManager.videoSettings.udpPort } } Row { spacing: ScreenTools.defaultFontPixelWidth - visible: QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 1 + visible: QGroundControl.settingsManager.videoSettings.rtspUrl.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 1 QGCLabel { anchors.baseline: rtspField.baseline text: qsTr("RTSP URL:") width: _labelWidth } - QGCTextField { + FactTextField { id: rtspField width: _editFieldWidth - text: QGroundControl.videoManager.rtspURL - onEditingFinished: { - QGroundControl.videoManager.rtspURL = text - } + fact: QGroundControl.settingsManager.videoSettings.rtspUrl } } Row { spacing: ScreenTools.defaultFontPixelWidth - visible: QGroundControl.videoManager.isGStreamer && QGroundControl.videoManager.recordingEnabled + visible: QGroundControl.settingsManager.videoSettings.videoSavePath.visible && QGroundControl.videoManager.isGStreamer && QGroundControl.videoManager.recordingEnabled QGCLabel { anchors.baseline: pathField.baseline text: qsTr("Save Path:") width: _labelWidth } - QGCTextField { + FactTextField { id: pathField width: _editFieldWidth - readOnly: true - text: QGroundControl.videoManager.videoSavePath + fact: QGroundControl.settingsManager.videoSettings.videoSavePath } QGCButton { text: "Browse" @@ -541,13 +525,12 @@ QGCView { title: "Choose a location to save video files." folder: shortcuts.home selectFolder: true - onAccepted: QGroundControl.videoManager.setVideoSavePathByUrl(fileDialog.fileUrl) + onAccepted: QGroundControl.settingsManager.videoSettings.videoSavePath.value = QGroundControl.urlToLocalFile(videoLocationFileDialog.fileUrl) } - } } } - } + } // Video Source - Rectangle QGCLabel { anchors.horizontalCenter: parent.horizontalCenter