summaryrefslogtreecommitdiffstats
path: root/rbutil
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
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')
-rw-r--r--rbutil/rbutilqt/base/systeminfo.cpp6
-rw-r--r--rbutil/rbutilqt/base/systeminfo.h8
-rw-r--r--rbutil/rbutilqt/base/ttssapi.cpp5
-rw-r--r--rbutil/rbutilqt/configure.cpp5
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp16
-rw-r--r--rbutil/rbutilqt/rbutil.ini76
6 files changed, 60 insertions, 56 deletions
diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp
index b493168699..4a9c471951 100644
--- a/rbutil/rbutilqt/base/systeminfo.cpp
+++ b/rbutil/rbutilqt/base/systeminfo.cpp
@@ -143,16 +143,16 @@ QStringList SystemInfo::platforms(enum SystemInfo::PlatformType type, QString va
return result;
}
-QStringList SystemInfo::languages()
+QMap<QString, QString> SystemInfo::languages(void)
{
ensureSystemInfoExists();
- QStringList result;
+ QMap<QString, QString> result;
systemInfos->beginGroup("languages");
QStringList a = systemInfos->childKeys();
for(int i = 0; i < a.size(); i++)
{
- result.append(systemInfos->value(a.at(i), "null").toString());
+ result.insert(a.at(i), systemInfos->value(a.at(i), "null").toString());
}
systemInfos->endGroup();
return result;
diff --git a/rbutil/rbutilqt/base/systeminfo.h b/rbutil/rbutilqt/base/systeminfo.h
index 214e423a51..f5e0eae6ef 100644
--- a/rbutil/rbutilqt/base/systeminfo.h
+++ b/rbutil/rbutilqt/base/systeminfo.h
@@ -34,7 +34,7 @@ class SystemInfo : public QObject
MapError,
MapIncompatible,
};
-
+
//! All system settings
enum SystemInfos {
ManualUrl,
@@ -78,14 +78,14 @@ class SystemInfo : public QObject
//! return a list of all platforms (rbutil internal names)
static QStringList platforms(enum PlatformType type = PlatformAll,
QString variant="");
- //! returns a list of all languages
- static QStringList languages(void);
+ //! returns a map of all languages
+ static QMap<QString, QString> languages(void);
//! returns a map of usb-ids and their targets
static QMap<int, QString> usbIdMap(enum MapType);
//! get a value from system settings
static QVariant value(enum SystemInfos info);
//! get a value from system settings for a named platform.
- static QVariant platformValue(QString platform, enum SystemInfos info);
+ static QVariant platformValue(QString platform, enum SystemInfos info);
private:
//! you shouldnt call this, its a fully static calls
diff --git a/rbutil/rbutilqt/base/ttssapi.cpp b/rbutil/rbutilqt/base/ttssapi.cpp
index b149e1d786..2cc95cd4aa 100644
--- a/rbutil/rbutilqt/base/ttssapi.cpp
+++ b/rbutil/rbutilqt/base/ttssapi.cpp
@@ -38,11 +38,10 @@ TTSBase::Capabilities TTSSapi::capabilities()
void TTSSapi::generateSettings()
{
// language
- QStringList languages = SystemInfo::languages();
- languages.sort();
+ QMap<QString, QString> languages = SystemInfo::languages();
EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,
tr("Language:"),RbSettings::subValue("sapi",RbSettings::TtsLanguage),
- languages);
+ languages.values());
connect(setting,SIGNAL(dataChanged()),this,SLOT(updateVoiceList()));
insertSetting(eLANGUAGE,setting);
// voice
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 7ed74f1b9e..e5ea699257 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -131,9 +131,10 @@ void Config::accept()
if(RbSettings::value(RbSettings::Language).toString() != language
&& !language.isEmpty()) {
QMessageBox::information(this, tr("Language changed"),
- tr("You need to restart the application for the changed language to take effect."));
- RbSettings::setValue(RbSettings::Language, language);
+ tr("You need to restart the application for the changed language "
+ "to take effect."));
}
+ RbSettings::setValue(RbSettings::Language, language);
// mountpoint
QString mp = ui.mountPoint->text();
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())
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini
index 2eb429eaf7..7fa25deb7d 100644
--- a/rbutil/rbutilqt/rbutil.ini
+++ b/rbutil/rbutilqt/rbutil.ini
@@ -755,42 +755,42 @@ name="Sansa View"
[languages]
-lang1=afrikaans
-lang2=bulgarian
-lang3=catala
-lang4=chinese-simp
-lang5=chinese-trad
-lang6=czech
-lang7=dansk
-lang8=deutsch
-lang9=eesti
-lang10=english
-lang11=espanol
-lang12=esperanto
-lang13=finnish
-lang14=francais
-lang15=galego
-lang16=greek
-lang17=hebrew
-lang18=islenska
-lang19=italiano
-lang20=japanese
-lang21=korean
-lang22=magyar
-lang23=nederlands
-lang24=norsk
-lang25=norsk-nynorsk
-lang26=polski
-lang27=portugues
-lang28=portugues-brasileiro
-lang29=romaneste
-lang30=russian
-lang31=slovenscina
-lang32=svenska
-lang33=thai
-lang34=turkce
-lang35=wallisertitsch
-lang36=hindi
-lang37=tagalog
-lang38=lietuviu
+af=afrikaans
+bg=bulgarian
+ca=catala
+cs=czech
+da=dansk
+de=deutsch
+el=greek
+en=english
+eo=esperanto
+es=espanol
+et=eesti
+fi=finnish
+fr=francais
+gl=galego
+he=hebrew
+hi=hindi
+hu=magyar
+is=islenska
+it=italiano
+ja=japanese
+ko=korean
+lt=lietuviu
+nb=norsk
+nl=nederlands
+nn=norsk-nynorsk
+pl=polski
+pt=portugues
+pt_BR=portugues-brasileiro
+ro=romaneste
+ru=russian
+sk=slovenscina
+sv=svenska
+th=thai
+tl=tagalog
+tr=turkce
+wa=wallisertitsch
+zh_CN=chinese-simp
+zh_TW=chinese-trad