]> sigrok.org Git - pulseview.git/commitdiff
Include translations and editors in about dialog
authorSoeren Apel <redacted>
Thu, 2 Jul 2020 19:48:34 +0000 (21:48 +0200)
committerSoeren Apel <redacted>
Thu, 2 Jul 2020 19:51:27 +0000 (21:51 +0200)
pv/application.cpp
pv/application.hpp
pv/dialogs/settings.cpp

index 6f666c5c308762c55ea0990297f1ea9fea1536eb..8252f27fb0c1e87ffbf97a2cf24b269b8ecfa6b7 100644 (file)
@@ -65,7 +65,7 @@ Application::Application(int &argc, char* argv[]) :
        setOrganizationDomain("sigrok.org");
 }
 
-QStringList Application::get_languages()
+const QStringList Application::get_languages() const
 {
        QStringList files = QDir(":/l10n/").entryList(QStringList("*.qm"), QDir::Files);
 
@@ -81,6 +81,14 @@ QStringList Application::get_languages()
        return result;
 }
 
+const QString Application::get_language_editors(const QString& language) const
+{
+       if (language == "de") return "Sören Apel, Uwe Hermann";
+       if (language == "es_mx") return "Carlos Diaz";
+
+       return QString();
+}
+
 void Application::switch_language(const QString& language)
 {
        removeTranslator(&app_translator_);
index 61fe46e2480dc855210e586230c2e6960e070101..75ddbc0603a5b62936caa028def364dd85b38fa7 100644 (file)
@@ -41,8 +41,10 @@ class Application : public QApplication, public pv::GlobalSettingsInterface
 public:
        Application(int &argc, char* argv[]);
 
-       QStringList get_languages();
+       const QStringList get_languages() const;
+       const QString get_language_editors(const QString& language) const;
        void switch_language(const QString& language);
+
        void on_setting_changed(const QString &key, const QVariant &value);
 
        void collect_version_info(shared_ptr<sigrok::Context> context);
index 9f458c99953e8c26c1721b5b9e819e73f9f1a1f7..ccf6c519748ad702ca71fea7269ce62470dcf1b3 100644 (file)
@@ -222,8 +222,8 @@ QWidget *Settings::get_general_settings_form(QWidget *parent) const
 
        QString current_language = settings.value(GlobalSettings::Key_General_Language).toString();
        for (const QString& language : a->get_languages()) {
-               QLocale locale = QLocale(language);
-               QString desc = locale.languageToString(locale.language());
+               const QLocale locale = QLocale(language);
+               const QString desc = locale.languageToString(locale.language());
                language_cb->addItem(desc, language);
 
                if (language == current_language) {
@@ -499,6 +499,21 @@ QWidget *Settings::get_about_page(QWidget *parent) const
                        .arg(entry.first, entry.second));
 #endif
 
+       s.append("<tr><td colspan=\"2\"></td></tr>");
+       s.append("<tr><td colspan=\"2\"><b>" +
+               tr("Available Translations:") + "</b></td></tr>");
+       for (const QString& language : a->get_languages()) {
+               if (language == "en")
+                       continue;
+
+               const QLocale locale = QLocale(language);
+               const QString desc = locale.languageToString(locale.language());
+               const QString editors = a->get_language_editors(language);
+
+               s.append(QString("<tr><td class=\"id\"><i>%1</i></td><td>(%2)</td></tr>")
+                       .arg(desc, editors));
+       }
+
        s.append("</table>");
 
        QTextDocument *supported_doc = new QTextDocument();