diff data/fileio/FileSource.h @ 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 12aff5a181bc
children 3a48b22fed48
line wrap: on
line diff
--- a/data/fileio/FileSource.h	Wed Sep 03 13:10:19 2014 +0100
+++ b/data/fileio/FileSource.h	Tue Sep 09 16:52:24 2014 +0100
@@ -101,10 +101,10 @@
     void waitForData();
 
     /**
-     * Return true if the FileSource object is valid and no error
-     * occurred in looking up the file or remote URL.  Non-existence
-     * of the file or URL is not an error -- call isAvailable() to
-     * test for that.
+     * Return true if the FileSource object is valid and neither error
+     * nor cancellation occurred while retrieving the file or remote
+     * URL.  Non-existence of the file or URL is not an error -- call
+     * isAvailable() to test for that.
      */
     bool isOK() const;
 
@@ -122,6 +122,14 @@
     bool isDone() const;
 
     /**
+     * Return true if the operation was cancelled by the user through
+     * the ProgressReporter interface. Note that the cancelled()
+     * signal will have been emitted, and isOK() will also return
+     * false in this case.
+     */
+    bool wasCancelled() const;
+
+    /**
      * Return true if this FileSource is referring to a QRC resource.
      */
     bool isResource() const;
@@ -227,6 +235,7 @@
     QString m_contentType;
     QString m_preferredContentType;
     bool m_ok;
+    bool m_cancelled;
     int m_lastStatus;
     bool m_resource;
     bool m_remote;