#ifndef DOWNLOADMANAGER_H #define DOWNLOADMANAGER_H #include #include #include #include #include #include #include class DownloadManager: public QObject { Q_OBJECT private: DownloadManager(QObject *parent = 0); public: static DownloadManager* getInstance() { static DownloadManager instance; return &instance; } public: void append(const QUrl &url); void append(const QStringList &urlList); void startNextDownload(); void abortDownload(QString name); signals: void finishedAllDownloads(); void fileDownloadFinished(QString filename, QString msg); void updateDownloadProgress(QString msg); private slots: void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); void downloadFinished(); void downloadReadyRead(); private: QNetworkAccessManager manager; QQueue downloadQueue; QNetworkReply *currentDownload; QFile output; QTime downloadTime; QString download_name; int downloadedCount; int totalCount; }; #endif // DOWNLOADMANAGER_H