summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/createvoicewindow.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-02-04 23:28:34 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-02-04 23:28:34 +0000
commit988b3083df91d88848ec637664e2d8b9ed26a489 (patch)
tree07186d46e09da918d246ecbe2d86f3e49440f9e5 /rbutil/rbutilqt/createvoicewindow.cpp
parent3419422c239758fc6002e56e6be3c034bc8dbe8e (diff)
downloadrockbox-988b3083df91d88848ec637664e2d8b9ed26a489.tar.gz
rockbox-988b3083df91d88848ec637664e2d8b9ed26a489.tar.bz2
rockbox-988b3083df91d88848ec637664e2d8b9ed26a489.zip
Replace list of languages with map.
- Use ISO codes as keys for voice languages instead of enumeration. - Instead of trying to select a suitable voicefile language from the UI language use the ISO codes stored as UI language and match against the mapping. - Always store the selected UI language. Fixes the voicefile creation language lookup to fail if the language used is the system language. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29207 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/createvoicewindow.cpp')
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp
index 7c2ff732c4..95df4b1b0c 100644
--- a/rbutil/rbutilqt/createvoicewindow.cpp
+++ b/rbutil/rbutilqt/createvoicewindow.cpp
@@ -71,24 +71,28 @@ void CreateVoiceWindow::accept()
void CreateVoiceWindow::updateSettings(void)
{
// fill in language combobox
- QStringList languages = SystemInfo::languages();
- languages.sort();
- ui.comboLanguage->addItems(languages);
+ QMap<QString, QString> languages = SystemInfo::languages();
+
+ for(int i = 0; i < languages.keys().size(); i++) {
+ QString key = languages.keys().at(i);
+ ui.comboLanguage->addItem(languages.value(key), key);
+ }
// set saved lang
- int sel = ui.comboLanguage->findText(RbSettings::value(RbSettings::VoiceLanguage).toString());
+ int sel = ui.comboLanguage->findText(
+ RbSettings::value(RbSettings::VoiceLanguage).toString());
// if no saved language is found try to figure the language from the UI lang
if(sel == -1) {
QString f = RbSettings::value(RbSettings::Language).toString();
// if no language is set default to english. Make sure not to check an empty string.
if(f.isEmpty()) f = "english";
- sel = ui.comboLanguage->findText(f, Qt::MatchStartsWith);
+ sel = ui.comboLanguage->findData(f);
qDebug() << "sel =" << sel;
// still nothing found?
if(sel == -1)
sel = ui.comboLanguage->findText("english", Qt::MatchStartsWith);
}
ui.comboLanguage->setCurrentIndex(sel);
-
+
QString ttsName = RbSettings::value(RbSettings::Tts).toString();
TTSBase* tts = TTSBase::getTTS(this,ttsName);
if(tts->configOk())