aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 913885d..4306afd 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -308,24 +308,25 @@ void MainWindow::handleTitleUpdated(const QString &title)
//setWindowTitle(browser->settings()->value("window.title").toString().replace("title", title).replace("profile", tabBar->profile()->name()));
}
-void MainWindow::addPlugins(QVector<PluginInterface *> &plugins) {
- for(PluginInterface *plugin : plugins) {
- ProfileInterface *profilePlugin = dynamic_cast<ProfileInterface *>(plugin);
- QWidget *w = profilePlugin->createWidget(m_profile.get(), this);
-
- QAction *profileAction = new QAction(this);
- profileAction->setText("Profile Action");
- ui->navigationToolBar->addAction(profileAction);
- connect(profileAction, &QAction::triggered, this, [this, w]() {
- w->setVisible(!w->isVisible());
- if(w->isVisible()) {
- w->adjustSize();
- QPoint pos = ui->navigationToolBar->pos();
- pos.setX(pos.x() + ui->navigationToolBar->width() - w->width());
- pos.setY(pos.y() + ui->navigationToolBar->height());
- w->move(mapToGlobal(pos));
- w->show();
- }
- });
+void MainWindow::addPlugins(const QVector<Browser::Plugin> &plugins)
+{
+ for(const Browser::Plugin &plugin : plugins) {
+ ProfileInterface *iProfilePlugin = qobject_cast<ProfileInterface *>(plugin.pointer);
+ 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]() {
+ w->setVisible(!w->isVisible());
+ if(w->isVisible()) {
+ QPoint pos = ui->navigationToolBar->pos();
+ pos.setX(pos.x() + ui->navigationToolBar->width() - w->width());
+ pos.setY(pos.y() + ui->navigationToolBar->height());
+ w->move(mapToGlobal(pos));
+ w->show();
+ }
+ });
+ }
}
}