aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-06-24 10:23:13 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2017-06-24 10:23:13 +0200
commit7f686d7740cab02f92d158df487341dbc0513b61 (patch)
treee4a8e255309458ae4bc536652ed80d063a3e2753 /src/mainwindow.cpp
parentFixed crash when closing last tab (diff)
downloadsmolbote-7f686d7740cab02f92d158df487341dbc0513b61.tar.xz
Some MainWindow and WebViewTabBar cleanup
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp15
1 files changed, 7 insertions, 8 deletions
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();
}