From affad4abfdd065a3c329ef40c1a46042c0562f2f Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Tue, 30 Jan 2018 13:34:44 +0100 Subject: Profile menu lists loadable profiles --- src/mainwindow/mainwindow.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/mainwindow/mainwindow.cpp') diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index b0195a5..5ee0a78 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -177,7 +177,7 @@ void MainWindow::newTab(const QUrl &url) MainWindow *MainWindow::newWindow(const QUrl &url) { - Browser *instance = static_cast(qApp->instance()); + auto *instance = dynamic_cast(QApplication::instance()); return instance->createSession(m_profile->storageName(), true, QStringList(url.toString())); } @@ -195,22 +195,16 @@ void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::about() { - AboutDialog *dlg = new AboutDialog(this); + auto *dlg = new AboutDialog(this); dlg->exec(); } -void MainWindow::showSettingsDialog() -{ - //SettingsDialog *dlg = new SettingsDialog(m_config, this); - //dlg->exec(); -} - void MainWindow::setProfile(std::shared_ptr profile) { Q_ASSERT(profile); m_profile = profile; tabBar->setProfile(profile.get()); - menuBar->setProfileName(profile->name()); + menuBar->profileAction()->setText(tr("Current profile: %1").arg(profile->name())); } WebEngineProfile *MainWindow::profile() @@ -297,9 +291,8 @@ void MainWindow::addPlugins(const QVector &plugins) if(iProfilePlugin) { QWidget *w = iProfilePlugin->createWidget(m_profile.get(), this); - auto *profileAction = new QAction(tr("Profile Action"), this); - ui->navigationToolBar->addAction(profileAction); - connect(profileAction, &QAction::triggered, this, [this, w]() { + menuBar->profileAction()->setEnabled(true); + connect(menuBar->profileAction(), &QAction::triggered, this, [this, w]() { w->setVisible(!w->isVisible()); if(w->isVisible()) { QPoint pos = ui->navigationToolBar->pos(); -- cgit v1.2.1