changeset 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 7709bb9a1130
children b65ee5c4f8bc
files framework/MainWindowBase.cpp
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
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;