aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2020-12-27 19:00:30 +1100
committerFelix Queißner <felix@ib-queissner.de>2020-12-27 11:01:48 +0100
commit346618c52e9c9e6d6fe9e91f0ef1a84c05210dc8 (patch)
tree0f23de9258d7cc0025741d60642aa7c766cd4f42 /src/mainwindow.cpp
parentb6ac752e32e6871fbe3226334aabc8e9af7c294b (diff)
downloadkristall-346618c52e9c9e6d6fe9e91f0ef1a84c05210dc8.tar.gz
Window title now contains page title
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index fc0d94e..91a865f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -149,6 +149,17 @@ void MainWindow::viewPageSource()
}
}
+void MainWindow::updateWindowTitle()
+{
+ BrowserTab * tab = qobject_cast<BrowserTab*>(this->ui->browser_tabs->currentWidget());
+ if (tab == nullptr || tab->page_title.isEmpty())
+ {
+ this->setWindowTitle("Kristall");
+ return;
+ }
+ this->setWindowTitle(QString("%0 - %1").arg(tab->page_title, "Kristall"));
+}
+
void MainWindow::on_browser_tabs_currentChanged(int index)
{
if(index >= 0) {
@@ -176,6 +187,7 @@ void MainWindow::on_browser_tabs_currentChanged(int index)
this->ui->history_view->setModel(nullptr);
this->setFileStatus(DocumentStats { });
}
+ updateWindowTitle();
}
//void MainWindow::on_favourites_view_doubleClicked(const QModelIndex &index)
@@ -205,6 +217,11 @@ void MainWindow::on_tab_titleChanged(const QString &title)
int index = this->ui->browser_tabs->indexOf(tab);
assert(index >= 0);
this->ui->browser_tabs->setTabText(index, title);
+
+ if (tab == this->ui->browser_tabs->currentWidget())
+ {
+ updateWindowTitle();
+ }
}
}