diff options
Diffstat (limited to 'src/webclient.hpp')
| -rw-r--r-- | src/webclient.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/webclient.hpp b/src/webclient.hpp new file mode 100644 index 0000000..bc7c13b --- /dev/null +++ b/src/webclient.hpp @@ -0,0 +1,38 @@ +#ifndef WEBCLIENT_HPP +#define WEBCLIENT_HPP + +#include <QObject> +#include <QNetworkAccessManager> + +class WebClient: public QObject +{ +private: + Q_OBJECT +public: + explicit WebClient(QObject *parent = nullptr); + + ~WebClient() override; + + bool startRequest(QUrl const & url); + + bool isInProgress() const; + + bool cancelRequest(); + +signals: + void requestComplete(QByteArray const & data, QString const & mime); + + void requestFailed(QString const & message); + +private slots: + void on_data(); + void on_finished(); + +private: + QNetworkAccessManager manager; + QNetworkReply * current_reply; + + QByteArray body; +}; + +#endif // WEBCLIENT_HPP |
