From 093bfcc50d5889358ed806096ac5652a9e925cfc Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Sun, 7 Jun 2020 01:06:07 +0200 Subject: Implements multi-protocol support. Adds support for HTTP/HTTPS, adds settings to enable/disable protocols --- src/webclient.hpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/webclient.hpp (limited to 'src/webclient.hpp') 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 +#include + +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 -- cgit v1.2.3