[welcome] Introduce a delegate for drawing the languages list

- Show the native name left, English name right
This commit is contained in:
Adriaan de Groot 2019-04-19 13:34:25 +02:00
parent 0b833b1e75
commit 81acc496dc
4 changed files with 30 additions and 8 deletions

View file

@ -36,10 +36,10 @@
#include <QApplication>
#include <QBoxLayout>
#include <QComboBox>
#include <QDesktopServices>
#include <QFocusEvent>
#include <QLabel>
#include <QComboBox>
#include <QMessageBox>
WelcomePage::WelcomePage( QWidget* parent )
@ -133,6 +133,7 @@ WelcomePage::initLanguages()
m_languages = new LocaleModel( QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';') );
ui->languageWidget->setModel( m_languages );
ui->languageWidget->setItemDelegate( new LocaleTwoColumnDelegate( ui->languageWidget ) );
// Find the best initial translation
QLocale defaultLocale = QLocale( QLocale::system().name() );
@ -165,7 +166,7 @@ WelcomePage::initLanguages()
{
QString name = m_languages->locale( matchedLocaleIndex ).name();
cDebug() << Logger::SubEntry << "Matched with index" << matchedLocaleIndex << name;
CalamaresUtils::installTranslator( name, Calamares::Branding::instance()->translationsPathPrefix(), qApp );
ui->languageWidget->setCurrentIndex( matchedLocaleIndex );
}