aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/about/CMakeLists.txt2
-rw-r--r--lib/about/aboutdialog.cpp74
-rw-r--r--lib/about/aboutdialog.h2
-rw-r--r--lib/about/aboutdialog.ui117
-rw-r--r--plugins/ProfileEditor/ProfileEditor.json2
-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
9 files changed, 165 insertions, 57 deletions
diff --git a/lib/about/CMakeLists.txt b/lib/about/CMakeLists.txt
index 7f53e8d..be506fe 100644
--- a/lib/about/CMakeLists.txt
+++ b/lib/about/CMakeLists.txt
@@ -15,8 +15,6 @@ add_library(about
target_include_directories(about
PRIVATE ${Boost_INCLUDE_DIRS}
PRIVATE ${CMAKE_BINARY_DIR}/src
- PRIVATE ${CMAKE_SOURCE_DIR}/src
- PRIVATE ${CMAKE_SOURCE_DIR}/plugins
)
target_link_libraries(about Qt5::Widgets)
diff --git a/lib/about/aboutdialog.cpp b/lib/about/aboutdialog.cpp
index 9b4d3bc..4fb7a27 100644
--- a/lib/about/aboutdialog.cpp
+++ b/lib/about/aboutdialog.cpp
@@ -8,10 +8,9 @@
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
+#include "version.h"
#include <QtWebEngine/QtWebEngineVersion>
#include <boost/version.hpp>
-#include "version.h"
-#include <browser.h>
// compiler
// clang also defines __GNUC__, so we need to check for clang first
@@ -25,21 +24,6 @@
#define compiler "unknown compiler"
#endif
-inline QString getPluginList()
-{
- auto *browser = qobject_cast<Browser*>(qApp);
- Q_CHECK_PTR(browser);
-
- QString plugins;
- for(const Plugin &p : browser->plugins()) {
- plugins.append(QString("<li>%1 (%2)</li>").arg(p.name, p.author));
- }
- if(!plugins.isEmpty())
- plugins = "Loaded plugins: <ul>" + plugins + "</ul";
-
- return plugins;
-}
-
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::AboutDialog)
@@ -49,41 +33,39 @@ AboutDialog::AboutDialog(QWidget *parent)
ui->icon->setPixmap(qApp->windowIcon().pixmap(72, 72));
- auto *aboutLabel = new QLabel(this);
- aboutLabel->setWordWrap(true);
- aboutLabel->setText(tr("<h2>smolbote %1</h2>"
- "<p><i>yet another no-frills browser</i></p>"
- "<p>This program is free software, see <i>License</i> for more information.</p>"
- "<p>This program uses free software: Qt " QT_VERSION_STR " and Boost " BOOST_LIB_VERSION "</p>")
- .arg(qApp->applicationVersion()));
- ui->toolBox->addItem(aboutLabel, tr("About"));
+ ui->aboutLabel->setText(tr("<h2>smolbote %1</h2>"
+ "<p><i>yet another no-frills browser</i></p>"
+ "<p>This program is free software, see <i>License</i> for more information.</p>"
+ "<p>This program uses free software: Qt " QT_VERSION_STR " and Boost " BOOST_LIB_VERSION "</p>")
+ .arg(qApp->applicationVersion()));
- auto *licenseLabel = new QLabel(this);
- licenseLabel->setWordWrap(true);
- licenseLabel->setText(tr("<p>Copyright 2017 - 2018 aqua</p>"
- "<p>This program is free software, and you are welcome to use it under the conditions set by the GNU GPLv3.<br>"
- "This is a short summary: <ul>"
- "<li> the freedom to use the software for any purpose,</li>"
- "<li> the freedom to change the software to suit your needs,</li>"
- "<li> the freedom to share the software with anyone,</li>"
- "<li> the freedom to share the changes you make, and</li>"
- "<li> the responsibility to grant the same freedoms when sharing the software.</li>"
- "</ul>"
- "<p>This program is distributed in the hope that it will be useful, but without any warranty.</p>"));
- ui->toolBox->addItem(licenseLabel, tr("License"));
+ ui->licenseLabel->setText(tr("<p>Copyright 2017 - 2018 aqua</p>"
+ "<p>This program is free software, and you are welcome to use it under the conditions set by the GNU GPLv3.<br>"
+ "This is a short summary: <ul>"
+ "<li> the freedom to use the software for any purpose,</li>"
+ "<li> the freedom to change the software to suit your needs,</li>"
+ "<li> the freedom to share the software with anyone,</li>"
+ "<li> the freedom to share the changes you make, and</li>"
+ "<li> the responsibility to grant the same freedoms when sharing the software.</li>"
+ "</ul>"
+ "<p>This program is distributed in the hope that it will be useful, but without any warranty.</p>"));
+ ui->detailsLabel->setText(tr("<p>Build " SMOLBOTE_BRANCH ":" SMOLBOTE_COMMIT "</p>"
+ "<p>Compiled with " compiler "</p>"));
-
-
- auto *detailsLabel = new QLabel(this);
- detailsLabel->setWordWrap(true);
- detailsLabel->setText(tr("<p>Build " SMOLBOTE_BRANCH ":" SMOLBOTE_COMMIT "</p>"
- "<p>Compiled with " compiler "</p>"
- "<p>%1</p>").arg(getPluginList()));
- ui->toolBox->addItem(detailsLabel, tr("Details"));
}
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 265f3c9..8a750ae 100644
--- a/lib/about/aboutdialog.h
+++ b/lib/about/aboutdialog.h
@@ -24,6 +24,8 @@ 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 f7fe21e..e6a37cf 100644
--- a/lib/about/aboutdialog.ui
+++ b/lib/about/aboutdialog.ui
@@ -49,8 +49,123 @@
<item>
<widget class="QToolBox" name="toolBox">
<property name="currentIndex">
- <number>-1</number>
+ <number>0</number>
</property>
+ <widget class="QWidget" name="aboutPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>452</height>
+ </rect>
+ </property>
+ <attribute name="label">
+ <string>About</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QLabel" name="aboutLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="licensePage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>452</height>
+ </rect>
+ </property>
+ <attribute name="label">
+ <string>License</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QLabel" name="licenseLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="detailsPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>452</height>
+ </rect>
+ </property>
+ <attribute name="label">
+ <string>Details</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="detailsLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </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>
</item>
<item>
diff --git a/plugins/ProfileEditor/ProfileEditor.json b/plugins/ProfileEditor/ProfileEditor.json
index ffb1c32..504eea4 100644
--- a/plugins/ProfileEditor/ProfileEditor.json
+++ b/plugins/ProfileEditor/ProfileEditor.json
@@ -1,5 +1,5 @@
{
"name": "Profile Editor",
"author": "Aqua-sama",
- "shortcut": "Ctrl+F2"
+ "shortcut": "Ctrl+Shift+P"
}
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();