From: Ralf Date: Sun, 10 Jan 2021 09:07:14 +0000 (+0100) Subject: Save dialog: Fix cancellation X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=cd38c84cb223ba9ecb01d9b0fc0ac11cd9e1d7a1;p=pulseview.git Save dialog: Fix cancellation Without the fix cancellation of save data does not work How to reproduce: 1. Start PV with demo device and generate sufficient data, e.g. demo device 1GSa/s, 10MSa 2. Save data (should take at least 30s) and try to cancel saving 3. PV continues saving data and dialog reappears after next progress update --- diff --git a/pv/dialogs/storeprogress.cpp b/pv/dialogs/storeprogress.cpp index 8699ccef..295e98fa 100644 --- a/pv/dialogs/storeprogress.cpp +++ b/pv/dialogs/storeprogress.cpp @@ -50,6 +50,7 @@ StoreProgress::StoreProgress(const QString &file_name, this, SLOT(on_progress_updated())); connect(&session_, SIGNAL(store_successful()), &session, SLOT(on_data_saved())); + connect(this, SIGNAL(canceled()), this, SLOT(on_cancel())); // Since we're not setting any progress in case of an error, the dialog // will pop up after the minimumDuration time has been reached - 4000 ms @@ -117,5 +118,10 @@ void StoreProgress::on_progress_updated() } } +void StoreProgress::on_cancel() +{ + session_.cancel(); +} + } // namespace dialogs } // namespace pv diff --git a/pv/dialogs/storeprogress.hpp b/pv/dialogs/storeprogress.hpp index 730a9e42..f355acc6 100644 --- a/pv/dialogs/storeprogress.hpp +++ b/pv/dialogs/storeprogress.hpp @@ -62,6 +62,7 @@ private: private Q_SLOTS: void on_progress_updated(); + void on_cancel(); private: pv::StoreSession session_;