Commit 0872125d authored by DonLakeFlyer's avatar DonLakeFlyer

Move video save path to standard location

parent 6dc95c6b
......@@ -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) {
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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;
......
......@@ -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("<not set>") : _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
}
}
}
}
}
}
......
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