aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-06-21 15:32:05 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-06-21 15:32:05 +0200
commitd9d213c80353b843c18af6e49db61fa77039f056 (patch)
tree21eaa71e62e88815a5c1caa9e0b0f273a6f63b1d /src
parentAddressBar: code cleanup (diff)
downloadsmolbote-d9d213c80353b843c18af6e49db61fa77039f056.tar.xz
Add Browser::about
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/browser.cpp11
-rw-r--r--src/browser.h4
-rw-r--r--src/mainwindow/mainwindow.cpp8
4 files changed, 18 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cf66a53..00b556f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -70,7 +70,7 @@ endif(Plasma)
target_compile_definitions(poi
PRIVATE QTBUG_65223_WORKAROUND
- PRIVATE QTBUG_68224_WORKAROUND
+ #PRIVATE QTBUG_68224_WORKAROUND
)
install(TARGETS poi RUNTIME DESTINATION bin CONFIGURATIONS Release)
diff --git a/src/browser.cpp b/src/browser.cpp
index e3857dc..e55d063 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -22,6 +22,7 @@
#include <QFileInfoList>
#include <QPluginLoader>
#include <QJsonArray>
+#include <about/aboutdialog.h>
inline Plugin loadPluginFromPath(const QString &path)
{
@@ -103,6 +104,15 @@ Browser::~Browser()
}
+void Browser::about()
+{
+ auto *dlg = new AboutDialog;
+ for(const Plugin &plugin : qAsConst(m_plugins)) {
+ dlg->addPlugin(plugin.name, plugin.author, plugin.shortcut.toString());
+ }
+ dlg->exec();
+}
+
void Browser::setConfiguration(std::shared_ptr<Configuration> &config)
{
Q_ASSERT(config);
@@ -266,6 +276,7 @@ MainWindow *Browser::createWindow()
if(p.instance->inherits("ProfileInterface")) {
auto *profileEditor = qobject_cast<ProfileInterface *>(p.instance.get());
auto *profileAction = new QAction(tr("Profile"), window);
+ profileAction->setShortcut(p.shortcut);
connect(profileAction, &QAction::triggered, window, [profileEditor]() {
profileEditor->createWidget(nullptr)->show();
});
diff --git a/src/browser.h b/src/browser.h
index b727059..7163c8f 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -33,6 +33,10 @@ public:
~Browser() final;
Q_DISABLE_COPY(Browser)
+public slots:
+ void about();
+
+public:
void setConfiguration(std::shared_ptr<Configuration> &config);
void setup(const QString &defaultProfile);
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index 48c9e9e..2b6eb07 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -12,6 +12,7 @@
#include "widgets/navigationbar.h"
#include "widgets/searchform.h"
#include "subwindow.h"
+#include "browser.h"
#include <QApplication>
#include <QCloseEvent>
#include "widgets/dockwidget.h"
@@ -24,7 +25,6 @@
#include <QStatusBar>
#include <QToolBar>
#include <QUrl>
-#include <about/aboutdialog.h>
#include <configuration/configuration.h>
#include <QJsonObject>
#include <QJsonArray>
@@ -157,11 +157,7 @@ void MainWindow::createMenuBar()
smolboteMenu->addSeparator();
- smolboteMenu->addAction(tr("About"), this, [this]() {
- auto *dlg = new AboutDialog(this);
- dlg->exec();
- },
- QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.about").value().c_str()));
+ smolboteMenu->addAction(tr("About"), qobject_cast<Browser*>(qApp), &Browser::about, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.about").value().c_str()));
smolboteMenu->addAction(tr("About Qt"), qApp, &QApplication::aboutQt);
smolboteMenu->addSeparator();