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();
cDebug() << "Calamares version:" << CALAMARES_VERSION;
cDebug() << Logger::SubEntry
<< "languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " );
cDebug() << Logger::SubEntry << "languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " );
if ( !Calamares::Settings::instance() )
{

View File

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

View File

@ -85,7 +85,11 @@ DebugWindow::DebugWindow()
m_ui->globalStorageView->expandAll();
// 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_model->reload();
m_ui->globalStorageView->expandAll();
@ -93,9 +97,10 @@ DebugWindow::DebugWindow()
// JobQueue page
m_ui->jobQueueText->setReadOnly( true );
connect( JobQueue::instance(), &JobQueue::queueChanged, this, [this]( const QStringList& jobs ) {
m_ui->jobQueueText->setText( jobs.join( '\n' ) );
} );
connect( JobQueue::instance(),
&JobQueue::queueChanged,
this,
[ this ]( const QStringList& jobs ) { m_ui->jobQueueText->setText( jobs.join( '\n' ) ); } );
// Modules page
QStringList modulesKeys;
@ -116,7 +121,12 @@ DebugWindow::DebugWindow()
m_ui->modulesVerticalLayout->insertWidget( 1, pythonConsoleButton );
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();
Module* module = ModuleManager::instance()->moduleInstance( moduleName );
if ( module->interface() != Module::Interface::PythonQt || module->type() != Module::Type::View )
@ -151,7 +161,8 @@ DebugWindow::DebugWindow()
QPushButton* closeButton = new QPushButton( consoleWindow );
closeButton->setText( "&Close" );
QObject::connect( closeButton, &QPushButton::clicked, [consoleWindow] { consoleWindow->close(); } );
QObject::connect(
closeButton, &QPushButton::clicked, [ consoleWindow ] { consoleWindow->close(); } );
bottomLayout->addWidget( closeButton );
bottomLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
@ -176,7 +187,8 @@ DebugWindow::DebugWindow()
,
pythonConsoleButton
#endif
] {
]
{
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module
= ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) );
@ -196,7 +208,10 @@ DebugWindow::DebugWindow()
// Tools page
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() )
{
// 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() )
{
Logger::CDebug deb;
@ -260,7 +278,11 @@ DebugWindowManager::show( bool visible )
{
m_debugWindow = new Calamares::DebugWindow();
m_debugWindow->show();
connect( m_debugWindow.data(), &Calamares::DebugWindow::closed, this, [=]() {
connect( m_debugWindow.data(),
&Calamares::DebugWindow::closed,
this,
[ = ]()
{
m_debugWindow->deleteLater();
m_visible = false;
emit visibleChanged( false );

View File

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

View File

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

View File

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

View File

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

View File

@ -224,10 +224,13 @@ public:
loadTZData( m_regions, m_altZones, in );
}
std::sort( m_regions.begin(), 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_regions.begin(),
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 )
{
if ( lhs->region() == rhs->region() )
{
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
* 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
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();
}
const TimeZoneData* ZonesModel::Iterator::operator*() const
const TimeZoneData*
ZonesModel::Iterator::operator*() const
{
if ( *this )
{

View File

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

View File

@ -102,9 +102,7 @@ KPMManager::KPMManager()
{
}
KPMManager::~KPMManager()
{
}
KPMManager::~KPMManager() {}
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;
}

View File

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

View File

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

View File

@ -222,22 +222,30 @@ registerQmlModels()
// Because branding and viewmanager have a parent (CalamaresApplication
// and CalamaresWindow), they will not be deleted by QmlEngine.
// https://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership
qmlRegisterSingletonType< Calamares::Branding >(
"io.calamares.ui", 1, 0, "Branding", []( QQmlEngine*, QJSEngine* ) -> QObject* {
return Calamares::Branding::instance();
} );
qmlRegisterSingletonType< Calamares::ViewManager >(
"io.calamares.ui", 1, 0, "ViewManager", []( QQmlEngine*, QJSEngine* ) -> QObject* {
return Calamares::ViewManager::instance();
} );
qmlRegisterSingletonType< Calamares::Branding >( "io.calamares.ui",
1,
0,
"Branding",
[]( QQmlEngine*, QJSEngine* ) -> QObject*
{ return Calamares::Branding::instance(); } );
qmlRegisterSingletonType< Calamares::ViewManager >( "io.calamares.ui",
1,
0,
"ViewManager",
[]( QQmlEngine*, QJSEngine* ) -> QObject*
{ return Calamares::ViewManager::instance(); } );
qmlRegisterSingletonType< Calamares::GlobalStorage >(
"io.calamares.core", 1, 0, "Global", []( QQmlEngine*, QJSEngine* ) -> QObject* {
return Calamares::JobQueue::instance()->globalStorage();
} );
"io.calamares.core",
1,
0,
"Global",
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return Calamares::JobQueue::instance()->globalStorage(); } );
qmlRegisterSingletonType< CalamaresUtils::Network::Manager >(
"io.calamares.core", 1, 0, "Network", []( QQmlEngine*, QJSEngine* ) -> QObject* {
return &CalamaresUtils::Network::Manager::instance();
} );
"io.calamares.core",
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->setOpenExternalLinks( true );
connect( config, &Config::restartModeChanged, [this]( Config::RestartMode mode ) {
connect( config,
&Config::restartModeChanged,
[ this ]( Config::RestartMode mode )
{
using Mode = Config::RestartMode;
ui->restartCheckBox->setVisible( mode != Mode::Never );
ui->restartCheckBox->setEnabled( mode != Mode::Always );
} );
connect( config, &Config::restartNowWantedChanged, ui->restartCheckBox, &QCheckBox::setChecked );
connect( ui->restartCheckBox, &QCheckBox::stateChanged, [config]( int state ) {
config->setRestartNowWanted( state != 0 );
} );
connect( ui->restartCheckBox,
&QCheckBox::stateChanged,
[ config ]( int state ) { config->setRestartNowWanted( state != 0 ); } );
CALAMARES_RETRANSLATE_SLOT( &FinishedPage::retranslate );
}

View File

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

View File

@ -27,7 +27,8 @@ retranslateKeyboardModels()
{
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(),
m_layouts.end(),
[]( const QPair< QString, KeyboardGlobal::KeyboardInfo >& a,
const QPair< QString, KeyboardGlobal::KeyboardInfo >& b ) {
return a.second.description < b.second.description;
} );
const QPair< QString, KeyboardGlobal::KeyboardInfo >& b )
{ return a.second.description < b.second.description; } );
}
QHash< int, QByteArray >

View File

@ -69,8 +69,9 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
cDebug() << "Variants now total=" << model->rowCount() << "selected=" << model->currentIndex();
}
connect(
ui->buttonRestore, &QPushButton::clicked, [config = config] { config->keyboardModels()->setCurrentIndex(); } );
connect( ui->buttonRestore,
&QPushButton::clicked,
[ config = config ] { config->keyboardModels()->setCurrentIndex(); } );
connect( ui->physicalModelSelector,
QOverload< int >::of( &QComboBox::currentIndexChanged ),
@ -83,8 +84,12 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
connect( ui->layoutSelector->selectionModel(),
&QItemSelectionModel::currentChanged,
[this]( const QModelIndex& current ) { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } );
connect( config->keyboardLayouts(), &KeyboardLayoutModel::currentIndexChanged, [this]( int index ) {
[ this ]( const QModelIndex& current )
{ m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } );
connect( config->keyboardLayouts(),
&KeyboardLayoutModel::currentIndexChanged,
[ this ]( int index )
{
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
m_keyboardPreview->setLayout( m_config->keyboardLayouts()->key( index ) );
m_keyboardPreview->setVariant(
@ -93,8 +98,12 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
connect( ui->variantSelector->selectionModel(),
&QItemSelectionModel::currentChanged,
[this]( const QModelIndex& current ) { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } );
connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [this]( int index ) {
[ this ]( const QModelIndex& current )
{ m_config->keyboardVariants()->setCurrentIndex( current.row() ); } );
connect( config->keyboardVariants(),
&KeyboardVariantsModel::currentIndexChanged,
[ this ]( int index )
{
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( 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
// because it's not 1995.
auto notUtf8 = []( const QString& s ) {
return !s.contains( "UTF-8", Qt::CaseInsensitive ) && !s.contains( "utf8", Qt::CaseInsensitive );
};
auto notUtf8 = []( const QString& s )
{ return !s.contains( "UTF-8", Qt::CaseInsensitive ) && !s.contains( "utf8", Qt::CaseInsensitive ); };
auto it = std::remove_if( localeGenLines.begin(), localeGenLines.end(), notUtf8 );
localeGenLines.erase( it, localeGenLines.end() );
// We strip " UTF-8" from "en_US.UTF-8 UTF-8" because it's redundant redundant.
// Also simplify whitespace.
auto unredundant = []( QString& s ) {
auto unredundant = []( QString& s )
{
if ( s.endsWith( " UTF-8" ) )
{
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
// update-thing-and-GS method. And everywhere where we **do** change
// language or location, we already emit the signal.
connect( this, &Config::currentLanguageCodeChanged, [&]() {
connect( this,
&Config::currentLanguageCodeChanged,
[ & ]()
{
auto* gs = Calamares::JobQueue::instance()->globalStorage();
gs->insert( "locale", m_selectedLocaleConfiguration.toBcp47() );
} );
connect( this, &Config::currentLCCodeChanged, [&]() {
updateGSLocale( Calamares::JobQueue::instance()->globalStorage(), localeConfiguration() );
} );
connect( this,
&Config::currentLCCodeChanged,
[ & ]() { updateGSLocale( Calamares::JobQueue::instance()->globalStorage(), localeConfiguration() ); } );
connect( this, &Config::currentLocationChanged, [&]() {
connect( this,
&Config::currentLocationChanged,
[ & ]()
{
const bool locationChanged
= 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( 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() )
{
dbb->button( QDialogButtonBox::Ok )->setEnabled( false );

View File

@ -185,7 +185,8 @@ TimeZoneWidget::mousePressEvent( QMouseEvent* event )
int mX = event->pos().x();
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() );
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->setModel( c->model() );
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->setText( title );
} );

View File

@ -12,7 +12,8 @@
#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 );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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