From 7f686d7740cab02f92d158df487341dbc0513b61 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sat, 24 Jun 2017 10:23:13 +0200 Subject: Some MainWindow and WebViewTabBar cleanup --- src/mainwindow.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 861f7cf..6944ac7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -90,8 +90,7 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : connect(tabBar, SIGNAL(currentTabChanged(WebView*)), this, SLOT(handleTabChanged(WebView*))); // Load profile - m_profile = qApp->profile(sSettings->value("browser.profile.default").toString()); - tabBar->setProfile(m_profile); + tabBar->setProfile(qApp->profile(sSettings->value("browser.profile.default").toString())); // loading bar ui->statusBar->addPermanentWidget(progressBar); @@ -181,8 +180,8 @@ void MainWindow::about() void MainWindow::setProfile(WebEngineProfile *profile) { - m_profile = profile; - tabBar->setProfile(m_profile); + Q_ASSERT(profile != nullptr); + tabBar->setProfile(profile); } void MainWindow::toggleFullscreen() @@ -201,7 +200,7 @@ void MainWindow::newWindow(const QUrl &url) void MainWindow::handleTabChanged(WebView *view) { - Q_ASSERT(view); + Q_ASSERT(view != nullptr); // centralWidget can be a nullptr if(centralWidget()) { @@ -235,15 +234,15 @@ void MainWindow::handleUrlChanged() void MainWindow::handleTitleUpdated(const QString &title) { - setWindowTitle(sSettings->value("window.title").toString().replace("title", title).replace("profile", m_profile->name())); + setWindowTitle(sSettings->value("window.title").toString().replace("title", title).replace("profile", tabBar->profile()->name())); } void MainWindow::profileAction() { - m_profile->dialog()->showProfile(); + tabBar->profile()->dialog()->showProfile(); } void MainWindow::cookiesAction() { - m_profile->dialog()->showCookies(); + tabBar->profile()->dialog()->showCookies(); } -- cgit v1.2.1