[partition] Drop InstallChoice enum from Page
- The enum for install choice was copied into PartitionActions and used in the Config object; its definition does not belong in the UI. - Chase the renamings required.
This commit is contained in:
parent
e21a2f0676
commit
41ce42cd4b
@ -80,7 +80,7 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent )
|
||||
, m_config( config )
|
||||
, m_nextEnabled( false )
|
||||
, m_core( nullptr )
|
||||
, m_choice( NoChoice )
|
||||
, m_choice( InstallChoice::NoChoice )
|
||||
, m_isEfi( false )
|
||||
, m_grp( nullptr )
|
||||
, m_alongsideButton( nullptr )
|
||||
@ -242,14 +242,14 @@ ChoicePage::setupChoices()
|
||||
m_alongsideButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionAlongside,
|
||||
CalamaresUtils::Original,
|
||||
iconSize ) );
|
||||
m_alongsideButton->addToGroup( m_grp, Alongside );
|
||||
m_alongsideButton->addToGroup( m_grp, InstallChoice::Alongside );
|
||||
|
||||
m_eraseButton = new PrettyRadioButton;
|
||||
m_eraseButton->setIconSize( iconSize );
|
||||
m_eraseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionEraseAuto,
|
||||
CalamaresUtils::Original,
|
||||
iconSize ) );
|
||||
m_eraseButton->addToGroup( m_grp, Erase );
|
||||
m_eraseButton->addToGroup( m_grp, InstallChoice::Erase );
|
||||
|
||||
m_replaceButton = new PrettyRadioButton;
|
||||
|
||||
@ -257,7 +257,7 @@ ChoicePage::setupChoices()
|
||||
m_replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs,
|
||||
CalamaresUtils::Original,
|
||||
iconSize ) );
|
||||
m_replaceButton->addToGroup( m_grp, Replace );
|
||||
m_replaceButton->addToGroup( m_grp, InstallChoice::Replace );
|
||||
|
||||
// Fill up swap options
|
||||
// .. TODO: only if enabled in the config
|
||||
@ -277,7 +277,7 @@ ChoicePage::setupChoices()
|
||||
CalamaresUtils::Original,
|
||||
iconSize ) );
|
||||
m_itemsLayout->addWidget( m_somethingElseButton );
|
||||
m_somethingElseButton->addToGroup( m_grp, Manual );
|
||||
m_somethingElseButton->addToGroup( m_grp, InstallChoice::Manual );
|
||||
|
||||
m_itemsLayout->addStretch();
|
||||
|
||||
@ -295,7 +295,7 @@ ChoicePage::setupChoices()
|
||||
{
|
||||
if ( m_grp->checkedButton() == nullptr ) // If no other action is chosen, we must
|
||||
{ // set m_choice to NoChoice and reset previews.
|
||||
m_choice = NoChoice;
|
||||
m_choice = InstallChoice::NoChoice;
|
||||
updateNextEnabled();
|
||||
|
||||
emit actionChosen();
|
||||
@ -441,7 +441,7 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
||||
|
||||
switch ( choice )
|
||||
{
|
||||
case Erase:
|
||||
case InstallChoice::Erase:
|
||||
{
|
||||
auto gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
|
||||
@ -474,7 +474,7 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Replace:
|
||||
case InstallChoice::Replace:
|
||||
if ( m_core->isDirty() )
|
||||
{
|
||||
ScanningDialog::run( QtConcurrent::run( [ = ]
|
||||
@ -492,7 +492,7 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
||||
Qt::UniqueConnection );
|
||||
break;
|
||||
|
||||
case Alongside:
|
||||
case InstallChoice::Alongside:
|
||||
if ( m_core->isDirty() )
|
||||
{
|
||||
ScanningDialog::run( QtConcurrent::run( [ = ]
|
||||
@ -515,8 +515,8 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
||||
this, SLOT( doAlongsideSetupSplitter( QModelIndex, QModelIndex ) ),
|
||||
Qt::UniqueConnection );
|
||||
break;
|
||||
case NoChoice:
|
||||
case Manual:
|
||||
case InstallChoice::NoChoice:
|
||||
case InstallChoice::Manual:
|
||||
break;
|
||||
}
|
||||
updateActionChoicePreview( choice );
|
||||
@ -571,13 +571,13 @@ void
|
||||
ChoicePage::onEncryptWidgetStateChanged()
|
||||
{
|
||||
EncryptWidget::Encryption state = m_encryptWidget->state();
|
||||
if ( m_choice == Erase )
|
||||
if ( m_choice == InstallChoice::Erase )
|
||||
{
|
||||
if ( state == EncryptWidget::Encryption::Confirmed ||
|
||||
state == EncryptWidget::Encryption::Disabled )
|
||||
applyActionChoice( m_choice );
|
||||
}
|
||||
else if ( m_choice == Replace )
|
||||
else if ( m_choice == InstallChoice::Replace )
|
||||
{
|
||||
if ( m_beforePartitionBarsView &&
|
||||
m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() &&
|
||||
@ -596,7 +596,7 @@ ChoicePage::onEncryptWidgetStateChanged()
|
||||
void
|
||||
ChoicePage::onHomeCheckBoxStateChanged()
|
||||
{
|
||||
if ( currentChoice() == Replace &&
|
||||
if ( currentChoice() == InstallChoice::Replace &&
|
||||
m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() )
|
||||
{
|
||||
doReplaceSelectedPartition( m_beforePartitionBarsView->
|
||||
@ -609,10 +609,10 @@ ChoicePage::onHomeCheckBoxStateChanged()
|
||||
void
|
||||
ChoicePage::onLeave()
|
||||
{
|
||||
if ( m_choice == Alongside )
|
||||
if ( m_choice == InstallChoice::Alongside )
|
||||
doAlongsideApply();
|
||||
|
||||
if ( m_isEfi && ( m_choice == Alongside || m_choice == Replace ) )
|
||||
if ( m_isEfi && ( m_choice == InstallChoice::Alongside || m_choice == InstallChoice::Replace ) )
|
||||
{
|
||||
QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions();
|
||||
if ( efiSystemPartitions.count() == 1 )
|
||||
@ -879,8 +879,8 @@ ChoicePage::updateDeviceStatePreview()
|
||||
|
||||
switch ( m_choice )
|
||||
{
|
||||
case Replace:
|
||||
case Alongside:
|
||||
case InstallChoice::Replace:
|
||||
case InstallChoice::Alongside:
|
||||
m_beforePartitionBarsView->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
m_beforePartitionLabelsView->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
break;
|
||||
@ -931,7 +931,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
||||
|
||||
switch ( choice )
|
||||
{
|
||||
case Alongside:
|
||||
case InstallChoice::Alongside:
|
||||
{
|
||||
if ( m_enableEncryptionWidget )
|
||||
m_encryptWidget->show();
|
||||
@ -975,8 +975,8 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
||||
|
||||
break;
|
||||
}
|
||||
case Erase:
|
||||
case Replace:
|
||||
case InstallChoice::Erase:
|
||||
case InstallChoice::Replace:
|
||||
{
|
||||
if ( m_enableEncryptionWidget )
|
||||
m_encryptWidget->show();
|
||||
@ -1042,7 +1042,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
||||
m_previewAfterFrame->show();
|
||||
m_previewAfterLabel->show();
|
||||
|
||||
if ( m_choice == Erase )
|
||||
if ( m_choice == InstallChoice::Erase )
|
||||
m_selectLabel->hide();
|
||||
else
|
||||
{
|
||||
@ -1062,8 +1062,8 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
||||
|
||||
break;
|
||||
}
|
||||
case NoChoice:
|
||||
case Manual:
|
||||
case InstallChoice::NoChoice:
|
||||
case InstallChoice::Manual:
|
||||
m_selectLabel->hide();
|
||||
m_previewAfterFrame->hide();
|
||||
m_previewBeforeLabel->setText( tr( "Current:" ) );
|
||||
@ -1072,7 +1072,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( m_isEfi && ( m_choice == Alongside || m_choice == Replace ) )
|
||||
if ( m_isEfi && ( m_choice == InstallChoice::Alongside || m_choice == InstallChoice::Replace ) )
|
||||
{
|
||||
QHBoxLayout* efiLayout = new QHBoxLayout;
|
||||
layout->addLayout( efiLayout );
|
||||
@ -1089,8 +1089,8 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
||||
QAbstractItemView::SelectionMode previewSelectionMode;
|
||||
switch ( m_choice )
|
||||
{
|
||||
case Replace:
|
||||
case Alongside:
|
||||
case InstallChoice::Replace:
|
||||
case InstallChoice::Alongside:
|
||||
previewSelectionMode = QAbstractItemView::SingleSelection;
|
||||
break;
|
||||
default:
|
||||
@ -1433,11 +1433,11 @@ ChoicePage::calculateNextEnabled() const
|
||||
|
||||
switch ( m_choice )
|
||||
{
|
||||
case NoChoice:
|
||||
case InstallChoice::NoChoice:
|
||||
cDebug() << "No partitioning choice";
|
||||
return false;
|
||||
case Replace:
|
||||
case Alongside:
|
||||
case InstallChoice::Replace:
|
||||
case InstallChoice::Alongside:
|
||||
if ( !( sm_p && sm_p->currentIndex().isValid() ) )
|
||||
{
|
||||
cDebug() << "No partition selected";
|
||||
@ -1445,8 +1445,8 @@ ChoicePage::calculateNextEnabled() const
|
||||
}
|
||||
enabled = true;
|
||||
break;
|
||||
case Erase:
|
||||
case Manual:
|
||||
case InstallChoice::Erase:
|
||||
case InstallChoice::Manual:
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
@ -1457,7 +1457,7 @@ ChoicePage::calculateNextEnabled() const
|
||||
}
|
||||
|
||||
|
||||
if ( m_isEfi && ( m_choice == Alongside || m_choice == Replace ) )
|
||||
if ( m_isEfi && ( m_choice == InstallChoice::Alongside || m_choice == InstallChoice::Replace ) )
|
||||
{
|
||||
if ( m_core->efiSystemPartitions().count() == 0 )
|
||||
{
|
||||
@ -1466,7 +1466,7 @@ ChoicePage::calculateNextEnabled() const
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_choice != Manual && m_encryptWidget->isVisible() )
|
||||
if ( m_choice != InstallChoice::Manual && m_encryptWidget->isVisible() )
|
||||
{
|
||||
switch ( m_encryptWidget->state() )
|
||||
{
|
||||
|
@ -62,14 +62,7 @@ class ChoicePage : public QWidget, private Ui::ChoicePage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum InstallChoice
|
||||
{
|
||||
NoChoice,
|
||||
Alongside,
|
||||
Erase,
|
||||
Replace,
|
||||
Manual
|
||||
};
|
||||
using InstallChoice = PartitionActions::Choices::InstallChoice;
|
||||
|
||||
explicit ChoicePage( Config* config, QWidget* parent = nullptr );
|
||||
virtual ~ChoicePage();
|
||||
|
@ -167,20 +167,20 @@ PartitionViewStep::createSummaryWidget() const
|
||||
QString modeText;
|
||||
switch ( choice )
|
||||
{
|
||||
case ChoicePage::Alongside:
|
||||
case ChoicePage::InstallChoice::Alongside:
|
||||
modeText = tr( "Install %1 <strong>alongside</strong> another operating system." )
|
||||
.arg( branding->shortVersionedName() );
|
||||
break;
|
||||
case ChoicePage::Erase:
|
||||
case ChoicePage::InstallChoice::Erase:
|
||||
modeText
|
||||
= tr( "<strong>Erase</strong> disk and install %1." ).arg( branding->shortVersionedName() );
|
||||
break;
|
||||
case ChoicePage::Replace:
|
||||
case ChoicePage::InstallChoice::Replace:
|
||||
modeText
|
||||
= tr( "<strong>Replace</strong> a partition with %1." ).arg( branding->shortVersionedName() );
|
||||
break;
|
||||
case ChoicePage::NoChoice:
|
||||
case ChoicePage::Manual:
|
||||
case ChoicePage::InstallChoice::NoChoice:
|
||||
case ChoicePage::InstallChoice::Manual:
|
||||
modeText = tr( "<strong>Manual</strong> partitioning." );
|
||||
}
|
||||
modeLabel->setText( modeText );
|
||||
@ -193,27 +193,27 @@ PartitionViewStep::createSummaryWidget() const
|
||||
QString modeText;
|
||||
switch ( choice )
|
||||
{
|
||||
case ChoicePage::Alongside:
|
||||
case ChoicePage::InstallChoice::Alongside:
|
||||
modeText = tr( "Install %1 <strong>alongside</strong> another operating system on disk "
|
||||
"<strong>%2</strong> (%3)." )
|
||||
.arg( branding->shortVersionedName() )
|
||||
.arg( info.deviceNode )
|
||||
.arg( info.deviceName );
|
||||
break;
|
||||
case ChoicePage::Erase:
|
||||
case ChoicePage::InstallChoice::Erase:
|
||||
modeText = tr( "<strong>Erase</strong> disk <strong>%2</strong> (%3) and install %1." )
|
||||
.arg( branding->shortVersionedName() )
|
||||
.arg( info.deviceNode )
|
||||
.arg( info.deviceName );
|
||||
break;
|
||||
case ChoicePage::Replace:
|
||||
case ChoicePage::InstallChoice::Replace:
|
||||
modeText = tr( "<strong>Replace</strong> a partition on disk <strong>%2</strong> (%3) with %1." )
|
||||
.arg( branding->shortVersionedName() )
|
||||
.arg( info.deviceNode )
|
||||
.arg( info.deviceName );
|
||||
break;
|
||||
case ChoicePage::NoChoice:
|
||||
case ChoicePage::Manual:
|
||||
case ChoicePage::InstallChoice::NoChoice:
|
||||
case ChoicePage::InstallChoice::Manual:
|
||||
modeText = tr( "<strong>Manual</strong> partitioning on disk <strong>%1</strong> (%2)." )
|
||||
.arg( info.deviceNode )
|
||||
.arg( info.deviceName );
|
||||
@ -296,7 +296,7 @@ PartitionViewStep::next()
|
||||
{
|
||||
if ( m_choicePage == m_widget->currentWidget() )
|
||||
{
|
||||
if ( m_choicePage->currentChoice() == ChoicePage::Manual )
|
||||
if ( m_choicePage->currentChoice() == ChoicePage::InstallChoice::Manual )
|
||||
{
|
||||
if ( !m_manualPartitionPage )
|
||||
{
|
||||
@ -378,8 +378,8 @@ PartitionViewStep::isAtEnd() const
|
||||
{
|
||||
if ( m_widget->currentWidget() == m_choicePage )
|
||||
{
|
||||
if ( m_choicePage->currentChoice() == ChoicePage::Erase || m_choicePage->currentChoice() == ChoicePage::Replace
|
||||
|| m_choicePage->currentChoice() == ChoicePage::Alongside )
|
||||
if ( m_choicePage->currentChoice() == ChoicePage::InstallChoice::Erase || m_choicePage->currentChoice() == ChoicePage::InstallChoice::Replace
|
||||
|| m_choicePage->currentChoice() == ChoicePage::InstallChoice::Alongside )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -395,9 +395,9 @@ PartitionViewStep::onActivate()
|
||||
m_config->updateGlobalStorage();
|
||||
|
||||
// if we're coming back to PVS from the next VS
|
||||
if ( m_widget->currentWidget() == m_choicePage && m_choicePage->currentChoice() == ChoicePage::Alongside )
|
||||
if ( m_widget->currentWidget() == m_choicePage && m_choicePage->currentChoice() == ChoicePage::InstallChoice::Alongside )
|
||||
{
|
||||
m_choicePage->applyActionChoice( ChoicePage::Alongside );
|
||||
m_choicePage->applyActionChoice( ChoicePage::InstallChoice::Alongside );
|
||||
// m_choicePage->reset();
|
||||
//FIXME: ReplaceWidget should be reset maybe?
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user