]> sigrok.org Git - pulseview.git/commitdiff
Save dialog: Fix cancellation
authorRalf <redacted>
Sun, 10 Jan 2021 09:07:14 +0000 (10:07 +0100)
committerSoeren Apel <redacted>
Tue, 22 Jun 2021 16:51:18 +0000 (18:51 +0200)
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

pv/dialogs/storeprogress.cpp
pv/dialogs/storeprogress.hpp

index 8699ccefdfbcca6fe2bae451f9c34072d0848717..295e98fa58053f025d388456e8520bc39ac028e4 100644 (file)
@@ -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
index 730a9e423d9a51aec37d2b9177106288202770fe..f355acc69e2f3b6c8ff35eac2a389d2b93aa56e9 100644 (file)
@@ -62,6 +62,7 @@ private:
 
 private Q_SLOTS:
        void on_progress_updated();
+       void on_cancel();
 
 private:
        pv::StoreSession session_;