diff --git a/src/ViewWidgets/LogDownloadController.cc b/src/ViewWidgets/LogDownloadController.cc index 1affbea7fb6a989a7c74f5c9716d77aae7e9988d..b570d77224f3e3bd9ebeed9601631058ac8c3a4f 100644 --- a/src/ViewWidgets/LogDownloadController.cc +++ b/src/ViewWidgets/LogDownloadController.cc @@ -326,8 +326,7 @@ LogDownloadController::_receivedAllData() _requestLogData(_downloadData->ID, 0, _downloadData->entry->size()); } else { _resetSelection(); - _downloadingLogs = false; - emit downloadingLogsChanged(); + _setDownloading(false); } } @@ -456,8 +455,7 @@ LogDownloadController::download(void) } } //-- Start download process - _downloadingLogs = true; - emit downloadingLogsChanged(); + _setDownloading(true); _receivedAllData(); } } @@ -545,6 +543,15 @@ LogDownloadController::_prepareLogDownload() return result; } +//---------------------------------------------------------------------------------------- +void +LogDownloadController::_setDownloading(bool active) +{ + _downloadingLogs = active; + _vehicle->setConnectionLostEnabled(!active); + emit downloadingLogsChanged(); +} + //---------------------------------------------------------------------------------------- void LogDownloadController::eraseAll(void) @@ -577,8 +584,7 @@ LogDownloadController::cancel(void) _downloadData = 0; } _resetSelection(true); - _downloadingLogs = false; - emit downloadingLogsChanged(); + _setDownloading(false); } //----------------------------------------------------------------------------- diff --git a/src/ViewWidgets/LogDownloadController.h b/src/ViewWidgets/LogDownloadController.h index 21010acc13c08b53fc6e36112d9cfab3031b7c60..99c909b52caeba16e0c44c34a8de1f5d50d246bb 100644 --- a/src/ViewWidgets/LogDownloadController.h +++ b/src/ViewWidgets/LogDownloadController.h @@ -176,6 +176,7 @@ private: void _requestLogList (uint32_t start = 0, uint32_t end = 0xFFFF); void _requestLogData (uint8_t id, uint32_t offset = 0, uint32_t count = 0xFFFFFFFF); bool _prepareLogDownload(); + void _setDownloading (bool active); QGCLogEntry* _getNextSelected();