aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-11-22 10:23:47 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-11-22 10:23:47 +0100
commit240fb8427a89d0aa78da07c8d147a0d57df5bb67 (patch)
treeaa4d46020f89e3d5dfc0b5fb24bc7190acbfe60c /src
parentAdd link to GPL to About dialog (diff)
downloadsmolbote-240fb8427a89d0aa78da07c8d147a0d57df5bb67.tar.xz
Add AboutPlugin dialog
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp39
-rw-r--r--src/mainwindow/mainwindow.ui8
2 files changed, 33 insertions, 14 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 8ff8616..0bd3d06 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -7,11 +7,21 @@
*/
#include "browser.h"
+#include "aboutdialog.h"
+#include "aboutplugin.h"
#include "addressbar.h"
+#include "bookmarkswidget.h"
+#include "config.h"
+#include "configuration.h"
+#include "downloadswidget.h"
#include "mainwindow/mainwindow.h"
+#include "profilemanager.h"
#include "subwindow/subwindow.h"
+#include "ui_mainwindow.h"
#include "util.h"
+#include "webengine/filter.h"
#include "webengine/urlinterceptor.h"
+#include "webprofile.h"
#include <QAction>
#include <QDir>
#include <QFileInfo>
@@ -20,18 +30,9 @@
#include <QJsonDocument>
#include <QPluginLoader>
#include <QTimer>
-#include "aboutdialog.h"
-#include "bookmarkswidget.h"
-#include "configuration.h"
-#include "downloadswidget.h"
-#include <version.h>
-#include "profilemanager.h"
-#include "webprofile.h"
-#include "webengine/filter.h"
-#include <QPluginLoader>
-#include <plugininterface.h>
-#include "config.h"
#include <QVersionNumber>
+#include <plugininterface.h>
+#include <version.h>
Browser::Browser(int &argc, char *argv[], bool allowSecondary)
: SingleApplication(argc, argv, allowSecondary, SingleApplication::User | SingleApplication::SecondaryNotification | SingleApplication::ExcludeAppVersion)
@@ -69,12 +70,12 @@ const QStringList Browser::configurationOptions() const
return options;
}
-const QString Browser::configuration(const QString& key) const
+const QString Browser::configuration(const QString &key) const
{
return m_config->value<QString>(qUtf8Printable(key)).value_or(QString());
}
-void Browser::setConfiguration(const QString& key, const QString& value)
+void Browser::setConfiguration(const QString &key, const QString &value)
{
m_config->setValue(qUtf8Printable(key), value);
}
@@ -223,6 +224,18 @@ MainWindow *Browser::createWindow()
connect(window->addressBar, &AddressBar::complete, m_bookmarks.get(), &BookmarksWidget::search);
connect(window, &MainWindow::createBookmark, m_bookmarks.get(), &BookmarksWidget::addBookmark);
+ connect(window->ui->menuTools, &QMenu::aboutToShow, this, [this, window]() {
+ window->ui->menuPlugins->clear();
+
+ for(const QPluginLoader *l : m_plugins) {
+ auto *action = window->ui->menuPlugins->addAction(l->metaData()[QLatin1String("MetaData")].toObject()[QLatin1String("name")].toString());
+ connect(action, &QAction::triggered, this, [l, window]() {
+ auto *dlg = new AboutPluginDialog(l, window);
+ dlg->exec();
+ });
+ }
+ });
+
auto *bookmarksAction = new QAction(tr("Bookmarks"), window);
m_config->setShortcut(bookmarksAction, "bookmarks.shortcut");
connect(bookmarksAction, &QAction::triggered, window, [this, window]() {
diff --git a/src/mainwindow/mainwindow.ui b/src/mainwindow/mainwindow.ui
index cb6d39e..ad213c6 100644
--- a/src/mainwindow/mainwindow.ui
+++ b/src/mainwindow/mainwindow.ui
@@ -20,7 +20,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
- <height>23</height>
+ <height>30</height>
</rect>
</property>
<widget class="QMenu" name="menusmolbote">
@@ -55,6 +55,12 @@
<property name="title">
<string>Too&amp;ls</string>
</property>
+ <widget class="QMenu" name="menuPlugins">
+ <property name="title">
+ <string>&amp;Plugins</string>
+ </property>
+ </widget>
+ <addaction name="menuPlugins"/>
</widget>
<widget class="QMenu" name="menuPage">
<property name="title">