[PATCH] Language chooser improvements

Dirk Hohndel dirk at hohndel.org
Sat Dec 7 07:33:38 UTC 2013


On Sat, 2013-12-07 at 17:05 +0200, Sergey Starosek wrote:
> Show language instead of country, sort the list.
> 
> Signed-off-by: Sergey Starosek <sergey.starosek at gmail.com>
> ---
>  qt-ui/models.cpp      | 2 +-
>  qt-ui/preferences.cpp | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
> index bac96f5..ca8205e 100644
> --- a/qt-ui/models.cpp
> +++ b/qt-ui/models.cpp
> @@ -1784,7 +1784,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 : l.languageToString(l.language());

I think that's wrong. Now you get Portuguese twice, German twice...
Brazil, Portugal, Germany, Switzerland seem much better. Or at least
German (Germany), German (Switzerland), etc...

Can you recreate that patch, please?

>  		}break;
>  	case Qt::UserRole:{
>  			QString currentString = languages.at(index.row());
> diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
> index 930a263..399d81d 100644
> --- a/qt-ui/preferences.cpp
> +++ b/qt-ui/preferences.cpp
> @@ -110,6 +110,7 @@ void PreferencesDialog::setUiFromPrefs()
>  	filterModel->setSourceModel(LanguageModel::instance());
>  	filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
>  	ui.languageView->setModel(filterModel);
> +	filterModel->sort(0);

This I like - I was making a mental note to ask someone to figure out
how to sort the list :-)

/D



More information about the subsurface mailing list