changeset 1911:2160976df436 import-audio-data

Use progress dialog when importing audio data
author Chris Cannam
date Fri, 29 Jun 2018 13:57:29 +0100
parents 05c53d02bf7e
children a28cab68eac6
files main/MainWindow.cpp repoint-lock.json
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Thu Jun 28 15:45:13 2018 +0100
+++ b/main/MainWindow.cpp	Fri Jun 29 13:57:29 2018 +0100
@@ -2901,13 +2901,23 @@
     format.setTimeUnits(CSVFormat::TimeAudioFrames);
 
     FileOpenStatus status = FileOpenSucceeded;
+
+    ProgressDialog *dialog = new ProgressDialog(tr("Importing audio data..."),
+                                                true, 0, this,
+                                                Qt::ApplicationModal);
     
     WaveFileModel *model = qobject_cast<WaveFileModel *>
         (DataFileReaderFactory::loadCSV
          (path, format,
-          getMainModel() ? getMainModel()->getSampleRate() : rate));
-
-    if (!model || !model->isOK()) {
+          getMainModel() ? getMainModel()->getSampleRate() : rate,
+          dialog));
+
+    if (dialog->wasCancelled()) {
+
+        delete model;
+        status = FileOpenCancelled;
+
+    } else if (!model || !model->isOK()) {
 
         delete model;
         status = FileOpenFailed;
@@ -2921,6 +2931,8 @@
                                      false);
     }
 
+    delete dialog;
+    
     if (status == FileOpenFailed) {
         emit hideSplash();
         QMessageBox::critical(this, tr("Failed to open file"),
--- a/repoint-lock.json	Thu Jun 28 15:45:13 2018 +0100
+++ b/repoint-lock.json	Fri Jun 29 13:57:29 2018 +0100
@@ -4,7 +4,7 @@
       "pin": "da86fb0bccb3"
     },
     "svcore": {
-      "pin": "8d4f09552ba4"
+      "pin": "f0c2b8b31609"
     },
     "svgui": {
       "pin": "fcc1f45f7bd5"