mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05: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 );
|
||||
|
|
|
@ -45,7 +45,7 @@ class DeviceInfoWidget;
|
|||
|
||||
class Device;
|
||||
|
||||
using SwapChoiceSet = QSet< PartitionActions::Choices::SwapChoice>;
|
||||
using SwapChoiceSet = QSet< PartitionActions::Choices::SwapChoice >;
|
||||
|
||||
/**
|
||||
* @brief The ChoicePage class is the first page of the partitioning interface.
|
||||
|
@ -151,7 +151,7 @@ private:
|
|||
PrettyRadioButton* m_eraseButton;
|
||||
PrettyRadioButton* m_replaceButton;
|
||||
PrettyRadioButton* m_somethingElseButton;
|
||||
QComboBox* m_eraseSwapChoices;
|
||||
QComboBox* m_eraseSwapChoices; // UI, see also m_swapChoices
|
||||
|
||||
DeviceInfoWidget* m_deviceInfoWidget;
|
||||
|
||||
|
@ -168,7 +168,8 @@ private:
|
|||
|
||||
QString m_defaultFsType;
|
||||
bool m_enableEncryptionWidget;
|
||||
SwapChoiceSet m_swapChoices;
|
||||
SwapChoiceSet m_availableSwapChoices; // What is available
|
||||
PartitionActions::Choices::SwapChoice m_eraseSwapChoice; // what is selected
|
||||
|
||||
QMutex m_coreMutex;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue