aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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
4 files changed, 146 insertions, 49 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>