Mercurial > hg > svcore
comparison data/fileio/FileSource.h @ 762:3b2409646cc0 qt5
Get FileSource building
author | Chris Cannam |
---|---|
date | Mon, 11 Mar 2013 13:42:01 +0000 |
parents | 579b2da21e7a |
children | 95d4a59295b7 |
comparison
equal
deleted
inserted
replaced
761:dc87569a196e | 762:3b2409646cc0 |
---|---|
18 | 18 |
19 #include <QUrl> | 19 #include <QUrl> |
20 #include <QMutex> | 20 #include <QMutex> |
21 #include <QString> | 21 #include <QString> |
22 #include <QTimer> | 22 #include <QTimer> |
23 #include <QNetworkReply> | |
23 | 24 |
24 #include <map> | 25 #include <map> |
25 | 26 |
26 #include "base/Debug.h" | 27 #include "base/Debug.h" |
27 | 28 |
28 class QFtp; | |
29 class QHttp; | |
30 class QFile; | 29 class QFile; |
31 class QHttpResponseHeader; | |
32 class ProgressReporter; | 30 class ProgressReporter; |
33 | 31 |
34 /** | 32 /** |
35 * FileSource is a class used to refer to the contents of a file that | 33 * FileSource is a class used to refer to the contents of a file that |
36 * may be either local or at a remote location such as a HTTP URL. | 34 * may be either local or at a remote location such as a HTTP URL. |
208 * local file is complete (if no error has occurred). | 206 * local file is complete (if no error has occurred). |
209 */ | 207 */ |
210 void ready(); | 208 void ready(); |
211 | 209 |
212 protected slots: | 210 protected slots: |
213 void dataReadProgress(int done, int total); | 211 void metadataChanged(); |
214 void httpResponseHeaderReceived(const QHttpResponseHeader &resp); | 212 void readyRead(); |
215 void ftpCommandFinished(int, bool); | 213 void replyFailed(QNetworkReply::NetworkError); |
216 void dataTransferProgress(qint64 done, qint64 total); | 214 void replyFinished(); |
217 void done(bool error); | 215 void downloadProgress(qint64 done, qint64 total); |
218 void cancelled(); | 216 void cancelled(); |
219 | 217 |
220 protected: | 218 protected: |
221 FileSource &operator=(const FileSource &); // not provided | 219 FileSource &operator=(const FileSource &); // not provided |
222 | 220 |
223 QUrl m_url; | 221 QUrl m_url; |
224 QFtp *m_ftp; | |
225 QHttp *m_http; | |
226 QFile *m_localFile; | 222 QFile *m_localFile; |
223 QNetworkReply *m_reply; | |
227 QString m_localFilename; | 224 QString m_localFilename; |
228 QString m_errorString; | 225 QString m_errorString; |
229 QString m_contentType; | 226 QString m_contentType; |
230 QString m_preferredContentType; | 227 QString m_preferredContentType; |
231 bool m_ok; | 228 bool m_ok; |
242 static RemoteLocalMap m_remoteLocalMap; | 239 static RemoteLocalMap m_remoteLocalMap; |
243 static QMutex m_mapMutex; | 240 static QMutex m_mapMutex; |
244 bool m_refCounted; | 241 bool m_refCounted; |
245 | 242 |
246 void init(); | 243 void init(); |
247 void initHttp(); | 244 void initRemote(); |
248 void initFtp(); | |
249 | 245 |
250 void cleanup(); | 246 void cleanup(); |
251 | 247 |
252 // Create a local file for m_url. If it already existed, return true. | 248 // Create a local file for m_url. If it already existed, return true. |
253 // The local filename is stored in m_localFilename. | 249 // The local filename is stored in m_localFilename. |