aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/about/aboutdialog.cpp10
-rw-r--r--lib/about/aboutdialog.h2
-rw-r--r--lib/about/aboutdialog.ui48
-rw-r--r--linux/.config4
-rw-r--r--src/browser.cpp44
-rw-r--r--src/browser.h9
-rw-r--r--src/main.cpp3
-rw-r--r--src/mainwindow/mainwindow.cpp20
-rw-r--r--src/mainwindow/mainwindow.h1
-rw-r--r--src/mainwindow/mainwindow.ui19
10 files changed, 46 insertions, 114 deletions
diff --git a/lib/about/aboutdialog.cpp b/lib/about/aboutdialog.cpp
index 4e57025..6434d68 100644
--- a/lib/about/aboutdialog.cpp
+++ b/lib/about/aboutdialog.cpp
@@ -58,13 +58,3 @@ AboutDialog::~AboutDialog()
{
delete ui;
}
-
-void AboutDialog::addPlugin(const QString &name, const QString &author, const QString &shortcut)
-{
- auto index = ui->pluginsTable->rowCount();
- ui->pluginsTable->setRowCount(index + 1);
-
- ui->pluginsTable->setItem(index, 0, new QTableWidgetItem(name));
- ui->pluginsTable->setItem(index, 1, new QTableWidgetItem(author));
- ui->pluginsTable->setItem(index, 2, new QTableWidgetItem(shortcut));
-}
diff --git a/lib/about/aboutdialog.h b/lib/about/aboutdialog.h
index 4eb4a87..1d33d3e 100644
--- a/lib/about/aboutdialog.h
+++ b/lib/about/aboutdialog.h
@@ -24,8 +24,6 @@ public:
explicit AboutDialog(QWidget *parent = nullptr);
~AboutDialog() override;
- void addPlugin(const QString &name, const QString &author, const QString &shortcut);
-
private:
Ui::AboutDialog *ui;
};
diff --git a/lib/about/aboutdialog.ui b/lib/about/aboutdialog.ui
index dbd2561..13edfed 100644
--- a/lib/about/aboutdialog.ui
+++ b/lib/about/aboutdialog.ui
@@ -81,8 +81,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>406</width>
- <height>450</height>
+ <width>96</width>
+ <height>30</height>
</rect>
</property>
<attribute name="label">
@@ -109,8 +109,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>96</width>
- <height>120</height>
+ <width>406</width>
+ <height>450</height>
</rect>
</property>
<attribute name="label">
@@ -127,46 +127,6 @@
</property>
</widget>
</item>
- <item>
- <widget class="QTableWidget" name="pluginsTable">
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="sizeAdjustPolicy">
- <enum>QAbstractScrollArea::AdjustToContents</enum>
- </property>
- <property name="editTriggers">
- <set>QAbstractItemView::NoEditTriggers</set>
- </property>
- <attribute name="horizontalHeaderCascadingSectionResizes">
- <bool>true</bool>
- </attribute>
- <attribute name="horizontalHeaderHighlightSections">
- <bool>false</bool>
- </attribute>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <column>
- <property name="text">
- <string>Name</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Author</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Shortcut</string>
- </property>
- </column>
- </widget>
- </item>
</layout>
</widget>
</widget>
diff --git a/linux/.config b/linux/.config
index 5cc898c..42e015b 100644
--- a/linux/.config
+++ b/linux/.config
@@ -25,7 +25,7 @@ CONFIG_PATH_DOWNLOADS="~/Downloads"
#
CONFIG_SHORTCUT_WINDOW_NEWGROUP="Ctrl+G"
CONFIG_SHORTCUT_WINDOW_NEWWINDOW="Ctrl+N"
-CONFIG_SHORTCUT_WINDOW_ABOUT="Ctrl+H"
+CONFIG_SHORTCUT_WINDOW_ABOUT="F1"
CONFIG_SHORTCUT_WINDOW_QUIT="Ctrl+Q"
CONFIG_SHORTCUT_WINDOW_SEARCH="F3"
CONFIG_SHORTCUT_WINDOW_BOOKMARKS="Ctrl+B"
@@ -51,7 +51,7 @@ CONFIG_SHORTCUT_ADDRESS_MENU="F2"
#
# Subwindow shortcuts
#
-CONFIG_SHORTCUT_SUBWINDOW_MENU="F1"
+CONFIG_SHORTCUT_SUBWINDOW_MENU="Ctrl+M"
CONFIG_SHORTCUT_SUBWINDOW_TILE="F9"
CONFIG_SHORTCUT_SUBWINDOW_CASCADE="F10"
CONFIG_SHORTCUT_SUBWINDOW_FULLSCREEN="F11"
diff --git a/src/browser.cpp b/src/browser.cpp
index 0bd3d06..cc5d565 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -54,10 +54,6 @@ Browser::~Browser()
void Browser::about()
{
auto *dlg = new AboutDialog;
- for(const QPluginLoader *loader : qAsConst(m_plugins)) {
- const auto meta = loader->metaData().value("MetaData").toObject();
- dlg->addPlugin(meta.value("name").toString(), meta.value("author").toString(), meta.value("shortcut").toString());
- }
dlg->exec();
}
@@ -224,21 +220,8 @@ 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]() {
+ m_config->setShortcut(window->ui->actionBookmarks, "bookmarks.shortcut");
+ connect(window->ui->actionBookmarks, &QAction::triggered, window, [this, window]() {
bool wasVisible = m_bookmarks->isVisible();
for(MainWindow *w : qAsConst(m_windows)) {
w->removeDockWidget(m_bookmarks.get());
@@ -247,11 +230,9 @@ MainWindow *Browser::createWindow()
window->addDockWidget(Qt::RightDockWidgetArea, m_bookmarks.get());
}
});
- window->addAction(MainWindow::ToolsMenu, bookmarksAction);
- auto *downloadsAction = new QAction(tr("Downloads"), window);
- m_config->setShortcut(downloadsAction, "downloads.shortcut");
- connect(downloadsAction, &QAction::triggered, window, [this, window]() {
+ m_config->setShortcut(window->ui->actionDownloads, "downloads.shortcut");
+ connect(window->ui->actionDownloads, &QAction::triggered, window, [this, window]() {
bool wasVisible = m_downloads->isVisible();
for(MainWindow *w : qAsConst(m_windows)) {
w->removeDockWidget(m_downloads.get());
@@ -260,18 +241,25 @@ MainWindow *Browser::createWindow()
window->addDockWidget(Qt::RightDockWidgetArea, m_downloads.get());
}
});
- window->addAction(MainWindow::ToolsMenu, downloadsAction);
for(QPluginLoader *loader : qAsConst(m_plugins)) {
const auto *plugin = qobject_cast<PluginInterface *>(loader->instance());
Q_CHECK_PTR(plugin);
- auto *pluginAction = new QAction(loader->metaData().value("MetaData").toObject().value("name").toString(), window);
- pluginAction->setShortcut(QKeySequence::fromString(loader->metaData().value("MetaData").toObject().value("shortcut").toString()));
- connect(pluginAction, &QAction::triggered, window, [=]() {
+ auto *pluginMenu = window->ui->menuTools->addMenu(loader->metaData().value("MetaData").toObject().value("name").toString());
+
+ auto *aboutAction = pluginMenu->addAction(tr("About"));
+ connect(aboutAction, &QAction::triggered, this, [loader, window]() {
+ auto *dlg = new AboutPluginDialog(loader, window);
+ dlg->exec();
+ });
+
+ auto *runAction = pluginMenu->addAction(tr("Run"));
+ runAction->setShortcut(QKeySequence::fromString(loader->metaData().value("MetaData").toObject().value("shortcut").toString()));
+
+ connect(runAction, &QAction::triggered, window, [=]() {
plugin->createWidget(window)->exec();
});
- window->addAction(MainWindow::ToolsMenu, pluginAction);
}
m_windows.append(window);
diff --git a/src/browser.h b/src/browser.h
index 35b4149..e871202 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -9,13 +9,13 @@
#ifndef SMOLBOTE_BROWSER_H
#define SMOLBOTE_BROWSER_H
-#include <singleapplication.h>
-#include <browserinterface.h>
+#include "session.h"
#include <QJsonObject>
#include <QVector>
+#include <browserinterface.h>
#include <functional>
#include <memory>
-#include "session.h"
+#include <singleapplication.h>
class Configuration;
class BookmarksWidget;
@@ -51,7 +51,8 @@ public:
void setup(QVector<QPluginLoader *> plugins);
- QJsonObject session() const {
+ QJsonObject session() const
+ {
return Session::session(m_windows);
}
diff --git a/src/main.cpp b/src/main.cpp
index c4e5d3f..3eb6dac 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -117,6 +117,7 @@ int main(int argc, char **argv)
QVector<QPluginLoader *> plugins;
CommandHash_t pluginCommands;
+ // Load plugins
for(const QString &path : Util::files(config->value<QString>("plugins.path").value())) {
QPluginLoader *loader = new QPluginLoader(path);
const bool loaded = loader->load();
@@ -124,7 +125,7 @@ int main(int argc, char **argv)
qDebug("Loading plugin %s %s", qUtf8Printable(path), loaded ? "[ok]" : "[failed]");
#endif
- if(loader->load()) {
+ if(loaded) {
plugins.append(loader);
auto *plugin = qobject_cast<PluginInterface *>(loader->instance());
pluginCommands.unite(plugin->commands());
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index e465a4f..8f635c9 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -9,10 +9,14 @@
#include "mainwindow.h"
#include "addressbar.h"
#include "browser.h"
+#include "config.h"
+#include "configuration.h"
+#include "profilemanager.h"
#include "session.h"
#include "subwindow/subwindow.h"
#include "ui_mainwindow.h"
#include "webengine/webview.h"
+#include "webprofile.h"
#include "widgets/dockwidget.h"
#include "widgets/navigationbar.h"
#include "widgets/searchform.h"
@@ -34,10 +38,6 @@
#include <QToolBar>
#include <QUrl>
#include <QVBoxLayout>
-#include "configuration.h"
-#include "profilemanager.h"
-#include "webprofile.h"
-#include "config.h"
#ifdef CONFIG_PLASMA_BLUR
#include <KWindowEffects>
#endif
@@ -285,18 +285,6 @@ MainWindow::~MainWindow()
disconnect(addressBar);
}
-void MainWindow::addAction(ActionLocation where, QAction *action)
-{
- switch(where) {
- case ToolsMenu:
- ui->menuTools->addAction(action);
- break;
- default:
- QMainWindow::addAction(action);
- break;
- }
-}
-
void MainWindow::addDockWidget(Qt::DockWidgetArea area, QWidget *widget)
{
QDockWidget *lastDock = nullptr;
diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h
index 6ce61b5..296a73e 100644
--- a/src/mainwindow/mainwindow.h
+++ b/src/mainwindow/mainwindow.h
@@ -43,7 +43,6 @@ public:
Q_DISABLE_COPY(MainWindow)
~MainWindow() override;
- void addAction(ActionLocation where, QAction *action);
void addDockWidget(Qt::DockWidgetArea area, QWidget *widget);
void removeDockWidget(QWidget *widget);
diff --git a/src/mainwindow/mainwindow.ui b/src/mainwindow/mainwindow.ui
index ad213c6..587b4fd 100644
--- a/src/mainwindow/mainwindow.ui
+++ b/src/mainwindow/mainwindow.ui
@@ -55,12 +55,9 @@
<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"/>
+ <addaction name="actionBookmarks"/>
+ <addaction name="actionDownloads"/>
+ <addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuPage">
<property name="title">
@@ -155,6 +152,16 @@
<string>&amp;Developer Tools</string>
</property>
</action>
+ <action name="actionBookmarks">
+ <property name="text">
+ <string>Bookmarks</string>
+ </property>
+ </action>
+ <action name="actionDownloads">
+ <property name="text">
+ <string>Downloads</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>