Commit 635cccee authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4743 from DonLakeFlyer/NoLogPrompt

Telemetry logs are now saved with generated file name
parents 1b54fd00 7791f55e
/**************************************************************************** /****************************************************************************
* *
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> * (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
* *
...@@ -82,19 +82,19 @@ ...@@ -82,19 +82,19 @@
#include "SettingsManager.h" #include "SettingsManager.h"
#ifndef NO_SERIAL_LINK #ifndef NO_SERIAL_LINK
#include "SerialLink.h" #include "SerialLink.h"
#endif #endif
#ifndef __mobile__ #ifndef __mobile__
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "FirmwareUpgradeController.h" #include "FirmwareUpgradeController.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "GeoTagController.h" #include "GeoTagController.h"
#endif #endif
#ifdef QGC_RTLAB_ENABLED #ifdef QGC_RTLAB_ENABLED
#include "OpalLink.h" #include "OpalLink.h"
#endif #endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
...@@ -162,15 +162,15 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -162,15 +162,15 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#ifdef __mobile__ #ifdef __mobile__
: QGuiApplication(argc, argv) : QGuiApplication(argc, argv)
, _qmlAppEngine(NULL) , _qmlAppEngine(NULL)
#else #else
: QApplication(argc, argv) : QApplication(argc, argv)
#endif #endif
, _runningUnitTests(unitTesting) , _runningUnitTests(unitTesting)
, _fakeMobile(false) , _fakeMobile(false)
, _settingsUpgraded(false) , _settingsUpgraded(false)
#ifdef QT_DEBUG #ifdef QT_DEBUG
, _testHighDPI(false) , _testHighDPI(false)
#endif #endif
, _toolbox(NULL) , _toolbox(NULL)
, _bluetoothAvailable(false) , _bluetoothAvailable(false)
, _lastKnownHomePosition(37.803784, -122.462276, 0.0) , _lastKnownHomePosition(37.803784, -122.462276, 0.0)
...@@ -237,9 +237,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -237,9 +237,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
{ "--clear-settings", &fClearSettingsOptions, NULL }, { "--clear-settings", &fClearSettingsOptions, NULL },
{ "--logging", &logging, &loggingOptions }, { "--logging", &logging, &loggingOptions },
{ "--fake-mobile", &_fakeMobile, NULL }, { "--fake-mobile", &_fakeMobile, NULL },
#ifdef QT_DEBUG #ifdef QT_DEBUG
{ "--test-high-dpi", &_testHighDPI, NULL }, { "--test-high-dpi", &_testHighDPI, NULL },
#endif #endif
// Add additional command line option flags here // Add additional command line option flags here
}; };
...@@ -498,33 +498,67 @@ void QGCApplication::criticalMessageBoxOnMainThread(const QString& title, const ...@@ -498,33 +498,67 @@ void QGCApplication::criticalMessageBoxOnMainThread(const QString& title, const
} }
#ifndef __mobile__ #ifndef __mobile__
void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile) void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile)
{ {
bool saveError; // The vehicle is gone now and we are shutting down so we need to use a message box for errors to hold shutdown and show the error
do{ if (_checkTelemetrySavePath(true /* useMessageBox */)) {
saveError = false;
QString saveFilename = QGCFileDialog::getSaveFileName( QString saveDirPath = _toolbox->settingsManager()->appSettings()->telemetrySavePath()->rawValue().toString();
MainWindow::instance(), QDir saveDir(saveDirPath);
tr("Save Flight Data Log"),
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), QString nameFormat("%1%2.mavlink");
tr("Flight Data Log Files (*.mavlink)"), QString dtFormat("yyyy-MMM-dd hh-mm-ss");
"mavlink");
int tryIndex = 1;
if (!saveFilename.isEmpty()) { QString saveFileName = nameFormat.arg(QDateTime::currentDateTime().toString(dtFormat)).arg("");
// if file exsits already, try to remove it first to overwrite it while (saveDir.exists(saveFileName)) {
if(QFile::exists(saveFilename) && !QFile::remove(saveFilename)){ saveFileName = nameFormat.arg(QDateTime::currentDateTime().toString(dtFormat)).arg(QStringLiteral(".%1").arg(tryIndex++));
// if the file cannot be removed, prompt user and ask new path }
saveError = true; QString saveFilePath = saveDir.absoluteFilePath(saveFileName);
QGCMessageBox::warning("File Error","Could not overwrite existing file.\nPlease provide a different file name to save to.");
} else if(!QFile::copy(tempLogfile, saveFilename)) { QFile tempFile(tempLogfile);
// if file could not be copied, prompt user and ask new path if (!tempFile.copy(saveFilePath)) {
saveError = true; QGCMessageBox::warning(tr("Telemetry save error"), tr("Unable to save telemetry log. Error copying telemetry to '%1': '%2'.").arg(saveFilePath).arg(tempFile.errorString()));
QGCMessageBox::warning("File Error","Could not create file.\nPlease provide a different file name to save to.");
}
} }
} while(saveError); // if the file could not be overwritten, ask for new file }
QFile::remove(tempLogfile); QFile::remove(tempLogfile);
} }
void QGCApplication::checkTelemetrySavePathOnMainThread(void)
{
// This is called with an active vehicle so don't pop message boxes which holds ui thread
_checkTelemetrySavePath(false /* useMessageBox */);
}
bool QGCApplication::_checkTelemetrySavePath(bool useMessageBox)
{
QString errorTitle = tr("Telemetry save error");
QString saveDirPath = _toolbox->settingsManager()->appSettings()->telemetrySavePath()->rawValue().toString();
if (saveDirPath.isEmpty()) {
QString error = tr("Unable to save telemetry log. Telemetry save directory is not set.");
if (useMessageBox) {
QGCMessageBox::warning(errorTitle, error);
} else {
showMessage(error);
}
return false;
}
QDir saveDir(saveDirPath);
if (!saveDir.exists()) {
QString error = tr("Unable to save telemetry log. Telemetry save directory \"%1\" does not exist.").arg(saveDirPath);
if (useMessageBox) {
QGCMessageBox::warning(errorTitle, error);
} else {
showMessage(error);
}
return false;
}
return true;
}
#endif #endif
void QGCApplication::_loadCurrentStyleSheet(void) void QGCApplication::_loadCurrentStyleSheet(void)
......
...@@ -116,8 +116,11 @@ public slots: ...@@ -116,8 +116,11 @@ public slots:
void qmlAttemptWindowClose(void); void qmlAttemptWindowClose(void);
#ifndef __mobile__ #ifndef __mobile__
/// Save the specified Flight Data Log /// Save the specified telemetry Log
void saveTempFlightDataLogOnMainThread(QString tempLogfile); void saveTelemetryLogOnMainThread(QString tempLogfile);
/// Check that the telemetry save path is set correctly
void checkTelemetrySavePathOnMainThread(void);
#endif #endif
signals: signals:
...@@ -150,6 +153,8 @@ public: ...@@ -150,6 +153,8 @@ public:
/// Shutdown the application object /// Shutdown the application object
void _shutdown(void); void _shutdown(void);
bool _checkTelemetrySavePath(bool useMessageBox);
private slots: private slots:
void _missingParamsDisplay(void); void _missingParamsDisplay(void);
......
...@@ -64,15 +64,15 @@ ...@@ -64,15 +64,15 @@
}, },
{ {
"name": "PromptFLightDataSave", "name": "PromptFLightDataSave",
"shortDescription": "Prompt to save Flight Data Log after each flight", "shortDescription": "Save telemetry Log after each flight",
"longDescription": "If this option is enabled you will be prompted to save Flight Data Log after each flight completes.", "longDescription": "If this option is enabled a telemetry will be saved after each flight completes.",
"type": "bool", "type": "bool",
"defaultValue": true "defaultValue": true
}, },
{ {
"name": "PromptFLightDataSaveNotArmed", "name": "PromptFLightDataSaveNotArmed",
"shortDescription": "Prompt to save Flight Data Log even if vehicle was not armed", "shortDescription": "Save telemetry log even if vehicle was not armed",
"longDescription": "If this option is enabled you will be prompted to save Flight Data Log even if vehicle was never armed.", "longDescription": "If this option is enabled a telemtry log will be saved even if vehicle was never armed.",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false
}, },
...@@ -114,5 +114,12 @@ ...@@ -114,5 +114,12 @@
"longDescription": "Show large compass on instrument panel", "longDescription": "Show large compass on instrument panel",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false
},
{
"name": "TelemetrySavePath",
"shortDescription": "Telemetry log save directory",
"longDescription": "The directory to which telemetry logs are automatically saved to.",
"type": "string",
"defaultValue": ""
} }
] ]
...@@ -22,13 +22,14 @@ const char* AppSettings::offlineEditingHoverSpeedSettingsName = "Offline ...@@ -22,13 +22,14 @@ const char* AppSettings::offlineEditingHoverSpeedSettingsName = "Offline
const char* AppSettings::batteryPercentRemainingAnnounceSettingsName = "batteryPercentRemainingAnnounce"; const char* AppSettings::batteryPercentRemainingAnnounceSettingsName = "batteryPercentRemainingAnnounce";
const char* AppSettings::defaultMissionItemAltitudeSettingsName = "DefaultMissionItemAltitude"; const char* AppSettings::defaultMissionItemAltitudeSettingsName = "DefaultMissionItemAltitude";
const char* AppSettings::missionAutoLoadDirSettingsName = "MissionAutoLoadDir"; const char* AppSettings::missionAutoLoadDirSettingsName = "MissionAutoLoadDir";
const char* AppSettings::promptFlightTelemetrySaveName = "PromptFLightDataSave"; const char* AppSettings::telemetrySaveName = "PromptFLightDataSave";
const char* AppSettings::promptFlightTelemetrySaveNotArmedName = "PromptFLightDataSaveNotArmed"; const char* AppSettings::telemetrySaveNotArmedName = "PromptFLightDataSaveNotArmed";
const char* AppSettings::audioMutedName = "AudioMuted"; const char* AppSettings::audioMutedName = "AudioMuted";
const char* AppSettings::virtualJoystickName = "VirtualTabletJoystick"; const char* AppSettings::virtualJoystickName = "VirtualTabletJoystick";
const char* AppSettings::appFontPointSizeName = "BaseDeviceFontPointSize"; const char* AppSettings::appFontPointSizeName = "BaseDeviceFontPointSize";
const char* AppSettings::indoorPaletteName = "StyleIsDark"; const char* AppSettings::indoorPaletteName = "StyleIsDark";
const char* AppSettings::showLargeCompassName = "ShowLargeCompass"; const char* AppSettings::showLargeCompassName = "ShowLargeCompass";
const char* AppSettings::telemetrySavePathName = "TelemetrySavePath";
AppSettings::AppSettings(QObject* parent) AppSettings::AppSettings(QObject* parent)
: SettingsGroup(appSettingsGroupName, QString() /* root settings group */, parent) : SettingsGroup(appSettingsGroupName, QString() /* root settings group */, parent)
...@@ -39,13 +40,14 @@ AppSettings::AppSettings(QObject* parent) ...@@ -39,13 +40,14 @@ AppSettings::AppSettings(QObject* parent)
, _batteryPercentRemainingAnnounceFact(NULL) , _batteryPercentRemainingAnnounceFact(NULL)
, _defaultMissionItemAltitudeFact(NULL) , _defaultMissionItemAltitudeFact(NULL)
, _missionAutoLoadDirFact(NULL) , _missionAutoLoadDirFact(NULL)
, _promptFlightTelemetrySaveFact(NULL) , _telemetrySaveFact(NULL)
, _promptFlightTelemetrySaveNotArmedFact(NULL) , _telemetrySaveNotArmedFact(NULL)
, _audioMutedFact(NULL) , _audioMutedFact(NULL)
, _virtualJoystickFact(NULL) , _virtualJoystickFact(NULL)
, _appFontPointSizeFact(NULL) , _appFontPointSizeFact(NULL)
, _indoorPaletteFact(NULL) , _indoorPaletteFact(NULL)
, _showLargeCompassFact(NULL) , _showLargeCompassFact(NULL)
, _telemetrySavePathFact(NULL)
{ {
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only"); qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only");
...@@ -113,22 +115,22 @@ Fact* AppSettings::missionAutoLoadDir(void) ...@@ -113,22 +115,22 @@ Fact* AppSettings::missionAutoLoadDir(void)
return _missionAutoLoadDirFact; return _missionAutoLoadDirFact;
} }
Fact* AppSettings::promptFlightTelemetrySave(void) Fact* AppSettings::telemetrySave(void)
{ {
if (!_promptFlightTelemetrySaveFact) { if (!_telemetrySaveFact) {
_promptFlightTelemetrySaveFact = _createSettingsFact(promptFlightTelemetrySaveName); _telemetrySaveFact = _createSettingsFact(telemetrySaveName);
} }
return _promptFlightTelemetrySaveFact; return _telemetrySaveFact;
} }
Fact* AppSettings::promptFlightTelemetrySaveNotArmed(void) Fact* AppSettings::telemetrySaveNotArmed(void)
{ {
if (!_promptFlightTelemetrySaveNotArmedFact) { if (!_telemetrySaveNotArmedFact) {
_promptFlightTelemetrySaveNotArmedFact = _createSettingsFact(promptFlightTelemetrySaveNotArmedName); _telemetrySaveNotArmedFact = _createSettingsFact(telemetrySaveNotArmedName);
} }
return _promptFlightTelemetrySaveNotArmedFact; return _telemetrySaveNotArmedFact;
} }
Fact* AppSettings::audioMuted(void) Fact* AppSettings::audioMuted(void)
...@@ -183,3 +185,12 @@ Fact* AppSettings::showLargeCompass(void) ...@@ -183,3 +185,12 @@ Fact* AppSettings::showLargeCompass(void)
return _showLargeCompassFact; return _showLargeCompassFact;
} }
Fact* AppSettings::telemetrySavePath(void)
{
if (!_telemetrySavePathFact) {
_telemetrySavePathFact = _createSettingsFact(telemetrySavePathName);
}
return _telemetrySavePathFact;
}
...@@ -26,13 +26,14 @@ public: ...@@ -26,13 +26,14 @@ public:
Q_PROPERTY(Fact* batteryPercentRemainingAnnounce READ batteryPercentRemainingAnnounce CONSTANT) Q_PROPERTY(Fact* batteryPercentRemainingAnnounce READ batteryPercentRemainingAnnounce CONSTANT)
Q_PROPERTY(Fact* defaultMissionItemAltitude READ defaultMissionItemAltitude CONSTANT) Q_PROPERTY(Fact* defaultMissionItemAltitude READ defaultMissionItemAltitude CONSTANT)
Q_PROPERTY(Fact* missionAutoLoadDir READ missionAutoLoadDir CONSTANT) Q_PROPERTY(Fact* missionAutoLoadDir READ missionAutoLoadDir CONSTANT)
Q_PROPERTY(Fact* promptFlightTelemetrySave READ promptFlightTelemetrySave CONSTANT) Q_PROPERTY(Fact* telemetrySave READ telemetrySave CONSTANT)
Q_PROPERTY(Fact* promptFlightTelemetrySaveNotArmed READ promptFlightTelemetrySaveNotArmed CONSTANT) Q_PROPERTY(Fact* telemetrySaveNotArmed READ telemetrySaveNotArmed CONSTANT)
Q_PROPERTY(Fact* audioMuted READ audioMuted CONSTANT) Q_PROPERTY(Fact* audioMuted READ audioMuted CONSTANT)
Q_PROPERTY(Fact* virtualJoystick READ virtualJoystick CONSTANT) Q_PROPERTY(Fact* virtualJoystick READ virtualJoystick CONSTANT)
Q_PROPERTY(Fact* appFontPointSize READ appFontPointSize CONSTANT) Q_PROPERTY(Fact* appFontPointSize READ appFontPointSize CONSTANT)
Q_PROPERTY(Fact* indoorPalette READ indoorPalette CONSTANT) Q_PROPERTY(Fact* indoorPalette READ indoorPalette CONSTANT)
Q_PROPERTY(Fact* showLargeCompass READ showLargeCompass CONSTANT) Q_PROPERTY(Fact* showLargeCompass READ showLargeCompass CONSTANT)
Q_PROPERTY(Fact* telemetrySavePath READ telemetrySavePath CONSTANT)
Fact* offlineEditingFirmwareType (void); Fact* offlineEditingFirmwareType (void);
Fact* offlineEditingVehicleType (void); Fact* offlineEditingVehicleType (void);
...@@ -41,13 +42,14 @@ public: ...@@ -41,13 +42,14 @@ public:
Fact* batteryPercentRemainingAnnounce (void); Fact* batteryPercentRemainingAnnounce (void);
Fact* defaultMissionItemAltitude (void); Fact* defaultMissionItemAltitude (void);
Fact* missionAutoLoadDir (void); Fact* missionAutoLoadDir (void);
Fact* promptFlightTelemetrySave (void); Fact* telemetrySave (void);
Fact* promptFlightTelemetrySaveNotArmed (void); Fact* telemetrySaveNotArmed (void);
Fact* audioMuted (void); Fact* audioMuted (void);
Fact* virtualJoystick (void); Fact* virtualJoystick (void);
Fact* appFontPointSize (void); Fact* appFontPointSize (void);
Fact* indoorPalette (void); Fact* indoorPalette (void);
Fact* showLargeCompass (void); Fact* showLargeCompass (void);
Fact* telemetrySavePath (void);
static const char* appSettingsGroupName; static const char* appSettingsGroupName;
...@@ -58,13 +60,14 @@ public: ...@@ -58,13 +60,14 @@ public:
static const char* batteryPercentRemainingAnnounceSettingsName; static const char* batteryPercentRemainingAnnounceSettingsName;
static const char* defaultMissionItemAltitudeSettingsName; static const char* defaultMissionItemAltitudeSettingsName;
static const char* missionAutoLoadDirSettingsName; static const char* missionAutoLoadDirSettingsName;
static const char* promptFlightTelemetrySaveName; static const char* telemetrySaveName;
static const char* promptFlightTelemetrySaveNotArmedName; static const char* telemetrySaveNotArmedName;
static const char* audioMutedName; static const char* audioMutedName;
static const char* virtualJoystickName; static const char* virtualJoystickName;
static const char* appFontPointSizeName; static const char* appFontPointSizeName;
static const char* indoorPaletteName; static const char* indoorPaletteName;
static const char* showLargeCompassName; static const char* showLargeCompassName;
static const char* telemetrySavePathName;
private slots: private slots:
void _indoorPaletteChanged(void); void _indoorPaletteChanged(void);
...@@ -77,13 +80,14 @@ private: ...@@ -77,13 +80,14 @@ private:
SettingsFact* _batteryPercentRemainingAnnounceFact; SettingsFact* _batteryPercentRemainingAnnounceFact;
SettingsFact* _defaultMissionItemAltitudeFact; SettingsFact* _defaultMissionItemAltitudeFact;
SettingsFact* _missionAutoLoadDirFact; SettingsFact* _missionAutoLoadDirFact;
SettingsFact* _promptFlightTelemetrySaveFact; SettingsFact* _telemetrySaveFact;
SettingsFact* _promptFlightTelemetrySaveNotArmedFact; SettingsFact* _telemetrySaveNotArmedFact;
SettingsFact* _audioMutedFact; SettingsFact* _audioMutedFact;
SettingsFact* _virtualJoystickFact; SettingsFact* _virtualJoystickFact;
SettingsFact* _appFontPointSizeFact; SettingsFact* _appFontPointSizeFact;
SettingsFact* _indoorPaletteFact; SettingsFact* _indoorPaletteFact;
SettingsFact* _showLargeCompassFact; SettingsFact* _showLargeCompassFact;
SettingsFact* _telemetrySavePathFact;
}; };
#endif #endif
...@@ -103,9 +103,10 @@ void MAVLinkProtocol::setToolbox(QGCToolbox *toolbox) ...@@ -103,9 +103,10 @@ void MAVLinkProtocol::setToolbox(QGCToolbox *toolbox)
} }
} }
connect(this, &MAVLinkProtocol::protocolStatusMessage, _app, &QGCApplication::criticalMessageBoxOnMainThread); connect(this, &MAVLinkProtocol::protocolStatusMessage, _app, &QGCApplication::criticalMessageBoxOnMainThread);
#ifndef __mobile__ #ifndef __mobile__
connect(this, &MAVLinkProtocol::saveTempFlightDataLog, _app, &QGCApplication::saveTempFlightDataLogOnMainThread); connect(this, &MAVLinkProtocol::saveTelemetryLog, _app, &QGCApplication::saveTelemetryLogOnMainThread);
connect(this, &MAVLinkProtocol::checkTelemetrySavePath, _app, &QGCApplication::checkTelemetrySavePathOnMainThread);
#endif #endif
connect(_multiVehicleManager->vehicles(), &QmlObjectListModel::countChanged, this, &MAVLinkProtocol::_vehicleCountChanged); connect(_multiVehicleManager->vehicles(), &QmlObjectListModel::countChanged, this, &MAVLinkProtocol::_vehicleCountChanged);
...@@ -413,6 +414,7 @@ void MAVLinkProtocol::_startLogging(void) ...@@ -413,6 +414,7 @@ void MAVLinkProtocol::_startLogging(void)
} }
qDebug() << "Temp log" << _tempLogFile.fileName(); qDebug() << "Temp log" << _tempLogFile.fileName();
emit checkTelemetrySavePath();
_logSuspendError = false; _logSuspendError = false;
} }
...@@ -424,8 +426,8 @@ void MAVLinkProtocol::_stopLogging(void) ...@@ -424,8 +426,8 @@ void MAVLinkProtocol::_stopLogging(void)
if (_closeLogFile()) { if (_closeLogFile()) {
// If the signals are not connected it means we are running a unit test. In that case just delete log files // If the signals are not connected it means we are running a unit test. In that case just delete log files
SettingsManager* settingsManager = _app->toolbox()->settingsManager(); SettingsManager* settingsManager = _app->toolbox()->settingsManager();
if ((_vehicleWasArmed || settingsManager->appSettings()->promptFlightTelemetrySaveNotArmed()->rawValue().toBool()) && settingsManager->appSettings()->promptFlightTelemetrySave()->rawValue().toBool()) { if ((_vehicleWasArmed || settingsManager->appSettings()->telemetrySaveNotArmed()->rawValue().toBool()) && settingsManager->appSettings()->telemetrySave()->rawValue().toBool()) {
emit saveTempFlightDataLog(_tempLogFile.fileName()); emit saveTelemetryLog(_tempLogFile.fileName());
} else { } else {
QFile::remove(_tempLogFile.fileName()); QFile::remove(_tempLogFile.fileName());
} }
...@@ -452,12 +454,7 @@ void MAVLinkProtocol::checkForLostLogFiles(void) ...@@ -452,12 +454,7 @@ void MAVLinkProtocol::checkForLostLogFiles(void)
continue; continue;
} }
// Give the user a chance to save the orphaned log file emit saveTelemetryLog(fileInfo.filePath());
emit protocolStatusMessage(tr("Found unsaved Flight Data"),
tr("This can happen if QGroundControl crashes during Flight Data collection. "
"If you want to save the unsaved Flight Data, select the file you want to save it to. "
"If you do not want to keep the Flight Data, select 'Cancel' on the next dialog."));
emit saveTempFlightDataLog(fileInfo.filePath());
} }
} }
......
...@@ -158,8 +158,11 @@ signals: ...@@ -158,8 +158,11 @@ signals:
void radioStatusChanged(LinkInterface* link, unsigned rxerrors, unsigned fixed, int rssi, int remrssi, void radioStatusChanged(LinkInterface* link, unsigned rxerrors, unsigned fixed, int rssi, int remrssi,
unsigned txbuf, unsigned noise, unsigned remnoise); unsigned txbuf, unsigned noise, unsigned remnoise);
/// @brief Emitted when a temporary log file is ready for saving /// Emitted when a temporary telemetry log file is ready for saving
void saveTempFlightDataLog(QString tempLogfile); void saveTelemetryLog(QString tempLogfile);
/// Emitted when a telemetry log is started to save.
void checkTelemetrySavePath(void);
private slots: private slots:
void _vehicleCountChanged(int count); void _vehicleCountChanged(int count);
......
...@@ -37,6 +37,8 @@ QGCView { ...@@ -37,6 +37,8 @@ QGCView {
property Fact _appFontPointSize: QGroundControl.settingsManager.appSettings.appFontPointSize property Fact _appFontPointSize: QGroundControl.settingsManager.appSettings.appFontPointSize
property real _labelWidth: ScreenTools.defaultFontPixelWidth * 15 property real _labelWidth: ScreenTools.defaultFontPixelWidth * 15
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30 property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30
property Fact _telemPath: QGroundControl.settingsManager.appSettings.telemetrySavePath
property Fact _videoPath: QGroundControl.settingsManager.videoSettings.videoSavePath
readonly property string _requiresRestart: qsTr("(Requires Restart)") readonly property string _requiresRestart: qsTr("(Requires Restart)")
...@@ -205,26 +207,61 @@ QGCView { ...@@ -205,26 +207,61 @@ QGCView {
property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted
} }
//----------------------------------------------------------------- //-----------------------------------------------------------------
//-- Prompt Save Log //-- Save telemetry log
FactCheckBox { FactCheckBox {
id: promptSaveLog id: promptSaveLog
text: qsTr("Prompt to save Flight Data Log after each flight") text: qsTr("Save telemetry log after each flight")
fact: _promptFlightTelemetrySave fact: _telemetrySave
visible: !ScreenTools.isMobile && _promptFlightTelemetrySave.visible visible: !ScreenTools.isMobile && _telemetrySave.visible
property Fact _promptFlightTelemetrySave: QGroundControl.settingsManager.appSettings.promptFlightTelemetrySave property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave
} }
//----------------------------------------------------------------- //-----------------------------------------------------------------
//-- Prompt Save even if not armed //-- Save even if not armed
FactCheckBox { FactCheckBox {
text: qsTr("Prompt to save Flight Data Log even if vehicle was not armed") text: qsTr("Save telemetry log even if vehicle was not armed")
fact: _promptFlightTelemetrySaveNotArmed fact: _telemetrySaveNotArmed
visible: !ScreenTools.isMobile && _promptFlightTelemetrySaveNotArmed.visible visible: !ScreenTools.isMobile && _telemetrySaveNotArmed.visible
enabled: promptSaveLog.checked enabled: promptSaveLog.checked
property Fact _promptFlightTelemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.promptFlightTelemetrySaveNotArmed property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed
} }
//-----------------------------------------------------------------
//-- Telemetry save path
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.appSettings.telemetrySavePath.visible
QGCLabel {
anchors.baseline: telemBrowse.baseline
text: qsTr("Telemetry save path:")
enabled: promptSaveLog.checked
}
QGCLabel {
anchors.baseline: telemBrowse.baseline
text: _telemPath.value == "" ? qsTr("<not set>") : _telemPath.value
enabled: promptSaveLog.checked
}
QGCButton {
id: telemBrowse
text: "Browse"
enabled: promptSaveLog.checked
onClicked: telemDialog.visible = true
FileDialog {
id: telemDialog
title: "Choose a location to save telemetry files."
folder: "file://" + _telemPath.value
selectFolder: true
onAccepted: _telemPath.value = QGroundControl.urlToLocalFile(telemDialog.fileUrl)
}
}
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
//-- Clear settings //-- Clear settings
QGCCheckBox { QGCCheckBox {
...@@ -329,7 +366,7 @@ QGCView { ...@@ -329,7 +366,7 @@ QGCView {
FileDialog { FileDialog {
id: autoloadDirPicker id: autoloadDirPicker
title: qsTr("Choose the location of mission file.") title: qsTr("Choose the location of mission file.")
folder: shortcuts.home folder: "file://" + _autoLoadDir.value
selectFolder: true selectFolder: true
onAccepted: _autoLoadDir.rawValue = QGroundControl.urlToLocalFile(autoloadDirPicker.fileUrl) onAccepted: _autoLoadDir.rawValue = QGroundControl.urlToLocalFile(autoloadDirPicker.fileUrl)
} }
...@@ -529,26 +566,27 @@ QGCView { ...@@ -529,26 +566,27 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: QGroundControl.settingsManager.videoSettings.videoSavePath.visible && QGroundControl.videoManager.isGStreamer && QGroundControl.videoManager.recordingEnabled visible: QGroundControl.settingsManager.videoSettings.videoSavePath.visible && QGroundControl.videoManager.isGStreamer && QGroundControl.videoManager.recordingEnabled
QGCLabel { QGCLabel {
anchors.baseline: pathField.baseline anchors.baseline: videoBrowse.baseline
text: qsTr("Save Path:") text: qsTr("Save path:")
width: _labelWidth enabled: promptSaveLog.checked
} }
FactTextField { QGCLabel {
id: pathField anchors.baseline: videoBrowse.baseline
width: _editFieldWidth text: _videoPath.value == "" ? qsTr("<not set>") : _videoPath.value
fact: QGroundControl.settingsManager.videoSettings.videoSavePath
} }
QGCButton { QGCButton {
id: videoBrowse
text: "Browse" text: "Browse"
onClicked: videoLocationFileDialog.visible = true onClicked: videoDialog.visible = true
FileDialog { FileDialog {
id: videoLocationFileDialog id: videoDialog
title: "Choose a location to save video files." title: "Choose a location to save video files."
folder: shortcuts.home folder: "file://" + _videoPath.value
selectFolder: true selectFolder: true
onAccepted: QGroundControl.settingsManager.videoSettings.videoSavePath.value = QGroundControl.urlToLocalFile(videoLocationFileDialog.fileUrl) onAccepted: _videoPath.value = QGroundControl.urlToLocalFile(videoDialog.fileUrl)
} }
} }
} }
......
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