[partition] Chase Branding API change

main
Adriaan de Groot 6 years ago
parent da82adeeee
commit c0a3614f09

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

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

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

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

Loading…
Cancel
Save