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 // TODO: move to KisApplication after string freeze is lifted
64 KAboutData aboutData(KAboutData::applicationData());
65 if (aboutData.translators().isEmpty()) {
66 aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
67 i18nc("EMAIL OF TRANSLATORS", "Your emails"));
68
69 }
70
71 QString translatorHtml = i18n(
72 "<html>"
73 "<head/>"
74 "<body>"
75 "<h1 align=\"center\"><b>Translators</b></h1>"
76 "<p><ul>");
77
78 Q_FOREACH (const KAboutPerson &person, aboutData.translators()) {
79 translatorHtml.append(QString("<li>%1</li>").arg(person.name()));
80 }
81
82 translatorHtml.append("<ul></p>");
83 translatorHtml.append(
84 i18n("<p>KDE is translated into many languages thanks to the work of the "
85 "translation teams all over the world.</p><p>For more information on KDE "
86 "internationalization visit <a href=\"http://l10n.kde.org\">http://l10n."
87 "kde.org</a></p>"));
88 translatorHtml.append("</body></html>");
89
90 wdgTab->lblTranslators->setText(translatorHtml);
91
92 QString sponsors = i18n(
93 "<html><head/><body>"
94 "<h1 align=\"center\">Development Fund</h1>"
95 "<p align=\"center\"> <a href=\"https://intel.com\"><img src=\":/intel.png\"></a> "
96 "<h2 align=\"center\">One Time Sponsors</h2>"
97 "<p align=\"center\"> <a href=\"https://www.unrealengine.com/en-US/megagrants\"><img src=\":/epic.png\"></a> "
98 "<p align=\"center\"> <a href=\"http://brokenrul.es/\"><img src=\":/broken_rules.png\"></a> "
99 "<p align=\"center\"> <a href=\"https://game-chuck.com/\"><img src=\":/gamechuck.png\"></a> "
100 "<p align=\"center\"> <a href=\"https://www.fosshub.com/Krita.html\"><img src=\":/fosshub.png\"></a> "
101 "<p align=\"center\"> <a href=\"http://www.asifa-hollywood.org/\"><img src=\":/asifa.png\"></a> "
102 "</body></html>");
103 wdgTab->lblKickstarter->setText(sponsors);
104
105 QString credits = i18n("<html>"
106 "<head/>"
107 "<body>"
108 "<h1 align=\"center\">Thanks To</h1>"
109 "<p>");
110
111 QFile fileCredits(":/credits.txt");
112 Q_ASSERT(fileCredits.exists());
113 if (fileCredits.open(QIODevice::ReadOnly | QIODevice::Text)) {
114 QTextStream creditsText(&fileCredits);
116
117 Q_FOREACH (const QString &credit, creditsText.readAll().split('\n', Qt::SkipEmptyParts)) {
118
119 if (credit.contains(":")) {
120 QList<QString> creditSplit = credit.split(':');
121 credits.append(creditSplit.at(0));
122 credits.append(" (<i>" + creditSplit.at(1) + "</i>)");
123 credits.append(", ");
124 }
125 }
126 credits.chop(2);
127 }
128 credits.append(i18n(".</p><p><i>For supporting Krita development with advice, icons, brush sets and more.</i></p></body></html>"));
129
130 wdgTab->lblCredits->setText(credits);
131
132 QString license = i18n("<html>"
133 "<head/>"
134 "<body>"
135 "<h1 align=\"center\"><b>Your Rights</b></h1>"
136 "<p>Krita is released under the GNU General Public License (version 3 or any later version).</p>"
137 "<p>This license grants people a number of freedoms:</p>"
138 "<ul>"
139 "<li>You are free to use Krita, for any purpose</li>"
140 "<li>You are free to distribute Krita</li>"
141 "<li>You can study how Krita works and change it</li>"
142 "<li>You can distribute changed versions of Krita</li>"
143 "</ul>"
144 "<p>The Krita Foundation and its projects on krita.org are <b>committed</b> to preserving Krita as free software.</p>"
145 "<h1 align=\"center\">Your artwork</h1>"
146 "<p>What you create with Krita is your sole property. All your artwork is free for you to use as you like.</p>"
147 "<p>That means that Krita can be used commercially, for any purpose. There are no restrictions whatsoever.</p>"
148 "<p>Krita’s GNU GPL license guarantees you this freedom. Nobody is ever permitted to take it away, in contrast "
149 "to trial or educational versions of commercial software that will forbid your work in commercial situations.</p>"
150 "<br/><hr/><pre>");
151
152 QFile licenseFile(":/LICENSE");
153 Q_ASSERT(licenseFile.exists());
154 if (licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
155 QTextStream licenseText(&licenseFile);
157 license.append(licenseText.readAll());
158 }
159 license.append("</pre></body></html>");
160 wdgTab->lblLicense->setText(license);
161
162 QFile thirdPartyFile(":/libraries.txt");
163 if (thirdPartyFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
164 QTextStream thirdPartyText(&thirdPartyFile);
165 KisPortingUtils::setUtf8OnStream(thirdPartyText);
166
167 QString thirdPartyHtml = i18n("<html>"
168 "<head/>"
169 "<body>"
170 "<h1 align=\"center\"><b>Third-party Libraries used by Krita</b></h1>"
171 "<p>Krita is built on the following free software libraries:</p><p><ul>");
172
173 Q_FOREACH (const QString &lib, thirdPartyText.readAll().split('\n', Qt::SkipEmptyParts)) {
174
175 if (!lib.startsWith("#")) {
176 QStringList parts = lib.split(',');
177 if (parts.size() >= 3) {
178 thirdPartyHtml.append(QString("<li><a href=\"%2\">%1</a>: %3</li>").arg(parts[0], parts[1], parts[2]));
179 }
180 }
181 }
182 thirdPartyHtml.append("<ul></p></body></html>");
183 wdgTab->lblThirdParty->setText(thirdPartyHtml);
184 }
185
186 setMainWidget(wdgTab);
187 setMinimumSize(sizeHint());
188 Q_ASSERT(layout());
189 layout()->setSizeConstraint(QLayout::SetFixedSize);
190}
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)