| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef HTTPDOWNLOAD_H
- #define HTTPDOWNLOAD_H
- #include "SNCCore_global.h"
- #include <QObject>
- #include <QNetworkAccessManager>
- #include <QUrl>
- #include <QtNetwork>
- QT_BEGIN_NAMESPACE
- class QFile;
- class QSslError;
- class QAuthenticator;
- class QNetworkReply;
- QT_END_NAMESPACE
- class SNCCORESHARED_EXPORT HttpDownload : public QObject
- {
- Q_OBJECT
- public:
- explicit HttpDownload(QObject *parent = 0);
- ~HttpDownload();
- int downloadFile(QString fileUrl,QString savePath);
- private:
- void startRequest(QUrl url);
- private slots:
- void httpFinished();
- void httpReadyRead();
- void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
- private:
- QUrl url;
- QNetworkAccessManager qnam;
- QNetworkReply *reply;
- QFile *file;
- bool httpRequestAborted;
- QEventLoop loop;
- int retCode ;
- bool finish ;
-
- };
- #endif // HTTPDOWNLOAD_H
|