Commit b3a849cf authored by DonLakeFlyer's avatar DonLakeFlyer

Add crash logs directory to AppSettings

parent 189dc1cf
......@@ -53,30 +53,31 @@ const char* AppSettings::telemetryDirectory = "Telemetry";
const char* AppSettings::missionDirectory = "Missions";
const char* AppSettings::logDirectory = "Logs";
const char* AppSettings::videoDirectory = "Video";
const char* AppSettings::crashDirectory = "CrashLogs";
AppSettings::AppSettings(QObject* parent)
: SettingsGroup(appSettingsGroupName, QString() /* root settings group */, parent)
, _offlineEditingFirmwareTypeFact(NULL)
, _offlineEditingVehicleTypeFact(NULL)
, _offlineEditingCruiseSpeedFact(NULL)
, _offlineEditingHoverSpeedFact(NULL)
, _offlineEditingAscentSpeedFact(NULL)
, _offlineEditingDescentSpeedFact(NULL)
, _batteryPercentRemainingAnnounceFact(NULL)
, _defaultMissionItemAltitudeFact(NULL)
, _telemetrySaveFact(NULL)
, _telemetrySaveNotArmedFact(NULL)
, _audioMutedFact(NULL)
, _virtualJoystickFact(NULL)
, _appFontPointSizeFact(NULL)
, _indoorPaletteFact(NULL)
, _showLargeCompassFact(NULL)
, _savePathFact(NULL)
, _autoLoadMissionsFact(NULL)
, _mapboxTokenFact(NULL)
, _esriTokenFact(NULL)
, _defaultFirmwareTypeFact(NULL)
, _gstDebugFact(NULL)
: SettingsGroup (appSettingsGroupName, QString() /* root settings group */, parent)
, _offlineEditingFirmwareTypeFact (NULL)
, _offlineEditingVehicleTypeFact (NULL)
, _offlineEditingCruiseSpeedFact (NULL)
, _offlineEditingHoverSpeedFact (NULL)
, _offlineEditingAscentSpeedFact (NULL)
, _offlineEditingDescentSpeedFact (NULL)
, _batteryPercentRemainingAnnounceFact (NULL)
, _defaultMissionItemAltitudeFact (NULL)
, _telemetrySaveFact (NULL)
, _telemetrySaveNotArmedFact (NULL)
, _audioMutedFact (NULL)
, _virtualJoystickFact (NULL)
, _appFontPointSizeFact (NULL)
, _indoorPaletteFact (NULL)
, _showLargeCompassFact (NULL)
, _savePathFact (NULL)
, _autoLoadMissionsFact (NULL)
, _mapboxTokenFact (NULL)
, _esriTokenFact (NULL)
, _defaultFirmwareTypeFact (NULL)
, _gstDebugFact (NULL)
{
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only");
......@@ -118,6 +119,7 @@ void AppSettings::_checkSavePathDirectories(void)
savePathDir.mkdir(missionDirectory);
savePathDir.mkdir(logDirectory);
savePathDir.mkdir(videoDirectory);
savePathDir.mkdir(crashDirectory);
}
}
......@@ -279,67 +281,68 @@ Fact* AppSettings::savePath(void)
QString AppSettings::missionSavePath(void)
{
QString fullPath;
QString path = savePath()->rawValue().toString();
if (!path.isEmpty() && QDir(path).exists()) {
QDir dir(path);
return dir.filePath(missionDirectory);
}
return fullPath;
return QString();
}
QString AppSettings::parameterSavePath(void)
{
QString fullPath;
QString path = savePath()->rawValue().toString();
if (!path.isEmpty() && QDir(path).exists()) {
QDir dir(path);
return dir.filePath(parameterDirectory);
}
return fullPath;
return QString();
}
QString AppSettings::telemetrySavePath(void)
{
QString fullPath;
QString path = savePath()->rawValue().toString();
if (!path.isEmpty() && QDir(path).exists()) {
QDir dir(path);
return dir.filePath(telemetryDirectory);
}
return fullPath;
return QString();
}
QString AppSettings::logSavePath(void)
{
QString fullPath;
QString path = savePath()->rawValue().toString();
if (!path.isEmpty() && QDir(path).exists()) {
QDir dir(path);
return dir.filePath(logDirectory);
}
return fullPath;
return QString();
}
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;
return QString();
}
QString AppSettings::crashSavePath(void)
{
QString path = savePath()->rawValue().toString();
if (!path.isEmpty() && QDir(path).exists()) {
QDir dir(path);
return dir.filePath(crashDirectory);
}
return QString();
}
Fact* AppSettings::autoLoadMissions(void)
......
......@@ -47,6 +47,7 @@ public:
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 crashSavePath READ crashSavePath NOTIFY savePathsChanged)
Q_PROPERTY(QString planFileExtension MEMBER planFileExtension CONSTANT)
Q_PROPERTY(QString missionFileExtension MEMBER missionFileExtension CONSTANT)
......@@ -83,6 +84,7 @@ public:
QString telemetrySavePath (void);
QString logSavePath (void);
QString videoSavePath (void);
QString crashSavePath (void);
static MAV_AUTOPILOT offlineEditingFirmwareTypeFromFirmwareType(MAV_AUTOPILOT firmwareType);
static MAV_TYPE offlineEditingVehicleTypeFromVehicleType(MAV_TYPE vehicleType);
......@@ -128,6 +130,7 @@ public:
static const char* missionDirectory;
static const char* logDirectory;
static const char* videoDirectory;
static const char* crashDirectory;
signals:
void savePathsChanged(void);
......
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