diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-05-28 12:32:34 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-05-28 12:32:34 +0200 |
commit | 7665ed207b67eeebde62d243c96f12054e884a4d (patch) | |
tree | 4108cc6a5c9cd19aa723af129255095024753ba7 /src/mainwindow | |
parent | Show profile name in window title (diff) | |
download | smolbote-7665ed207b67eeebde62d243c96f12054e884a4d.tar.xz |
Show view profile instead of window profile in title
Diffstat (limited to 'src/mainwindow')
-rw-r--r-- | src/mainwindow/window.cpp | 18 | ||||
-rw-r--r-- | src/mainwindow/window.h | 2 |
2 files changed, 7 insertions, 13 deletions
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<QString, QString> &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<WebView *>(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<WebView *>(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<WebView *>(tabWidget->widget(i)); - const auto url = view->url(); - view->setPage(new WebPage(profile, view)); - view->load(url); + view->setProfile(profile); } } diff --git a/src/mainwindow/window.h b/src/mainwindow/window.h index 4d15e8d..6431466 100644 --- a/src/mainwindow/window.h +++ b/src/mainwindow/window.h @@ -24,8 +24,6 @@ public: explicit Window(const QHash<QString, QString> &config, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); ~Window() override; - void setWindowTitle(const QString &title); - WebView *currentView(); WebView *view(int index) const; |