aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-15 00:35:58 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-15 00:35:58 +0100
commit2660fff9e6191808aa83197639a663b73a27bbfa (patch)
treee01930c4202d87c5b74f701938a0004a952425a1 /src/mainwindow.cpp
parentInitial plugins testing (diff)
downloadsmolbote-2660fff9e6191808aa83197639a663b73a27bbfa.tar.xz
Moved ProfileView to ProfileEditorPlugin
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();
+ }
+ });
+ }
}
}