[graphics/krita] libs/ui/dialogs: Add a translators tab to the aboutbox

Boudewijn Rempt null at kde.org
Thu Sep 10 12:26:11 BST 2020


Git commit d239357b27223c35c4fb8f83bb1d21eea0a46e37 by Boudewijn Rempt.
Committed on 10/09/2020 at 11:26.
Pushed by rempt into branch 'master'.

Add a translators tab to the aboutbox

This breaks string freeze, but the strings are present in kxmlgui -- which
we don't use in Krita.

BUG:422156
CCMAIL:kimageshop at kde.org
CCMAIL:kde-i18n-doc at kde.org
(cherry picked from commit f79e2349773071a96d0e32676f28cf21c45813a0)

M  +51   -0    libs/ui/dialogs/kis_about_application.cpp
M  +9    -0    libs/ui/dialogs/kis_about_application.h

https://invent.kde.org/graphics/krita/commit/d239357b27223c35c4fb8f83bb1d21eea0a46e37

diff --git a/libs/ui/dialogs/kis_about_application.cpp b/libs/ui/dialogs/kis_about_application.cpp
index 5b41403b34..f7762cc70d 100644
--- a/libs/ui/dialogs/kis_about_application.cpp
+++ b/libs/ui/dialogs/kis_about_application.cpp
@@ -32,6 +32,7 @@
 #include <QApplication>
 #include <QFile>
 #include <QDesktopServices>
+#include <kaboutdata.h>
 
 #include <klocalizedstring.h>
 
@@ -92,6 +93,21 @@ KisAboutApplication::KisAboutApplication(QWidget *parent)
     lblAuthors->setText(authors);
     wdgTab->addTab(lblAuthors, i18nc("Heading for the list of Krita authors/developers", "Authors"));
 
+
+    // Translators
+    KAboutData aboutData(KAboutData::applicationData());
+    if (aboutData.translators().isEmpty()) {
+        aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
+                                i18nc("EMAIL OF TRANSLATORS", "Your emails"));
+
+    }
+
+    if (!aboutData.translators().isEmpty()) {
+        wdgTab->addTab(createTranslatorsWidget(aboutData.translators(), aboutData.ocsProviderUrl()),
+                       i18nc("@title:tab", "Translators"));
+    }
+
+
     QTextEdit *lblKickstarter = new QTextEdit();
     lblKickstarter->setReadOnly(true);
 
@@ -198,6 +214,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent)
     }
     wdgTab->addTab(lblThirdParty, i18n("Third-party libraries"));
 
+
     QPushButton *bnClose = new QPushButton(i18n("Close"));
     bnClose->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
     connect(bnClose, SIGNAL(clicked()), SLOT(close()));
@@ -210,3 +227,37 @@ KisAboutApplication::KisAboutApplication(QWidget *parent)
     vlayout->addLayout(hlayout);
 
 }
+
+QWidget *KisAboutApplication::createTranslatorsWidget(const QList<KAboutPerson> &translators, const QString &ocsProviderUrl)
+{
+    QString aboutTranslationTeam = KAboutData::aboutTranslationTeam();
+
+    qDebug() << aboutTranslationTeam << ocsProviderUrl;
+
+    QTextBrowser *lblTranslators = new QTextBrowser();
+
+    lblTranslators->setOpenExternalLinks(true);
+
+    QString translatorHtml = i18n("<html>"
+                                  "<head/>"
+                                  "<body>"
+                                  "<h1 align=\"center\"><b>Translators</b></h1>"
+                                  "<p><ul>");
+
+
+    Q_FOREACH(const KAboutPerson &person, translators) {
+        translatorHtml.append(QString("<li>%1</li>").arg(person.name()));
+    }
+
+    translatorHtml.append("<ul></p>");
+    translatorHtml.append("<p>KDE is translated into many languages thanks to the work of the "
+                          "translation teams all over the world.</p><p>For more information on KDE "
+                          "internationalization visit <a href=\"http://l10n.kde.org\">http://l10n."
+                          "kde.org</a></p>");
+    translatorHtml.append("</body></html>");
+
+    lblTranslators->setText(translatorHtml);
+
+    return lblTranslators;
+}
+
diff --git a/libs/ui/dialogs/kis_about_application.h b/libs/ui/dialogs/kis_about_application.h
index 6fd8a9e40b..1c5df6256a 100644
--- a/libs/ui/dialogs/kis_about_application.h
+++ b/libs/ui/dialogs/kis_about_application.h
@@ -19,6 +19,9 @@
 #define KIS_ABOUT_APPLICATION_H
 
 #include <QDialog>
+#include <QList>
+
+#include <kaboutdata.h>
 
 class KisAboutApplication : public QDialog
 {
@@ -26,6 +29,12 @@ class KisAboutApplication : public QDialog
 public:
     explicit KisAboutApplication(QWidget *parent = 0);
 
+
+private:
+    QWidget *createTranslatorsWidget(const QList<KAboutPerson> &translators,
+                                     const QString &ocsProviderUrl);
 };
 
+
+
 #endif // KIS_ABOUT_APPLICATION_H


More information about the kimageshop mailing list