diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-01-20 01:32:38 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-01-20 01:32:38 +0100 |
commit | 222d3c0dc5a8b8a9e93b9368e964cda7becc7f02 (patch) | |
tree | 9ab4538f2e80847874a7c9a5c7c2dbc099cb8cae /gui/dialogs/SettingsDialog.cpp | |
parent | 48b587e7b6b96b5c3ac17dc8b67a7b0ab9c2c4f0 (diff) | |
parent | 3a3c9ac9515447941d383f2c4fe4b0225fdd8252 (diff) | |
download | MultiMC-222d3c0dc5a8b8a9e93b9368e964cda7becc7f02.tar MultiMC-222d3c0dc5a8b8a9e93b9368e964cda7becc7f02.tar.gz MultiMC-222d3c0dc5a8b8a9e93b9368e964cda7becc7f02.tar.lz MultiMC-222d3c0dc5a8b8a9e93b9368e964cda7becc7f02.tar.xz MultiMC-222d3c0dc5a8b8a9e93b9368e964cda7becc7f02.zip |
Merge branch 'release-0.2'0.2
Diffstat (limited to 'gui/dialogs/SettingsDialog.cpp')
-rw-r--r-- | gui/dialogs/SettingsDialog.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gui/dialogs/SettingsDialog.cpp b/gui/dialogs/SettingsDialog.cpp index 00b3b1fd..ef363f02 100644 --- a/gui/dialogs/SettingsDialog.cpp +++ b/gui/dialogs/SettingsDialog.cpp @@ -269,6 +269,10 @@ void SettingsDialog::refreshUpdateChannelDesc() // Get the channel list. QList<UpdateChecker::ChannelListEntry> channelList = MMC->updateChecker()->getChannelList(); int selectedIndex = ui->updateChannelComboBox->currentIndex(); + if(selectedIndex < 0) + { + return; + } if (selectedIndex < channelList.count()) { // Find the channel list entry with the given index. @@ -284,6 +288,9 @@ void SettingsDialog::refreshUpdateChannelDesc() void SettingsDialog::applySettings(SettingsObject *s) { + // Language + s->set("Language", ui->languageBox->itemData(ui->languageBox->currentIndex()).toLocale().bcp47Name()); + // Updates s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked()); s->set("UpdateChannel", m_currentUpdateChannel); @@ -365,6 +372,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()); m_currentUpdateChannel = s->get("UpdateChannel").toString(); |