diff options
| author | Mike Skec <skec@protonmail.ch> | 2020-12-24 18:27:04 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2020-12-24 09:21:59 +0100 |
| commit | 9ee987f8216b412957ffcb46c01bbe268b282746 (patch) | |
| tree | 971602fd748c29f5a9e4defe555f9d581430ebb3 /src/browsertab.cpp | |
| parent | 237d3a8bc9ed6be7196115e0c7b640ca59349b1d (diff) | |
| download | kristall-9ee987f8216b412957ffcb46c01bbe268b282746.tar.gz | |
theme changes are now reflected instantly upon confirmation.
Diffstat (limited to 'src/browsertab.cpp')
| -rw-r--r-- | src/browsertab.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp index e88225b..22360aa 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -447,8 +447,23 @@ void BrowserTab::on_requestComplete(const QByteArray &ref_data, const QString &m } } + renderPage(data, mime); + + QString title = this->current_location.toString(); + emit this->titleChanged(title); + + this->current_stats.file_size = ref_data.size(); + this->current_stats.mime_type = mime; + this->current_stats.loading_time = this->timer.elapsed(); + emit this->fileLoaded(this->current_stats); + + this->successfully_loaded = true; +} + +void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime) +{ this->current_mime = mime; - this->current_buffer = ref_data; + this->current_buffer = data; this->graphics_scene.clear(); this->ui->text_browser->setText(""); @@ -574,7 +589,7 @@ void BrowserTab::on_requestComplete(const QByteArray &ref_data, const QString &m else if (mime.is("video") or mime.is("audio")) { doc_type = Media; - this->ui->media_browser->setMedia(data, this->current_location, mime_text); + this->ui->media_browser->setMedia(data, this->current_location, mime.type); } else { @@ -590,7 +605,7 @@ Info: MIME Type: %1 File Size: %2 )md") - .arg(mime_text) + .arg(mime.type) .arg(IoUtil::size_human(data.size()))); } @@ -603,21 +618,18 @@ File Size: %2 this->ui->text_browser->setDocument(document.get()); this->current_document = std::move(document); - emit this->locationChanged(this->current_location); + this->needs_rerender = false; - QString title = this->current_location.toString(); - emit this->titleChanged(title); - - this->current_stats.file_size = ref_data.size(); - this->current_stats.mime_type = mime; - this->current_stats.loading_time = this->timer.elapsed(); - emit this->fileLoaded(this->current_stats); - - this->successfully_loaded = true; + emit this->locationChanged(this->current_location); this->updateUI(); } +void BrowserTab::rerenderPage() +{ + this->renderPage(this->current_buffer, this->current_mime); +} + void BrowserTab::on_inputRequired(const QString &query, const bool is_sensitive) { this->network_timeout_timer.stop(); |
