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#include <QLabel>
15
16#include <kis_debug.h>
17#include <kis_global.h>
18
19#include "kis_splash_screen.h"
20#include "ui_wdgaboutapplication.h"
21#include <KisPortingUtils.h>
22
23#ifdef Q_OS_MACOS
25#endif
26
27class Q_DECL_HIDDEN WdgAboutApplication : public QWidget, public Ui::WdgAboutApplication
28{
29public:
30 WdgAboutApplication(QWidget *parent = nullptr)
31 : QWidget(parent)
32 {
33 setupUi(this);
34 }
35};
36
38 : KoDialog(parent)
39{
40 setWindowTitle(i18n("About Krita"));
42
43 WdgAboutApplication *wdgTab = new WdgAboutApplication(this);
44
45 KisSplashScreen *splash = new KisSplashScreen(320, this, Qt::Widget);
46
47 QStringList lblLinksText;
48 lblLinksText << "<html>"
49 << "<head/>"
50 << "<body><table style=\"width:100%\" cellpadding=\"30\"><tr><td>"
51 << i18n("<p><b>Using Krita</b></p>");
52
53#ifdef Q_OS_MACOS
54 // macOS store version should not contain external links containing donation buttons or forms
55 if (!KisMacosEntitlements().sandbox()) {
56#endif
57
58 lblLinksText << i18n("<p><a href=\"https://krita.org/support-us/\"><span style=\" text-decoration: underline;\">Support Krita's Development!</span></a></p>")
59 << i18n("<p><a href=\"https://krita.org/\"><span style=\" text-decoration: underline;\">Krita Website</span></a></p>");
60#ifdef Q_OS_MACOS
61 }
62#endif
63 lblLinksText << i18n("<p><a href=\"https://docs.krita.org/en/user_manual/getting_started.html\"><span style=\" text-decoration: underline;\">Getting Started</span></a></p>")
64 << i18n("<p><a href=\"https://docs.krita.org/\"><span style=\" text-decoration: underline;\">Manual</span></a></p>")
65 << "</td><td>"
66 << i18n("<p><b>Coding Krita</b></p>")
67 << i18n("<p><a href=\"https://krita-artists.org\"><span style=\" text-decoration: underline;\">User Community</span></a></p>")
68 << i18n("<p><a href=\"https://invent.kde.org/graphics/krita\"><span style=\" text-decoration: underline;;\">Source Code</span></a></p>")
69 << i18n("<p><a href=\"https://api.kde.org/krita/html/classKrita.html\"><span style=\" text-decoration: underline;\">Scripting API</span></a></p>")
70 << i18n("<p><a href=\"https://scripting.krita.org/lessons/introduction\"><span style=\" text-decoration: underline;;\">Scripting School</span></a></p>")
71 << "</td></tr></table></body>"
72 << "</html>";
73
74
75 QLabel* lblLinks = new QLabel();
76 lblLinks->setTextFormat(Qt::RichText);
77 lblLinks->setText(lblLinksText.join(""));
78 lblLinks->setOpenExternalLinks(true);
79
80 wdgTab->aboutTab->layout()->addWidget(splash);
81 wdgTab->aboutTab->layout()->addWidget(lblLinks);
82
83 QString authors = i18n("<html>"
84 "<head/>"
85 "<body>"
86 "<h1 align=\"center\">Created By</h1></p>"
87 "<p>");
88
89 QFile fileDevelopers(":/developers.txt");
90 Q_ASSERT(fileDevelopers.exists());
91 if (fileDevelopers.open(QIODevice::ReadOnly | QIODevice::Text)) {
92 QTextStream developersText(&fileDevelopers);
94 authors.append(developersText.readAll().split("\n", Qt::SkipEmptyParts).join(", "));
95 }
96 authors.append(".</p></body></html>");
97 wdgTab->lblAuthors->setText(authors);
98
99 // Translators
100 // TODO: move to KisApplication after string freeze is lifted
101 KAboutData aboutData(KAboutData::applicationData());
102 if (aboutData.translators().isEmpty()) {
103 aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
104 i18nc("EMAIL OF TRANSLATORS", "Your emails"));
105
106 }
107
108 QString translatorHtml = i18n(
109 "<html>"
110 "<head/>"
111 "<body>"
112 "<h1 align=\"center\"><b>Translators</b></h1>"
113 "<p><ul>");
114
115 Q_FOREACH (const KAboutPerson &person, aboutData.translators()) {
116 translatorHtml.append(QString("<li>%1</li>").arg(person.name()));
117 }
118
119 translatorHtml.append("<ul></p>");
120 translatorHtml.append(
121 i18n("<p>KDE is translated into many languages thanks to the work of the "
122 "translation teams all over the world.</p><p>For more information on KDE "
123 "internationalization visit <a href=\"http://l10n.kde.org\">http://l10n."
124 "kde.org</a></p>"));
125 translatorHtml.append("</body></html>");
126
127 wdgTab->lblTranslators->setText(translatorHtml);
128
129 QString sponsors = i18n(
130 "<html><head/><body>"
131 "<h1 align=\"center\">Development Fund</h1>"
132 "<p align=\"center\"> <a href=\"https://intel.com\"><img src=\":/intel.png\"></a> "
133 "<h2 align=\"center\">One Time Sponsors</h2>"
134 "<p align=\"center\"> <a href=\"https://www.unrealengine.com/en-US/megagrants\"><img src=\":/epic.png\"></a> "
135 "<p align=\"center\"> <a href=\"http://brokenrul.es/\"><img src=\":/broken_rules.png\"></a> "
136 "<p align=\"center\"> <a href=\"https://game-chuck.com/\"><img src=\":/gamechuck.png\"></a> "
137 "<p align=\"center\"> <a href=\"https://www.fosshub.com/Krita.html\"><img src=\":/fosshub.png\"></a> "
138 "<p align=\"center\"> <a href=\"http://www.asifa-hollywood.org/\"><img src=\":/asifa.png\"></a> "
139 "</body></html>");
140 wdgTab->lblKickstarter->setText(sponsors);
141
142 QString credits = i18n("<html>"
143 "<head/>"
144 "<body>"
145 "<h1 align=\"center\">Thanks To</h1>"
146 "<p>");
147
148 QFile fileCredits(":/credits.txt");
149 Q_ASSERT(fileCredits.exists());
150 if (fileCredits.open(QIODevice::ReadOnly | QIODevice::Text)) {
151 QTextStream creditsText(&fileCredits);
153
154 Q_FOREACH (const QString &credit, creditsText.readAll().split('\n', Qt::SkipEmptyParts)) {
155
156 if (credit.contains(":")) {
157 QList<QString> creditSplit = credit.split(':');
158 credits.append(creditSplit.at(0));
159 credits.append(" (<i>" + creditSplit.at(1) + "</i>)");
160 credits.append(", ");
161 }
162 }
163 credits.chop(2);
164 }
165 credits.append(i18n(".</p><p><i>For supporting Krita development with advice, icons, brush sets and more.</i></p></body></html>"));
166
167 wdgTab->lblCredits->setText(credits);
168
169 QString license = i18n("<html>"
170 "<head/>"
171 "<body>"
172 "<h1 align=\"center\"><b>Your Rights</b></h1>"
173 "<p>Krita is released under the GNU General Public License (version 3 or any later version).</p>"
174 "<p>This license grants people a number of freedoms:</p>"
175 "<ul>"
176 "<li>You are free to use Krita, for any purpose</li>"
177 "<li>You are free to distribute Krita</li>"
178 "<li>You can study how Krita works and change it</li>"
179 "<li>You can distribute changed versions of Krita</li>"
180 "</ul>"
181 "<p>The Krita Foundation and its projects on krita.org are <b>committed</b> to preserving Krita as free software.</p>"
182 "<h1 align=\"center\">Your artwork</h1>"
183 "<p>What you create with Krita is your sole property. All your artwork is free for you to use as you like.</p>"
184 "<p>That means that Krita can be used commercially, for any purpose. There are no restrictions whatsoever.</p>"
185 "<p>Krita’s GNU GPL license guarantees you this freedom. Nobody is ever permitted to take it away, in contrast "
186 "to trial or educational versions of commercial software that will forbid your work in commercial situations.</p>"
187 "<br/><hr/><pre>");
188
189 QFile licenseFile(":/LICENSE");
190 Q_ASSERT(licenseFile.exists());
191 if (licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
192 QTextStream licenseText(&licenseFile);
194 license.append(licenseText.readAll());
195 }
196 license.append("</pre></body></html>");
197 wdgTab->lblLicense->setText(license);
198
199 QFile thirdPartyFile(":/libraries.txt");
200 if (thirdPartyFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
201 QTextStream thirdPartyText(&thirdPartyFile);
202 KisPortingUtils::setUtf8OnStream(thirdPartyText);
203
204 QString thirdPartyHtml = i18n("<html>"
205 "<head/>"
206 "<body>"
207 "<h1 align=\"center\"><b>Third-party Libraries used by Krita</b></h1>"
208 "<p>Krita is built on the following free software libraries:</p><p><ul>");
209
210 Q_FOREACH (const QString &lib, thirdPartyText.readAll().split('\n', Qt::SkipEmptyParts)) {
211
212 if (!lib.startsWith("#")) {
213 QStringList parts = lib.split(',');
214 if (parts.size() >= 3) {
215 thirdPartyHtml.append(QString("<li><a href=\"%2\">%1</a>: %3</li>").arg(parts[0], parts[1], parts[2]));
216 }
217 }
218 }
219 thirdPartyHtml.append("<ul></p></body></html>");
220 wdgTab->lblThirdParty->setText(thirdPartyHtml);
221 }
222
223 setMainWidget(wdgTab);
224 setMinimumSize(sizeHint());
225 Q_ASSERT(layout());
226 layout()->setSizeConstraint(QLayout::SetFixedSize);
227}
KisAboutApplication(QWidget *parent=nullptr)
A dialog base class with standard buttons and predefined layouts.
Definition KoDialog.h:116
void setMainWidget(QWidget *widget)
Definition KoDialog.cpp:345
QSize sizeHint() const override
Definition KoDialog.cpp:368
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)