diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-19 14:22:29 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-19 16:51:21 +0300 |
commit | eaa6623d1b82982509b8f5f51a44205a3d5f9b5f (patch) | |
tree | 038ecbba485c46ffda18055227009350dc01dc20 | |
parent | Add args.wrap (diff) | |
download | smolbote-eaa6623d1b82982509b8f5f51a44205a3d5f9b5f.tar.xz |
move lib/about to src/about
- add AboutDialog test
- add SVG icon in place of application icon
-rw-r--r-- | lib/about/meson.build | 12 | ||||
-rw-r--r-- | meson.build | 5 | ||||
-rw-r--r-- | src/about/aboutdialog.cpp (renamed from lib/about/aboutdialog.cpp) | 27 | ||||
-rw-r--r-- | src/about/aboutdialog.h (renamed from lib/about/aboutdialog.h) | 2 | ||||
-rw-r--r-- | src/about/aboutdialog.ui (renamed from lib/about/aboutdialog.ui) | 89 | ||||
-rw-r--r-- | src/about/aboutplugin.cpp (renamed from lib/about/aboutplugin.cpp) | 0 | ||||
-rw-r--r-- | src/about/aboutplugin.h (renamed from lib/about/aboutplugin.h) | 0 | ||||
-rw-r--r-- | src/about/aboutplugin.ui (renamed from lib/about/aboutplugin.ui) | 4 | ||||
-rw-r--r-- | src/about/meson.build | 21 | ||||
-rw-r--r-- | src/about/test/main.cpp | 21 | ||||
-rw-r--r-- | src/meson.build | 2 |
11 files changed, 118 insertions, 65 deletions
diff --git a/lib/about/meson.build b/lib/about/meson.build deleted file mode 100644 index 531355d..0000000 --- a/lib/about/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -about_moc = mod_qt5.preprocess( - moc_headers: ['aboutdialog.h', 'aboutplugin.h'], - ui_files: ['aboutdialog.ui', 'aboutplugin.ui'], - dependencies: dep_qt5 -) - -dep_about = declare_dependency( - include_directories: include_directories('.'), - link_with: static_library('about', - ['aboutdialog.cpp', 'aboutplugin.cpp', about_moc, version_h], - dependencies: [dep_qt5]) -) diff --git a/meson.build b/meson.build index 8db72eb..f2a51bc 100644 --- a/meson.build +++ b/meson.build @@ -49,7 +49,7 @@ endif mod_qt5 = import('qt5') dep_qt5 = dependency('qt5', - modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Concurrent', 'Test'], + modules: [ 'Core', 'Network', 'Widgets', 'Svg', 'WebEngineWidgets', 'Concurrent', 'Test' ], include_type: 'system' ) @@ -76,7 +76,6 @@ poi_sourceset = sourceset.source_set() subdir('include') # plugin interaces -subdir('lib/about') subdir('lib/bookmarks') subdir('lib/configuration') subdir('lib/downloads') @@ -100,7 +99,7 @@ poi_exe = executable(get_option('poi'), cpp_args: ['-DQAPPLICATION_CLASS=QApplication', poi_cpp_args], sources: [ssconfig.sources()], include_directories: [include, include_directories('src')], - dependencies: [ dep_qt5, dep_spdlog, dep_SingleApplication, dep_args, optional_deps, dep_about, dep_bookmarks, dep_configuration, dep_downloads, dep_pluginloader, dep_urlfilter, dep_plugininterface, ssconfig.dependencies(), lib_session_formats ], + dependencies: [ dep_qt5, dep_spdlog, dep_SingleApplication, dep_args, optional_deps, dep_bookmarks, dep_configuration, dep_downloads, dep_pluginloader, dep_urlfilter, dep_plugininterface, ssconfig.dependencies(), lib_session_formats ], install: true, ) diff --git a/lib/about/aboutdialog.cpp b/src/about/aboutdialog.cpp index 99fb7ce..894b1ec 100644 --- a/lib/about/aboutdialog.cpp +++ b/src/about/aboutdialog.cpp @@ -1,7 +1,7 @@ /* * This file is part of smolbote. It's copyrighted by the contributors recorded * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote + * location: https://library.iserlohn-fortress.net/aqua/smolbote.git * * SPDX-License-Identifier: GPL-3.0 */ @@ -26,17 +26,28 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::AboutDialog) { - setAttribute(Qt::WA_DeleteOnClose, true); + //setAttribute(Qt::WA_DeleteOnClose, true); ui->setupUi(this); - ui->icon->setPixmap(qApp->windowIcon().pixmap(72, 72)); + const QByteArray icon_svg = R"SVG( +<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" version="1.1"> + <circle cx="150" cy="150" r="100" stroke="#000000" stroke-width="6" fill="#e60026"></circle> + <circle cx="150" cy="150" r="87" stroke="#000000" stroke-width="4" fill="#e5e4e2"></circle> + <path d="M230,150 A80,80 0 0 0 150,70 L150,150 Z" /> + <path d="M70,150 A80,80 0 0 0 150,230 L150,150 Z" /> +</svg> +)SVG"; + ui->appIcon_svg->load(icon_svg); - ui->aboutLabel->setText(tr("<h2>smolbote %1</h2>" + ui->appName_label->setText(qApp->applicationName()); + ui->appVersion_label->setText(qApp->applicationVersion()); + + ui->aboutLabel->setText(tr("<h2>%1 %2</h2>" "<p><i>yet another no-frills browser</i></p>" "<p>This program is free software, see <i>License</i> for more information.</p>") - .arg(qApp->applicationVersion())); + .arg(qApp->applicationName(), qApp->applicationVersion())); - ui->licenseLabel->setText(tr("<p>Copyright 2017 - 2019 aqua</p>" + ui->licenseLabel->setText(tr("<p>Copyright 2017 - 2020 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>" @@ -55,14 +66,10 @@ AboutDialog::AboutDialog(QWidget *parent) "<li>spdlog</li>" "<li><a href='https://github.com/Taywee/args'>args.hxx</a></li>" "<li><a href='https://github.com/itay-grudev/SingleApplication'>SingleApplication</a></li>" -#ifdef CONFIG_USEPLASMA - "<li><a href='https://community.kde.org/Frameworks'>KDE Frameworks</a></li>" -#endif #ifdef CONFIG_USEBREAKPAD "<li><a href='https://chromium.googlesource.com/breakpad/breakpad'>Breakpad</a></li>" #endif "</ul></p>")); - } AboutDialog::~AboutDialog() diff --git a/lib/about/aboutdialog.h b/src/about/aboutdialog.h index 1d33d3e..e114e7c 100644 --- a/lib/about/aboutdialog.h +++ b/src/about/aboutdialog.h @@ -1,7 +1,7 @@ /* * This file is part of smolbote. It's copyrighted by the contributors recorded * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote + * location: https://library.iserlohn-fortress.net/aqua/smolbote.git * * SPDX-License-Identifier: GPL-3.0 */ diff --git a/lib/about/aboutdialog.ui b/src/about/aboutdialog.ui index 0af877d..5b1c12a 100644 --- a/lib/about/aboutdialog.ui +++ b/src/about/aboutdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>500</width> - <height>600</height> + <width>600</width> + <height>420</height> </rect> </property> <property name="windowTitle"> @@ -17,15 +17,38 @@ <item> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QLabel" name="icon"> + <widget class="QSvgWidget" name="appIcon_svg" native="true"> <property name="minimumSize"> <size> - <width>72</width> - <height>72</height> + <width>120</width> + <height>120</height> </size> </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>120</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="appName_label"> + <property name="text"> + <string>smolbote</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="appVersion_label"> <property name="text"> - <string>TextLabel</string> + <string>0.1.0</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> </property> </widget> </item> @@ -47,20 +70,15 @@ <item> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QToolBox" name="toolBox"> + <widget class="QTabWidget" name="tabWidget"> + <property name="tabPosition"> + <enum>QTabWidget::West</enum> + </property> <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="aboutPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>406</width> - <height>450</height> - </rect> - </property> - <attribute name="label"> + <widget class="QWidget" name="tabWidgetPage1"> + <attribute name="title"> <string>About</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_4"> @@ -76,16 +94,8 @@ </item> </layout> </widget> - <widget class="QWidget" name="licensePage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>406</width> - <height>450</height> - </rect> - </property> - <attribute name="label"> + <widget class="QWidget" name="tabWidgetPage2"> + <attribute name="title"> <string>License</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_5"> @@ -104,16 +114,8 @@ </item> </layout> </widget> - <widget class="QWidget" name="detailsPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>406</width> - <height>450</height> - </rect> - </property> - <attribute name="label"> + <widget class="QWidget" name="tabWidgetPage3"> + <attribute name="title"> <string>Details</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -132,6 +134,11 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Plugins</string> + </attribute> + </widget> </widget> </item> <item> @@ -148,6 +155,14 @@ </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>QSvgWidget</class> + <extends>QWidget</extends> + <header location="global">QSvgWidget</header> + <container>1</container> + </customwidget> + </customwidgets> <resources/> <connections> <connection> diff --git a/lib/about/aboutplugin.cpp b/src/about/aboutplugin.cpp index 99c04ec..99c04ec 100644 --- a/lib/about/aboutplugin.cpp +++ b/src/about/aboutplugin.cpp diff --git a/lib/about/aboutplugin.h b/src/about/aboutplugin.h index 9651060..9651060 100644 --- a/lib/about/aboutplugin.h +++ b/src/about/aboutplugin.h diff --git a/lib/about/aboutplugin.ui b/src/about/aboutplugin.ui index 31e20c6..5df1c0d 100644 --- a/lib/about/aboutplugin.ui +++ b/src/about/aboutplugin.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>474</width> - <height>329</height> + <width>500</width> + <height>400</height> </rect> </property> <property name="windowTitle"> diff --git a/src/about/meson.build b/src/about/meson.build new file mode 100644 index 0000000..49274a8 --- /dev/null +++ b/src/about/meson.build @@ -0,0 +1,21 @@ +about_moc = mod_qt5.preprocess( + moc_headers: ['aboutdialog.h', 'aboutplugin.h'], + ui_files: ['aboutdialog.ui', 'aboutplugin.ui'], + dependencies: dep_qt5 +) + +dep_about = declare_dependency( + include_directories: '.', + link_with: static_library('about', + [ 'aboutdialog.cpp', 'aboutplugin.cpp', about_moc, version_h], + dependencies: [dep_qt5]) +) + +poi_sourceset.add(dep_about) + +test('about dialog', executable('about', + sources: 'test/main.cpp', + dependencies: [ dep_qt5, dep_about, dep_catch ]), + args: [ '-platform', 'offscreen' ], + env: 'autoclose=1' +) diff --git a/src/about/test/main.cpp b/src/about/test/main.cpp new file mode 100644 index 0000000..18037e1 --- /dev/null +++ b/src/about/test/main.cpp @@ -0,0 +1,21 @@ +#include <QApplication> +#include <QTimer> +#include "aboutdialog.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + app.setApplicationName("about"); + app.setApplicationVersion("1.2.3"); + + AboutDialog dlg; + QObject::connect(&dlg, &AboutDialog::finished, &app, &QApplication::quit); + dlg.show(); + + if(qEnvironmentVariableIsSet("autoclose")) { + QTimer::singleShot(200, &dlg, &AboutDialog::accept); + } + + return app.exec(); +} + diff --git a/src/meson.build b/src/meson.build index 31f4ffc..1101b7a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,6 +7,8 @@ poi_settings_h = custom_target('default_config_value', command: [ python3, '@INPUT0@', '--kconfig=@INPUT1@', '--dotconfig=@INPUT2@', '--input=@INPUT3@', '--output=@OUTPUT@' ] ) +subdir('about') + poi_sourceset.add(mod_qt5.preprocess( moc_headers: ['browser.h', 'mainwindow/mainwindow.h', 'mainwindow/addressbar.h', 'mainwindow/menubar.h', 'mainwindow/widgets/completer.h', 'mainwindow/widgets/urllineedit.h', 'mainwindow/widgets/dockwidget.h', 'mainwindow/widgets/navigationbar.h', 'mainwindow/widgets/searchform.h', |