diff data/fileio/FileSource.cpp @ 981:c6f2b93a7d52

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 613ee830de5e
children 60e2927b1475
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp	Wed Sep 03 13:10:19 2014 +0100
+++ b/data/fileio/FileSource.cpp	Tue Sep 09 16:52:24 2014 +0100
@@ -78,6 +78,7 @@
     m_reply(0),
     m_preferredContentType(preferredContentType),
     m_ok(false),
+    m_cancelled(false),
     m_lastStatus(0),
     m_resource(fileOrUrl.startsWith(':')),
     m_remote(isRemote(fileOrUrl)),
@@ -167,6 +168,7 @@
     m_localFile(0),
     m_reply(0),
     m_ok(false),
+    m_cancelled(false),
     m_lastStatus(0),
     m_resource(false),
     m_remote(isRemote(url.toString())),
@@ -199,6 +201,7 @@
     m_localFile(0),
     m_reply(0),
     m_ok(rf.m_ok),
+    m_cancelled(rf.m_cancelled),
     m_lastStatus(rf.m_lastStatus),
     m_resource(rf.m_resource),
     m_remote(rf.m_remote),
@@ -571,6 +574,12 @@
 }
 
 bool
+FileSource::wasCancelled() const
+{
+    return m_cancelled;
+}
+
+bool
 FileSource::isResource() const
 {
     return m_resource;
@@ -710,6 +719,7 @@
     cleanup();
 
     m_ok = false;
+    m_cancelled = true;
     m_errorString = tr("Download cancelled");
 }