From a8d0bc33d768701c22139bc8f8ba5cc67769bceb Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Fri, 5 Apr 2019 11:55:37 -0400 Subject: [PATCH] Change setting from save logs to any data persistence. --- src/Settings/App.SettingsGroup.json | 8 +++---- src/Settings/AppSettings.cc | 2 +- src/Settings/AppSettings.h | 2 +- src/comm/MAVLinkProtocol.cc | 4 ++-- src/ui/preferences/GeneralSettings.qml | 16 +++++++------- src/ui/preferences/MavlinkSettings.qml | 30 +++++++++++++------------- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/Settings/App.SettingsGroup.json b/src/Settings/App.SettingsGroup.json index 225fcdeff..4e423823f 100644 --- a/src/Settings/App.SettingsGroup.json +++ b/src/Settings/App.SettingsGroup.json @@ -237,10 +237,10 @@ "defaultValue": 0 }, { - "name": "enableLocalLogging", - "shortDescription": "Enable local telemetry logging", - "longDescription": "If this option is enabled telemetry logs from vehicle will be stored to disk.", + "name": "disableAllPersistence", + "shortDescription": "Disable all data persistence", + "longDescription": "If this option is set, nothing will be saved to disk.", "type": "bool", - "defaultValue": true + "defaultValue": false } ] diff --git a/src/Settings/AppSettings.cc b/src/Settings/AppSettings.cc index 77e0b8970..3d7ec1c58 100644 --- a/src/Settings/AppSettings.cc +++ b/src/Settings/AppSettings.cc @@ -94,7 +94,7 @@ DECLARE_SETTINGSFACT(AppSettings, enableTaisync) DECLARE_SETTINGSFACT(AppSettings, enableTaisyncVideo) DECLARE_SETTINGSFACT(AppSettings, enableMicrohard) DECLARE_SETTINGSFACT(AppSettings, language) -DECLARE_SETTINGSFACT(AppSettings, enableLocalLogging) +DECLARE_SETTINGSFACT(AppSettings, disableAllPersistence) DECLARE_SETTINGSFACT_NO_FUNC(AppSettings, indoorPalette) { diff --git a/src/Settings/AppSettings.h b/src/Settings/AppSettings.h index 3dc1a763b..17cb0ecfd 100644 --- a/src/Settings/AppSettings.h +++ b/src/Settings/AppSettings.h @@ -48,7 +48,7 @@ public: DEFINE_SETTINGFACT(enableTaisyncVideo) DEFINE_SETTINGFACT(enableMicrohard) DEFINE_SETTINGFACT(language) - DEFINE_SETTINGFACT(enableLocalLogging) + DEFINE_SETTINGFACT(disableAllPersistence) // Although this is a global setting it only affects ArduPilot vehicle since PX4 automatically starts the stream from the vehicle side DEFINE_SETTINGFACT(apmStartMavlinkStreams) diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index f1288555e..2d4e08da1 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -405,7 +405,7 @@ void MAVLinkProtocol::_startLogging(void) return; } AppSettings* appSettings = _app->toolbox()->settingsManager()->appSettings(); - if(!appSettings->enableLocalLogging()->rawValue().toBool()) { + if(appSettings->disableAllPersistence()->rawValue().toBool()) { return; } #ifdef __mobile__ @@ -440,7 +440,7 @@ void MAVLinkProtocol::_stopLogging(void) if (_closeLogFile()) { if ((_vehicleWasArmed || _app->toolbox()->settingsManager()->appSettings()->telemetrySaveNotArmed()->rawValue().toBool()) && _app->toolbox()->settingsManager()->appSettings()->telemetrySave()->rawValue().toBool() && - _app->toolbox()->settingsManager()->appSettings()->enableLocalLogging()->rawValue().toBool()) { + !_app->toolbox()->settingsManager()->appSettings()->disableAllPersistence()->rawValue().toBool()) { emit saveTelemetryLog(_tempLogFile.fileName()); } else { QFile::remove(_tempLogFile.fileName()); diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 5c7790f0f..a891778c0 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -356,7 +356,7 @@ QGCView { Item { width: 1; height: _margins } QGCLabel { id: loggingSectionLabel - text: qsTr("Telemetry Logs from Vehicle") + text: qsTr("Data Persistence") } Rectangle { Layout.preferredHeight: loggingCol.height + (_margins * 2) @@ -370,18 +370,18 @@ QGCView { anchors.horizontalCenter: parent.horizontalCenter spacing: _margins FactCheckBox { - id: enableLogging - text: qsTr("Save logs to disk") - fact: _enableLogging - visible: _enableLogging.visible - property Fact _enableLogging: QGroundControl.settingsManager.appSettings.enableLocalLogging + id: disableDataPersistence + text: qsTr("Disable all data persistence") + fact: _disableDataPersistence + visible: _disableDataPersistence.visible + property Fact _disableDataPersistence: QGroundControl.settingsManager.appSettings.disableAllPersistence } FactCheckBox { id: promptSaveLog text: qsTr("Save log after each flight") fact: _telemetrySave visible: _telemetrySave.visible - enabled: enableLogging.checked + enabled: !disableDataPersistence.checked property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave } FactCheckBox { @@ -389,7 +389,7 @@ QGCView { text: qsTr("Save logs even if vehicle was not armed") fact: _telemetrySaveNotArmed visible: _telemetrySaveNotArmed.visible - enabled: promptSaveLog.checked && enableLogging.checked + enabled: promptSaveLog.checked && !disableDataPersistence.checked property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed } } diff --git a/src/ui/preferences/MavlinkSettings.qml b/src/ui/preferences/MavlinkSettings.qml index 639802fd5..e0757696d 100644 --- a/src/ui/preferences/MavlinkSettings.qml +++ b/src/ui/preferences/MavlinkSettings.qml @@ -35,8 +35,8 @@ Rectangle { property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _showMavlinkLog: QGroundControl.corePlugin.options.showMavlinkLogOptions property bool _showAPMStreamRates: QGroundControl.apmFirmwareSupported && QGroundControl.settingsManager.apmMavlinkStreamRateSettings.visible - property Fact _enableLoggingFact: QGroundControl.settingsManager.appSettings.enableLocalLogging - property bool _enableLogging: _enableLoggingFact ? _enableLoggingFact.rawValue : true + property Fact _disableDataPersistenceFact: QGroundControl.settingsManager.appSettings.disableAllPersistence + property bool _disableDataPersistence: _disableDataPersistenceFact ? _disableDataPersistenceFact.rawValue : false QGCPalette { id: qgcPal } @@ -372,14 +372,14 @@ Rectangle { QGCButton { text: qsTr("Start Logging") width: (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5) - enabled: !QGroundControl.mavlinkLogManager.logRunning && QGroundControl.mavlinkLogManager.canStartLog && _enableLogging + enabled: !QGroundControl.mavlinkLogManager.logRunning && QGroundControl.mavlinkLogManager.canStartLog && !_disableDataPersistence onClicked: QGroundControl.mavlinkLogManager.startLogging() anchors.verticalCenter: parent.verticalCenter } QGCButton { text: qsTr("Stop Logging") width: (_valueWidth * 0.5) - (ScreenTools.defaultFontPixelWidth * 0.5) - enabled: QGroundControl.mavlinkLogManager.logRunning && _enableLogging + enabled: QGroundControl.mavlinkLogManager.logRunning && !_disableDataPersistence onClicked: QGroundControl.mavlinkLogManager.stopLogging() anchors.verticalCenter: parent.verticalCenter } @@ -389,7 +389,7 @@ Rectangle { QGCCheckBox { text: qsTr("Enable automatic logging") checked: QGroundControl.mavlinkLogManager.enableAutoStart - enabled: _enableLogging + enabled: !_disableDataPersistence onClicked: { QGroundControl.mavlinkLogManager.enableAutoStart = checked } @@ -434,7 +434,7 @@ Rectangle { id: emailField text: QGroundControl.mavlinkLogManager.emailAddress width: _valueWidth - enabled: _enableLogging + enabled: !_disableDataPersistence inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly anchors.verticalCenter: parent.verticalCenter onEditingFinished: { @@ -455,7 +455,7 @@ Rectangle { id: descField text: QGroundControl.mavlinkLogManager.description width: _valueWidth - enabled: _enableLogging + enabled: !_disableDataPersistence anchors.verticalCenter: parent.verticalCenter onEditingFinished: { saveItems(); @@ -475,7 +475,7 @@ Rectangle { id: urlField text: QGroundControl.mavlinkLogManager.uploadURL width: _valueWidth - enabled: _enableLogging + enabled: !_disableDataPersistence inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly anchors.verticalCenter: parent.verticalCenter onEditingFinished: { @@ -496,7 +496,7 @@ Rectangle { id: videoUrlField text: QGroundControl.mavlinkLogManager.videoURL width: _valueWidth - enabled: _enableLogging + enabled: !_disableDataPersistence inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly anchors.verticalCenter: parent.verticalCenter } @@ -513,7 +513,7 @@ Rectangle { QGCComboBox { id: windCombo width: _valueWidth - enabled: _enableLogging + enabled: !_disableDataPersistence model: ListModel { id: windItems ListElement { text: "Please Select"; value: -1 } @@ -550,7 +550,7 @@ Rectangle { QGCComboBox { id: ratingCombo width: _valueWidth - enabled: _enableLogging + enabled: !_disableDataPersistence model: ListModel { id: ratingItems ListElement { text: "Please Select"; value: "notset"} @@ -591,7 +591,7 @@ Rectangle { frameVisible: false font.pointSize: ScreenTools.defaultFontPointSize text: QGroundControl.mavlinkLogManager.feedback - enabled: _enableLogging + enabled: !_disableDataPersistence style: TextAreaStyle { textColor: qgcPal.windowShade backgroundColor: qgcPal.text @@ -603,7 +603,7 @@ Rectangle { QGCCheckBox { text: qsTr("Make this log publicly available") checked: QGroundControl.mavlinkLogManager.publicLog - enabled: _enableLogging + enabled: !_disableDataPersistence onClicked: { QGroundControl.mavlinkLogManager.publicLog = checked } @@ -614,7 +614,7 @@ Rectangle { id: autoUploadCheck text: qsTr("Enable automatic log uploads") checked: QGroundControl.mavlinkLogManager.enableAutoUpload - enabled: _enableLogging + enabled: !_disableDataPersistence onClicked: { saveItems(); if(checked && QGroundControl.mavlinkLogManager.emailAddress === "") @@ -626,7 +626,7 @@ Rectangle { QGCCheckBox { text: qsTr("Delete log file after uploading") checked: QGroundControl.mavlinkLogManager.deleteAfterUpload - enabled: autoUploadCheck.checked && _enableLogging + enabled: autoUploadCheck.checked && !_disableDataPersistence onClicked: { QGroundControl.mavlinkLogManager.deleteAfterUpload = checked } -- 2.22.0