Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_about_application.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2022 L. E. Segovia <amy@amyspark.me>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
9
10#include <KAboutData>
11#include <KLocalizedString>
12#include <QFile>
13#include <QStandardPaths>
14
15#include <kis_debug.h>
16#include <kis_global.h>
17
18#include "kis_splash_screen.h"
19#include "ui_wdgaboutapplication.h"
20#include <KisPortingUtils.h>
21
22class Q_DECL_HIDDEN WdgAboutApplication : public QWidget, public Ui::WdgAboutApplication
23{
24public:
25 WdgAboutApplication(QWidget *parent = nullptr)
26 : QWidget(parent)
27 {
28 setupUi(this);
29 }
30};
31
33 : KoDialog(parent)
34{
35 setWindowTitle(i18n("About Krita"));
37
38 WdgAboutApplication *wdgTab = new WdgAboutApplication(this);
39
40 KisSplashScreen *splash = new KisSplashScreen(true);
41 splash->setWindowFlags(Qt::Widget);
42 splash->displayLinks(true);
43
44 wdgTab->aboutTab->layout()->addWidget(splash);
45
46 QString authors = i18n("<html>"
47 "<head/>"
48 "<body>"
49 "<h1 align=\"center\">Created By</h1></p>"
50 "<p>");
51
52 QFile fileDevelopers(":/developers.txt");
53 Q_ASSERT(fileDevelopers.exists());
54 if (fileDevelopers.open(QIODevice::ReadOnly | QIODevice::Text)) {
55 QTextStream developersText(&fileDevelopers);
57 authors.append(developersText.readAll().split("\n", Qt::SkipEmptyParts).join(", "));
58 }
59 authors.append(".</p></body></html>");
60 wdgTab->lblAuthors->setText(authors);
61
62 // Translators
63 KAboutData aboutData(KAboutData::applicationData());
64 if (aboutData.translators().isEmpty()) {
65 aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
66 i18nc("EMAIL OF TRANSLATORS", "Your emails"));
67
68 }
69
70 QString translatorHtml = i18n(
71 "<html>"
72 "<head/>"
73 "<body>"
74 "<h1 align=\"center\"><b>Translators</b></h1>"
75 "<p><ul>");
76
77 Q_FOREACH (const KAboutPerson &person, aboutData.translators()) {
78 translatorHtml.append(QString("<li>%1</li>").arg(person.name()));
79 }
80
81 translatorHtml.append("<ul></p>");
82 translatorHtml.append(
83 i18n("<p>KDE is translated into many languages thanks to the work of the "
84 "translation teams all over the world.</p><p>For more information on KDE "
85 "internationalization visit <a href=\"http://l10n.kde.org\">http://l10n."
86 "kde.org</a></p>"));
87 translatorHtml.append("</body></html>");
88
89 wdgTab->lblTranslators->setText(translatorHtml);
90
91 QString sponsors = i18n(
92 "<html><head/><body>"
93 "<h1 align=\"center\">Development Fund</h1>"
94 "<p align=\"center\"> <a href=\"https://intel.com\"><img src=\":/intel.png\"></a> "
95 "<h2 align=\"center\">One Time Sponsors</h2>"
96 "<p align=\"center\"> <a href=\"https://www.unrealengine.com/en-US/megagrants\"><img src=\":/epic.png\"></a> "
97 "<p align=\"center\"> <a href=\"http://brokenrul.es/\"><img src=\":/broken_rules.png\"></a> "
98 "<p align=\"center\"> <a href=\"https://game-chuck.com/\"><img src=\":/gamechuck.png\"></a> "
99 "<p align=\"center\"> <a href=\"https://www.fosshub.com/Krita.html\"><img src=\":/fosshub.png\"></a> "
100 "<p align=\"center\"> <a href=\"http://www.asifa-hollywood.org/\"><img src=\":/asifa.png\"></a> "
101 "</body></html>");
102 wdgTab->lblKickstarter->setText(sponsors);
103
104 QString credits = i18n("<html>"
105 "<head/>"
106 "<body>"
107 "<h1 align=\"center\">Thanks To</h1>"
108 "<p>");
109
110 QFile fileCredits(":/credits.txt");
111 Q_ASSERT(fileCredits.exists());
112 if (fileCredits.open(QIODevice::ReadOnly | QIODevice::Text)) {
113 QTextStream creditsText(&fileCredits);
115
116 Q_FOREACH (const QString &credit, creditsText.readAll().split('\n', Qt::SkipEmptyParts)) {
117
118 if (credit.contains(":")) {
119 QList<QString> creditSplit = credit.split(':');
120 credits.append(creditSplit.at(0));
121 credits.append(" (<i>" + creditSplit.at(1) + "</i>)");
122 credits.append(", ");
123 }
124 }
125 credits.chop(2);
126 }
127 credits.append(i18n(".</p><p><i>For supporting Krita development with advice, icons, brush sets and more.</i></p></body></html>"));
128
129 wdgTab->lblCredits->setText(credits);
130
131 QString license = i18n("<html>"
132 "<head/>"
133 "<body>"
134 "<h1 align=\"center\"><b>Your Rights</b></h1>"
135 "<p>Krita is released under the GNU General Public License (version 3 or any later version).</p>"
136 "<p>This license grants people a number of freedoms:</p>"
137 "<ul>"
138 "<li>You are free to use Krita, for any purpose</li>"
139 "<li>You are free to distribute Krita</li>"
140 "<li>You can study how Krita works and change it</li>"
141 "<li>You can distribute changed versions of Krita</li>"
142 "</ul>"
143 "<p>The Krita Foundation and its projects on krita.org are <b>committed</b> to preserving Krita as free software.</p>"
144 "<h1 align=\"center\">Your artwork</h1>"
145 "<p>What you create with Krita is your sole property. All your artwork is free for you to use as you like.</p>"
146 "<p>That means that Krita can be used commercially, for any purpose. There are no restrictions whatsoever.</p>"
147 "<p>Krita’s GNU GPL license guarantees you this freedom. Nobody is ever permitted to take it away, in contrast "
148 "to trial or educational versions of commercial software that will forbid your work in commercial situations.</p>"
149 "<br/><hr/><pre>");
150
151 QFile licenseFile(":/LICENSE");
152 Q_ASSERT(licenseFile.exists());
153 if (licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
154 QTextStream licenseText(&licenseFile);
156 license.append(licenseText.readAll());
157 }
158 license.append("</pre></body></html>");
159 wdgTab->lblLicense->setText(license);
160
161 QFile thirdPartyFile(":/libraries.txt");
162 if (thirdPartyFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
163 QTextStream thirdPartyText(&thirdPartyFile);
164 KisPortingUtils::setUtf8OnStream(thirdPartyText);
165
166 QString thirdPartyHtml = i18n("<html>"
167 "<head/>"
168 "<body>"
169 "<h1 align=\"center\"><b>Third-party Libraries used by Krita</b></h1>"
170 "<p>Krita is built on the following free software libraries:</p><p><ul>");
171
172 Q_FOREACH (const QString &lib, thirdPartyText.readAll().split('\n', Qt::SkipEmptyParts)) {
173
174 if (!lib.startsWith("#")) {
175 QStringList parts = lib.split(',');
176 if (parts.size() >= 3) {
177 thirdPartyHtml.append(QString("<li><a href=\"%2\">%1</a>: %3</li>").arg(parts[0], parts[1], parts[2]));
178 }
179 }
180 }
181 thirdPartyHtml.append("<ul></p></body></html>");
182 wdgTab->lblThirdParty->setText(thirdPartyHtml);
183 }
184
185 setMainWidget(wdgTab);
186 setMinimumSize(sizeHint());
187 Q_ASSERT(layout());
188 layout()->setSizeConstraint(QLayout::SetFixedSize);
189}
KisAboutApplication(QWidget *parent=nullptr)
void displayLinks(bool show)
A dialog base class with standard buttons and predefined layouts.
Definition KoDialog.h:116
void setMainWidget(QWidget *widget)
Definition KoDialog.cpp:354
QSize sizeHint() const override
Definition KoDialog.cpp:377
void setButtons(ButtonCodes buttonMask)
Definition KoDialog.cpp:195
@ Close
Show Close-button. (this button closes the dialog)
Definition KoDialog.h:131
WdgAboutApplication(QWidget *parent=nullptr)
void setUtf8OnStream(QTextStream &stream)