mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 01:15:38 -04:00
[partition] Only create drop-down if there is something to select
- Swap choices may be 0 (then choose none), 1 (choose that one) or more (currently undecided)
This commit is contained in:
parent
00df8a9fb1
commit
4973d00ace
2 changed files with 19 additions and 6 deletions
|
@ -65,6 +65,14 @@
|
|||
|
||||
using PartitionActions::Choices::SwapChoice;
|
||||
|
||||
SwapChoice pickOne( const SwapChoiceSet& s )
|
||||
{
|
||||
if ( s.count() == 1 )
|
||||
for ( auto i = s.begin(); i != s.end(); ++i )
|
||||
return *i; // That's the only element
|
||||
return SwapChoice::NoSwap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ChoicePage::ChoicePage is the default constructor. Called on startup as part of
|
||||
* the module loading code path.
|
||||
|
@ -90,7 +98,8 @@ ChoicePage::ChoicePage( const SwapChoiceSet& swapChoices, QWidget* parent )
|
|||
, m_bootloaderComboBox( nullptr )
|
||||
, m_lastSelectedDeviceIndex( -1 )
|
||||
, m_enableEncryptionWidget( true )
|
||||
, m_swapChoices( swapChoices )
|
||||
, m_availableSwapChoices( swapChoices )
|
||||
, m_eraseSwapChoice( pickOne( swapChoices ) )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
|
@ -258,8 +267,11 @@ ChoicePage::setupChoices()
|
|||
|
||||
// Fill up swap options
|
||||
// .. TODO: only if enabled in the config
|
||||
m_eraseSwapChoices = createCombo( m_swapChoices );
|
||||
m_eraseButton->addOptionsComboBox( m_eraseSwapChoices );
|
||||
if ( m_availableSwapChoices.count() > 1 )
|
||||
{
|
||||
m_eraseSwapChoices = createCombo( m_availableSwapChoices );
|
||||
m_eraseButton->addOptionsComboBox( m_eraseSwapChoices );
|
||||
}
|
||||
|
||||
m_itemsLayout->addWidget( m_alongsideButton );
|
||||
m_itemsLayout->addWidget( m_replaceButton );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue