From eaa6623d1b82982509b8f5f51a44205a3d5f9b5f Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 19 Apr 2020 14:22:29 +0300 Subject: move lib/about to src/about - add AboutDialog test - add SVG icon in place of application icon --- lib/about/aboutdialog.cpp | 71 ----------------- lib/about/aboutdialog.h | 31 -------- lib/about/aboutdialog.ui | 186 ------------------------------------------- lib/about/aboutplugin.cpp | 111 -------------------------- lib/about/aboutplugin.h | 31 -------- lib/about/aboutplugin.ui | 196 ---------------------------------------------- lib/about/meson.build | 12 --- 7 files changed, 638 deletions(-) delete mode 100644 lib/about/aboutdialog.cpp delete mode 100644 lib/about/aboutdialog.h delete mode 100644 lib/about/aboutdialog.ui delete mode 100644 lib/about/aboutplugin.cpp delete mode 100644 lib/about/aboutplugin.h delete mode 100644 lib/about/aboutplugin.ui delete mode 100644 lib/about/meson.build (limited to 'lib/about') diff --git a/lib/about/aboutdialog.cpp b/lib/about/aboutdialog.cpp deleted file mode 100644 index 99fb7ce..0000000 --- a/lib/about/aboutdialog.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#include "aboutdialog.h" -#include "ui_aboutdialog.h" -#include - -// compiler -// clang also defines __GNUC__, so we need to check for clang first -#if defined(__clang__) -#define compiler "Clang " __clang_version__ -#elif defined(__GNUC__) -#define compiler "GCC " __VERSION__ -#elif defined(_MSC_VER) -#define compiler "MSVC" -#else -#define compiler "unknown compiler" -#endif - -AboutDialog::AboutDialog(QWidget *parent) - : QDialog(parent) - , ui(new Ui::AboutDialog) -{ - setAttribute(Qt::WA_DeleteOnClose, true); - ui->setupUi(this); - - ui->icon->setPixmap(qApp->windowIcon().pixmap(72, 72)); - - ui->aboutLabel->setText(tr("

smolbote %1

" - "

yet another no-frills browser

" - "

This program is free software, see License for more information.

") - .arg(qApp->applicationVersion())); - - ui->licenseLabel->setText(tr("

Copyright 2017 - 2019 aqua

" - "

This program is free software, and you are welcome to use it under the conditions set by the GNU GPLv3.
" - "This is a short summary:

" - "

This program is distributed in the hope that it will be useful, but without any warranty.

" - "

You can read the full terms of the license on the GNU website.

")); - - ui->detailsLabel->setText(tr("

Version " poi_Version "

" - "

Compiled with " compiler "

" - "

Libraries:

")); - -} - -AboutDialog::~AboutDialog() -{ - delete ui; -} diff --git a/lib/about/aboutdialog.h b/lib/about/aboutdialog.h deleted file mode 100644 index 1d33d3e..0000000 --- a/lib/about/aboutdialog.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#ifndef SMOLBOTE_ABOUTDIALOG_H -#define SMOLBOTE_ABOUTDIALOG_H - -#include - -namespace Ui -{ -class AboutDialog; -} - -class AboutDialog : public QDialog -{ - Q_OBJECT - -public: - explicit AboutDialog(QWidget *parent = nullptr); - ~AboutDialog() override; - -private: - Ui::AboutDialog *ui; -}; - -#endif // SMOLBOTE_ABOUTDIALOG_H diff --git a/lib/about/aboutdialog.ui b/lib/about/aboutdialog.ui deleted file mode 100644 index 0af877d..0000000 --- a/lib/about/aboutdialog.ui +++ /dev/null @@ -1,186 +0,0 @@ - - - AboutDialog - - - - 0 - 0 - 500 - 600 - - - - About - - - - - - - - - 72 - 72 - - - - TextLabel - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - 0 - - - - - 0 - 0 - 406 - 450 - - - - About - - - - - - TextLabel - - - true - - - - - - - - - 0 - 0 - 406 - 450 - - - - License - - - - - - TextLabel - - - true - - - true - - - - - - - - - 0 - 0 - 406 - 450 - - - - Details - - - - - - TextLabel - - - true - - - true - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - - - buttonBox - accepted() - AboutDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - AboutDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/lib/about/aboutplugin.cpp b/lib/about/aboutplugin.cpp deleted file mode 100644 index 99c04ec..0000000 --- a/lib/about/aboutplugin.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#include "aboutplugin.h" -#include "ui_aboutplugin.h" -#include -#include - -QTreeWidgetItem *createItem(const QString &key, const QJsonValue &json, QTreeWidgetItem *parent) -{ - auto *item = new QTreeWidgetItem(parent, { key, QLatin1String("---") }); - - switch(json.type()) { - case QJsonValue::Bool: - item->setText(1, json.toBool() ? QLatin1String("true") : QLatin1String("false")); - break; - - case QJsonValue::Double: - item->setText(1, QString::number(json.toDouble())); - break; - - case QJsonValue::String: - item->setText(1, json.toString()); - break; - - case QJsonValue::Array: - item->setText(1, QString()); - for(const auto &v : json.toArray()) { - createItem(QString(), v, item); - } - break; - - case QJsonValue::Object: - item->setText(1, QString()); - for(const QString &k : json.toObject().keys()) { - createItem(k, json.toObject()[k], item); - } - break; - - case QJsonValue::Null: - item->setText(1, QLatin1String("null")); - break; - - case QJsonValue::Undefined: - item->setText(1, QLatin1String("undefined")); - break; - } - - return item; -} - -AboutPluginDialog::AboutPluginDialog(QPluginLoader *loader, QWidget *parent) - : QDialog(parent) - , ui(new Ui::AboutPluginDialog) -{ - setAttribute(Qt::WA_DeleteOnClose, true); - ui->setupUi(this); - - // load button icon - { - QIcon load_icon; - load_icon.addPixmap(style()->standardPixmap(QStyle::SP_MediaPlay), QIcon::Normal, QIcon::On); - load_icon.addPixmap(style()->standardPixmap(QStyle::SP_MediaStop), QIcon::Normal, QIcon::Off); - ui->load->setIcon(load_icon); - } - - auto metaData = loader->metaData()["MetaData"].toObject(); - - this->setWindowTitle(metaData["name"].toString()); - - ui->path->setText(loader->fileName()); - ui->load->setChecked(loader->isLoaded()); - - connect(ui->load, &QToolButton::clicked, this, [this, loader](bool checked) { - if(checked) { - // load plugin - if(!loader->load()) { - ui->load->setChecked(false); - ui->error->setText(loader->errorString()); - } - } else { - // unload plugin - if(!loader->unload()) { - ui->load->setChecked(true); - ui->error->setText(loader->errorString()); - } - } - }); - - ui->name->setText(metaData[QLatin1String("name")].toString()); - ui->author->setText(metaData[QLatin1String("author")].toString()); - ui->license->setText(metaData[QLatin1String("license")].toString()); - ui->shortcut->setText(metaData[QLatin1String("shortcut")].toString()); - - for(const QString &key : loader->metaData().keys()) { - auto *i = createItem(key, loader->metaData()[key], nullptr); - - if(i != nullptr) - ui->details_treeWidget->insertTopLevelItem(0, i); - } -} - -AboutPluginDialog::~AboutPluginDialog() -{ - delete ui; -} diff --git a/lib/about/aboutplugin.h b/lib/about/aboutplugin.h deleted file mode 100644 index 9651060..0000000 --- a/lib/about/aboutplugin.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#ifndef SMOLBOTE_ABOUTPLUGIN_H -#define SMOLBOTE_ABOUTPLUGIN_H - -#include - -namespace Ui -{ -class AboutPluginDialog; -} -class QPluginLoader; -class AboutPluginDialog : public QDialog -{ - Q_OBJECT - -public: - explicit AboutPluginDialog(QPluginLoader *loader, QWidget *parent = nullptr); - ~AboutPluginDialog() override; - -private: - Ui::AboutPluginDialog *ui; -}; - -#endif // SMOLBOTE_ABOUTPLUGIN_H diff --git a/lib/about/aboutplugin.ui b/lib/about/aboutplugin.ui deleted file mode 100644 index 31e20c6..0000000 --- a/lib/about/aboutplugin.ui +++ /dev/null @@ -1,196 +0,0 @@ - - - AboutPluginDialog - - - - 0 - 0 - 474 - 329 - - - - Dialog - - - - - - 0 - - - - General - - - - - - Name - - - - - - - - - - - - - - Author - - - - - - - - - - - - - - Shortcut - - - - - - - - - - - - - - - - - - - - - - - - License - - - - - - - - Details - - - - - - TextLabel - - - - - - - - Key - - - - - Value - - - - - - - - - Controls - - - - - - Load - - - true - - - - - - - - - - - - - - Status - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - buttonBox - accepted() - AboutPluginDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - AboutPluginDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - 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]) -) -- cgit v1.2.1