[partition] code style (minor followup to #872)

This commit is contained in:
Adriaan de Groot 2017-12-14 15:55:23 -05:00
parent 0729bdd0be
commit 38688bab47

View File

@ -47,7 +47,7 @@ SetPartFlagsJob::prettyName() const
if ( !partition()->fileSystem().name().isEmpty() ) if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Set flags on %1MB %2 partition." ) return tr( "Set flags on %1MB %2 partition." )
.arg( partition()->capacity() /1024 /1024) .arg( partition()->capacity() /1024 /1024 )
.arg( partition()->fileSystem().name() ); .arg( partition()->fileSystem().name() );
return tr( "Set flags on new partition." ); return tr( "Set flags on new partition." );
@ -66,7 +66,7 @@ SetPartFlagsJob::prettyDescription() const
if ( !partition()->fileSystem().name().isEmpty() ) if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Clear flags on %1MB <strong>%2</strong> partition." ) return tr( "Clear flags on %1MB <strong>%2</strong> partition." )
.arg( partition()->capacity() /1024 /1024) .arg( partition()->capacity() /1024 /1024 )
.arg( partition()->fileSystem().name() ); .arg( partition()->fileSystem().name() );
return tr( "Clear flags on new partition." ); return tr( "Clear flags on new partition." );
@ -81,7 +81,7 @@ SetPartFlagsJob::prettyDescription() const
if ( !partition()->fileSystem().name().isEmpty() ) if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Flag %1MB <strong>%2</strong> partition as " return tr( "Flag %1MB <strong>%2</strong> partition as "
"<strong>%3</strong>." ) "<strong>%3</strong>." )
.arg( partition()->capacity() /1024 /1024) .arg( partition()->capacity() /1024 /1024 )
.arg( partition()->fileSystem().name() ) .arg( partition()->fileSystem().name() )
.arg( flagsList.join( ", " ) ); .arg( flagsList.join( ", " ) );
@ -102,7 +102,7 @@ SetPartFlagsJob::prettyStatusMessage() const
if ( !partition()->fileSystem().name().isEmpty() ) if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Clearing flags on %1MB <strong>%2</strong> partition." ) return tr( "Clearing flags on %1MB <strong>%2</strong> partition." )
.arg( partition()->capacity() /1024 /1024) .arg( partition()->capacity() /1024 /1024 )
.arg( partition()->fileSystem().name() ); .arg( partition()->fileSystem().name() );
return tr( "Clearing flags on new partition." ); return tr( "Clearing flags on new partition." );
@ -117,7 +117,7 @@ SetPartFlagsJob::prettyStatusMessage() const
if ( !partition()->fileSystem().name().isEmpty() ) if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Setting flags <strong>%3</strong> on " return tr( "Setting flags <strong>%3</strong> on "
"%1MB <strong>%2</strong> partition." ) "%1MB <strong>%2</strong> partition." )
.arg( partition()->capacity() /1024 /1024) .arg( partition()->capacity() /1024 /1024 )
.arg( partition()->fileSystem().name() ) .arg( partition()->fileSystem().name() )
.arg( flagsList.join( ", " ) ); .arg( flagsList.join( ", " ) );
@ -129,15 +129,18 @@ SetPartFlagsJob::prettyStatusMessage() const
Calamares::JobResult Calamares::JobResult
SetPartFlagsJob::exec() SetPartFlagsJob::exec()
{ {
Report report (nullptr); Report report ( nullptr );
SetPartFlagsOperation op(*m_device, *partition(), m_flags); SetPartFlagsOperation op( *m_device, *partition(), m_flags );
op.setStatus(Operation::StatusRunning); op.setStatus( Operation::StatusRunning );
connect(&op, &Operation::progress, [&](int percent) { emit progress(percent / 100.0); } ); connect( &op, &Operation::progress, [&]( int percent )
{
emit progress( percent / 100.0 );
} );
QString errorMessage = tr( "The installer failed to set flags on partition %1." ) QString errorMessage = tr( "The installer failed to set flags on partition %1." )
.arg( m_partition->partitionPath() ); .arg( m_partition->partitionPath() );
if (op.execute(report)) if ( op.execute( report ) )
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
return Calamares::JobResult::error(errorMessage, report.toText()); return Calamares::JobResult::error( errorMessage, report.toText() );
} }