Skip to content

Commit

Permalink
Display the native language name in the language chooser rather than …
Browse files Browse the repository at this point in the history
…the locale
  • Loading branch information
Andreas Sinz authored and hacst committed Dec 22, 2014
1 parent 442fef9 commit ad19d15
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/mumble/LookConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ LookConfig::LookConfig(Settings &st) : ConfigWidget(st) {

qcbLanguage->addItem(tr("System default"));
QDir d(QLatin1String(":"),QLatin1String("mumble_*.qm"),QDir::Name,QDir::Files);
QStringList langs;
foreach(const QString &key, d.entryList()) {
QString cc = key.mid(7,key.indexOf(QLatin1Char('.'))-7);
langs << cc;
qcbLanguage->addItem(cc);
QLocale tmpLocale = QLocale(cc);

//If there is no native language name, use the locale
if(!tmpLocale.nativeLanguageName().isEmpty()) {
qcbLanguage->addItem(tmpLocale.nativeLanguageName(), QVariant(cc));
} else {
qcbLanguage->addItem(cc, QVariant(cc));
}
}

QStringList styles = QStyleFactory::keys();
Expand Down Expand Up @@ -109,7 +114,7 @@ void LookConfig::load(const Settings &r) {


for (int i=0;i<qcbLanguage->count();i++) {
if (qcbLanguage->itemText(i) == r.qsLanguage) {
if (qcbLanguage->itemData(i).toString() == r.qsLanguage) {
loadComboBox(qcbLanguage, i);
break;
}
Expand Down Expand Up @@ -142,7 +147,7 @@ void LookConfig::save() const {
if (qcbLanguage->currentIndex() == 0)
s.qsLanguage = QString();
else
s.qsLanguage = qcbLanguage->currentText();
s.qsLanguage = qcbLanguage->itemData(qcbLanguage->currentIndex()).toString();

if (qcbStyle->currentIndex() == 0)
s.qsStyle = QString();
Expand Down

0 comments on commit ad19d15

Please sign in to comment.