[partition] set the right buttons if an action is pre-selected
This commit is contained in:
parent
b518ef7dfe
commit
a92cb32cef
@ -83,7 +83,6 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent )
|
||||
, m_beforePartitionBarsView( nullptr )
|
||||
, m_beforePartitionLabelsView( nullptr )
|
||||
, m_bootloaderComboBox( nullptr )
|
||||
, m_lastSelectedDeviceIndex( -1 )
|
||||
, m_enableEncryptionWidget( true )
|
||||
, m_availableSwapChoices( config->swapChoices() )
|
||||
, m_eraseSwapChoice( config->initialSwapChoice() )
|
||||
@ -339,6 +338,38 @@ ChoicePage::hideButtons()
|
||||
m_somethingElseButton->hide();
|
||||
}
|
||||
|
||||
void
|
||||
ChoicePage::checkInstallChoiceRadioButton( InstallChoice c )
|
||||
{
|
||||
QSignalBlocker b( m_grp );
|
||||
PrettyRadioButton* button = nullptr;
|
||||
switch ( c )
|
||||
{
|
||||
case InstallChoice::Alongside:
|
||||
button = m_alongsideButton;
|
||||
break;
|
||||
case InstallChoice::Replace:
|
||||
button = m_replaceButton;
|
||||
break;
|
||||
case InstallChoice::Erase:
|
||||
button = m_eraseButton;
|
||||
break;
|
||||
case InstallChoice::Manual:
|
||||
button = m_somethingElseButton;
|
||||
break;
|
||||
case InstallChoice::NoChoice:
|
||||
// Nothing
|
||||
;
|
||||
}
|
||||
|
||||
m_grp->setExclusive( false );
|
||||
m_eraseButton->setChecked( button == m_eraseButton );
|
||||
m_replaceButton->setChecked( button == m_replaceButton );
|
||||
m_alongsideButton->setChecked( button == m_alongsideButton );
|
||||
m_somethingElseButton->setChecked( button == m_somethingElseButton );
|
||||
m_grp->setExclusive( true );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief ChoicePage::applyDeviceChoice handler for the selected event of the device
|
||||
@ -392,7 +423,14 @@ ChoicePage::continueApplyDeviceChoice()
|
||||
// Preview setup done. Now we show/hide choices as needed.
|
||||
setupActions();
|
||||
|
||||
cDebug() << "Previous device" << m_lastSelectedDeviceIndex << "new device" << m_drivesCombo->currentIndex();
|
||||
if ( m_lastSelectedDeviceIndex != m_drivesCombo->currentIndex() )
|
||||
{
|
||||
m_lastSelectedDeviceIndex = m_drivesCombo->currentIndex();
|
||||
m_lastSelectedActionIndex = -1;
|
||||
m_choice = m_config->initialInstallChoice();
|
||||
checkInstallChoiceRadioButton( m_choice );
|
||||
}
|
||||
|
||||
emit actionChosen();
|
||||
emit deviceChosen();
|
||||
@ -423,6 +461,8 @@ ChoicePage::onEraseSwapChoiceChanged()
|
||||
void
|
||||
ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
||||
{
|
||||
cDebug() << "Prev" << m_lastSelectedActionIndex << "InstallChoice" << choice
|
||||
<< PartitionActions::Choices::installChoiceNames().find( choice );
|
||||
m_beforePartitionBarsView->selectionModel()->disconnect( SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ) );
|
||||
m_beforePartitionBarsView->selectionModel()->clearSelection();
|
||||
m_beforePartitionBarsView->selectionModel()->clearCurrentIndex();
|
||||
|
@ -114,6 +114,7 @@ private:
|
||||
bool calculateNextEnabled() const;
|
||||
void updateNextEnabled();
|
||||
void setupChoices();
|
||||
void checkInstallChoiceRadioButton( ChoicePage::InstallChoice choice ); ///< Sets the chosen button to "on"
|
||||
QComboBox* createBootloaderComboBox( QWidget* parentButton );
|
||||
Device* selectedDevice();
|
||||
|
||||
@ -161,7 +162,8 @@ private:
|
||||
QPointer< QLabel > m_efiLabel;
|
||||
QPointer< QComboBox > m_efiComboBox;
|
||||
|
||||
int m_lastSelectedDeviceIndex;
|
||||
int m_lastSelectedDeviceIndex = -1;
|
||||
int m_lastSelectedActionIndex = -1;
|
||||
|
||||
QString m_defaultFsType;
|
||||
bool m_enableEncryptionWidget;
|
||||
|
Loading…
Reference in New Issue
Block a user