4 #include <QNetworkAccessManager>
16 Download(const QUrl
&url
, const QString
&file
)
17 {_url
= url
; _file
= file
;}
18 const QUrl
& url() const {return _url
;}
19 const QString
& file() const {return _file
;}
27 class Downloader
: public QObject
32 Downloader(QObject
*parent
= 0);
34 bool get(const QList
<Download
> &list
);
40 void downloadFinished(QNetworkReply
*reply
);
46 Redirect() : _level(0) {}
47 Redirect(const QUrl
&origin
, int level
) :
48 _origin(origin
), _level(level
) {}
50 const QUrl
&origin() const {return _origin
;}
51 int level() const {return _level
;}
53 bool isNull() const {return (_level
== 0);}
60 bool doDownload(const Download
&dl
, const Redirect
&redirect
= Redirect());
61 bool saveToDisk(const QString
&filename
, QIODevice
*data
);
63 QNetworkAccessManager _manager
;
64 QMap
<QUrl
, QNetworkReply
*> _currentDownloads
;
65 QSet
<QUrl
> _errorDownloads
;
68 #endif // DOWNLOADER_H