[partition] Tidy up description in prettyStatus

- the length parameter to diskDescription() is worse than
  useless, because it doesn't say anything about what will
  be done if there's more than one disk.
This commit is contained in:
Adriaan de Groot 2022-02-21 12:30:34 +01:00
parent 9dd2f275f1
commit 7129a2239c

View File

@ -52,8 +52,8 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
m_waitingWidget = new WaitingWidget( QString() );
m_widget->addWidget( m_waitingWidget );
CALAMARES_RETRANSLATE(
if ( m_waitingWidget ) { m_waitingWidget->setText( tr( "Gathering system information..." ) ); } );
CALAMARES_RETRANSLATE( if ( m_waitingWidget )
{ m_waitingWidget->setText( tr( "Gathering system information..." ) ); } );
m_core = new PartitionCoreModule( this ); // Unusable before init is complete!
// We're not done loading, but we need the configuration map first.
@ -216,18 +216,13 @@ diskDescription( int listLength, const PartitionCoreModule::SummaryInfo& info, C
QString
PartitionViewStep::prettyStatus() const
{
QString diskInfoLabel;
const Config::InstallChoice choice = m_config->installChoice();
const QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo();
cDebug() << "Summary for Partition" << list.length() << choice;
for ( const auto& info : list )
{
// TODO: this overwrites each iteration
diskInfoLabel = diskDescription( list.length(), info, choice );
}
auto joinDiskInfo = [ choice = choice ]( QString& s, const PartitionCoreModule::SummaryInfo& i )
{ return s + diskDescription( 1, i, choice ); };
const QString diskInfoLabel = std::accumulate( list.begin(), list.end(), QString(), joinDiskInfo );
const QString jobsLabel = jobDescriptions( jobs() ).join( QStringLiteral( "<br/>" ) );
return diskInfoLabel + "<br/>" + jobsLabel;
}