summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/configure.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2008-07-25 19:28:24 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2008-07-25 19:28:24 +0000
commitc367c21a7683617c76bc9281991c3ee11adcdaa0 (patch)
tree95c8f9c53c1cac8b8024572bc4b8316786dce8ad /rbutil/rbutilqt/configure.cpp
parent3f01df3f9c713f679d192061000e1441ec664439 (diff)
downloadrockbox-c367c21a7683617c76bc9281991c3ee11adcdaa0.tar.gz
rockbox-c367c21a7683617c76bc9281991c3ee11adcdaa0.tar.bz2
rockbox-c367c21a7683617c76bc9281991c3ee11adcdaa0.zip
Make rbutil check the system language and try to use the correct translation. A language selection in the configuration file will override this.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18118 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/configure.cpp')
-rw-r--r--rbutil/rbutilqt/configure.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 364068f61a..4406e4aba2 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -37,7 +37,7 @@
#include <windows.h>
#endif
-#define DEFAULT_LANG "English (C)"
+#define DEFAULT_LANG "English (en)"
Config::Config(QWidget *parent,int index) : QDialog(parent)
{
@@ -56,14 +56,13 @@ Config::Config(QWidget *parent,int index) : QDialog(parent)
QStringList langs = findLanguageFiles();
for(int i = 0; i < langs.size(); ++i)
lang.insert(languageName(langs.at(i)) + tr(" (%1)").arg(langs.at(i)), langs.at(i));
- lang.insert(DEFAULT_LANG, "");
+ lang.insert(DEFAULT_LANG, "en");
QMap<QString, QString>::const_iterator i = lang.constBegin();
while (i != lang.constEnd()) {
ui.listLanguages->addItem(i.key());
i++;
}
ui.listLanguages->setSelectionMode(QAbstractItemView::SingleSelection);
- connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage()));
ui.proxyPass->setEchoMode(QLineEdit::Password);
ui.treeDevices->setAlternatingRowColors(true);
ui.listLanguages->setAlternatingRowColors(true);
@@ -109,7 +108,7 @@ void Config::accept()
settings->setProxyType(proxyType);
// language
- if(settings->curLang() != language)
+ if(settings->curLang() != language && !language.isEmpty())
QMessageBox::information(this, tr("Language changed"),
tr("You need to restart the application for the changed language to take effect."));
settings->setLang(language);
@@ -188,13 +187,19 @@ void Config::setUserSettings()
b = i.key();
break;
}
+ else if(settings->curLang().startsWith(i.value(), Qt::CaseInsensitive)) {
+ // check if there is a base language (en -> en_US, etc.)
+ b = i.key();
+ break;
+ }
i++;
}
a = ui.listLanguages->findItems(b, Qt::MatchExactly);
- if(a.size() <= 0)
- a = ui.listLanguages->findItems(DEFAULT_LANG, Qt::MatchExactly);
if(a.size() > 0)
ui.listLanguages->setCurrentItem(a.at(0));
+ // don't connect before language list has been set up to prevent
+ // triggering the signal by selecting the saved language.
+ connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage()));
// devices tab
ui.mountPoint->setText(QDir::toNativeSeparators(settings->mountpoint()));