aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-30 13:34:44 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-30 13:34:44 +0100
commitaffad4abfdd065a3c329ef40c1a46042c0562f2f (patch)
tree49368a9f941ef4192c3a5e10bd7007ce84867100 /src/mainwindow
parentAdded profile and plugin list to About dialog (diff)
downloadsmolbote-affad4abfdd065a3c329ef40c1a46042c0562f2f.tar.xz
Profile menu lists loadable profiles
Diffstat (limited to 'src/mainwindow')
-rw-r--r--src/mainwindow/mainwindow.cpp17
-rw-r--r--src/mainwindow/mainwindow.h1
2 files changed, 5 insertions, 13 deletions
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<Browser *>(qApp->instance());
+ auto *instance = dynamic_cast<Browser *>(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<WebEngineProfile> 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<Browser::Plugin> &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();
diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h
index 0965b43..f9e0515 100644
--- a/src/mainwindow/mainwindow.h
+++ b/src/mainwindow/mainwindow.h
@@ -53,7 +53,6 @@ public:
public slots:
void about();
- void showSettingsDialog();
void newTab(const QUrl &url = QUrl(""));
MainWindow *newWindow(const QUrl &url = QUrl(""));