aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-14 20:34:50 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-14 20:34:50 +0100
commit037b039bfbfeda2e9b7ebef7e38616575411c876 (patch)
tree6767f8edc0860b60b590dc30a37319a7c1c66a0d /src/mainwindow.cpp
parentMinor fixes (diff)
downloadsmolbote-037b039bfbfeda2e9b7ebef7e38616575411c876.tar.xz
Initial plugins testing
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp23
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();
+ }
+ });
+ }
+}