diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-16 22:01:59 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-16 22:01:59 +0200 |
| commit | a3f3e3933c4a2522e233917a6795c6e9d677e65c (patch) | |
| tree | 6e1bd483bbd5e8ca6fee4566e544de48bfa754a6 /src/webclient.cpp | |
| parent | bc18d9356828f1ae40d3b4ce5432b30ca13cfc15 (diff) | |
| download | kristall-a3f3e3933c4a2522e233917a6795c6e9d677e65c.tar.gz | |
Refactoring: Changes internal structure of requests and unifies a lot of code. Now all errors are handled the same.
Diffstat (limited to 'src/webclient.cpp')
| -rw-r--r-- | src/webclient.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
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 <QNetworkRequest> #include <QNetworkReply> -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 { |
