[partition] Massage types of job messages

This commit is contained in:
Adriaan de Groot 2023-12-30 19:23:52 +01:00
parent ee09fd6613
commit e326758900
7 changed files with 53 additions and 44 deletions

View File

@ -31,14 +31,14 @@ ChangeFilesystemLabelJob::ChangeFilesystemLabelJob( Device* device, Partition* p
QString QString
ChangeFilesystemLabelJob::prettyName() const ChangeFilesystemLabelJob::prettyName() const
{ {
return tr( "Setting filesystem label on %1", "@status" ).arg( partition()->partitionPath() ); return tr( "Set filesystem label on %1", "@title" ).arg( partition()->partitionPath() );
} }
QString QString
ChangeFilesystemLabelJob::prettyDescription() const ChangeFilesystemLabelJob::prettyDescription() const
{ {
return tr( "Setting filesystem label <strong>%1</strong> to partition <strong>%2</strong>", "@status" ) return tr( "Set filesystem label <strong>%1</strong> to partition <strong>%2</strong>", "@info" )
.arg( m_label ) .arg( m_label )
.arg( partition()->partitionPath() ); .arg( partition()->partitionPath() );
} }
@ -47,7 +47,9 @@ ChangeFilesystemLabelJob::prettyDescription() const
QString QString
ChangeFilesystemLabelJob::prettyStatusMessage() const ChangeFilesystemLabelJob::prettyStatusMessage() const
{ {
return prettyDescription(); return tr( "Setting filesystem label <strong>%1</strong> to partition <strong>%2</strong>…", "@status" )
.arg( m_label )
.arg( partition()->partitionPath() );
} }
@ -79,5 +81,6 @@ ChangeFilesystemLabelJob::exec()
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }
return Calamares::JobResult::error( return Calamares::JobResult::error(
tr( "The installer failed to update partition table on disk '%1'.", "@info" ).arg( m_device->name() ), report.toText() ); tr( "The installer failed to update partition table on disk '%1'.", "@info" ).arg( m_device->name() ),
report.toText() );
} }

View File

@ -329,7 +329,8 @@ tryVGDisable( const QString& vgName )
vgProcess.start( "vgchange", { "-an", vgName } ); vgProcess.start( "vgchange", { "-an", vgName } );
vgProcess.waitForFinished(); vgProcess.waitForFinished();
return ( vgProcess.exitCode() == 0 ) return ( vgProcess.exitCode() == 0 )
? MessageAndPath { QT_TRANSLATE_NOOP( "ClearMountsJob", "Successfully disabled volume group %1.", "@info" ), vgName } ? MessageAndPath { QT_TRANSLATE_NOOP( "ClearMountsJob", "Successfully disabled volume group %1.", "@info" ),
vgName }
: MessageAndPath {}; : MessageAndPath {};
} }
@ -368,7 +369,7 @@ ClearMountsJob::ClearMountsJob( Device* device )
QString QString
ClearMountsJob::prettyName() const ClearMountsJob::prettyName() const
{ {
return tr( "Clearing mounts for partitioning operations on %1", "@status" ).arg( m_deviceNode ); return tr( "Clear mounts for partitioning operations on %1", "@title" ).arg( m_deviceNode );
} }
QString QString

View File

@ -178,7 +178,7 @@ CreatePartitionJob::prettyName() const
QString entries = prettyGptEntries( m_partition ); QString entries = prettyGptEntries( m_partition );
if ( !entries.isEmpty() ) if ( !entries.isEmpty() )
{ {
return tr( "Creating new %1MiB partition on %3 (%2) with entries %4…", "@status" ) return tr( "Create new %1MiB partition on %3 (%2) with entries %4", "@title" )
.arg( Calamares::BytesToMiB( m_partition->capacity() ) ) .arg( Calamares::BytesToMiB( m_partition->capacity() ) )
.arg( m_device->name() ) .arg( m_device->name() )
.arg( m_device->deviceNode() ) .arg( m_device->deviceNode() )
@ -186,14 +186,14 @@ CreatePartitionJob::prettyName() const
} }
else else
{ {
return tr( "Creating new %1MiB partition on %3 (%2)…", "@status" ) return tr( "Create new %1MiB partition on %3 (%2)", "@title" )
.arg( Calamares::BytesToMiB( m_partition->capacity() ) ) .arg( Calamares::BytesToMiB( m_partition->capacity() ) )
.arg( m_device->name() ) .arg( m_device->name() )
.arg( m_device->deviceNode() ); .arg( m_device->deviceNode() );
} }
} }
return tr( "Creating new %2MiB partition on %4 (%3) with file system %1…" "@status" ) return tr( "Create new %2MiB partition on %4 (%3) with file system %1", "@title" )
.arg( userVisibleFS( m_partition->fileSystem() ) ) .arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( Calamares::BytesToMiB( m_partition->capacity() ) ) .arg( Calamares::BytesToMiB( m_partition->capacity() ) )
.arg( m_device->name() ) .arg( m_device->name() )
@ -209,8 +209,9 @@ CreatePartitionJob::prettyDescription() const
QString entries = prettyGptEntries( m_partition ); QString entries = prettyGptEntries( m_partition );
if ( !entries.isEmpty() ) if ( !entries.isEmpty() )
{ {
return tr( "Creating new <strong>%1MiB</strong> partition on <strong>%3</strong> (%2) with entries " return tr( "Create new <strong>%1MiB</strong> partition on <strong>%3</strong> (%2) with entries "
"<em>%4</em>…", "@status" ) "<em>%4</em>",
"@info" )
.arg( Calamares::BytesToMiB( m_partition->capacity() ) ) .arg( Calamares::BytesToMiB( m_partition->capacity() ) )
.arg( m_device->name() ) .arg( m_device->name() )
.arg( m_device->deviceNode() ) .arg( m_device->deviceNode() )
@ -218,15 +219,16 @@ CreatePartitionJob::prettyDescription() const
} }
else else
{ {
return tr( "Creating new <strong>%1MiB</strong> partition on <strong>%3</strong> (%2)", "@status" ) return tr( "Create new <strong>%1MiB</strong> partition on <strong>%3</strong> (%2)", "@info" )
.arg( Calamares::BytesToMiB( m_partition->capacity() ) ) .arg( Calamares::BytesToMiB( m_partition->capacity() ) )
.arg( m_device->name() ) .arg( m_device->name() )
.arg( m_device->deviceNode() ); .arg( m_device->deviceNode() );
} }
} }
return tr( "Creating new <strong>%2MiB</strong> partition on <strong>%4</strong> " return tr( "Create new <strong>%2MiB</strong> partition on <strong>%4</strong> "
"(%3) with file system <strong>%1</strong>…", "@status" ) "(%3) with file system <strong>%1</strong>",
"@info" )
.arg( userVisibleFS( m_partition->fileSystem() ) ) .arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( Calamares::BytesToMiB( m_partition->capacity() ) ) .arg( Calamares::BytesToMiB( m_partition->capacity() ) )
.arg( m_device->name() ) .arg( m_device->name() )

View File

@ -176,7 +176,7 @@ FillGlobalStorageJob::FillGlobalStorageJob( const Config*, QList< Device* > devi
QString QString
FillGlobalStorageJob::prettyName() const FillGlobalStorageJob::prettyName() const
{ {
return tr( "Setting partition information", "@status" ); return tr( "Set partition information", "@title" );
} }
@ -205,15 +205,16 @@ FillGlobalStorageJob::prettyDescription() const
{ {
if ( !features.isEmpty() ) if ( !features.isEmpty() )
{ {
lines.append( tr( "Installing %1 on <strong>new</strong> %2 system partition " lines.append( tr( "Install %1 on <strong>new</strong> %2 system partition "
"with features <em>%3</em>…", "@status" ) "with features <em>%3</em>",
"@info" )
.arg( Calamares::Branding::instance()->shortProductName() ) .arg( Calamares::Branding::instance()->shortProductName() )
.arg( fsType ) .arg( fsType )
.arg( features ) ); .arg( features ) );
} }
else else
{ {
lines.append( tr( "Installing %1 on <strong>new</strong> %2 system partition", "@status" ) lines.append( tr( "Install %1 on <strong>new</strong> %2 system partition", "@info" )
.arg( Calamares::Branding::instance()->shortProductName() ) .arg( Calamares::Branding::instance()->shortProductName() )
.arg( fsType ) ); .arg( fsType ) );
} }
@ -222,16 +223,18 @@ FillGlobalStorageJob::prettyDescription() const
{ {
if ( !features.isEmpty() ) if ( !features.isEmpty() )
{ {
lines.append( tr( "Setting up <strong>new</strong> %2 partition with mount point " lines.append( tr( "Set up <strong>new</strong> %2 partition with mount point "
"<strong>%1</strong> and features <em>%3</em>…", "@status" ) "<strong>%1</strong> and features <em>%3</em>",
"@info" )
.arg( mountPoint ) .arg( mountPoint )
.arg( fsType ) .arg( fsType )
.arg( features ) ); .arg( features ) );
} }
else else
{ {
lines.append( tr( "Setting up <strong>new</strong> %2 partition with mount point " lines.append( tr( "Set up <strong>new</strong> %2 partition with mount point "
"<strong>%1</strong>%3…", "@status" ) "<strong>%1</strong>%3",
"@info" )
.arg( mountPoint ) .arg( mountPoint )
.arg( fsType ) .arg( fsType )
.arg( features ) ); .arg( features ) );
@ -244,8 +247,9 @@ FillGlobalStorageJob::prettyDescription() const
{ {
if ( !features.isEmpty() ) if ( !features.isEmpty() )
{ {
lines.append( tr( "Installing %2 on %3 system partition <strong>%1</strong>" lines.append( tr( "Install %2 on %3 system partition <strong>%1</strong>"
" with features <em>%4</em>…", "@status" ) " with features <em>%4</em>",
"@info" )
.arg( path ) .arg( path )
.arg( Calamares::Branding::instance()->shortProductName() ) .arg( Calamares::Branding::instance()->shortProductName() )
.arg( fsType ) .arg( fsType )
@ -253,7 +257,7 @@ FillGlobalStorageJob::prettyDescription() const
} }
else else
{ {
lines.append( tr( "Installing %2 on %3 system partition <strong>%1</strong>", "@status" ) lines.append( tr( "Install %2 on %3 system partition <strong>%1</strong>", "@info" )
.arg( path ) .arg( path )
.arg( Calamares::Branding::instance()->shortProductName() ) .arg( Calamares::Branding::instance()->shortProductName() )
.arg( fsType ) ); .arg( fsType ) );
@ -263,8 +267,9 @@ FillGlobalStorageJob::prettyDescription() const
{ {
if ( !features.isEmpty() ) if ( !features.isEmpty() )
{ {
lines.append( tr( "Setting up %3 partition <strong>%1</strong> with mount point " lines.append( tr( "Set up %3 partition <strong>%1</strong> with mount point "
"<strong>%2</strong> and features <em>%4</em>…", "@status" ) "<strong>%2</strong> and features <em>%4</em>",
"@info" )
.arg( path ) .arg( path )
.arg( mountPoint ) .arg( mountPoint )
.arg( fsType ) .arg( fsType )
@ -272,8 +277,9 @@ FillGlobalStorageJob::prettyDescription() const
} }
else else
{ {
lines.append( tr( "Setting up %3 partition <strong>%1</strong> with mount point " lines.append( tr( "Set up %3 partition <strong>%1</strong> with mount point "
"<strong>%2</strong>%4…", "@status" ) "<strong>%2</strong>%4…",
"@info" )
.arg( path ) .arg( path )
.arg( mountPoint ) .arg( mountPoint )
.arg( fsType ) .arg( fsType )
@ -287,7 +293,7 @@ FillGlobalStorageJob::prettyDescription() const
QVariant bootloaderMap = createBootLoaderMap(); QVariant bootloaderMap = createBootLoaderMap();
if ( !m_bootLoaderPath.isEmpty() ) if ( !m_bootLoaderPath.isEmpty() )
{ {
lines.append( tr( "Installing boot loader on <strong>%1</strong>…", "@status" ).arg( m_bootLoaderPath ) ); lines.append( tr( "Install boot loader on <strong>%1</strong>…", "@info" ).arg( m_bootLoaderPath ) );
} }
return lines.join( "<br/>" ); return lines.join( "<br/>" );
} }

View File

@ -36,7 +36,7 @@ FormatPartitionJob::FormatPartitionJob( Device* device, Partition* partition )
QString QString
FormatPartitionJob::prettyName() const FormatPartitionJob::prettyName() const
{ {
return tr( "Formatting partition %1 (file system: %2, size: %3 MiB) on %4", "@status" ) return tr( "Format partition %1 (file system: %2, size: %3 MiB) on %4", "@title" )
.arg( m_partition->partitionPath() ) .arg( m_partition->partitionPath() )
.arg( userVisibleFS( m_partition->fileSystem() ) ) .arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( m_partition->capacity() / 1024 / 1024 ) .arg( m_partition->capacity() / 1024 / 1024 )
@ -46,8 +46,9 @@ FormatPartitionJob::prettyName() const
QString QString
FormatPartitionJob::prettyDescription() const FormatPartitionJob::prettyDescription() const
{ {
return tr( "Formatting <strong>%3MiB</strong> partition <strong>%1</strong> with " return tr( "Format <strong>%3MiB</strong> partition <strong>%1</strong> with "
"file system <strong>%2</strong>…", "@status" ) "file system <strong>%2</strong>",
"@info" )
.arg( m_partition->partitionPath() ) .arg( m_partition->partitionPath() )
.arg( userVisibleFS( m_partition->fileSystem() ) ) .arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( m_partition->capacity() / 1024 / 1024 ); .arg( m_partition->capacity() / 1024 / 1024 );
@ -60,8 +61,7 @@ FormatPartitionJob::prettyStatusMessage() const
? m_partition->partitionPath() ? m_partition->partitionPath()
: tr( "%1 (%2)", "partition label %1 (device path %2)" ) : tr( "%1 (%2)", "partition label %1 (device path %2)" )
.arg( m_partition->label(), m_partition->partitionPath() ); .arg( m_partition->label(), m_partition->partitionPath() );
return tr( "Formatting partition %1 with " return tr( "Formatting partition %1 with file system %2…", "@status" )
"file system %2…", "@status" )
.arg( partitionLabel, userVisibleFS( m_partition->fileSystem() ) ); .arg( partitionLabel, userVisibleFS( m_partition->fileSystem() ) );
} }

View File

@ -36,16 +36,13 @@ ResizePartitionJob::ResizePartitionJob( Device* device, Partition* partition, qi
QString QString
ResizePartitionJob::prettyName() const ResizePartitionJob::prettyName() const
{ {
// FIXME: Copy PM ResizeOperation code which generates a description of the return tr( "Resize partition %1", "@title" ).arg( partition()->partitionPath() );
// operation
return tr( "Resizing partition %1…", "@status" ).arg( partition()->partitionPath() );
} }
QString QString
ResizePartitionJob::prettyDescription() const ResizePartitionJob::prettyDescription() const
{ {
return tr( "Resizing <strong>%2MiB</strong> partition <strong>%1</strong> to " return tr( "Resize <strong>%2MiB</strong> partition <strong>%1</strong> to <strong>%3MiB</strong>", "@info" )
"<strong>%3MiB</strong>…", "@status" )
.arg( partition()->partitionPath() ) .arg( partition()->partitionPath() )
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) ) .arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) ); .arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );
@ -54,8 +51,7 @@ ResizePartitionJob::prettyDescription() const
QString QString
ResizePartitionJob::prettyStatusMessage() const ResizePartitionJob::prettyStatusMessage() const
{ {
return tr( "Resizing %2MiB partition %1 to " return tr( "Resizing %2MiB partition %1 to %3MiB…", "@status" )
"%3MiB…", "@status" )
.arg( partition()->partitionPath() ) .arg( partition()->partitionPath() )
.arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) ) .arg( ( BytesToMiB( m_oldLastSector - m_oldFirstSector + 1 ) * partition()->sectorSize() ) )
.arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) ); .arg( ( BytesToMiB( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() ) );

View File

@ -25,7 +25,7 @@ ResizeVolumeGroupJob::ResizeVolumeGroupJob( Device*, LvmDevice* device, QVector<
QString QString
ResizeVolumeGroupJob::prettyName() const ResizeVolumeGroupJob::prettyName() const
{ {
return tr( "Resizing volume group named %1 from %2 to %3…", "@status" ) return tr( "Resize volume group named %1 from %2 to %3", "@title" )
.arg( m_device->name() ) .arg( m_device->name() )
.arg( currentPartitions() ) .arg( currentPartitions() )
.arg( targetPartitions() ); .arg( targetPartitions() );
@ -34,7 +34,8 @@ ResizeVolumeGroupJob::prettyName() const
QString QString
ResizeVolumeGroupJob::prettyDescription() const ResizeVolumeGroupJob::prettyDescription() const
{ {
return tr( "Resizing volume group named <strong>%1</strong> from <strong>%2</strong> to <strong>%3</strong>…", "@status" ) return tr( "Resize volume group named <strong>%1</strong> from <strong>%2</strong> to <strong>%3</strong>",
"@info" )
.arg( m_device->name() ) .arg( m_device->name() )
.arg( currentPartitions() ) .arg( currentPartitions() )
.arg( targetPartitions() ); .arg( targetPartitions() );