diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f57cab9..913885d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -17,7 +17,6 @@ #include <bookmarks/bookmarkswidget.h> #include <downloads/downloadswidget.h> #include <navigation/urllineedit.h> -#include <settings/configuration.h> #include <settings/settingsdialog.h> MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) @@ -308,3 +307,25 @@ void MainWindow::handleTitleUpdated(const QString &title) setWindowTitle(t); //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(); + } + }); + } +} |