aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-08 20:32:19 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-08 20:32:19 +0200
commit24adf0b41746449a163cfd2daaa2feefd67e9d57 (patch)
treefc9406213734ea898968067aa43482621d167cec /src
parente6e28fd4814e1f513773288710e1bcb3cfad0028 (diff)
downloadkristall-24adf0b41746449a163cfd2daaa2feefd67e9d57.tar.gz
Adds loading progress display.
Diffstat (limited to 'src')
-rw-r--r--src/browsertab.cpp8
-rw-r--r--src/browsertab.hpp2
-rw-r--r--src/geminiclient.cpp1
-rw-r--r--src/geminiclient.hpp2
-rw-r--r--src/gopherclient.cpp1
-rw-r--r--src/gopherclient.hpp2
-rw-r--r--src/webclient.cpp1
-rw-r--r--src/webclient.hpp2
8 files changed, 19 insertions, 0 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index 3f9f5bb..33d67e6 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -34,8 +34,10 @@ BrowserTab::BrowserTab(MainWindow * mainWindow) :
connect(&web_client, &WebClient::requestComplete, this, &BrowserTab::on_requestComplete);
connect(&web_client, &WebClient::requestFailed, this, &BrowserTab::on_requestFailed);
+ connect(&web_client, &WebClient::requestProgress, this, &BrowserTab::on_requestProgress);
connect(&gemini_client, &GeminiClient::requestComplete, this, &BrowserTab::on_requestComplete);
+ connect(&gemini_client, &GeminiClient::requestProgress, this, &BrowserTab::on_requestProgress);
connect(&gemini_client, &GeminiClient::protocolViolation, this, &BrowserTab::on_protocolViolation);
connect(&gemini_client, &GeminiClient::inputRequired, this, &BrowserTab::on_inputRequired);
connect(&gemini_client, &GeminiClient::redirected, this, &BrowserTab::on_redirected);
@@ -47,6 +49,7 @@ BrowserTab::BrowserTab(MainWindow * mainWindow) :
connect(&gopher_client, &GopherClient::requestComplete, this, &BrowserTab::on_requestComplete);
connect(&gopher_client, &GopherClient::requestFailed, this, &BrowserTab::on_requestFailed);
+ connect(&gopher_client, &GopherClient::requestProgress, this, &BrowserTab::on_requestProgress);
this->updateUI();
@@ -530,6 +533,11 @@ void BrowserTab::on_stop_button_clicked()
gopher_client.cancelRequest();
}
+void BrowserTab::on_requestProgress(qint64 transferred)
+{
+ emit this->fileLoaded(transferred, "Loading...", timer.elapsed());
+}
+
void BrowserTab::on_back_button_clicked()
{
navOneBackback();
diff --git a/src/browsertab.hpp b/src/browsertab.hpp
index 7fc39f6..7554a7c 100644
--- a/src/browsertab.hpp
+++ b/src/browsertab.hpp
@@ -96,6 +96,8 @@ private slots:
void on_stop_button_clicked();
+ void on_requestProgress(qint64 transferred);
+
private:
void setErrorMessage(QString const & msg);
diff --git a/src/geminiclient.cpp b/src/geminiclient.cpp
index 8117a4f..0809120 100644
--- a/src/geminiclient.cpp
+++ b/src/geminiclient.cpp
@@ -78,6 +78,7 @@ void GeminiClient::socketReadyRead()
if(is_receiving_body)
{
body.append(response);
+ emit this->requestProgress(body.size());
}
else
{
diff --git a/src/geminiclient.hpp b/src/geminiclient.hpp
index 590eb5b..2578102 100644
--- a/src/geminiclient.hpp
+++ b/src/geminiclient.hpp
@@ -45,6 +45,8 @@ public:
bool cancelRequest();
signals:
+ void requestProgress(qint64 transferred);
+
void requestComplete(QByteArray const & data, QString const & mime);
void protocolViolation(QString const & reason);
diff --git a/src/gopherclient.cpp b/src/gopherclient.cpp
index 056ecd8..17faceb 100644
--- a/src/gopherclient.cpp
+++ b/src/gopherclient.cpp
@@ -66,6 +66,7 @@ void GopherClient::on_connected()
void GopherClient::on_readRead()
{
body.append(socket.readAll());
+ emit this->requestProgress(body.size());
}
void GopherClient::on_finished()
diff --git a/src/gopherclient.hpp b/src/gopherclient.hpp
index 2bf98fc..a2beb0c 100644
--- a/src/gopherclient.hpp
+++ b/src/gopherclient.hpp
@@ -20,6 +20,8 @@ public:
bool cancelRequest();
signals:
+ void requestProgress(qint64 transferred);
+
void requestComplete(QByteArray const & data, QString const & mime);
void requestFailed(QString const & message);
diff --git a/src/webclient.cpp b/src/webclient.cpp
index f3d8daa..d8e1da5 100644
--- a/src/webclient.cpp
+++ b/src/webclient.cpp
@@ -58,6 +58,7 @@ bool WebClient::cancelRequest()
void WebClient::on_data()
{
this->body.append(this->current_reply->readAll());
+ emit this->requestProgress(this->body.size());
}
void WebClient::on_finished()
diff --git a/src/webclient.hpp b/src/webclient.hpp
index bc7c13b..8cbf3ab 100644
--- a/src/webclient.hpp
+++ b/src/webclient.hpp
@@ -20,6 +20,8 @@ public:
bool cancelRequest();
signals:
+ void requestProgress(qint64 transferred);
+
void requestComplete(QByteArray const & data, QString const & mime);
void requestFailed(QString const & message);