diff framework/MainWindowBase.cpp @ 413:a39a7d6b0f2d

Respond tidily to user cancellation during download, instead of going on to attempt to load the nonexistent file as a non-audio format
author Chris Cannam
date Tue, 09 Sep 2014 16:52:24 +0100
parents 41242512d544
children f32a64149602 9876a1db566c
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Sep 03 13:01:51 2014 +0100
+++ b/framework/MainWindowBase.cpp	Tue Sep 09 16:52:24 2014 +0100
@@ -1268,7 +1268,14 @@
 
 //    cerr << "template is: \"" << templateName << "\"" << endl;
 
-    if (!source.isAvailable()) return FileOpenFailed;
+    if (!source.isAvailable()) {
+        if (source.wasCancelled()) {
+            return FileOpenCancelled;
+        } else {
+            return FileOpenFailed;
+        }
+    }
+
     source.waitForData();
 
     m_openingAudioFile = true;
@@ -1286,7 +1293,11 @@
     if (!newModel->isOK()) {
 	delete newModel;
         m_openingAudioFile = false;
-	return FileOpenFailed;
+        if (source.wasCancelled()) {
+            return FileOpenCancelled;
+        } else { 
+            return FileOpenFailed;
+        }
     }
 
 //    cerr << "mode = " << mode << endl;