CI: apply coding style globally again

This commit is contained in:
Adriaan de Groot 2022-05-18 12:44:55 +02:00
parent 8fea6f71ab
commit 874a0c1f38
39 changed files with 376 additions and 293 deletions

View File

@ -67,8 +67,7 @@ CalamaresApplication::init()
{ {
Logger::setupLogfile(); Logger::setupLogfile();
cDebug() << "Calamares version:" << CALAMARES_VERSION; cDebug() << "Calamares version:" << CALAMARES_VERSION;
cDebug() << Logger::SubEntry cDebug() << Logger::SubEntry << "languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " );
<< "languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " );
if ( !Calamares::Settings::instance() ) if ( !Calamares::Settings::instance() )
{ {

View File

@ -134,10 +134,9 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
{ {
QPushButton* debugWindowBtn = new QPushButton; QPushButton* debugWindowBtn = new QPushButton;
debugWindowBtn->setObjectName( "debugButton" ); debugWindowBtn->setObjectName( "debugButton" );
CALAMARES_RETRANSLATE_FOR( CALAMARES_RETRANSLATE_FOR( debugWindowBtn,
debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate(
debugWindowBtn->setText( QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), CalamaresWindow::staticMetaObject.className(), "Show debug information" ) ); );
"Show debug information" ) ); );
sideLayout->addWidget( debugWindowBtn ); sideLayout->addWidget( debugWindowBtn );
debugWindowBtn->setFlat( true ); debugWindowBtn->setFlat( true );
debugWindowBtn->setCheckable( true ); debugWindowBtn->setCheckable( true );

View File

@ -85,7 +85,11 @@ DebugWindow::DebugWindow()
m_ui->globalStorageView->expandAll(); m_ui->globalStorageView->expandAll();
// Do above when the GS changes, too // Do above when the GS changes, too
connect( gs, &GlobalStorage::changed, this, [=] { connect( gs,
&GlobalStorage::changed,
this,
[ = ]
{
m_globals = JobQueue::instance()->globalStorage()->data(); m_globals = JobQueue::instance()->globalStorage()->data();
m_globals_model->reload(); m_globals_model->reload();
m_ui->globalStorageView->expandAll(); m_ui->globalStorageView->expandAll();
@ -93,9 +97,10 @@ DebugWindow::DebugWindow()
// JobQueue page // JobQueue page
m_ui->jobQueueText->setReadOnly( true ); m_ui->jobQueueText->setReadOnly( true );
connect( JobQueue::instance(), &JobQueue::queueChanged, this, [this]( const QStringList& jobs ) { connect( JobQueue::instance(),
m_ui->jobQueueText->setText( jobs.join( '\n' ) ); &JobQueue::queueChanged,
} ); this,
[ this ]( const QStringList& jobs ) { m_ui->jobQueueText->setText( jobs.join( '\n' ) ); } );
// Modules page // Modules page
QStringList modulesKeys; QStringList modulesKeys;
@ -116,7 +121,12 @@ DebugWindow::DebugWindow()
m_ui->modulesVerticalLayout->insertWidget( 1, pythonConsoleButton ); m_ui->modulesVerticalLayout->insertWidget( 1, pythonConsoleButton );
pythonConsoleButton->hide(); pythonConsoleButton->hide();
QObject::connect( pythonConsoleButton, &QPushButton::clicked, this, [this, moduleConfigModel] { QObject::connect(
pythonConsoleButton,
&QPushButton::clicked,
this,
[ this, moduleConfigModel ]
{
QString moduleName = m_ui->modulesListView->currentIndex().data().toString(); QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module = ModuleManager::instance()->moduleInstance( moduleName ); Module* module = ModuleManager::instance()->moduleInstance( moduleName );
if ( module->interface() != Module::Interface::PythonQt || module->type() != Module::Type::View ) if ( module->interface() != Module::Interface::PythonQt || module->type() != Module::Type::View )
@ -151,7 +161,8 @@ DebugWindow::DebugWindow()
QPushButton* closeButton = new QPushButton( consoleWindow ); QPushButton* closeButton = new QPushButton( consoleWindow );
closeButton->setText( "&Close" ); closeButton->setText( "&Close" );
QObject::connect( closeButton, &QPushButton::clicked, [consoleWindow] { consoleWindow->close(); } ); QObject::connect(
closeButton, &QPushButton::clicked, [ consoleWindow ] { consoleWindow->close(); } );
bottomLayout->addWidget( closeButton ); bottomLayout->addWidget( closeButton );
bottomLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); bottomLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
@ -176,7 +187,8 @@ DebugWindow::DebugWindow()
, ,
pythonConsoleButton pythonConsoleButton
#endif #endif
] { ]
{
QString moduleName = m_ui->modulesListView->currentIndex().data().toString(); QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module Module* module
= ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) ); = ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) );
@ -196,7 +208,10 @@ DebugWindow::DebugWindow()
// Tools page // Tools page
connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } ); connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
connect( m_ui->reloadStylesheetButton, &QPushButton::clicked, []() { connect( m_ui->reloadStylesheetButton,
&QPushButton::clicked,
[]()
{
for ( auto* w : qApp->topLevelWidgets() ) for ( auto* w : qApp->topLevelWidgets() )
{ {
// Needs to match what's set in CalamaresWindow // Needs to match what's set in CalamaresWindow
@ -206,7 +221,10 @@ DebugWindow::DebugWindow()
} }
} }
} ); } );
connect( m_ui->widgetTreeButton, &QPushButton::clicked, []() { connect( m_ui->widgetTreeButton,
&QPushButton::clicked,
[]()
{
for ( auto* w : qApp->topLevelWidgets() ) for ( auto* w : qApp->topLevelWidgets() )
{ {
Logger::CDebug deb; Logger::CDebug deb;
@ -260,7 +278,11 @@ DebugWindowManager::show( bool visible )
{ {
m_debugWindow = new Calamares::DebugWindow(); m_debugWindow = new Calamares::DebugWindow();
m_debugWindow->show(); m_debugWindow->show();
connect( m_debugWindow.data(), &Calamares::DebugWindow::closed, this, [=]() { connect( m_debugWindow.data(),
&Calamares::DebugWindow::closed,
this,
[ = ]()
{
m_debugWindow->deleteLater(); m_debugWindow->deleteLater();
m_visible = false; m_visible = false;
emit visibleChanged( false ); emit visibleChanged( false );

View File

@ -89,9 +89,10 @@ public:
= m_queuedJobs->isEmpty() ? 0.0 : ( m_queuedJobs->last().cumulative + m_queuedJobs->last().weight ); = m_queuedJobs->isEmpty() ? 0.0 : ( m_queuedJobs->last().cumulative + m_queuedJobs->last().weight );
qreal totalJobWeight qreal totalJobWeight
= std::accumulate( jobs.cbegin(), jobs.cend(), qreal( 0.0 ), []( qreal total, const job_ptr& j ) { = std::accumulate( jobs.cbegin(),
return total + j->getJobWeight(); jobs.cend(),
} ); qreal( 0.0 ),
[]( qreal total, const job_ptr& j ) { return total + j->getJobWeight(); } );
if ( totalJobWeight < 1 ) if ( totalJobWeight < 1 )
{ {
totalJobWeight = 1.0; totalJobWeight = 1.0;

View File

@ -211,9 +211,9 @@ _process_output( Calamares::Utils::RunLocation location,
bp::extract< bp::list > x( callback ); bp::extract< bp::list > x( callback );
if ( x.check() ) if ( x.check() )
{ {
QObject::connect( &r, &decltype( r )::output, [cb = callback.attr( "append" )]( const QString& s ) { QObject::connect( &r,
cb( s.toStdString() ); &decltype( r )::output,
} ); [ cb = callback.attr( "append" ) ]( const QString& s ) { cb( s.toStdString() ); } );
} }
else else
{ {

View File

@ -425,9 +425,8 @@ sequence:
// Make a lambda where we can adjust what it looks for from the outside, // Make a lambda where we can adjust what it looks for from the outside,
// by capturing a reference. // by capturing a reference.
QString moduleKey = QString( "welcome" ); QString moduleKey = QString( "welcome" );
auto moduleFinder = [&moduleKey]( const Calamares::InstanceDescription& d ) { auto moduleFinder = [ &moduleKey ]( const Calamares::InstanceDescription& d )
return d.isValid() && d.key().module() == moduleKey; { return d.isValid() && d.key().module() == moduleKey; };
};
const auto it0 = std::find_if( s.moduleInstances().constBegin(), s.moduleInstances().constEnd(), moduleFinder ); const auto it0 = std::find_if( s.moduleInstances().constBegin(), s.moduleInstances().constEnd(), moduleFinder );
QVERIFY( it0 != s.moduleInstances().constEnd() ); QVERIFY( it0 != s.moduleInstances().constEnd() );

View File

@ -43,9 +43,9 @@ lookup( TwoChar c )
} }
const CountryData* p const CountryData* p
= std::find_if( country_data_table, country_data_table + country_data_size, [c = c]( const CountryData& d ) { = std::find_if( country_data_table,
return ( d.cc1 == c.cc1 ) && ( d.cc2 == c.cc2 ); country_data_table + country_data_size,
} ); [ c = c ]( const CountryData& d ) { return ( d.cc1 == c.cc1 ) && ( d.cc2 == c.cc2 ); } );
if ( p == country_data_table + country_data_size ) if ( p == country_data_table + country_data_size )
{ {
return nullptr; return nullptr;

View File

@ -224,10 +224,13 @@ public:
loadTZData( m_regions, m_altZones, in ); loadTZData( m_regions, m_altZones, in );
} }
std::sort( m_regions.begin(), m_regions.end(), []( const RegionData* lhs, const RegionData* rhs ) { std::sort( m_regions.begin(),
return lhs->key() < rhs->key(); m_regions.end(),
} ); []( const RegionData* lhs, const RegionData* rhs ) { return lhs->key() < rhs->key(); } );
std::sort( m_zones.begin(), m_zones.end(), []( const TimeZoneData* lhs, const TimeZoneData* rhs ) { std::sort( m_zones.begin(),
m_zones.end(),
[]( const TimeZoneData* lhs, const TimeZoneData* rhs )
{
if ( lhs->region() == rhs->region() ) if ( lhs->region() == rhs->region() )
{ {
return lhs->zone() < rhs->zone(); return lhs->zone() < rhs->zone();
@ -399,7 +402,8 @@ ZonesModel::find( double latitude, double longitude ) const
* either N/S or E/W equal to any other; this obviously * either N/S or E/W equal to any other; this obviously
* falls apart at the poles. * falls apart at the poles.
*/ */
auto distance = [&]( const TimeZoneData* zone ) -> double { auto distance = [ & ]( const TimeZoneData* zone ) -> double
{
// Latitude doesn't wrap around: there is nothing north of 90 // Latitude doesn't wrap around: there is nothing north of 90
double latitudeDifference = abs( zone->latitude() - latitude ); double latitudeDifference = abs( zone->latitude() - latitude );
@ -445,7 +449,8 @@ ZonesModel::Iterator::operator bool() const
return 0 <= m_index && m_index < m_p->m_zones.count(); return 0 <= m_index && m_index < m_p->m_zones.count();
} }
const TimeZoneData* ZonesModel::Iterator::operator*() const const TimeZoneData*
ZonesModel::Iterator::operator*() const
{ {
if ( *this ) if ( *this )
{ {

View File

@ -63,9 +63,9 @@ RequirementsChecker::finished()
static QMutex finishedMutex; static QMutex finishedMutex;
QMutexLocker lock( &finishedMutex ); QMutexLocker lock( &finishedMutex );
if ( m_progressTimer && std::all_of( m_watchers.cbegin(), m_watchers.cend(), []( const Watcher* w ) { if ( m_progressTimer
return w && w->isFinished(); && std::all_of(
} ) ) m_watchers.cbegin(), m_watchers.cend(), []( const Watcher* w ) { return w && w->isFinished(); } ) )
{ {
cDebug() << "All requirements have been checked."; cDebug() << "All requirements have been checked.";
if ( m_progressTimer ) if ( m_progressTimer )
@ -100,7 +100,10 @@ RequirementsChecker::reportProgress()
m_progressTimeouts++; m_progressTimeouts++;
QStringList remainingNames; QStringList remainingNames;
auto remaining = std::count_if( m_watchers.cbegin(), m_watchers.cend(), [&]( const Watcher* w ) { auto remaining = std::count_if( m_watchers.cbegin(),
m_watchers.cend(),
[ & ]( const Watcher* w )
{
if ( w && !w->isFinished() ) if ( w && !w->isFinished() )
{ {
remainingNames << w->objectName(); remainingNames << w->objectName();

View File

@ -102,9 +102,7 @@ KPMManager::KPMManager()
{ {
} }
KPMManager::~KPMManager() KPMManager::~KPMManager() {}
{
}
KPMManager::operator bool() const KPMManager::operator bool() const
{ {

View File

@ -29,7 +29,8 @@ PartitionIterator::PartitionIterator( PartitionTable* table )
{ {
} }
Partition* PartitionIterator::operator*() const Partition*
PartitionIterator::operator*() const
{ {
return m_current; return m_current;
} }

View File

@ -151,7 +151,10 @@ Calamares::Utils::Runner::run()
if ( m_output ) if ( m_output )
{ {
connect( &process, &QProcess::readyReadStandardOutput, [this, &process]() { connect( &process,
&QProcess::readyReadStandardOutput,
[ this, &process ]()
{
do do
{ {
QString s = process.readLine(); QString s = process.readLine();

View File

@ -97,12 +97,12 @@ PythonQtViewModule::loadSelf()
cala.addVariable( "configuration", m_configurationMap ); cala.addVariable( "configuration", m_configurationMap );
// Basic stdout/stderr handling // Basic stdout/stderr handling
QObject::connect( PythonQt::self(), &PythonQt::pythonStdOut, []( const QString& message ) { QObject::connect( PythonQt::self(),
cDebug() << "PythonQt OUT>" << message; &PythonQt::pythonStdOut,
} ); []( const QString& message ) { cDebug() << "PythonQt OUT>" << message; } );
QObject::connect( PythonQt::self(), &PythonQt::pythonStdErr, []( const QString& message ) { QObject::connect( PythonQt::self(),
cDebug() << "PythonQt ERR>" << message; &PythonQt::pythonStdErr,
} ); []( const QString& message ) { cDebug() << "PythonQt ERR>" << message; } );
} }
QDir workingDir( m_workingPath ); QDir workingDir( m_workingPath );

View File

@ -222,22 +222,30 @@ registerQmlModels()
// Because branding and viewmanager have a parent (CalamaresApplication // Because branding and viewmanager have a parent (CalamaresApplication
// and CalamaresWindow), they will not be deleted by QmlEngine. // and CalamaresWindow), they will not be deleted by QmlEngine.
// https://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership // https://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership
qmlRegisterSingletonType< Calamares::Branding >( qmlRegisterSingletonType< Calamares::Branding >( "io.calamares.ui",
"io.calamares.ui", 1, 0, "Branding", []( QQmlEngine*, QJSEngine* ) -> QObject* { 1,
return Calamares::Branding::instance(); 0,
} ); "Branding",
qmlRegisterSingletonType< Calamares::ViewManager >( []( QQmlEngine*, QJSEngine* ) -> QObject*
"io.calamares.ui", 1, 0, "ViewManager", []( QQmlEngine*, QJSEngine* ) -> QObject* { { return Calamares::Branding::instance(); } );
return Calamares::ViewManager::instance(); qmlRegisterSingletonType< Calamares::ViewManager >( "io.calamares.ui",
} ); 1,
0,
"ViewManager",
[]( QQmlEngine*, QJSEngine* ) -> QObject*
{ return Calamares::ViewManager::instance(); } );
qmlRegisterSingletonType< Calamares::GlobalStorage >( qmlRegisterSingletonType< Calamares::GlobalStorage >(
"io.calamares.core", 1, 0, "Global", []( QQmlEngine*, QJSEngine* ) -> QObject* { "io.calamares.core",
return Calamares::JobQueue::instance()->globalStorage(); 1,
} ); 0,
"Global",
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return Calamares::JobQueue::instance()->globalStorage(); } );
qmlRegisterSingletonType< CalamaresUtils::Network::Manager >( qmlRegisterSingletonType< CalamaresUtils::Network::Manager >(
"io.calamares.core", 1, 0, "Network", []( QQmlEngine*, QJSEngine* ) -> QObject* { "io.calamares.core",
return &CalamaresUtils::Network::Manager::instance(); 1,
} ); 0,
"Network",
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return &CalamaresUtils::Network::Manager::instance(); } );
} }
} }

View File

@ -31,16 +31,19 @@ FinishedPage::FinishedPage( Config* config, QWidget* parent )
ui->mainText->setWordWrap( true ); ui->mainText->setWordWrap( true );
ui->mainText->setOpenExternalLinks( true ); ui->mainText->setOpenExternalLinks( true );
connect( config, &Config::restartModeChanged, [this]( Config::RestartMode mode ) { connect( config,
&Config::restartModeChanged,
[ this ]( Config::RestartMode mode )
{
using Mode = Config::RestartMode; using Mode = Config::RestartMode;
ui->restartCheckBox->setVisible( mode != Mode::Never ); ui->restartCheckBox->setVisible( mode != Mode::Never );
ui->restartCheckBox->setEnabled( mode != Mode::Always ); ui->restartCheckBox->setEnabled( mode != Mode::Always );
} ); } );
connect( config, &Config::restartNowWantedChanged, ui->restartCheckBox, &QCheckBox::setChecked ); connect( config, &Config::restartNowWantedChanged, ui->restartCheckBox, &QCheckBox::setChecked );
connect( ui->restartCheckBox, &QCheckBox::stateChanged, [config]( int state ) { connect( ui->restartCheckBox,
config->setRestartNowWanted( state != 0 ); &QCheckBox::stateChanged,
} ); [ config ]( int state ) { config->setRestartNowWanted( state != 0 ); } );
CALAMARES_RETRANSLATE_SLOT( &FinishedPage::retranslate ); CALAMARES_RETRANSLATE_SLOT( &FinishedPage::retranslate );
} }

View File

@ -156,14 +156,20 @@ Config::Config( QObject* parent )
m_setxkbmapTimer.setSingleShot( true ); m_setxkbmapTimer.setSingleShot( true );
// Connect signals and slots // Connect signals and slots
connect( m_keyboardModelsModel, &KeyboardModelsModel::currentIndexChanged, [&]( int index ) { connect( m_keyboardModelsModel,
&KeyboardModelsModel::currentIndexChanged,
[ & ]( int index )
{
// Set Xorg keyboard model // Set Xorg keyboard model
m_selectedModel = m_keyboardModelsModel->key( index ); m_selectedModel = m_keyboardModelsModel->key( index );
QProcess::execute( "setxkbmap", xkbmap_model_args( m_selectedModel ) ); QProcess::execute( "setxkbmap", xkbmap_model_args( m_selectedModel ) );
emit prettyStatusChanged(); emit prettyStatusChanged();
} ); } );
connect( m_keyboardLayoutsModel, &KeyboardLayoutModel::currentIndexChanged, [&]( int index ) { connect( m_keyboardLayoutsModel,
&KeyboardLayoutModel::currentIndexChanged,
[ & ]( int index )
{
m_selectedLayout = m_keyboardLayoutsModel->item( index ).first; m_selectedLayout = m_keyboardLayoutsModel->item( index ).first;
updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) ); updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) );
emit prettyStatusChanged(); emit prettyStatusChanged();

View File

@ -27,7 +27,8 @@ retranslateKeyboardModels()
{ {
s_kbtranslator = new QTranslator; s_kbtranslator = new QTranslator;
} }
(void)CalamaresUtils::loadTranslator( CalamaresUtils::translatorLocaleName(), QStringLiteral( "kb_" ), s_kbtranslator ); (void)CalamaresUtils::loadTranslator(
CalamaresUtils::translatorLocaleName(), QStringLiteral( "kb_" ), s_kbtranslator );
} }
@ -220,9 +221,8 @@ KeyboardLayoutModel::init()
std::stable_sort( m_layouts.begin(), std::stable_sort( m_layouts.begin(),
m_layouts.end(), m_layouts.end(),
[]( const QPair< QString, KeyboardGlobal::KeyboardInfo >& a, []( const QPair< QString, KeyboardGlobal::KeyboardInfo >& a,
const QPair< QString, KeyboardGlobal::KeyboardInfo >& b ) { const QPair< QString, KeyboardGlobal::KeyboardInfo >& b )
return a.second.description < b.second.description; { return a.second.description < b.second.description; } );
} );
} }
QHash< int, QByteArray > QHash< int, QByteArray >

View File

@ -69,8 +69,9 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
cDebug() << "Variants now total=" << model->rowCount() << "selected=" << model->currentIndex(); cDebug() << "Variants now total=" << model->rowCount() << "selected=" << model->currentIndex();
} }
connect( connect( ui->buttonRestore,
ui->buttonRestore, &QPushButton::clicked, [config = config] { config->keyboardModels()->setCurrentIndex(); } ); &QPushButton::clicked,
[ config = config ] { config->keyboardModels()->setCurrentIndex(); } );
connect( ui->physicalModelSelector, connect( ui->physicalModelSelector,
QOverload< int >::of( &QComboBox::currentIndexChanged ), QOverload< int >::of( &QComboBox::currentIndexChanged ),
@ -83,8 +84,12 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
connect( ui->layoutSelector->selectionModel(), connect( ui->layoutSelector->selectionModel(),
&QItemSelectionModel::currentChanged, &QItemSelectionModel::currentChanged,
[this]( const QModelIndex& current ) { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } ); [ this ]( const QModelIndex& current )
connect( config->keyboardLayouts(), &KeyboardLayoutModel::currentIndexChanged, [this]( int index ) { { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } );
connect( config->keyboardLayouts(),
&KeyboardLayoutModel::currentIndexChanged,
[ this ]( int index )
{
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) ); ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
m_keyboardPreview->setLayout( m_config->keyboardLayouts()->key( index ) ); m_keyboardPreview->setLayout( m_config->keyboardLayouts()->key( index ) );
m_keyboardPreview->setVariant( m_keyboardPreview->setVariant(
@ -93,8 +98,12 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
connect( ui->variantSelector->selectionModel(), connect( ui->variantSelector->selectionModel(),
&QItemSelectionModel::currentChanged, &QItemSelectionModel::currentChanged,
[this]( const QModelIndex& current ) { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } ); [ this ]( const QModelIndex& current )
connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [this]( int index ) { { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } );
connect( config->keyboardVariants(),
&KeyboardVariantsModel::currentIndexChanged,
[ this ]( int index )
{
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) ); ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
m_keyboardPreview->setVariant( m_config->keyboardVariants()->key( index ) ); m_keyboardPreview->setVariant( m_config->keyboardVariants()->key( index ) );
} ); } );

View File

@ -118,15 +118,15 @@ loadLocales( const QString& localeGenPath )
// Assuming we have a list of supported locales, we usually only want UTF-8 ones // Assuming we have a list of supported locales, we usually only want UTF-8 ones
// because it's not 1995. // because it's not 1995.
auto notUtf8 = []( const QString& s ) { auto notUtf8 = []( const QString& s )
return !s.contains( "UTF-8", Qt::CaseInsensitive ) && !s.contains( "utf8", Qt::CaseInsensitive ); { return !s.contains( "UTF-8", Qt::CaseInsensitive ) && !s.contains( "utf8", Qt::CaseInsensitive ); };
};
auto it = std::remove_if( localeGenLines.begin(), localeGenLines.end(), notUtf8 ); auto it = std::remove_if( localeGenLines.begin(), localeGenLines.end(), notUtf8 );
localeGenLines.erase( it, localeGenLines.end() ); localeGenLines.erase( it, localeGenLines.end() );
// We strip " UTF-8" from "en_US.UTF-8 UTF-8" because it's redundant redundant. // We strip " UTF-8" from "en_US.UTF-8 UTF-8" because it's redundant redundant.
// Also simplify whitespace. // Also simplify whitespace.
auto unredundant = []( QString& s ) { auto unredundant = []( QString& s )
{
if ( s.endsWith( " UTF-8" ) ) if ( s.endsWith( " UTF-8" ) )
{ {
s.chop( 6 ); s.chop( 6 );
@ -183,16 +183,22 @@ Config::Config( QObject* parent )
// we don't need to call an update-GS method, or introduce an intermediate // we don't need to call an update-GS method, or introduce an intermediate
// update-thing-and-GS method. And everywhere where we **do** change // update-thing-and-GS method. And everywhere where we **do** change
// language or location, we already emit the signal. // language or location, we already emit the signal.
connect( this, &Config::currentLanguageCodeChanged, [&]() { connect( this,
&Config::currentLanguageCodeChanged,
[ & ]()
{
auto* gs = Calamares::JobQueue::instance()->globalStorage(); auto* gs = Calamares::JobQueue::instance()->globalStorage();
gs->insert( "locale", m_selectedLocaleConfiguration.toBcp47() ); gs->insert( "locale", m_selectedLocaleConfiguration.toBcp47() );
} ); } );
connect( this, &Config::currentLCCodeChanged, [&]() { connect( this,
updateGSLocale( Calamares::JobQueue::instance()->globalStorage(), localeConfiguration() ); &Config::currentLCCodeChanged,
} ); [ & ]() { updateGSLocale( Calamares::JobQueue::instance()->globalStorage(), localeConfiguration() ); } );
connect( this, &Config::currentLocationChanged, [&]() { connect( this,
&Config::currentLocationChanged,
[ & ]()
{
const bool locationChanged const bool locationChanged
= updateGSLocation( Calamares::JobQueue::instance()->globalStorage(), currentLocation() ); = updateGSLocation( Calamares::JobQueue::instance()->globalStorage(), currentLocation() );

View File

@ -60,7 +60,10 @@ LCLocaleDialog::LCLocaleDialog( const QString& guessedLCLocale, const QStringLis
connect( dbb->button( QDialogButtonBox::Cancel ), &QPushButton::clicked, this, &QDialog::reject ); connect( dbb->button( QDialogButtonBox::Cancel ), &QPushButton::clicked, this, &QDialog::reject );
connect( m_localesWidget, &QListWidget::itemDoubleClicked, this, &QDialog::accept ); connect( m_localesWidget, &QListWidget::itemDoubleClicked, this, &QDialog::accept );
connect( m_localesWidget, &QListWidget::itemSelectionChanged, [this, dbb]() { connect( m_localesWidget,
&QListWidget::itemSelectionChanged,
[ this, dbb ]()
{
if ( m_localesWidget->selectedItems().isEmpty() ) if ( m_localesWidget->selectedItems().isEmpty() )
{ {
dbb->button( QDialogButtonBox::Ok )->setEnabled( false ); dbb->button( QDialogButtonBox::Ok )->setEnabled( false );

View File

@ -185,7 +185,8 @@ TimeZoneWidget::mousePressEvent( QMouseEvent* event )
int mX = event->pos().x(); int mX = event->pos().x();
int mY = event->pos().y(); int mY = event->pos().y();
auto distance = [&]( const CalamaresUtils::Locale::TimeZoneData* zone ) { auto distance = [ & ]( const CalamaresUtils::Locale::TimeZoneData* zone )
{
QPoint locPos = TimeZoneImageList::getLocationPosition( zone->longitude(), zone->latitude() ); QPoint locPos = TimeZoneImageList::getLocationPosition( zone->longitude(), zone->latitude() );
return double( abs( mX - locPos.x() ) + abs( mY - locPos.y() ) ); return double( abs( mX - locPos.x() ) + abs( mY - locPos.y() ) );
}; };

View File

@ -35,7 +35,10 @@ NetInstallPage::NetInstallPage( Config* c, QWidget* parent )
ui->groupswidget->header()->setSectionResizeMode( QHeaderView::ResizeToContents ); ui->groupswidget->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
ui->groupswidget->setModel( c->model() ); ui->groupswidget->setModel( c->model() );
connect( c, &Config::statusChanged, ui->netinst_status, &QLabel::setText ); connect( c, &Config::statusChanged, ui->netinst_status, &QLabel::setText );
connect( c, &Config::titleLabelChanged, [ui = this->ui]( const QString title ) { connect( c,
&Config::titleLabelChanged,
[ ui = this->ui ]( const QString title )
{
ui->label->setVisible( !title.isEmpty() ); ui->label->setVisible( !title.isEmpty() );
ui->label->setText( title ); ui->label->setText( title );
} ); } );

View File

@ -12,7 +12,8 @@
#include <QPainter> #include <QPainter>
void GroupsTreeView::drawBranches(QPainter* painter, const QRect& rect, const QModelIndex& index) const void
GroupsTreeView::drawBranches( QPainter* painter, const QRect& rect, const QModelIndex& index ) const
{ {
QTreeView::drawBranches( painter, rect, index ); QTreeView::drawBranches( painter, rect, index );

View File

@ -56,9 +56,9 @@ PackageChooserViewStep::widget()
if ( !m_widget ) if ( !m_widget )
{ {
m_widget = new PackageChooserPage( m_config->mode(), nullptr ); m_widget = new PackageChooserPage( m_config->mode(), nullptr );
connect( m_widget, &PackageChooserPage::selectionChanged, [=]() { connect( m_widget,
emit nextStatusChanged( this->isNextEnabled() ); &PackageChooserPage::selectionChanged,
} ); [ = ]() { emit nextStatusChanged( this->isNextEnabled() ); } );
hookupModel(); hookupModel();
} }
return m_widget; return m_widget;

View File

@ -96,7 +96,8 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
connect( view->selectionModel(), connect( view->selectionModel(),
&QItemSelectionModel::selectionChanged, &QItemSelectionModel::selectionChanged,
[this]( const QItemSelection& selected, const QItemSelection& ) { [ this ]( const QItemSelection& selected, const QItemSelection& )
{
auto i = selected.indexes(); auto i = selected.indexes();
if ( !i.isEmpty() ) if ( !i.isEmpty() )
{ {

View File

@ -45,10 +45,16 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent )
&QCheckBox::stateChanged, \ &QCheckBox::stateChanged, \
config->x##Tracking(), \ config->x##Tracking(), \
QOverload< bool >::of( &TrackingStyleConfig::setTracking ) ); \ QOverload< bool >::of( &TrackingStyleConfig::setTracking ) ); \
connect( config->x##Tracking(), &TrackingStyleConfig::trackingChanged, this, [this, config]() { \ connect( config->x##Tracking(), \
this->trackerChanged( config->x##Tracking(), this->ui->x##Group, this->ui->x##CheckBox ); \ &TrackingStyleConfig::trackingChanged, \
} ); \ this, \
connect( ui->x##PolicyButton, &QAbstractButton::clicked, config, [config] { \ [ this, config ]() \
{ this->trackerChanged( config->x##Tracking(), this->ui->x##Group, this->ui->x##CheckBox ); } ); \
connect( ui->x##PolicyButton, \
&QAbstractButton::clicked, \
config, \
[ config ] \
{ \
QString url( config->x##Tracking()->policy() ); \ QString url( config->x##Tracking()->policy() ); \
if ( !url.isEmpty() ) \ if ( !url.isEmpty() ) \
{ \ { \
@ -63,10 +69,13 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent )
#undef trackingSetup #undef trackingSetup
connect( config, &Config::generalPolicyChanged, [this]( const QString& url ) { connect( config,
this->ui->generalPolicyLabel->setVisible( !url.isEmpty() ); &Config::generalPolicyChanged,
} ); [ this ]( const QString& url ) { this->ui->generalPolicyLabel->setVisible( !url.isEmpty() ); } );
connect( ui->generalPolicyLabel, &QLabel::linkActivated, [config] { connect( ui->generalPolicyLabel,
&QLabel::linkActivated,
[ config ]
{
QString url( config->generalPolicy() ); QString url( config->generalPolicy() );
if ( !url.isEmpty() ) if ( !url.isEmpty() )
{ {

View File

@ -379,7 +379,8 @@ DEFINE_CHECK_FUNC( libpwquality )
if ( requirement_count ) if ( requirement_count )
{ {
checks.push_back( PasswordCheck( [ settings ]() { return settings->explanation(); }, checks.push_back( PasswordCheck( [ settings ]() { return settings->explanation(); },
[settings]( const QString& s ) { [ settings ]( const QString& s )
{
int r = settings->check( s ); int r = settings->check( s );
if ( r < 0 ) if ( r < 0 )
{ {

View File

@ -152,10 +152,10 @@ GeneralRequirements::checkRequirements()
{ {
checkEntries.append( checkEntries.append(
{ entry, { entry,
[req = m_requiredStorageGiB] { return tr( "has at least %1 GiB available drive space" ).arg( req ); }, [ req = m_requiredStorageGiB ]
[req = m_requiredStorageGiB] { { return tr( "has at least %1 GiB available drive space" ).arg( req ); },
return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req ); [ req = m_requiredStorageGiB ]
}, { return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req ); },
enoughStorage, enoughStorage,
m_entriesToRequire.contains( entry ) } ); m_entriesToRequire.contains( entry ) } );
} }
@ -191,7 +191,8 @@ GeneralRequirements::checkRequirements()
{ {
checkEntries.append( { entry, checkEntries.append( { entry,
[] { return tr( "is running the installer as an administrator (root)" ); }, [] { return tr( "is running the installer as an administrator (root)" ); },
[] { []
{
return Calamares::Settings::instance()->isSetupMode() return Calamares::Settings::instance()->isSetupMode()
? tr( "The setup program is not running with administrator rights." ) ? tr( "The setup program is not running with administrator rights." )
: tr( "The installer is not running with administrator rights." ); : tr( "The installer is not running with administrator rights." );
@ -203,7 +204,8 @@ GeneralRequirements::checkRequirements()
{ {
checkEntries.append( { entry, checkEntries.append( { entry,
[] { return tr( "has a screen large enough to show the whole installer" ); }, [] { return tr( "has a screen large enough to show the whole installer" ); },
[] { []
{
return Calamares::Settings::instance()->isSetupMode() return Calamares::Settings::instance()->isSetupMode()
? tr( "The screen is too small to display the setup program." ) ? tr( "The screen is too small to display the setup program." )
: tr( "The screen is too small to display the installer." ); : tr( "The screen is too small to display the installer." );

View File

@ -110,10 +110,11 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model,
m_title = new QLabel( this ); m_title = new QLabel( this );
m_title->setObjectName( "resultDialogTitle" ); m_title->setObjectName( "resultDialogTitle" );
createResultWidgets( createResultWidgets( entriesLayout,
entriesLayout, m_resultWidgets, model, []( const Calamares::RequirementsModel& m, QModelIndex i ) { m_resultWidgets,
return m.data( i, Calamares::RequirementsModel::HasDetails ).toBool(); model,
} ); []( const Calamares::RequirementsModel& m, QModelIndex i )
{ return m.data( i, Calamares::RequirementsModel::HasDetails ).toBool(); } );
QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this ); QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
buttonBox->setObjectName( "resultDialogButtons" ); buttonBox->setObjectName( "resultDialogButtons" );
@ -182,9 +183,8 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent )
// all *mandatory* entries are satisfied (gives errors if not). // all *mandatory* entries are satisfied (gives errors if not).
const bool requirementsSatisfied = config->requirementsModel()->satisfiedRequirements(); const bool requirementsSatisfied = config->requirementsModel()->satisfiedRequirements();
auto isUnSatisfied = []( const Calamares::RequirementsModel& m, QModelIndex i ) { auto isUnSatisfied = []( const Calamares::RequirementsModel& m, QModelIndex i )
return !m.data( i, Calamares::RequirementsModel::Satisfied ).toBool(); { return !m.data( i, Calamares::RequirementsModel::Satisfied ).toBool(); };
};
createResultWidgets( entriesLayout, m_resultWidgets, *( config->requirementsModel() ), isUnSatisfied ); createResultWidgets( entriesLayout, m_resultWidgets, *( config->requirementsModel() ), isUnSatisfied );