changeset 339:eac06513db86

dialog/about: add licenses button otherwise we wouldn't be complying with most of the libraries and external software we use
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 14:02:11 -0400
parents f63dfa309380
children 74e2365326c6
files Makefile.am dep/json/LICENSE dep/pugixml/LICENSE dep/pugixml/LICENSE.md dep/semver/LICENSE dep/utf8proc/LICENSE include/gui/dialog/licenses.h rc/licenses.qrc src/gui/dialog/about.cc src/gui/dialog/licenses.cc
diffstat 10 files changed, 355 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Wed Jun 19 13:06:10 2024 -0400
+++ b/Makefile.am	Wed Jun 19 14:02:11 2024 -0400
@@ -72,6 +72,7 @@
 minori_qtrc = \
 	$(top_srcdir)/rc/icons/icons.qrc	\
 	$(top_srcdir)/rc/animone.qrc	\
+	$(top_srcdir)/rc/licenses.qrc   \
 	rc/locale/translations.qrc
 
 # various things we want to distribute
@@ -175,6 +176,7 @@
 	include/core/http.h			\
 	include/core/session.h      \
 	include/gui/dialog/about.h		\
+	include/gui/dialog/licenses.h   \
 	include/gui/dialog/information.h		\
 	include/gui/dialog/settings.h			\
 	include/gui/pages/anime_list.h			\
@@ -250,6 +252,7 @@
 	src/gui/dialog/settings/services.cc		\
 	src/gui/dialog/settings/torrents.cc		\
 	src/gui/dialog/about.cc		\
+	src/gui/dialog/licenses.cc   \
 	src/gui/dialog/information.cc		\
 	src/gui/dialog/settings.cc		\
 	src/gui/pages/anime_list.cc		\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dep/json/LICENSE	Wed Jun 19 14:02:11 2024 -0400
@@ -0,0 +1,21 @@
+MIT License 
+
+Copyright (c) 2013-2022 Niels Lohmann
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dep/pugixml/LICENSE	Wed Jun 19 14:02:11 2024 -0400
@@ -0,0 +1,24 @@
+MIT License
+
+Copyright (c) 2006-2023 Arseny Kapoulkine
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
--- a/dep/pugixml/LICENSE.md	Wed Jun 19 13:06:10 2024 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-MIT License
-
-Copyright (c) 2006-2023 Arseny Kapoulkine
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dep/semver/LICENSE	Wed Jun 19 14:02:11 2024 -0400
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2018 - 2024 Daniil Goncharov
+Copyright (c) 2020 - 2021 Alexander Gorbunov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dep/utf8proc/LICENSE	Wed Jun 19 14:02:11 2024 -0400
@@ -0,0 +1,93 @@
+## utf8proc license ##
+
+**utf8proc** is a software package originally developed
+by Jan Behrens and the rest of the Public Software Group, who
+deserve nearly all of the credit for this library, that is now maintained by the Julia-language developers.  Like the original utf8proc,
+whose copyright and license statements are reproduced below, all new
+work on the utf8proc library is licensed under the [MIT "expat"
+license](http://opensource.org/licenses/MIT):
+
+*Copyright (c) 2014-2021 by Steven G. Johnson, Jiahao Chen, Tony Kelman, Jonas Fonseca, and other contributors listed in the git history.*
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+## Original utf8proc license ##
+
+*Copyright (c) 2009, 2013 Public Software Group e. V., Berlin, Germany*
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+## Unicode data license ##
+
+This software contains data (`utf8proc_data.c`) derived from processing
+the Unicode data files. The following license applies to that data:
+
+**COPYRIGHT AND PERMISSION NOTICE**
+
+*Copyright (c) 1991-2007 Unicode, Inc. All rights reserved. Distributed
+under the Terms of Use in http://www.unicode.org/copyright.html.*
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of the Unicode data files and any associated documentation (the "Data
+Files") or Unicode software and any associated documentation (the
+"Software") to deal in the Data Files or Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, and/or sell copies of the Data Files or Software, and
+to permit persons to whom the Data Files or Software are furnished to do
+so, provided that (a) the above copyright notice(s) and this permission
+notice appear with all copies of the Data Files or Software, (b) both the
+above copyright notice(s) and this permission notice appear in associated
+documentation, and (c) there is clear notice in each modified Data File or
+in the Software as well as in the documentation associated with the Data
+File(s) or Software that the data or software has been modified.
+
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
+INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
+CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in these Data Files or Software without prior written
+authorization of the copyright holder.
+
+Unicode and the Unicode logo are trademarks of Unicode, Inc., and may be
+registered in some jurisdictions. All other trademarks and registered
+trademarks mentioned herein are the property of their respective owners.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/gui/dialog/licenses.h	Wed Jun 19 14:02:11 2024 -0400
@@ -0,0 +1,16 @@
+#ifndef MINORI_GUI_DIALOG_LICENSES_H_
+#define MINORI_GUI_DIALOG_LICENSES_H_
+
+#include <QDialog>
+
+class LicensesWindow final : public QDialog {
+	Q_OBJECT
+
+public:
+	LicensesWindow(QWidget* parent = nullptr);
+
+protected:
+	void showEvent(QShowEvent* event) override;
+};
+
+#endif // MINORI_GUI_DIALOG_LICENSES_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/licenses.qrc	Wed Jun 19 14:02:11 2024 -0400
@@ -0,0 +1,14 @@
+<!DOCTYPE rcc><RCC version="1.0">
+	<qresource prefix="licenses/">
+		<file alias="LICENSE.minori">../LICENSE</file>
+		<file alias="LICENSE.BSD.animone">../dep/animone/LICENSE.BSD</file>
+		<file alias="LICENSE.MIT.animone">../dep/animone/LICENSE.MIT</file>
+		<file alias="LICENSE.anitomy">../dep/anitomy/LICENSE</file>
+		<file alias="LICENSE.fmt">../dep/fmt/LICENSE</file>
+		<file alias="LICENSE.nlohmann">../dep/json/LICENSE</file>
+		<file alias="LICENSE.pugixml">../dep/pugixml/LICENSE</file>
+		<file alias="LICENSE.semver">../dep/semver/LICENSE</file>
+		<file alias="LICENSE.toml11">../dep/toml11/LICENSE</file>
+		<file alias="LICENSE.utf8proc">../dep/utf8proc/LICENSE</file>
+	</qresource>
+</RCC>
--- a/src/gui/dialog/about.cc	Wed Jun 19 13:06:10 2024 -0400
+++ b/src/gui/dialog/about.cc	Wed Jun 19 14:02:11 2024 -0400
@@ -1,4 +1,5 @@
 #include "gui/dialog/about.h"
+#include "gui/dialog/licenses.h"
 #include "core/json.h"
 #include "core/session.h"
 #include "core/strings.h"
@@ -16,6 +17,7 @@
 #include <QTextBrowser>
 #include <QTextCharFormat>
 #include <QTextCursor>
+#include <QPushButton>
 
 #include <curl/curl.h>
 #ifdef WIN32
@@ -70,7 +72,7 @@
 	setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
 	setAutoFillBackground(true);
 
-	QHBoxLayout* layout = new QHBoxLayout(this);
+	QVBoxLayout* layout = new QVBoxLayout(this);
 
 	std::string html = fmt::format(about_template, session.version.to_string(), get_curl_version(), fugue_icons_version.to_string(), json_version.to_string(), pugixml_version.to_string(), semver_version.to_string(), utf8proc_version(), fmt_version.to_string());
 
@@ -86,6 +88,15 @@
 
 		layout->addWidget(paragraph);
 	}
+
+	{
+		QPushButton *license = new QPushButton("&Licenses", this);
+		layout->addWidget(license, Qt::AlignRight);
+		connect(license, &QPushButton::clicked, this, []{
+			LicensesWindow dialog;
+			dialog.exec();
+		});
+	}
 }
 
 void AboutWindow::showEvent(QShowEvent* event) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gui/dialog/licenses.cc	Wed Jun 19 14:02:11 2024 -0400
@@ -0,0 +1,150 @@
+#include "gui/dialog/licenses.h"
+#include "core/json.h"
+#include "core/session.h"
+#include "core/strings.h"
+#include "gui/widgets/text.h"
+
+#include "pugixml.hpp"
+
+#include "utf8proc.h"
+
+#include <fmt/core.h>
+
+#include <QCoreApplication>
+#include <QFont>
+#include <QHBoxLayout>
+#include <QTabWidget>
+#include <QTextBrowser>
+#include <QTextCharFormat>
+#include <QTextCursor>
+
+#include <curl/curl.h>
+#ifdef WIN32
+#	include "sys/win32/dark_theme.h"
+#endif
+
+static QWidget *create_license_widget(QWidget *parent, const std::string& license) {
+	QTextBrowser* paragraph = new QTextBrowser(parent);
+	paragraph->setFrameShape(QFrame::NoFrame);
+	paragraph->setPlainText(Strings::ToQString(license));
+	paragraph->setFont(QFont("monospace"));
+	return paragraph;
+}
+
+LicensesWindow::LicensesWindow(QWidget* parent) : QDialog(parent) {
+	resize(641, 500);
+	setWindowTitle(tr("About Minori"));
+	setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
+	setAutoFillBackground(true);
+
+	QHBoxLayout* layout = new QHBoxLayout(this);
+
+	setBackgroundRole(QPalette::Base);
+
+	QTabWidget *tab_widget = new QTabWidget(this);
+
+	layout->addWidget(tab_widget);
+
+	do {
+		QFile f(":/licenses/LICENSE.minori");
+		if (!f.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		tab_widget->addTab(create_license_widget(this, Strings::ToUtf8String(f.readAll())), tr("Minori"));
+	} while (0);
+
+	do {
+		QFile f(":/licenses/LICENSE.MIT.animone");
+		QFile b(":/licenses/LICENSE.BSD.animone");
+		if (!f.exists() || !b.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		b.open(QFile::ReadOnly | QFile::Text);
+
+		std::string mit = Strings::ToUtf8String(f.readAll());
+		std::string bsd = Strings::ToUtf8String(b.readAll());
+
+		QWidget *dual = new QWidget(this);
+		QVBoxLayout *dual_layout = new QVBoxLayout(dual);
+
+		QLabel *dual_notice = new QLabel(tr("Animone was originally forked from Anisthesia, where any changes divergent from Anisthesia are now under a different license. Both the licenses for Animone and Anisthesia are provided below, respectfully:"), dual);
+		dual_notice->setWordWrap(true);
+		dual_layout->addWidget(dual_notice);
+		dual_layout->addWidget(create_license_widget(dual, bsd));
+		dual_layout->addWidget(create_license_widget(dual, mit));
+
+		tab_widget->addTab(dual, tr("Animone"));
+	} while (0);
+
+	do {
+		QFile f(":/licenses/LICENSE.anitomy");
+		if (!f.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		tab_widget->addTab(create_license_widget(this, Strings::ToUtf8String(f.readAll())), tr("Anitomy"));
+	} while (0);
+
+	do {
+		QFile f(":/licenses/LICENSE.fmt");
+		if (!f.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		tab_widget->addTab(create_license_widget(this, Strings::ToUtf8String(f.readAll())), tr("fmt"));
+	} while (0);
+
+	do {
+		QFile f(":/licenses/LICENSE.nlohmann");
+		if (!f.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		tab_widget->addTab(create_license_widget(this, Strings::ToUtf8String(f.readAll())), tr("JSON for Modern C++"));
+	} while (0);
+
+	do {
+		QFile f(":/licenses/LICENSE.pugixml");
+		if (!f.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		tab_widget->addTab(create_license_widget(this, Strings::ToUtf8String(f.readAll())), tr("pugixml"));
+	} while (0);
+
+	do {
+		QFile f(":/licenses/LICENSE.semver");
+		if (!f.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		tab_widget->addTab(create_license_widget(this, Strings::ToUtf8String(f.readAll())), tr("semver"));
+	} while (0);
+
+	do {
+		QFile f(":/licenses/LICENSE.toml11");
+		if (!f.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		tab_widget->addTab(create_license_widget(this, Strings::ToUtf8String(f.readAll())), tr("toml11"));
+	} while (0);
+
+	do {
+		QFile f(":/licenses/LICENSE.utf8proc");
+		if (!f.exists())
+			break;
+
+		f.open(QFile::ReadOnly | QFile::Text);
+		tab_widget->addTab(create_license_widget(this, Strings::ToUtf8String(f.readAll())), tr("utf8proc"));
+	} while (0);
+}
+
+void LicensesWindow::showEvent(QShowEvent* event) {
+	QDialog::showEvent(event);
+#ifdef WIN32
+	win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme());
+#endif
+}