Mercurial > hg > svcore
comparison data/fileio/RemoteFile.h @ 304:4fc6f49436b3
* Add support for remote files to image layer
author | Chris Cannam |
---|---|
date | Fri, 05 Oct 2007 15:52:52 +0000 |
parents | ce6f65ab3327 |
children | 96ef9746c560 |
comparison
equal
deleted
inserted
replaced
303:15b47d30c085 | 304:4fc6f49436b3 |
---|---|
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 | |
24 #include <map> | |
23 | 25 |
24 class QFtp; | 26 class QFtp; |
25 class QHttp; | 27 class QHttp; |
26 class QFile; | 28 class QFile; |
27 class QProgressDialog; | 29 class QProgressDialog; |
45 QString getLocalFilename() const; | 47 QString getLocalFilename() const; |
46 QString getErrorString() const; | 48 QString getErrorString() const; |
47 | 49 |
48 void deleteLocalFile(); | 50 void deleteLocalFile(); |
49 | 51 |
52 static bool isRemote(QString fileOrUrl); | |
50 static bool canHandleScheme(QUrl url); | 53 static bool canHandleScheme(QUrl url); |
51 | 54 |
52 signals: | 55 signals: |
53 void progress(int percent); | 56 void progress(int percent); |
54 void ready(); | 57 void ready(); |
61 void done(bool error); | 64 void done(bool error); |
62 void showProgressDialog(); | 65 void showProgressDialog(); |
63 void cancelled(); | 66 void cancelled(); |
64 | 67 |
65 protected: | 68 protected: |
69 QUrl m_url; | |
66 QFtp *m_ftp; | 70 QFtp *m_ftp; |
67 QHttp *m_http; | 71 QHttp *m_http; |
68 QFile *m_localFile; | 72 QFile *m_localFile; |
69 QString m_localFilename; | 73 QString m_localFilename; |
70 QString m_errorString; | 74 QString m_errorString; |
72 int m_lastStatus; | 76 int m_lastStatus; |
73 bool m_done; | 77 bool m_done; |
74 QProgressDialog *m_progressDialog; | 78 QProgressDialog *m_progressDialog; |
75 QTimer m_progressShowTimer; | 79 QTimer m_progressShowTimer; |
76 | 80 |
81 typedef std::map<QUrl, int> RemoteRefCountMap; | |
82 typedef std::map<QUrl, QString> RemoteLocalMap; | |
83 static RemoteRefCountMap m_refCountMap; | |
84 static RemoteLocalMap m_remoteLocalMap; | |
85 static QMutex m_mapMutex; | |
86 bool m_referenced; | |
87 | |
77 void cleanup(); | 88 void cleanup(); |
78 | 89 |
79 QString createLocalFile(QUrl url); | 90 QString createLocalFile(QUrl url); |
80 | 91 |
81 static QMutex m_fileCreationMutex; | 92 static QMutex m_fileCreationMutex; |