Language chooser improvements

Show language instead of country, sort the list.
Show country in brackets to avoid ambiguity for locales like
de_DE and de_CH.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Sergey Starosek 2013-12-07 17:32:17 +02:00 committed by Dirk Hohndel
parent 4c3f51291e
commit 482214703b
2 changed files with 2 additions and 1 deletions

View file

@ -1772,7 +1772,7 @@ QVariant LanguageModel::data(const QModelIndex& index, int role) const
switch(role){
case Qt::DisplayRole:{
QLocale l( currentString.remove("subsurface_"));
return currentString == "English" ? currentString : l.countryToString(l.country());
return currentString == "English" ? currentString : QString("%1 (%2)").arg(l.languageToString(l.language())).arg(l.countryToString(l.country()));
}break;
case Qt::UserRole:{
QString currentString = languages.at(index.row());

View file

@ -110,6 +110,7 @@ void PreferencesDialog::setUiFromPrefs()
filterModel->setSourceModel(LanguageModel::instance());
filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui.languageView->setModel(filterModel);
filterModel->sort(0);
connect(ui.languageFilter, SIGNAL(textChanged(QString)), filterModel, SLOT(setFilterFixedString(QString)));
QSettings s;