From b917b6099ab8477488f0f352339aa6fca2235c36 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Fri, 5 Jun 2020 10:44:38 +0200 Subject: Starts to implement navigation history. --- browsertab.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'browsertab.cpp') diff --git a/browsertab.cpp b/browsertab.cpp index d7c974b..357454f 100644 --- a/browsertab.cpp +++ b/browsertab.cpp @@ -180,7 +180,6 @@ void BrowserTab::on_gemini_complete(const QByteArray &data, const QString &mime) auto * item = this->graphics_scene.addText("Failed to load picture!"); } - this->ui->graphics_browser->fitInView(graphics_scene.sceneRect(), Qt::KeepAspectRatio); } @@ -189,6 +188,8 @@ void BrowserTab::on_gemini_complete(const QByteArray &data, const QString &mime) this->ui->text_browser->setText(QString("Unsupported Mime: %1").arg(mime)); } + this->pushToHistory(this->current_location); + this->successfully_loaded = true; this->updateUI(); } @@ -330,7 +331,7 @@ void BrowserTab::setErrorMessage(const QString &msg) void BrowserTab::pushToHistory(const QUrl &url) { - this->navigation_history.append(url); + this->history.pushUrl(url); this->updateUI(); } @@ -382,8 +383,8 @@ void BrowserTab::on_text_browser_highlighted(const QUrl &url) void BrowserTab::updateUI() { - // this->ui->back_button->setEnabled(this->navigation_history.size() > 0); - // this->ui->forward_button->setEnabled(false); + this->ui->back_button->setEnabled(this->history.canGoBack()); + this->ui->forward_button->setEnabled(this->history.canGoForward()); this->ui->refresh_button->setEnabled(this->successfully_loaded); -- cgit v1.2.3