From 2660fff9e6191808aa83197639a663b73a27bbfa Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 15 Jan 2018 00:35:58 +0100 Subject: Moved ProfileView to ProfileEditorPlugin --- src/mainwindow.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/mainwindow.cpp') 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 &plugins) { - for(PluginInterface *plugin : plugins) { - ProfileInterface *profilePlugin = dynamic_cast(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 &plugins) +{ + for(const Browser::Plugin &plugin : plugins) { + ProfileInterface *iProfilePlugin = qobject_cast(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(); + } + }); + } } } -- cgit v1.2.1