diff options
| -rw-r--r-- | src/settingsdialog.ui | 42 | ||||
| -rw-r--r-- | src/settingsdialoggeneral.cpp | 57 |
2 files changed, 63 insertions, 36 deletions
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 @@ <item row="0" column="1"> <widget class="QComboBox" name="languageBox"> <property name="toolTip"> - <string>The display language</string> + <string>The language of the user interface.</string> </property> <property name="whatsThis"> - <string><!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></string> + <string>The language of the user interface.</string> </property> </widget> </item> @@ -89,10 +85,10 @@ p, li { white-space: pre-wrap; } <item row="1" column="1"> <widget class="QComboBox" name="styleBox"> <property name="toolTip"> - <string>graphical style</string> + <string>Visual theme of the user interface.</string> </property> <property name="whatsThis"> - <string>graphical style of the MO user interface</string> + <string>Visual theme of the user interface.</string> </property> </widget> </item> @@ -121,10 +117,10 @@ p, li { white-space: pre-wrap; } </size> </property> <property name="toolTip"> - <string>Reset stored information from dialogs.</string> + <string>Reset all choices made in dialogs.</string> </property> <property name="whatsThis"> - <string>This will make all dialogs show up again where you checked the "Remember selection"-box.</string> + <string>Reset all choices made in dialogs.</string> </property> <property name="text"> <string>Reset Dialog Choices</string> @@ -169,7 +165,10 @@ p, li { white-space: pre-wrap; } <item> <widget class="QCheckBox" name="showMetaBox"> <property name="toolTip"> - <string>If checked, the download list will display meta information instead of file names.</string> + <string>Show meta information instead of file names in the download list.</string> + </property> + <property name="whatsThis"> + <string>Show meta information instead of file names in the download list.</string> </property> <property name="text"> <string>Show Meta Information</string> @@ -179,7 +178,10 @@ p, li { white-space: pre-wrap; } <item> <widget class="QCheckBox" name="compactBox"> <property name="toolTip"> - <string>If checked, the download interface will be more compact.</string> + <string>Make the download list more compact.</string> + </property> + <property name="whatsThis"> + <string>Make the download list more compact.</string> </property> <property name="text"> <string>Compact List</string> @@ -257,10 +259,10 @@ p, li { white-space: pre-wrap; } <item> <widget class="QCheckBox" name="colorSeparatorsBox"> <property name="toolTip"> - <string>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.</string> + <string>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.</string> </property> <property name="whatsThis"> - <string>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.</string> + <string>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.</string> </property> <property name="text"> <string>Show mod list separator colors on the scrollbar</string> @@ -285,6 +287,12 @@ p, li { white-space: pre-wrap; } </item> <item> <widget class="QPushButton" name="resetColorsBtn"> + <property name="toolTip"> + <string>Reset all colors to their default value.</string> + </property> + <property name="whatsThis"> + <string>Reset all colors to their default value.</string> + </property> <property name="text"> <string>Reset Colors</string> </property> @@ -305,10 +313,10 @@ p, li { white-space: pre-wrap; } <item> <widget class="QCheckBox" name="checkForUpdates"> <property name="toolTip"> - <string>Mod Organizer checks for updates on Github on startup.</string> + <string>Check for Mod Organizer updates on Github on startup.</string> </property> <property name="whatsThis"> - <string>Mod Organizer checks for updates on Github on startup.</string> + <string>Check for Mod Organizer updates on Github on startup.</string> </property> <property name="text"> <string>Check for updates</string> @@ -321,7 +329,7 @@ p, li { white-space: pre-wrap; } <string>Update to non-stable releases.</string> </property> <property name="whatsThis"> - <string>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.</string> + <string>Update to non-stable releases.</string> </property> <property name="text"> <string>Install Pre-releases (Betas)</string> 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<std::pair<QString, QString>> 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); } } |
