diff options
| author | Mike Skec <skec@protonmail.ch> | 2021-01-09 15:55:52 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-01-10 13:40:46 +0100 |
| commit | c635094a6bdfcf2f081eb3c0ed9a1454ae2933fb (patch) | |
| tree | b41aca9c2803ad3acbe89c027b340b15ac473eee /src/protocols/gopherclient.cpp | |
| parent | dd3e8716b276f9f1646338f8801ca9a2f688fc46 (diff) | |
| download | kristall-c635094a6bdfcf2f081eb3c0ed9a1454ae2933fb.tar.gz | |
status bar: show request status when loading pages
status text for loading HTTP/S is only a simple 'loading webpage'. The other protocols display more information
Diffstat (limited to 'src/protocols/gopherclient.cpp')
| -rw-r--r-- | src/protocols/gopherclient.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/protocols/gopherclient.cpp b/src/protocols/gopherclient.cpp index ec0fa70..af2b141 100644 --- a/src/protocols/gopherclient.cpp +++ b/src/protocols/gopherclient.cpp @@ -1,5 +1,6 @@ #include "gopherclient.hpp" #include "ioutil.hpp" +#include "kristall.hpp" GopherClient::GopherClient(QObject *parent) : ProtocolHandler(parent) { @@ -12,6 +13,11 @@ GopherClient::GopherClient(QObject *parent) : ProtocolHandler(parent) #else connect(&socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error), this, &GopherClient::on_socketError); #endif + + connect(&socket, &QAbstractSocket::hostFound, this, [this]() { + emit this->requestStateChange(RequestState::HostFound); + }); + emit this->requestStateChange(RequestState::None); } GopherClient::~GopherClient() @@ -34,6 +40,8 @@ bool GopherClient::startRequest(const QUrl &url, RequestOptions options) if(url.scheme() != "gopher") return false; + emit this->requestStateChange(RequestState::Started); + // Second char on the URL path denotes the Gopher type // See https://tools.ietf.org/html/rfc4266 QString type = url.path().mid(1, 1); @@ -79,6 +87,8 @@ void GopherClient::on_connected() auto blob = (requested_url.path().mid(2) + "\r\n").toUtf8(); IoUtil::writeAll(socket, blob); + + emit this->requestStateChange(RequestState::Connected); } void GopherClient::on_readRead() @@ -107,6 +117,8 @@ void GopherClient::on_finished() was_cancelled = true; } body.clear(); + + emit this->requestStateChange(RequestState::None); } void GopherClient::on_socketError(QAbstractSocket::SocketError error_code) |
