From d894638f2f96d1140f192e7ced1fb3dc8dff89eb Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 15 Apr 2015 15:36:49 +0200 Subject: [PATCH] Add information about the partitioning action in the Summary page. --- .../partition/gui/PartitionViewStep.cpp | 76 ++++++++++++++++++- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index d1f1f986b..4df684256 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -41,6 +41,7 @@ #include "GlobalStorage.h" #include "JobQueue.h" #include "Job.h" +#include "Branding.h" // Qt #include @@ -176,17 +177,86 @@ PartitionViewStep::createSummaryWidget() const QVBoxLayout* mainLayout = new QVBoxLayout; widget->setLayout( mainLayout ); mainLayout->setMargin( 0 ); + + ChoicePage::Choice choice = m_choicePage->currentChoice(); + QFormLayout* formLayout = new QFormLayout( widget ); const int MARGIN = CalamaresUtils::defaultFontHeight() / 2; formLayout->setContentsMargins( MARGIN, 0, MARGIN, MARGIN ); mainLayout->addLayout( formLayout ); QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo(); + if ( list.length() > 1 ) // There are changes on more than one disk + { + //NOTE: all of this should only happen when Manual partitioning is active. + // Any other choice should result in a list.length() == 1. + QLabel* modeLabel = new QLabel; + formLayout->addRow( modeLabel ); + QString modeText; + switch ( choice ) + { + case ChoicePage::Alongside: + modeText = tr( "Install %1 alongside another operating system." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ShortVersionedName ) ); + break; + case ChoicePage::Erase: + modeText = tr( "Erase disk and install %1." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ShortVersionedName ) ); + break; + case ChoicePage::Replace: + modeText = tr( "Replace a partition with %1." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ShortVersionedName ) ); + break; + default: + modeText = tr( "Manual partitioning." ); + } + modeLabel->setText( modeText ); + } for ( const auto& info : list ) { - QLabel* diskInfoLabel = new QLabel( tr( "Disk %1 (%2)" ) - .arg( info.deviceNode ) - .arg( info.deviceName ) ); + QLabel* diskInfoLabel = new QLabel; + if ( list.length() == 1 ) // this is the only disk preview + { + QString modeText; + switch ( choice ) + { + case ChoicePage::Alongside: + modeText = tr( "Install %1 alongside another operating system on disk %2 (%3)." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ShortVersionedName ) ) + .arg( info.deviceNode ) + .arg( info.deviceName ); + break; + case ChoicePage::Erase: + modeText = tr( "Erase disk %2 (%3) and install %1." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ShortVersionedName ) ) + .arg( info.deviceNode ) + .arg( info.deviceName ); + break; + case ChoicePage::Replace: + modeText = tr( "Replace a partition on disk %2 (%3) with %1." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ShortVersionedName ) ) + .arg( info.deviceNode ) + .arg( info.deviceName ); + break; + default: + modeText = tr( "Manual partitioning on disk %1 (%2)." ) + .arg( info.deviceNode ) + .arg( info.deviceName ); + } + diskInfoLabel->setText( modeText ); + } + else // multiple disk previews! + { + diskInfoLabel->setText( tr( "Disk %1 (%2)" ) + .arg( info.deviceNode ) + .arg( info.deviceName ) ); + } formLayout->addRow( diskInfoLabel ); PartitionPreview* preview;