aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-06-23 12:50:10 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-06-23 12:50:10 +0200
commit41329fae5f819eee8c394571125f11f0a0b67cd9 (patch)
treee8e36f9b8458ee809114714e497c4a43a19949ef /src
parentAdd Configuration::setValue and Configuration::setShortcut (diff)
downloadsmolbote-41329fae5f819eee8c394571125f11f0a0b67cd9.tar.xz
Add ConfigurationEditor plugin
Removed poi-config
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 56eed96..e266024 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -70,6 +70,13 @@ void Browser::registerPlugin(const Plugin &plugin)
});
}
+ if(plugin.instance->inherits("ConfigurationInterface")) {
+ auto *configEditor = qobject_cast<ConfigurationInterface *>(plugin.instance);
+ Q_CHECK_PTR(configEditor);
+
+ configEditor->setConfiguration(m_config.get());
+ }
+
m_plugins.append(plugin);
}
@@ -193,15 +200,17 @@ MainWindow *Browser::createWindow()
window->addAction(MainWindow::ToolsMenu, downloadsAction);
for(const Plugin &p : qAsConst(m_plugins)) {
- if(p.instance->inherits("ProfileInterface")) {
- auto *profileEditor = qobject_cast<ProfileInterface *>(p.instance);
- auto *profileAction = new QAction(tr("Profile"), window);
- profileAction->setShortcut(p.shortcut);
- connect(profileAction, &QAction::triggered, window, [profileEditor]() {
- profileEditor->createWidget(nullptr)->show();
- });
- window->addAction(MainWindow::ToolsMenu, profileAction);
- }
+ auto *plugin = qobject_cast<PluginInterface *>(p.instance);
+ Q_CHECK_PTR(plugin);
+
+ auto *pluginAction = new QAction(p.name, window);
+ pluginAction->setShortcut(p.shortcut);
+
+ connect(pluginAction, &QAction::triggered, window, [=]() {
+ plugin->createWidget(window)->exec();
+ });
+ window->addAction(MainWindow::ToolsMenu, pluginAction);
+
}
m_windows.append(window);