From 5d74bd3789515a3e04e54267f1cdfe8f5397f6df Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 25 Sep 2019 19:32:53 -0400 Subject: refactored addLanguages() a bit changed some of the tooltips --- src/settingsdialog.ui | 42 ++++++++++++++++++------------- src/settingsdialoggeneral.cpp | 57 ++++++++++++++++++++++++++++--------------- 2 files changed, 63 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 1ecf19f9..704e4134 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -68,14 +68,10 @@ - The display language + The language of the user interface. - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">The display language. This will only displaye languages for which you have a translation installed.</span></p></body></html> + The language of the user interface. @@ -89,10 +85,10 @@ p, li { white-space: pre-wrap; } - graphical style + Visual theme of the user interface. - graphical style of the MO user interface + Visual theme of the user interface. @@ -121,10 +117,10 @@ p, li { white-space: pre-wrap; } - Reset stored information from dialogs. + Reset all choices made in dialogs. - This will make all dialogs show up again where you checked the "Remember selection"-box. + Reset all choices made in dialogs. Reset Dialog Choices @@ -169,7 +165,10 @@ p, li { white-space: pre-wrap; } - If checked, the download list will display meta information instead of file names. + Show meta information instead of file names in the download list. + + + Show meta information instead of file names in the download list. Show Meta Information @@ -179,7 +178,10 @@ p, li { white-space: pre-wrap; } - If checked, the download interface will be more compact. + Make the download list more compact. + + + Make the download list more compact. Compact List @@ -257,10 +259,10 @@ p, li { white-space: pre-wrap; } - When this is enabled, the color defined for a separator will be shown on the mod list scrollbar at the location of the separator. This can be useful for quick navigation between separator sections or to a specific separator section. + Colors set on separators will also be shown in the mod list scrollbar at the location of the separator. This can be useful for quickly navigating to a specific separator. - When this is enabled, the color defined for a separator will be shown on the mod list scrollbar at the location of the separator. This can be useful for quick navigation between separator sections or to a specific separator section. + Colors set on separators will also be shown in the mod list scrollbar at the location of the separator. This can be useful for quickly navigating to a specific separator. Show mod list separator colors on the scrollbar @@ -285,6 +287,12 @@ p, li { white-space: pre-wrap; } + + Reset all colors to their default value. + + + Reset all colors to their default value. + Reset Colors @@ -305,10 +313,10 @@ p, li { white-space: pre-wrap; } - Mod Organizer checks for updates on Github on startup. + Check for Mod Organizer updates on Github on startup. - Mod Organizer checks for updates on Github on startup. + Check for Mod Organizer updates on Github on startup. Check for updates @@ -321,7 +329,7 @@ p, li { white-space: pre-wrap; } Update to non-stable releases. - If this is enabled, the integrated update mechanism will notify of all releases, including pre-releases (alphas, betas). Please use this only if you're sufficiently tech-savvy to investigate issues, look for known problems in the issue tracker and create meaningful reports. + Update to non-stable releases. Install Pre-releases (Betas) diff --git a/src/settingsdialoggeneral.cpp b/src/settingsdialoggeneral.cpp index 754d10cb..0dfd3a08 100644 --- a/src/settingsdialoggeneral.cpp +++ b/src/settingsdialoggeneral.cpp @@ -158,33 +158,52 @@ void GeneralSettingsTab::update() void GeneralSettingsTab::addLanguages() { + // matches the end of filenames for something like "_en.qm" or "_zh_CN.qm" + const QString pattern = + QString::fromStdWString(AppConfig::translationPrefix()) + + "_([a-z]{2,3}(_[A-Z]{2,2})?).qm"; + + const QRegExp exp(pattern); + + QDirIterator iter( + QCoreApplication::applicationDirPath() + "/translations", + QDir::Files); + std::vector> languages; - QDirIterator langIter(QCoreApplication::applicationDirPath() + "/translations", QDir::Files); - QString pattern = QString::fromStdWString(AppConfig::translationPrefix()) + "_([a-z]{2,3}(_[A-Z]{2,2})?).qm"; - QRegExp exp(pattern); - while (langIter.hasNext()) { - langIter.next(); - QString file = langIter.fileName(); - if (exp.exactMatch(file)) { - QString languageCode = exp.cap(1); - QLocale locale(languageCode); - QString languageString = QString("%1 (%2)").arg(locale.nativeLanguageName()).arg(locale.nativeCountryName()); //QLocale::languageToString(locale.language()); - if (locale.language() == QLocale::Chinese) { - if (languageCode == "zh_TW") { - languageString = "Chinese (traditional)"; - } else { - languageString = "Chinese (simplified)"; - } + while (iter.hasNext()) { + iter.next(); + + const QString file = iter.fileName(); + if (!exp.exactMatch(file)) { + continue; + } + + const QString languageCode = exp.cap(1); + const QLocale locale(languageCode); + + QString languageString = QString("%1 (%2)") + .arg(locale.nativeLanguageName()) + .arg(locale.nativeCountryName()); + + if (locale.language() == QLocale::Chinese) { + if (languageCode == "zh_TW") { + languageString = "Chinese (Traditional)"; + } else { + languageString = "Chinese (Simplified)"; } - languages.push_back(std::make_pair(QString("%1").arg(languageString), exp.cap(1))); } + + languages.push_back({languageString, exp.cap(1)}); } + if (!ui->languageBox->findText("English")) { - languages.push_back(std::make_pair(QString("English"), QString("en_US"))); + languages.push_back({QString("English"), QString("en_US")}); } + std::sort(languages.begin(), languages.end()); - for (const auto &lang : languages) { + + for (const auto& lang : languages) { ui->languageBox->addItem(lang.first, lang.second); } } -- cgit v1.3.1