From a3f3e3933c4a2522e233917a6795c6e9d677e65c Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Tue, 16 Jun 2020 22:01:59 +0200 Subject: Refactoring: Changes internal structure of requests and unifies a lot of code. Now all errors are handled the same. --- src/webclient.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/webclient.cpp') diff --git a/src/webclient.cpp b/src/webclient.cpp index eb5f85e..b317692 100644 --- a/src/webclient.cpp +++ b/src/webclient.cpp @@ -3,8 +3,8 @@ #include #include -WebClient::WebClient(QObject *parent) : - QObject(parent), +WebClient::WebClient() : + ProtocolHandler(nullptr), current_reply(nullptr) { manager.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy); @@ -15,6 +15,11 @@ WebClient::~WebClient() } +bool WebClient::supportsScheme(const QString &scheme) const +{ + return (scheme == "https") or (scheme == "http"); +} + bool WebClient::startRequest(const QUrl &url) { if(url.scheme() != "http" and url.scheme() != "https") @@ -67,7 +72,7 @@ void WebClient::on_finished() if(this->current_reply->error() != QNetworkReply::NoError) { qDebug() << "web network error" << this->current_reply->errorString(); - emit this->requestFailed(this->current_reply->errorString()); + emit this->networkError(UnknownError, this->current_reply->errorString()); } else { -- cgit v1.2.3