1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #ifndef DOWNLOADMANAGER_H
- #define DOWNLOADMANAGER_H
- #include <QFile>
- #include <QObject>
- #include <QQueue>
- #include <QTime>
- #include <QUrl>
- #include <QLabel>
- #include <QNetworkAccessManager>
- //#include "textprogressbar.h"
- class DownloadManager: public QObject
- {
- Q_OBJECT
- public:
- DownloadManager(QObject *parent = 0);
- void append(const QUrl &url);
- void append(const QStringList &urlList);
- void startNextDownload();
- void abortDownload(QString name);
- signals:
- void finished();
- void cancelDownload();
- private slots:
- void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
- void downloadFinished();
- void downloadReadyRead();
- private:
- QNetworkAccessManager manager;
- QQueue<QUrl> downloadQueue;
- QNetworkReply *currentDownload;
- QFile output;
- QTime downloadTime;
- QString download_name;
- int downloadedCount;
- int totalCount;
- };
- #endif // DOWNLOADMANAGER_H
|