diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2014-01-04 16:13:28 +0100 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2014-01-04 16:13:28 +0100 |
commit | 7f6b344b49506462a63453bc79ae1b82536dc138 (patch) | |
tree | eaa00948a8d465359b81a50e95d530ca51d2c1d0 /gui | |
parent | 9bbbb050602e401b3805febf23a2bc2bdb881d18 (diff) | |
download | MultiMC-7f6b344b49506462a63453bc79ae1b82536dc138.tar MultiMC-7f6b344b49506462a63453bc79ae1b82536dc138.tar.gz MultiMC-7f6b344b49506462a63453bc79ae1b82536dc138.tar.lz MultiMC-7f6b344b49506462a63453bc79ae1b82536dc138.tar.xz MultiMC-7f6b344b49506462a63453bc79ae1b82536dc138.zip |
Clean up/update translation code and made language selectable in the settings dialog
Diffstat (limited to 'gui')
-rw-r--r-- | gui/dialogs/SettingsDialog.cpp | 16 | ||||
-rw-r--r-- | gui/dialogs/SettingsDialog.ui | 17 |
2 files changed, 31 insertions, 2 deletions
diff --git a/gui/dialogs/SettingsDialog.cpp b/gui/dialogs/SettingsDialog.cpp index 9362075e..e0e1b82c 100644 --- a/gui/dialogs/SettingsDialog.cpp +++ b/gui/dialogs/SettingsDialog.cpp @@ -219,6 +219,9 @@ void SettingsDialog::applySettings(SettingsObject *s) } } + // Language + s->set("Language", ui->languageBox->currentData().toLocale().bcp47Name()); + // Updates s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked()); @@ -286,6 +289,19 @@ void SettingsDialog::applySettings(SettingsObject *s) void SettingsDialog::loadSettings(SettingsObject *s) { + // Language + ui->languageBox->clear(); + ui->languageBox->addItem(tr("English"), QLocale(QLocale::English)); + foreach(const QString & lang, + QDir(MMC->root() + "/translations").entryList(QStringList() << "*.qm", QDir::Files)) + { + QLocale locale(lang.section(QRegExp("[_\.]"), 1)); + ui->languageBox->addItem( + QLocale::languageToString(locale.language()), + locale); + } + ui->languageBox->setCurrentIndex(ui->languageBox->findData(QLocale(s->get("Language").toString()))); + // Updates ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool()); ui->devBuildsCheckBox->setChecked(s->get("UseDevBuilds").toBool()); diff --git a/gui/dialogs/SettingsDialog.ui b/gui/dialogs/SettingsDialog.ui index dbc8ca88..c1008c75 100644 --- a/gui/dialogs/SettingsDialog.ui +++ b/gui/dialogs/SettingsDialog.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>526</width> - <height>628</height> + <height>701</height> </rect> </property> <property name="sizePolicy"> @@ -41,6 +41,20 @@ </attribute> <layout class="QVBoxLayout" name="verticalLayout"> <item> + <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1"> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Language (needs restart):</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="languageBox"/> + </item> + </layout> + </item> + <item> <widget class="QGroupBox" name="sortingModeBox"> <property name="enabled"> <bool>true</bool> @@ -644,7 +658,6 @@ </layout> </widget> <tabstops> - <tabstop>settingsTab</tabstop> <tabstop>buttonBox</tabstop> <tabstop>sortLastLaunchedBtn</tabstop> <tabstop>sortByNameBtn</tabstop> |