CI: apply coding style globally again
This commit is contained in:
parent
8fea6f71ab
commit
874a0c1f38
@ -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() )
|
||||
{
|
||||
|
@ -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 );
|
||||
@ -173,7 +172,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*,
|
||||
QObject::connect( viewManager, &Calamares::ViewManager::backEnabledChanged, back, &QPushButton::setEnabled );
|
||||
QObject::connect( viewManager, &Calamares::ViewManager::backLabelChanged, back, &QPushButton::setText );
|
||||
QObject::connect(
|
||||
viewManager, &Calamares::ViewManager::backIconChanged, [=]( QString n ) { setButtonIcon( back, n ); } );
|
||||
viewManager, &Calamares::ViewManager::backIconChanged, [ = ]( QString n ) { setButtonIcon( back, n ); } );
|
||||
QObject::connect(
|
||||
viewManager, &Calamares::ViewManager::backAndNextVisibleChanged, back, &QPushButton::setVisible );
|
||||
bottomLayout->addWidget( back );
|
||||
@ -189,7 +188,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*,
|
||||
QObject::connect( viewManager, &Calamares::ViewManager::nextEnabledChanged, next, &QPushButton::setEnabled );
|
||||
QObject::connect( viewManager, &Calamares::ViewManager::nextLabelChanged, next, &QPushButton::setText );
|
||||
QObject::connect(
|
||||
viewManager, &Calamares::ViewManager::nextIconChanged, [=]( QString n ) { setButtonIcon( next, n ); } );
|
||||
viewManager, &Calamares::ViewManager::nextIconChanged, [ = ]( QString n ) { setButtonIcon( next, n ); } );
|
||||
QObject::connect(
|
||||
viewManager, &Calamares::ViewManager::backAndNextVisibleChanged, next, &QPushButton::setVisible );
|
||||
bottomLayout->addWidget( next );
|
||||
@ -205,7 +204,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*,
|
||||
QObject::connect( viewManager, &Calamares::ViewManager::quitEnabledChanged, quit, &QPushButton::setEnabled );
|
||||
QObject::connect( viewManager, &Calamares::ViewManager::quitLabelChanged, quit, &QPushButton::setText );
|
||||
QObject::connect(
|
||||
viewManager, &Calamares::ViewManager::quitIconChanged, [=]( QString n ) { setButtonIcon( quit, n ); } );
|
||||
viewManager, &Calamares::ViewManager::quitIconChanged, [ = ]( QString n ) { setButtonIcon( quit, n ); } );
|
||||
QObject::connect( viewManager, &Calamares::ViewManager::quitTooltipChanged, quit, &QPushButton::setToolTip );
|
||||
QObject::connect( viewManager, &Calamares::ViewManager::quitVisibleChanged, quit, &QPushButton::setVisible );
|
||||
bottomLayout->addWidget( quit );
|
||||
|
@ -85,17 +85,22 @@ DebugWindow::DebugWindow()
|
||||
m_ui->globalStorageView->expandAll();
|
||||
|
||||
// Do above when the GS changes, too
|
||||
connect( gs, &GlobalStorage::changed, this, [=] {
|
||||
m_globals = JobQueue::instance()->globalStorage()->data();
|
||||
m_globals_model->reload();
|
||||
m_ui->globalStorageView->expandAll();
|
||||
} );
|
||||
connect( gs,
|
||||
&GlobalStorage::changed,
|
||||
this,
|
||||
[ = ]
|
||||
{
|
||||
m_globals = JobQueue::instance()->globalStorage()->data();
|
||||
m_globals_model->reload();
|
||||
m_ui->globalStorageView->expandAll();
|
||||
} );
|
||||
|
||||
// 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,67 +121,74 @@ DebugWindow::DebugWindow()
|
||||
m_ui->modulesVerticalLayout->insertWidget( 1, pythonConsoleButton );
|
||||
pythonConsoleButton->hide();
|
||||
|
||||
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 )
|
||||
return;
|
||||
|
||||
for ( ViewStep* step : ViewManager::instance()->viewSteps() )
|
||||
QObject::connect(
|
||||
pythonConsoleButton,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
[ this, moduleConfigModel ]
|
||||
{
|
||||
if ( step->moduleInstanceKey() == module->instanceKey() )
|
||||
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 )
|
||||
return;
|
||||
|
||||
for ( ViewStep* step : ViewManager::instance()->viewSteps() )
|
||||
{
|
||||
PythonQtViewStep* pqvs = qobject_cast< PythonQtViewStep* >( step );
|
||||
if ( pqvs )
|
||||
if ( step->moduleInstanceKey() == module->instanceKey() )
|
||||
{
|
||||
QWidget* consoleWindow = new QWidget;
|
||||
PythonQtViewStep* pqvs = qobject_cast< PythonQtViewStep* >( step );
|
||||
if ( pqvs )
|
||||
{
|
||||
QWidget* consoleWindow = new QWidget;
|
||||
|
||||
QWidget* console = pqvs->createScriptingConsole();
|
||||
console->setParent( consoleWindow );
|
||||
QWidget* console = pqvs->createScriptingConsole();
|
||||
console->setParent( consoleWindow );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
consoleWindow->setLayout( layout );
|
||||
layout->addWidget( console );
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
consoleWindow->setLayout( layout );
|
||||
layout->addWidget( console );
|
||||
|
||||
QHBoxLayout* bottomLayout = new QHBoxLayout;
|
||||
layout->addLayout( bottomLayout );
|
||||
QHBoxLayout* bottomLayout = new QHBoxLayout;
|
||||
layout->addLayout( bottomLayout );
|
||||
|
||||
QLabel* bottomLabel = new QLabel( consoleWindow );
|
||||
bottomLayout->addWidget( bottomLabel );
|
||||
QString line = QString( "Module: <font color=\"#008000\"><code>%1</code></font><br/>"
|
||||
"Python class: <font color=\"#008000\"><code>%2</code></font>" )
|
||||
.arg( module->instanceKey() )
|
||||
.arg( console->property( "classname" ).toString() );
|
||||
bottomLabel->setText( line );
|
||||
QLabel* bottomLabel = new QLabel( consoleWindow );
|
||||
bottomLayout->addWidget( bottomLabel );
|
||||
QString line = QString( "Module: <font color=\"#008000\"><code>%1</code></font><br/>"
|
||||
"Python class: <font color=\"#008000\"><code>%2</code></font>" )
|
||||
.arg( module->instanceKey() )
|
||||
.arg( console->property( "classname" ).toString() );
|
||||
bottomLabel->setText( line );
|
||||
|
||||
QPushButton* closeButton = new QPushButton( consoleWindow );
|
||||
closeButton->setText( "&Close" );
|
||||
QObject::connect( closeButton, &QPushButton::clicked, [consoleWindow] { consoleWindow->close(); } );
|
||||
bottomLayout->addWidget( closeButton );
|
||||
bottomLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||
QPushButton* closeButton = new QPushButton( consoleWindow );
|
||||
closeButton->setText( "&Close" );
|
||||
QObject::connect(
|
||||
closeButton, &QPushButton::clicked, [ consoleWindow ] { consoleWindow->close(); } );
|
||||
bottomLayout->addWidget( closeButton );
|
||||
bottomLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||
|
||||
consoleWindow->setParent( this );
|
||||
consoleWindow->setWindowFlags( Qt::Window );
|
||||
consoleWindow->setWindowTitle( "Calamares Python console" );
|
||||
consoleWindow->setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
consoleWindow->showNormal();
|
||||
break;
|
||||
consoleWindow->setParent( this );
|
||||
consoleWindow->setWindowFlags( Qt::Window );
|
||||
consoleWindow->setWindowTitle( "Calamares Python console" );
|
||||
consoleWindow->setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
consoleWindow->showNormal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
#endif
|
||||
|
||||
connect( m_ui->modulesListView->selectionModel(),
|
||||
&QItemSelectionModel::selectionChanged,
|
||||
this,
|
||||
[this
|
||||
[ this
|
||||
#ifdef WITH_PYTHONQT
|
||||
,
|
||||
pythonConsoleButton
|
||||
,
|
||||
pythonConsoleButton
|
||||
#endif
|
||||
] {
|
||||
]
|
||||
{
|
||||
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
|
||||
Module* module
|
||||
= ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) );
|
||||
@ -196,27 +208,33 @@ DebugWindow::DebugWindow()
|
||||
|
||||
// Tools page
|
||||
connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
|
||||
connect( m_ui->reloadStylesheetButton, &QPushButton::clicked, []() {
|
||||
for ( auto* w : qApp->topLevelWidgets() )
|
||||
{
|
||||
// Needs to match what's set in CalamaresWindow
|
||||
if ( w->objectName() == QStringLiteral( "mainApp" ) )
|
||||
{
|
||||
w->setStyleSheet( Calamares::Branding::instance()->stylesheet() );
|
||||
}
|
||||
}
|
||||
} );
|
||||
connect( m_ui->widgetTreeButton, &QPushButton::clicked, []() {
|
||||
for ( auto* w : qApp->topLevelWidgets() )
|
||||
{
|
||||
Logger::CDebug deb;
|
||||
dumpWidgetTree( deb, w, 0 );
|
||||
}
|
||||
} );
|
||||
connect( m_ui->reloadStylesheetButton,
|
||||
&QPushButton::clicked,
|
||||
[]()
|
||||
{
|
||||
for ( auto* w : qApp->topLevelWidgets() )
|
||||
{
|
||||
// Needs to match what's set in CalamaresWindow
|
||||
if ( w->objectName() == QStringLiteral( "mainApp" ) )
|
||||
{
|
||||
w->setStyleSheet( Calamares::Branding::instance()->stylesheet() );
|
||||
}
|
||||
}
|
||||
} );
|
||||
connect( m_ui->widgetTreeButton,
|
||||
&QPushButton::clicked,
|
||||
[]()
|
||||
{
|
||||
for ( auto* w : qApp->topLevelWidgets() )
|
||||
{
|
||||
Logger::CDebug deb;
|
||||
dumpWidgetTree( deb, w, 0 );
|
||||
}
|
||||
} );
|
||||
|
||||
// Send Log button only if it would be useful
|
||||
m_ui->sendLogButton->setVisible( CalamaresUtils::Paste::isEnabled() );
|
||||
connect( m_ui->sendLogButton, &QPushButton::clicked, [this]() { CalamaresUtils::Paste::doLogUploadUI( this ); } );
|
||||
connect( m_ui->sendLogButton, &QPushButton::clicked, [ this ]() { CalamaresUtils::Paste::doLogUploadUI( this ); } );
|
||||
|
||||
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); );
|
||||
}
|
||||
@ -260,11 +278,15 @@ DebugWindowManager::show( bool visible )
|
||||
{
|
||||
m_debugWindow = new Calamares::DebugWindow();
|
||||
m_debugWindow->show();
|
||||
connect( m_debugWindow.data(), &Calamares::DebugWindow::closed, this, [=]() {
|
||||
m_debugWindow->deleteLater();
|
||||
m_visible = false;
|
||||
emit visibleChanged( false );
|
||||
} );
|
||||
connect( m_debugWindow.data(),
|
||||
&Calamares::DebugWindow::closed,
|
||||
this,
|
||||
[ = ]()
|
||||
{
|
||||
m_debugWindow->deleteLater();
|
||||
m_visible = false;
|
||||
emit visibleChanged( false );
|
||||
} );
|
||||
m_visible = true;
|
||||
emit visibleChanged( true );
|
||||
}
|
||||
|
@ -51,6 +51,6 @@ ProgressTreeView::setModel( QAbstractItemModel* model )
|
||||
Calamares::ViewManager::instance(),
|
||||
&Calamares::ViewManager::currentStepChanged,
|
||||
this,
|
||||
[this]() { viewport()->update(); },
|
||||
[ this ]() { viewport()->update(); },
|
||||
Qt::UniqueConnection );
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -211,14 +211,14 @@ _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
|
||||
{
|
||||
QObject::connect(
|
||||
&r, &decltype( r )::output, [&callback]( const QString& s ) { callback( s.toStdString() ); } );
|
||||
&r, &decltype( r )::output, [ &callback ]( const QString& s ) { callback( s.toStdString() ); } );
|
||||
}
|
||||
r.enableOutputProcessing();
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ Settings::reconcileInstancesAndSequence()
|
||||
// Since moduleFinder captures targetKey by reference, we can
|
||||
// update targetKey to change what the finder lambda looks for.
|
||||
Calamares::ModuleSystem::InstanceKey targetKey;
|
||||
auto moduleFinder = [&targetKey]( const InstanceDescription& d ) { return d.isValid() && d.key() == targetKey; };
|
||||
auto moduleFinder = [ &targetKey ]( const InstanceDescription& d ) { return d.isValid() && d.key() == targetKey; };
|
||||
|
||||
// Check the sequence against the existing instances (which so far are only custom)
|
||||
for ( const auto& step : m_modulesSequence )
|
||||
|
@ -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() );
|
||||
|
@ -150,7 +150,7 @@ Handler::query() const
|
||||
QString url = m_url;
|
||||
QString selector = m_selector;
|
||||
|
||||
return QtConcurrent::run( [=] { return do_query( type, url, selector ); } );
|
||||
return QtConcurrent::run( [ = ] { return do_query( type, url, selector ); } );
|
||||
}
|
||||
|
||||
QString
|
||||
@ -171,7 +171,7 @@ Handler::queryRaw() const
|
||||
QString url = m_url;
|
||||
QString selector = m_selector;
|
||||
|
||||
return QtConcurrent::run( [=] { return do_raw_query( type, url, selector ); } );
|
||||
return QtConcurrent::run( [ = ] { return do_raw_query( type, url, selector ); } );
|
||||
}
|
||||
|
||||
} // namespace GeoIP
|
||||
|
@ -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;
|
||||
@ -86,7 +86,7 @@ languageForCountry( QLocale::Country country )
|
||||
{
|
||||
const CountryData* p = std::find_if( country_data_table,
|
||||
country_data_table + country_data_size,
|
||||
[c = country]( const CountryData& d ) { return d.c == c; } );
|
||||
[ c = country ]( const CountryData& d ) { return d.c == c; } );
|
||||
if ( p == country_data_table + country_data_size )
|
||||
{
|
||||
return QLocale::Language::AnyLanguage;
|
||||
|
@ -224,16 +224,19 @@ 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 ) {
|
||||
if ( lhs->region() == rhs->region() )
|
||||
{
|
||||
return lhs->zone() < rhs->zone();
|
||||
}
|
||||
return lhs->region() < rhs->region();
|
||||
} );
|
||||
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();
|
||||
}
|
||||
return lhs->region() < rhs->region();
|
||||
} );
|
||||
|
||||
for ( auto* z : m_zones )
|
||||
{
|
||||
@ -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 )
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ Presets::Presets( const QVariantMap& configurationMap, const QStringList& recogn
|
||||
{
|
||||
reserve( recognizedKeys.size() );
|
||||
loadPresets(
|
||||
*this, configurationMap, [&recognizedKeys]( const QString& s ) { return recognizedKeys.contains( s ); } );
|
||||
*this, configurationMap, [ &recognizedKeys ]( const QString& s ) { return recognizedKeys.contains( s ); } );
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -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,14 +100,17 @@ RequirementsChecker::reportProgress()
|
||||
m_progressTimeouts++;
|
||||
|
||||
QStringList remainingNames;
|
||||
auto remaining = std::count_if( m_watchers.cbegin(), m_watchers.cend(), [&]( const Watcher* w ) {
|
||||
if ( w && !w->isFinished() )
|
||||
{
|
||||
remainingNames << w->objectName();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} );
|
||||
auto remaining = std::count_if( m_watchers.cbegin(),
|
||||
m_watchers.cend(),
|
||||
[ & ]( const Watcher* w )
|
||||
{
|
||||
if ( w && !w->isFinished() )
|
||||
{
|
||||
remainingNames << w->objectName();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} );
|
||||
if ( remaining > 0 )
|
||||
{
|
||||
cDebug() << "Remaining modules:" << remaining << Logger::DebugList( remainingNames );
|
||||
|
@ -140,7 +140,7 @@ PackagesTests::testAdd()
|
||||
{
|
||||
// This is the "original" instance, so it's missing extraEditor
|
||||
auto op = action[ "install" ].toList();
|
||||
QCOMPARE( op.length(), packages.length()-1 ); // changed from original length
|
||||
QCOMPARE( op.length(), packages.length() - 1 ); // changed from original length
|
||||
QVERIFY( !op.contains( extraEditor ) );
|
||||
}
|
||||
}
|
||||
|
@ -102,9 +102,7 @@ KPMManager::KPMManager()
|
||||
{
|
||||
}
|
||||
|
||||
KPMManager::~KPMManager()
|
||||
{
|
||||
}
|
||||
KPMManager::~KPMManager() {}
|
||||
|
||||
KPMManager::operator bool() const
|
||||
{
|
||||
|
@ -29,7 +29,8 @@ PartitionIterator::PartitionIterator( PartitionTable* table )
|
||||
{
|
||||
}
|
||||
|
||||
Partition* PartitionIterator::operator*() const
|
||||
Partition*
|
||||
PartitionIterator::operator*() const
|
||||
{
|
||||
return m_current;
|
||||
}
|
||||
|
@ -108,5 +108,5 @@ struct cScopedAssignment
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
cScopedAssignment( T p )->cScopedAssignment< decltype( *p ) >;
|
||||
cScopedAssignment( T p ) -> cScopedAssignment< decltype( *p ) >;
|
||||
#endif
|
||||
|
@ -116,7 +116,7 @@ private:
|
||||
* immediately after setting up the connection. This allows
|
||||
* setup and translation code to be mixed together.
|
||||
*/
|
||||
#define CALAMARES_RETRANSLATE( body ) CalamaresUtils::Retranslator::attach( this, [=] { body } )
|
||||
#define CALAMARES_RETRANSLATE( body ) CalamaresUtils::Retranslator::attach( this, [ = ] { body } )
|
||||
/** @brief Call code for the given object (widget) when language changes
|
||||
*
|
||||
* This is identical to CALAMARES_RETRANSLATE, except the @p body is called
|
||||
@ -126,7 +126,7 @@ private:
|
||||
* immediately after setting up the connection. This allows
|
||||
* setup and translation code to be mixed together.
|
||||
*/
|
||||
#define CALAMARES_RETRANSLATE_FOR( object, body ) CalamaresUtils::Retranslator::attach( object, [=] { body } )
|
||||
#define CALAMARES_RETRANSLATE_FOR( object, body ) CalamaresUtils::Retranslator::attach( object, [ = ] { body } )
|
||||
/** @brief Call a slot in this object when language changes
|
||||
*
|
||||
* Given a slot (in method-function-pointer notation), call that slot when the
|
||||
|
@ -151,16 +151,19 @@ Calamares::Utils::Runner::run()
|
||||
|
||||
if ( m_output )
|
||||
{
|
||||
connect( &process, &QProcess::readyReadStandardOutput, [this, &process]() {
|
||||
do
|
||||
{
|
||||
QString s = process.readLine();
|
||||
if ( !s.isEmpty() )
|
||||
{
|
||||
Q_EMIT this->output( s );
|
||||
}
|
||||
} while ( process.canReadLine() );
|
||||
} );
|
||||
connect( &process,
|
||||
&QProcess::readyReadStandardOutput,
|
||||
[ this, &process ]()
|
||||
{
|
||||
do
|
||||
{
|
||||
QString s = process.readLine();
|
||||
if ( !s.isEmpty() )
|
||||
{
|
||||
Q_EMIT this->output( s );
|
||||
}
|
||||
} while ( process.canReadLine() );
|
||||
} );
|
||||
}
|
||||
|
||||
cDebug() << Logger::SubEntry << "Running" << Logger::RedactedCommand( m_command );
|
||||
|
@ -993,7 +993,7 @@ LibCalamaresTests::testRunnerOutput()
|
||||
|
||||
Calamares::Utils::Runner r( { "cat" } );
|
||||
r.enableOutputProcessing().setInput( QStringLiteral( "hello\nworld\n\n!\n" ) );
|
||||
QObject::connect( &r, &decltype( r )::output, [&collectedOutput]( QString s ) { collectedOutput << s; } );
|
||||
QObject::connect( &r, &decltype( r )::output, [ &collectedOutput ]( QString s ) { collectedOutput << s; } );
|
||||
|
||||
{
|
||||
auto result = r.run();
|
||||
|
@ -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 );
|
||||
|
@ -135,14 +135,14 @@ addExpansions( QmlSearch method, QStringList& candidates, const QStringList& nam
|
||||
std::transform( names.constBegin(),
|
||||
names.constEnd(),
|
||||
std::back_inserter( candidates ),
|
||||
[&]( const QString& s ) { return s.isEmpty() ? QString() : bPath.arg( brandDir, s ); } );
|
||||
[ & ]( const QString& s ) { return s.isEmpty() ? QString() : bPath.arg( brandDir, s ); } );
|
||||
}
|
||||
if ( ( method == QmlSearch::Both ) || ( method == QmlSearch::QrcOnly ) )
|
||||
{
|
||||
std::transform( names.constBegin(),
|
||||
names.constEnd(),
|
||||
std::back_inserter( candidates ),
|
||||
[&]( const QString& s ) { return s.isEmpty() ? QString() : qrPath.arg( s ); } );
|
||||
[ & ]( const QString& s ) { return s.isEmpty() ? QString() : qrPath.arg( s ); } );
|
||||
}
|
||||
}
|
||||
|
||||
@ -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(); } );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 ) {
|
||||
using Mode = Config::RestartMode;
|
||||
connect( config,
|
||||
&Config::restartModeChanged,
|
||||
[ this ]( Config::RestartMode mode )
|
||||
{
|
||||
using Mode = Config::RestartMode;
|
||||
|
||||
ui->restartCheckBox->setVisible( mode != Mode::Never );
|
||||
ui->restartCheckBox->setEnabled( mode != Mode::Always );
|
||||
} );
|
||||
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 );
|
||||
}
|
||||
|
@ -156,18 +156,24 @@ Config::Config( QObject* parent )
|
||||
m_setxkbmapTimer.setSingleShot( true );
|
||||
|
||||
// Connect signals and slots
|
||||
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_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 ) {
|
||||
m_selectedLayout = m_keyboardLayoutsModel->item( index ).first;
|
||||
updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) );
|
||||
emit prettyStatusChanged();
|
||||
} );
|
||||
connect( m_keyboardLayoutsModel,
|
||||
&KeyboardLayoutModel::currentIndexChanged,
|
||||
[ & ]( int index )
|
||||
{
|
||||
m_selectedLayout = m_keyboardLayoutsModel->item( index ).first;
|
||||
updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) );
|
||||
emit prettyStatusChanged();
|
||||
} );
|
||||
|
||||
connect( m_keyboardVariantsModel, &KeyboardVariantsModel::currentIndexChanged, this, &Config::xkbChanged );
|
||||
|
||||
|
@ -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 >
|
||||
|
@ -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,21 +84,29 @@ 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 ) {
|
||||
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
|
||||
m_keyboardPreview->setLayout( m_config->keyboardLayouts()->key( index ) );
|
||||
m_keyboardPreview->setVariant(
|
||||
m_config->keyboardVariants()->key( m_config->keyboardVariants()->currentIndex() ) );
|
||||
} );
|
||||
[ 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(
|
||||
m_config->keyboardVariants()->key( m_config->keyboardVariants()->currentIndex() ) );
|
||||
} );
|
||||
|
||||
connect( ui->variantSelector->selectionModel(),
|
||||
&QItemSelectionModel::currentChanged,
|
||||
[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 ) );
|
||||
} );
|
||||
[ 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 ) );
|
||||
} );
|
||||
CALAMARES_RETRANSLATE_SLOT( &KeyboardPage::retranslate );
|
||||
}
|
||||
|
||||
|
@ -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,30 +183,36 @@ 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, [&]() {
|
||||
auto* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
gs->insert( "locale", m_selectedLocaleConfiguration.toBcp47() );
|
||||
} );
|
||||
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, [&]() {
|
||||
const bool locationChanged
|
||||
= updateGSLocation( Calamares::JobQueue::instance()->globalStorage(), currentLocation() );
|
||||
connect( this,
|
||||
&Config::currentLocationChanged,
|
||||
[ & ]()
|
||||
{
|
||||
const bool locationChanged
|
||||
= updateGSLocation( Calamares::JobQueue::instance()->globalStorage(), currentLocation() );
|
||||
|
||||
if ( locationChanged && m_adjustLiveTimezone )
|
||||
{
|
||||
QProcess::execute( "timedatectl", // depends on systemd
|
||||
{ "set-timezone", currentTimezoneCode() } );
|
||||
}
|
||||
if ( locationChanged && m_adjustLiveTimezone )
|
||||
{
|
||||
QProcess::execute( "timedatectl", // depends on systemd
|
||||
{ "set-timezone", currentTimezoneCode() } );
|
||||
}
|
||||
|
||||
emit currentTimezoneCodeChanged( currentTimezoneCode() );
|
||||
emit currentTimezoneNameChanged( currentTimezoneName() );
|
||||
} );
|
||||
emit currentTimezoneCodeChanged( currentTimezoneCode() );
|
||||
emit currentTimezoneNameChanged( currentTimezoneName() );
|
||||
} );
|
||||
|
||||
auto prettyStatusNotify = [&]() { emit prettyStatusChanged( prettyStatus() ); };
|
||||
auto prettyStatusNotify = [ & ]() { emit prettyStatusChanged( prettyStatus() ); };
|
||||
connect( this, &Config::currentLanguageStatusChanged, prettyStatusNotify );
|
||||
connect( this, &Config::currentLCStatusChanged, prettyStatusNotify );
|
||||
connect( this, &Config::currentLocationStatusChanged, prettyStatusNotify );
|
||||
|
@ -60,16 +60,19 @@ 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]() {
|
||||
if ( m_localesWidget->selectedItems().isEmpty() )
|
||||
{
|
||||
dbb->button( QDialogButtonBox::Ok )->setEnabled( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
dbb->button( QDialogButtonBox::Ok )->setEnabled( true );
|
||||
}
|
||||
} );
|
||||
connect( m_localesWidget,
|
||||
&QListWidget::itemSelectionChanged,
|
||||
[ this, dbb ]()
|
||||
{
|
||||
if ( m_localesWidget->selectedItems().isEmpty() )
|
||||
{
|
||||
dbb->button( QDialogButtonBox::Ok )->setEnabled( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
dbb->button( QDialogButtonBox::Ok )->setEnabled( true );
|
||||
}
|
||||
} );
|
||||
|
||||
if ( selected > -1 )
|
||||
{
|
||||
|
@ -140,9 +140,9 @@ TimeZoneWidget::paintEvent( QPaintEvent* )
|
||||
// .. the lambda manages deprecations: the old one works in Qt 5.9 and Qt 5.10,
|
||||
// while the new one avoids deprecation messages in Qt 5.13 and later.
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 11, 0 )
|
||||
auto textwidth = [&]( const QString& s ) { return fontMetrics.horizontalAdvance( s ); };
|
||||
auto textwidth = [ & ]( const QString& s ) { return fontMetrics.horizontalAdvance( s ); };
|
||||
#else
|
||||
auto textwidth = [&]( const QString& s ) { return fontMetrics.width( s ); };
|
||||
auto textwidth = [ & ]( const QString& s ) { return fontMetrics.width( s ); };
|
||||
#endif
|
||||
const int textWidth = textwidth( m_currentLocation ? m_currentLocation->tr() : QString() );
|
||||
const int textHeight = fontMetrics.height();
|
||||
@ -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() ) );
|
||||
};
|
||||
|
@ -35,10 +35,13 @@ 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 ) {
|
||||
ui->label->setVisible( !title.isEmpty() );
|
||||
ui->label->setText( title );
|
||||
} );
|
||||
connect( c,
|
||||
&Config::titleLabelChanged,
|
||||
[ ui = this->ui ]( const QString title )
|
||||
{
|
||||
ui->label->setVisible( !title.isEmpty() );
|
||||
ui->label->setText( title );
|
||||
} );
|
||||
connect( c, &Config::statusReady, this, &NetInstallPage::expandGroups );
|
||||
}
|
||||
|
||||
|
@ -12,19 +12,20 @@
|
||||
|
||||
#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 );
|
||||
|
||||
// Empty names are handled specially: don't draw them as items,
|
||||
// so the "branch" seems to just pass them by.
|
||||
const QString s = index.data().toString();
|
||||
if (s.isEmpty())
|
||||
if ( s.isEmpty() )
|
||||
{
|
||||
QStyleOptionViewItem opt = viewOptions();
|
||||
opt.state = QStyle::State_Sibling;
|
||||
opt.rect = QRect (!isRightToLeft() ? rect.left() : rect.right() + 1, rect.top(), indentation(), rect.height());
|
||||
painter->eraseRect(opt.rect);
|
||||
style()->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this);
|
||||
opt.rect = QRect( !isRightToLeft() ? rect.left() : rect.right() + 1, rect.top(), indentation(), rect.height() );
|
||||
painter->eraseRect( opt.rect );
|
||||
style()->drawPrimitive( QStyle::PE_IndicatorBranch, &opt, painter, this );
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,5 @@ public:
|
||||
using QTreeView::QTreeView;
|
||||
|
||||
protected:
|
||||
virtual void drawBranches(QPainter*painter, const QRect& rect, const QModelIndex& index) const override;
|
||||
virtual void drawBranches( QPainter* painter, const QRect& rect, const QModelIndex& index ) const override;
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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() )
|
||||
{
|
||||
|
@ -45,16 +45,22 @@ 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] { \
|
||||
QString url( config->x##Tracking()->policy() ); \
|
||||
if ( !url.isEmpty() ) \
|
||||
{ \
|
||||
QDesktopServices::openUrl( url ); \
|
||||
} \
|
||||
} ); \
|
||||
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() ) \
|
||||
{ \
|
||||
QDesktopServices::openUrl( url ); \
|
||||
} \
|
||||
} ); \
|
||||
} while ( false )
|
||||
|
||||
trackingSetup( install );
|
||||
@ -63,16 +69,19 @@ 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] {
|
||||
QString url( config->generalPolicy() );
|
||||
if ( !url.isEmpty() )
|
||||
{
|
||||
QDesktopServices::openUrl( url );
|
||||
}
|
||||
} );
|
||||
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() )
|
||||
{
|
||||
QDesktopServices::openUrl( url );
|
||||
}
|
||||
} );
|
||||
|
||||
retranslate();
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ DEFINE_CHECK_FUNC( minLength )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "minLength set to" << minLength;
|
||||
checks.push_back( PasswordCheck( []() { return QCoreApplication::translate( "PWQ", "Password is too short" ); },
|
||||
[minLength]( const QString& s ) { return s.length() >= minLength; },
|
||||
[ minLength ]( const QString& s ) { return s.length() >= minLength; },
|
||||
PasswordCheck::Weight( 10 ) ) );
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ DEFINE_CHECK_FUNC( maxLength )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "maxLength set to" << maxLength;
|
||||
checks.push_back( PasswordCheck( []() { return QCoreApplication::translate( "PWQ", "Password is too long" ); },
|
||||
[maxLength]( const QString& s ) { return s.length() <= maxLength; },
|
||||
[ maxLength ]( const QString& s ) { return s.length() <= maxLength; },
|
||||
PasswordCheck::Weight( 10 ) ) );
|
||||
}
|
||||
}
|
||||
@ -378,8 +378,9 @@ DEFINE_CHECK_FUNC( libpwquality )
|
||||
/* Something actually added? */
|
||||
if ( requirement_count )
|
||||
{
|
||||
checks.push_back( PasswordCheck( [settings]() { return settings->explanation(); },
|
||||
[settings]( const QString& s ) {
|
||||
checks.push_back( PasswordCheck( [ settings ]() { return settings->explanation(); },
|
||||
[ settings ]( const QString& s )
|
||||
{
|
||||
int r = settings->check( s );
|
||||
if ( r < 0 )
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ WelcomePage::setupButton( Button role, const QString& url )
|
||||
{
|
||||
auto size = 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() );
|
||||
button->setIcon( CalamaresUtils::defaultPixmap( icon, CalamaresUtils::Original, size ) );
|
||||
connect( button, &QPushButton::clicked, [u]() { QDesktopServices::openUrl( u ); } );
|
||||
connect( button, &QPushButton::clicked, [ u ]() { QDesktopServices::openUrl( u ); } );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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 ) } );
|
||||
}
|
||||
@ -163,8 +163,8 @@ GeneralRequirements::checkRequirements()
|
||||
{
|
||||
checkEntries.append(
|
||||
{ entry,
|
||||
[req = m_requiredRamGiB] { return tr( "has at least %1 GiB working memory" ).arg( req ); },
|
||||
[req = m_requiredRamGiB] {
|
||||
[ req = m_requiredRamGiB ] { return tr( "has at least %1 GiB working memory" ).arg( req ); },
|
||||
[ req = m_requiredRamGiB ] {
|
||||
return tr( "The system does not have enough working memory. At least %1 GiB is required." )
|
||||
.arg( req );
|
||||
},
|
||||
@ -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." );
|
||||
|
@ -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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user