From 7665ed207b67eeebde62d243c96f12054e884a4d Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 28 May 2018 12:32:34 +0200 Subject: Show view profile instead of window profile in title --- src/mainwindow/window.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/mainwindow/window.cpp') diff --git a/src/mainwindow/window.cpp b/src/mainwindow/window.cpp index 3d7d037..273aa0a 100644 --- a/src/mainwindow/window.cpp +++ b/src/mainwindow/window.cpp @@ -103,10 +103,13 @@ Window::Window(const QHash &config, QWidget *parent, Qt::Windo disconnect(titleConnection); disconnect(linkHoveredConnection); - connect(view, &WebView::titleChanged, this, &Window::setWindowTitle); - setWindowTitle(view->title()); + titleConnection = connect(view, &WebView::titleChanged, this, [this](const QString &title) { + auto *v = qobject_cast(sender()); + this->setWindowTitle(QString("%1 :%2").arg(title, v->profile()->name())); + }); + setWindowTitle(QString("%1 :%2").arg(view->title(), view->profile()->name())); - connect(view->page(), &WebPage::linkHovered, this, [this](const QString &url) { + linkHoveredConnection = connect(view->page(), &WebPage::linkHovered, this, [this](const QString &url) { if(!url.isEmpty()) emit showStatusMessage(url, 3000); }); @@ -121,11 +124,6 @@ Window::~Window() delete tabWidget; } -void Window::setWindowTitle(const QString &title) -{ - QMdiSubWindow::setWindowTitle(QString("%1 :%2").arg(title, profile->name())); -} - WebView *Window::currentView() { return qobject_cast(tabWidget->currentWidget()); @@ -142,9 +140,7 @@ void Window::setProfile(WebProfile *profile) this->profile = profile; for(int i = 0; i < tabWidget->count(); ++i) { auto *view = qobject_cast(tabWidget->widget(i)); - const auto url = view->url(); - view->setPage(new WebPage(profile, view)); - view->load(url); + view->setProfile(profile); } } -- cgit v1.2.1