summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/createvoicewindow.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-05-19 16:49:48 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-05-19 16:52:58 +0200
commit733eb9af409a0482d92fe8411b1a2bd53375cc71 (patch)
tree41578ac9fa0e91ba09b23860dd23863b1ef15f52 /rbutil/rbutilqt/createvoicewindow.cpp
parent9f89ffa71c7029803c96a102efee0ab65edc6ead (diff)
downloadrockbox-733eb9af409a0482d92fe8411b1a2bd53375cc71.tar.gz
rockbox-733eb9af409a0482d92fe8411b1a2bd53375cc71.tar.bz2
rockbox-733eb9af409a0482d92fe8411b1a2bd53375cc71.zip
Show nicer language names in voice creation dialog.
Instead of showing the internal language names show some more human friendly string. Currently only applies to the voice creation dialog, the language configuration dialog needs further adjustments to support display strings differing from values. Change-Id: Ic94838f1079c1d09a666d7dbd9682c577f686b3f
Diffstat (limited to 'rbutil/rbutilqt/createvoicewindow.cpp')
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp
index d1db0145e4..a45425a0ef 100644
--- a/rbutil/rbutilqt/createvoicewindow.cpp
+++ b/rbutil/rbutilqt/createvoicewindow.cpp
@@ -52,7 +52,7 @@ void CreateVoiceWindow::accept()
//configure voicecreator
voicecreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
- voicecreator->setLang(ui.comboLanguage->currentText());
+ voicecreator->setLang(ui.comboLanguage->itemData(ui.comboLanguage->currentIndex()).toString());
voicecreator->setWavtrimThreshold(ui.wavtrimthreshold->value());
//start creating
@@ -69,25 +69,25 @@ void CreateVoiceWindow::accept()
void CreateVoiceWindow::updateSettings(void)
{
// fill in language combobox
- QMap<QString, QString> languages = SystemInfo::languages();
+ QMap<QString, QStringList> 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);
+ ui.comboLanguage->addItem(languages.value(key).at(1), languages.value(key).at(0));
}
// set saved lang
- int sel = ui.comboLanguage->findText(
+ int sel = ui.comboLanguage->findData(
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();
+ QString uilang = 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";
+ QString f = "english";
+ if(!uilang.isEmpty() && languages.contains(uilang)) {
+ f = languages.value(uilang).at(0);
+ }
sel = ui.comboLanguage->findData(f);
- qDebug() << "sel =" << sel;
- // still nothing found?
- if(sel == -1)
- sel = ui.comboLanguage->findText("english", Qt::MatchStartsWith);
+ qDebug() << "[CreateVoiceWindow] Selected language index:" << sel;
}
ui.comboLanguage->setCurrentIndex(sel);
@@ -125,7 +125,7 @@ void CreateVoiceWindow::saveSettings(void)
{
// save selected language
RbSettings::setValue(RbSettings::VoiceLanguage,
- ui.comboLanguage->currentText());
+ ui.comboLanguage->itemData(ui.comboLanguage->currentIndex()).toString());
// save wavtrim threshold value
RbSettings::setValue(RbSettings::WavtrimThreshold,
ui.wavtrimthreshold->value());