diff --git a/src/Settings/AppSettings.cc b/src/Settings/AppSettings.cc index 72c5470f0aaaa92c97ab5b6e69d1199fd169256a..5cfac17ee0ed7f13a71b0a75983660828c1bc005 100644 --- a/src/Settings/AppSettings.cc +++ b/src/Settings/AppSettings.cc @@ -48,6 +48,7 @@ const char* AppSettings::parameterDirectory = "Parameters"; const char* AppSettings::telemetryDirectory = "Telemetry"; const char* AppSettings::missionDirectory = "Missions"; const char* AppSettings::logDirectory = "Logs"; +const char* AppSettings::videoDirectory = "Video"; AppSettings::AppSettings(QObject* parent) : SettingsGroup(appSettingsGroupName, QString() /* root settings group */, parent) @@ -109,6 +110,7 @@ void AppSettings::_checkSavePathDirectories(void) savePathDir.mkdir(telemetryDirectory); savePathDir.mkdir(missionDirectory); savePathDir.mkdir(logDirectory); + savePathDir.mkdir(videoDirectory); } } @@ -295,6 +297,19 @@ QString AppSettings::logSavePath(void) return fullPath; } +QString AppSettings::videoSavePath(void) +{ + QString fullPath; + + QString path = savePath()->rawValue().toString(); + if (!path.isEmpty() && QDir(path).exists()) { + QDir dir(path); + return dir.filePath(videoDirectory); + } + + return fullPath; +} + Fact* AppSettings::autoLoadMissions(void) { if (!_autoLoadMissionsFact) { diff --git a/src/Settings/AppSettings.h b/src/Settings/AppSettings.h index 2e73596484b7e889c33a442f26b978ddda24919e..e967e5e8916621d8bdfdffccf94288d4f73f8954 100644 --- a/src/Settings/AppSettings.h +++ b/src/Settings/AppSettings.h @@ -43,6 +43,7 @@ public: Q_PROPERTY(QString parameterSavePath READ parameterSavePath NOTIFY savePathsChanged) Q_PROPERTY(QString telemetrySavePath READ telemetrySavePath NOTIFY savePathsChanged) Q_PROPERTY(QString logSavePath READ logSavePath NOTIFY savePathsChanged) + Q_PROPERTY(QString videoSavePath READ videoSavePath NOTIFY savePathsChanged) Q_PROPERTY(QString planFileExtension MEMBER planFileExtension CONSTANT) Q_PROPERTY(QString missionFileExtension MEMBER missionFileExtension CONSTANT) @@ -74,6 +75,7 @@ public: QString parameterSavePath (void); QString telemetrySavePath (void); QString logSavePath (void); + QString videoSavePath (void); static MAV_AUTOPILOT offlineEditingFirmwareTypeFromFirmwareType(MAV_AUTOPILOT firmwareType); static MAV_TYPE offlineEditingVehicleTypeFromVehicleType(MAV_TYPE vehicleType); @@ -114,6 +116,7 @@ public: static const char* telemetryDirectory; static const char* missionDirectory; static const char* logDirectory; + static const char* videoDirectory; signals: void savePathsChanged(void); diff --git a/src/Settings/VideoSettings.cc b/src/Settings/VideoSettings.cc index f5a4044f6f47f56ee66d22bf02e6600f70978237..120b0ce80bd6e4d32c4ae904d6db3b6ce617fc8c 100644 --- a/src/Settings/VideoSettings.cc +++ b/src/Settings/VideoSettings.cc @@ -22,7 +22,6 @@ 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::videoAspectRatioName = "VideoAspectRatio"; const char* VideoSettings::videoGridLinesName = "VideoGridLines"; const char* VideoSettings::showRecControlName = "ShowRecControl"; @@ -38,7 +37,6 @@ VideoSettings::VideoSettings(QObject* parent) , _videoSourceFact(NULL) , _udpPortFact(NULL) , _rtspUrlFact(NULL) - , _videoSavePathFact(NULL) , _videoAspectRatioFact(NULL) , _gridLinesFact(NULL) , _showRecControlFact(NULL) @@ -106,15 +104,6 @@ Fact* VideoSettings::rtspUrl(void) return _rtspUrlFact; } -Fact* VideoSettings::videoSavePath(void) -{ - if (!_videoSavePathFact) { - _videoSavePathFact = _createSettingsFact(videoSavePathName); - } - - return _videoSavePathFact; -} - Fact* VideoSettings::aspectRatio(void) { if (!_videoAspectRatioFact) { diff --git a/src/Settings/VideoSettings.h b/src/Settings/VideoSettings.h index 12989d32dc26dc865b618cbaaf883d5de07770f7..22fcbbb36c14a4d273d167c625cf03cdfdfef43f 100644 --- a/src/Settings/VideoSettings.h +++ b/src/Settings/VideoSettings.h @@ -22,7 +22,6 @@ public: 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) Q_PROPERTY(Fact* aspectRatio READ aspectRatio CONSTANT) Q_PROPERTY(Fact* gridLines READ gridLines CONSTANT) Q_PROPERTY(Fact* showRecControl READ showRecControl CONSTANT) @@ -32,7 +31,6 @@ public: Fact* videoSource (void); Fact* udpPort (void); Fact* rtspUrl (void); - Fact* videoSavePath (void); Fact* aspectRatio (void); Fact* gridLines (void); Fact* showRecControl (void); @@ -44,7 +42,6 @@ public: static const char* videoSourceName; static const char* udpPortName; static const char* rtspUrlName; - static const char* videoSavePathName; static const char* videoAspectRatioName; static const char* videoGridLinesName; static const char* showRecControlName; @@ -59,7 +56,6 @@ private: SettingsFact* _videoSourceFact; SettingsFact* _udpPortFact; SettingsFact* _rtspUrlFact; - SettingsFact* _videoSavePathFact; SettingsFact* _videoAspectRatioFact; SettingsFact* _gridLinesFact; SettingsFact* _showRecControlFact; diff --git a/src/VideoStreaming/VideoReceiver.cc b/src/VideoStreaming/VideoReceiver.cc index 05e01844e1ce457f7258e3e45c2f35e4d644df75..0ea078d34206c4f7756bbcad5e37afe0e02faef0 100644 --- a/src/VideoStreaming/VideoReceiver.cc +++ b/src/VideoStreaming/VideoReceiver.cc @@ -469,7 +469,7 @@ gboolean VideoReceiver::_onBusMessage(GstBus* bus, GstMessage* msg, gpointer dat #if defined(QGC_GST_STREAMING) void VideoReceiver::_cleanupOldVideos() { - QString savePath = qgcApp()->toolbox()->settingsManager()->videoSettings()->videoSavePath()->rawValue().toString(); + QString savePath = qgcApp()->toolbox()->settingsManager()->appSettings()->videoSavePath(); QDir videoDir = QDir(savePath); videoDir.setFilter(QDir::Files | QDir::Readable | QDir::NoSymLinks | QDir::Writable); videoDir.setSorting(QDir::Time); @@ -523,7 +523,7 @@ void VideoReceiver::startRecording(void) return; } - QString savePath = qgcApp()->toolbox()->settingsManager()->videoSettings()->videoSavePath()->rawValue().toString(); + QString savePath = qgcApp()->toolbox()->settingsManager()->appSettings()->videoSavePath(); if(savePath.isEmpty()) { qgcApp()->showMessage(tr("Unabled to record video. Video save path must be specified in Settings.")); return; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index a44cbc11fad130f2f0403a70fe697ecec639766a..41360be8b581470d18bda1e4e6d1d6083b74569b 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -37,7 +37,6 @@ QGCView { property Fact _appFontPointSize: QGroundControl.settingsManager.appSettings.appFontPointSize property real _labelWidth: ScreenTools.defaultFontPixelWidth * 15 property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30 - property Fact _videoPath: QGroundControl.settingsManager.videoSettings.videoSavePath property Fact _mapProvider: QGroundControl.settingsManager.flightMapSettings.mapProvider property Fact _mapType: QGroundControl.settingsManager.flightMapSettings.mapType @@ -640,36 +639,6 @@ QGCView { anchors.verticalCenter: parent.verticalCenter } } - Row { - spacing: ScreenTools.defaultFontPixelWidth - visible: QGroundControl.settingsManager.videoSettings.videoSavePath.visible && QGroundControl.videoManager.isGStreamer - - QGCLabel { - anchors.baseline: videoBrowse.baseline - text: qsTr("Save Path:") - enabled: promptSaveLog.checked - } - QGCLabel { - anchors.baseline: videoBrowse.baseline - text: _videoPath.value === "" ? qsTr("") : _videoPath.value - } - QGCButton { - id: videoBrowse - text: "Browse" - onClicked: videoDialog.openForLoad() - - QGCFileDialog { - id: videoDialog - title: "Choose a location to save video files." - folder: "file://" + _videoPath.value - selectFolder: true - - onAcceptedForLoad: { - _videoPath.value = file - } - } - } - } } }