mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 09:55:37 -04:00
[welcome] Switch to using LocaleModel for language combobox
- Use the model instead of inserting items - While here, tidy includes and documentation
This commit is contained in:
parent
589168685e
commit
94765d40cd
2 changed files with 18 additions and 24 deletions
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2015, Anke Boersma <demm@kaosx.us>
|
||||
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017-2019, Adriaan de Groot <groot@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -21,16 +21,18 @@
|
|||
#include "WelcomePage.h"
|
||||
|
||||
#include "ui_WelcomePage.h"
|
||||
#include "CalamaresVersion.h"
|
||||
#include "LocaleModel.h"
|
||||
#include "checker/CheckerContainer.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "CalamaresVersion.h"
|
||||
#include "Settings.h"
|
||||
#include "ViewManager.h"
|
||||
#include "modulesystem/ModuleManager.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Retranslator.h"
|
||||
|
||||
#include "modulesystem/ModuleManager.h"
|
||||
#include "Settings.h"
|
||||
#include "ViewManager.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QBoxLayout>
|
||||
#include <QDesktopServices>
|
||||
|
@ -39,13 +41,11 @@
|
|||
#include <QComboBox>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "Branding.h"
|
||||
|
||||
|
||||
WelcomePage::WelcomePage( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui( new Ui::WelcomePage )
|
||||
, m_checkingWidget( new CheckerContainer( this ) )
|
||||
, m_languages( nullptr )
|
||||
{
|
||||
connect( Calamares::ModuleManager::instance(), &Calamares::ModuleManager::requirementsResult, m_checkingWidget, &CheckerContainer::requirementsChecked );
|
||||
connect( Calamares::ModuleManager::instance(), &Calamares::ModuleManager::requirementsComplete, m_checkingWidget, &CheckerContainer::requirementsComplete );
|
||||
|
@ -156,21 +156,8 @@ WelcomePage::initLanguages()
|
|||
ui->languageWidget->clear();
|
||||
ui->languageWidget->setInsertPolicy( QComboBox::InsertAtBottom );
|
||||
|
||||
{
|
||||
std::list< CalamaresUtils::LocaleLabel > localeList;
|
||||
const auto locales = QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';');
|
||||
for ( const QString& locale : locales )
|
||||
{
|
||||
localeList.emplace_back( locale );
|
||||
}
|
||||
|
||||
localeList.sort(); // According to the sortkey, which is english
|
||||
|
||||
for ( const auto& locale : localeList )
|
||||
{
|
||||
ui->languageWidget->addItem( locale.label(), locale.locale() );
|
||||
}
|
||||
}
|
||||
m_languages = new LocaleModel( QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';') );
|
||||
ui->languageWidget->setModel( m_languages );
|
||||
|
||||
// Find the best initial translation
|
||||
QLocale defaultLocale = QLocale( QLocale::system().name() );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue