X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=app%2Fsrc%2Fhttpclient.h;fp=app%2Fsrc%2Fhttpclient.h;h=42f002cfd70b1785c13bae4e25f31d81af2fbab8;hb=5a9d121e37b110a8dce34d2a2d506412cac6b2d7;hp=0000000000000000000000000000000000000000;hpb=de4e4f75c59b1da4de91a75b3ab7b94d0ab8335f;p=apps%2Fonscreenapp.git diff --git a/app/src/httpclient.h b/app/src/httpclient.h new file mode 100644 index 0000000..42f002c --- /dev/null +++ b/app/src/httpclient.h @@ -0,0 +1,48 @@ + +#ifndef HTTPCLIENT_H +#define HTTPCLIENT_H + +#include +#include + +class QString; +class QByteArray; +class QNetworkRequest; +class QNetworkReply; +class QNetworkAccessManager; +class HttpClientPrivate; + +class HttpClient { + public: + HttpClient(const QString& url); + ~HttpClient(); + + HttpClient& manager(QNetworkAccessManager* manager); + + HttpClient& debug(bool debug); + + HttpClient& param(const QString& name, const QString& value); + + HttpClient& header(const QString& header, const QString& value); + + void get(std::function successHandler, + std::function errorHandler = NULL, + const char* encoding = "UTF-8"); + + void download( + const QString& savePath, + std::function successHandler = NULL, + std::function errorHandler = NULL, + std::function progressHandler = NULL); + + void download( + std::function readyRead, + std::function successHandler = NULL, + std::function errorHandler = NULL, + std::function progressHandler = NULL); + + private: + HttpClientPrivate* d; +}; + +#endif // !HTTPCLIENT_H