[partition] Chase Branding API change

This commit is contained in:
Adriaan de Groot 2020-05-04 12:48:11 +02:00
parent da82adeeee
commit c0a3614f09
4 changed files with 38 additions and 35 deletions

View File

@ -832,7 +832,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
if ( !homePartitionPath->isEmpty() )
m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )
.arg( *homePartitionPath )
.arg( *Calamares::Branding::ShortProductName ) );
.arg( Calamares::Branding::instance()->shortProductName() ) );
delete homePartitionPath;
if ( m_isEfi )
@ -975,7 +975,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
.arg( m_beforePartitionBarsView->selectionModel()->currentIndex().data().toString() )
.arg( CalamaresUtils::BytesToMiB( size ) )
.arg( CalamaresUtils::BytesToMiB( sizeNext ) )
.arg( *Calamares::Branding::ShortProductName ) );
.arg( Calamares::Branding::instance()->shortProductName() ) );
}
);
@ -1004,7 +1004,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
m_afterPartitionBarsView->setNestedPartitionsMode( mode );
m_afterPartitionLabelsView = new PartitionLabelsView( m_previewAfterFrame );
m_afterPartitionLabelsView->setExtendedPartitionHidden( mode == PartitionBarsView::NoNestedPartitions );
m_afterPartitionLabelsView->setCustomNewRootLabel( *Calamares::Branding::BootloaderEntryName );
m_afterPartitionLabelsView->setCustomNewRootLabel( Calamares::Branding::instance()->string(Calamares::Branding::BootloaderEntryName) );
PartitionModel* model = m_core->partitionModelForDevice( selectedDevice() );
@ -1135,7 +1135,7 @@ ChoicePage::setupEfiSystemPartitionSelector()
tr( "An EFI system partition cannot be found anywhere "
"on this system. Please go back and use manual "
"partitioning to set up %1." )
.arg( *Calamares::Branding::ShortProductName ) );
.arg( Calamares::Branding::instance()->shortProductName() ) );
updateNextEnabled();
}
else if ( efiSystemPartitions.count() == 1 ) //probably most usual situation
@ -1144,7 +1144,7 @@ ChoicePage::setupEfiSystemPartitionSelector()
tr( "The EFI system partition at %1 will be used for "
"starting %2." )
.arg( efiSystemPartitions.first()->partitionPath() )
.arg( *Calamares::Branding::ShortProductName ) );
.arg( Calamares::Branding::instance()->shortProductName() ) );
}
else
{
@ -1278,11 +1278,11 @@ ChoicePage::setupActions()
m_alongsideButton->setText( tr( "<strong>Install alongside</strong><br/>"
"The installer will shrink a partition to make room for %1." )
.arg( *Calamares::Branding::ShortVersionedName ) );
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
m_replaceButton->setText( tr( "<strong>Replace a partition</strong><br/>"
"Replaces a partition with %1." )
.arg( *Calamares::Branding::ShortVersionedName ) );
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
)
m_replaceButton->hide();
@ -1308,7 +1308,7 @@ ChoicePage::setupActions()
m_alongsideButton->setText( tr( "<strong>Install alongside</strong><br/>"
"The installer will shrink a partition to make room for %1." )
.arg( *Calamares::Branding::ShortVersionedName ) );
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
m_eraseButton->setText( tr( "<strong>Erase disk</strong><br/>"
"This will <font color=\"red\">delete</font> all data "
@ -1317,7 +1317,7 @@ ChoicePage::setupActions()
m_replaceButton->setText( tr( "<strong>Replace a partition</strong><br/>"
"Replaces a partition with %1." )
.arg( *Calamares::Branding::ShortVersionedName ) );
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
)
}
else
@ -1331,7 +1331,7 @@ ChoicePage::setupActions()
m_alongsideButton->setText( tr( "<strong>Install alongside</strong><br/>"
"The installer will shrink a partition to make room for %1." )
.arg( *Calamares::Branding::ShortVersionedName ) );
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
m_eraseButton->setText( tr( "<strong>Erase disk</strong><br/>"
"This will <font color=\"red\">delete</font> all data "
@ -1339,7 +1339,7 @@ ChoicePage::setupActions()
m_replaceButton->setText( tr( "<strong>Replace a partition</strong><br/>"
"Replaces a partition with %1." )
.arg( *Calamares::Branding::ShortVersionedName ) );
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
)
}
}
@ -1357,7 +1357,7 @@ ChoicePage::setupActions()
m_alongsideButton->setText( tr( "<strong>Install alongside</strong><br/>"
"The installer will shrink a partition to make room for %1." )
.arg( *Calamares::Branding::ShortVersionedName ) );
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
m_eraseButton->setText( tr( "<strong>Erase disk</strong><br/>"
"This will <font color=\"red\">delete</font> all data "
@ -1365,7 +1365,7 @@ ChoicePage::setupActions()
m_replaceButton->setText( tr( "<strong>Replace a partition</strong><br/>"
"Replaces a partition with %1." )
.arg( *Calamares::Branding::ShortVersionedName ) );
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
)
}

View File

@ -154,6 +154,7 @@ PartitionViewStep::createSummaryWidget() const
formLayout->setContentsMargins( MARGIN, 0, MARGIN, MARGIN );
mainLayout->addLayout( formLayout );
const auto* branding = Calamares::Branding::instance();
QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo();
if ( list.length() > 1 ) // There are changes on more than one disk
{
@ -166,15 +167,15 @@ PartitionViewStep::createSummaryWidget() const
{
case ChoicePage::Alongside:
modeText = tr( "Install %1 <strong>alongside</strong> another operating system." )
.arg( *Calamares::Branding::ShortVersionedName );
.arg( branding->shortVersionedName() );
break;
case ChoicePage::Erase:
modeText
= tr( "<strong>Erase</strong> disk and install %1." ).arg( *Calamares::Branding::ShortVersionedName );
= tr( "<strong>Erase</strong> disk and install %1." ).arg( branding->shortVersionedName() );
break;
case ChoicePage::Replace:
modeText
= tr( "<strong>Replace</strong> a partition with %1." ).arg( *Calamares::Branding::ShortVersionedName );
= tr( "<strong>Replace</strong> a partition with %1." ).arg( branding->shortVersionedName() );
break;
case ChoicePage::NoChoice:
case ChoicePage::Manual:
@ -193,19 +194,19 @@ PartitionViewStep::createSummaryWidget() const
case ChoicePage::Alongside:
modeText = tr( "Install %1 <strong>alongside</strong> another operating system on disk "
"<strong>%2</strong> (%3)." )
.arg( *Calamares::Branding::ShortVersionedName )
.arg( branding->shortVersionedName() )
.arg( info.deviceNode )
.arg( info.deviceName );
break;
case ChoicePage::Erase:
modeText = tr( "<strong>Erase</strong> disk <strong>%2</strong> (%3) and install %1." )
.arg( *Calamares::Branding::ShortVersionedName )
.arg( branding->shortVersionedName() )
.arg( info.deviceNode )
.arg( info.deviceName );
break;
case ChoicePage::Replace:
modeText = tr( "<strong>Replace</strong> a partition on disk <strong>%2</strong> (%3) with %1." )
.arg( *Calamares::Branding::ShortVersionedName )
.arg( branding->shortVersionedName() )
.arg( info.deviceNode )
.arg( info.deviceName );
break;
@ -256,7 +257,7 @@ PartitionViewStep::createSummaryWidget() const
previewLabels->setModel( info.partitionModelAfter );
preview->setSelectionMode( QAbstractItemView::NoSelection );
previewLabels->setSelectionMode( QAbstractItemView::NoSelection );
previewLabels->setCustomNewRootLabel( *Calamares::Branding::BootloaderEntryName );
previewLabels->setCustomNewRootLabel( Calamares::Branding::instance()->string( Calamares::Branding::BootloaderEntryName ));
info.partitionModelAfter->setParent( widget );
field = new QVBoxLayout;
CalamaresUtils::unmarginLayout( field );
@ -411,6 +412,7 @@ PartitionViewStep::onLeave()
return;
}
const auto* branding = Calamares::Branding::instance();
if ( m_widget->currentWidget() == m_manualPartitionPage )
{
if ( PartUtils::isEfiSystem() )
@ -438,7 +440,7 @@ PartitionViewStep::onLeave()
"<strong>%2</strong>.<br/><br/>"
"You can continue without setting up an EFI system "
"partition but your system may fail to start." )
.arg( *Calamares::Branding::ShortProductName )
.arg( branding->shortProductName() )
.arg( espMountPoint, espFlagName );
}
else if ( esp && !PartUtils::isEfiBootable( esp ) )
@ -453,7 +455,7 @@ PartitionViewStep::onLeave()
"<br/><br/>"
"You can continue without setting the flag but your "
"system may fail to start." )
.arg( *Calamares::Branding::ShortProductName )
.arg( branding->shortProductName() )
.arg( espMountPoint, espFlagName );
}
@ -482,7 +484,7 @@ PartitionViewStep::onLeave()
"<strong>bios_grub</strong> flag enabled.<br/><br/>"
"An unformatted 8 MB partition is necessary "
"to start %1 on a BIOS system with GPT." )
.arg( *Calamares::Branding::ShortProductName );
.arg( branding->shortProductName() );
QMessageBox::information( m_manualPartitionPage, message, description );
}

View File

@ -133,13 +133,14 @@ ReplaceWidget::onPartitionSelected()
if ( Calamares::JobQueue::instance()->globalStorage()->value( "firmwareType" ) == "efi" )
m_isEfi = true;
const auto* branding = Calamares::Branding::instance();
if ( m_ui->partitionTreeView->currentIndex() == QModelIndex() )
{
updateStatus( CalamaresUtils::PartitionPartition,
tr( "Select where to install %1.<br/>"
"<font color=\"red\">Warning: </font>this will delete all files "
"on the selected partition." )
.arg( *Calamares::Branding::VersionedName ) );
.arg( branding->versionedName() ) );
setNextEnabled( false );
return;
}
@ -172,7 +173,7 @@ ReplaceWidget::onPartitionSelected()
updateStatus( CalamaresUtils::Fail,
tr( "%1 cannot be installed on empty space. Please select an "
"existing partition." )
.arg( *Calamares::Branding::VersionedName ) );
.arg( branding->versionedName() ) );
setNextEnabled( false );
return;
}
@ -182,7 +183,7 @@ ReplaceWidget::onPartitionSelected()
updateStatus( CalamaresUtils::Fail,
tr( "%1 cannot be installed on an extended partition. Please select an "
"existing primary or logical partition." )
.arg( *Calamares::Branding::VersionedName ) );
.arg( branding->versionedName() ) );
setNextEnabled( false );
return;
}
@ -191,7 +192,7 @@ ReplaceWidget::onPartitionSelected()
{
updateStatus( CalamaresUtils::Fail,
tr( "%1 cannot be installed on this partition." )
.arg( *Calamares::Branding::VersionedName ) );
.arg( branding->versionedName() ) );
setNextEnabled( false );
return;
}
@ -233,7 +234,7 @@ ReplaceWidget::onPartitionSelected()
"The partition %1 is too small for %2. Please select a partition "
"with capacity at least %3 GiB." )
.arg( partition->partitionPath() )
.arg( *Calamares::Branding::VersionedName )
.arg( branding->versionedName() )
.arg( requiredSpaceB / ( 1024. * 1024. * 1024. ),
0, 'f', 1 )
.arg( prettyName ) );
@ -256,7 +257,7 @@ ReplaceWidget::onPartitionSelected()
"An EFI system partition cannot be found anywhere "
"on this system. Please go back and use manual "
"partitioning to set up %1." )
.arg( *Calamares::Branding::ShortProductName )
.arg( branding->shortProductName() )
.arg( prettyName ) );
setNextEnabled( false );
}
@ -267,14 +268,14 @@ ReplaceWidget::onPartitionSelected()
"%1 will be installed on %2.<br/>"
"<font color=\"red\">Warning: </font>all data on partition "
"%2 will be lost.")
.arg( *Calamares::Branding::VersionedName )
.arg( branding->versionedName() )
.arg( partition->partitionPath() )
.arg( prettyName ) );
m_ui->bootStatusLabel->show();
m_ui->bootStatusLabel->setText(
tr( "The EFI system partition at %1 will be used for starting %2." )
.arg( efiSystemPartitions.first()->partitionPath() )
.arg( *Calamares::Branding::ShortProductName ) );
.arg( branding->shortProductName() ) );
setNextEnabled( true );
}
else
@ -284,7 +285,7 @@ ReplaceWidget::onPartitionSelected()
"%1 will be installed on %2.<br/>"
"<font color=\"red\">Warning: </font>all data on partition "
"%2 will be lost.")
.arg( *Calamares::Branding::VersionedName )
.arg( branding->versionedName() )
.arg( partition->partitionPath() )
.arg( prettyName ) );
m_ui->bootStatusLabel->show();
@ -308,7 +309,7 @@ ReplaceWidget::onPartitionSelected()
"%1 will be installed on %2.<br/>"
"<font color=\"red\">Warning: </font>all data on partition "
"%2 will be lost.")
.arg( *Calamares::Branding::VersionedName )
.arg( branding->versionedName() )
.arg( partition->partitionPath() )
.arg( prettyName ) );
setNextEnabled( true );

View File

@ -163,7 +163,7 @@ FillGlobalStorageJob::prettyDescription() const
if ( mountPoint == "/" )
{
lines.append( tr( "Install %1 on <strong>new</strong> %2 system partition." )
.arg( *Calamares::Branding::ShortProductName )
.arg( Calamares::Branding::instance()->shortProductName() )
.arg( fsType ) );
}
else
@ -180,7 +180,7 @@ FillGlobalStorageJob::prettyDescription() const
{
lines.append( tr( "Install %2 on %3 system partition <strong>%1</strong>." )
.arg( path )
.arg( *Calamares::Branding::ShortProductName )
.arg( Calamares::Branding::instance()->shortProductName() )
.arg( fsType ) );
}
else