[partition] move the swap-choice to Config

main
Adriaan de Groot 4 years ago
parent 6e30a7b8f6
commit 92a874dae7

@ -57,8 +57,6 @@ public:
void setConfigurationMap( const QVariantMap& ); void setConfigurationMap( const QVariantMap& );
void updateGlobalStorage() const; void updateGlobalStorage() const;
SwapChoiceSet swapChoices() const { return m_swapChoices; }
/** @brief What kind of installation (partitioning) is requested **initially**? /** @brief What kind of installation (partitioning) is requested **initially**?
* *
* @return the partitioning choice (may be @c NoChoice) * @return the partitioning choice (may be @c NoChoice)
@ -74,6 +72,14 @@ public:
*/ */
InstallChoice installChoice() const { return m_installChoice; } InstallChoice installChoice() const { return m_installChoice; }
/** @brief The set of swap choices enabled for this install
*
* Not all swap choices are supported by each distro, so they
* can choose to enable or disable them. This method
* returns a set (hopefully non-empty) of configured swap choices.
*/
SwapChoiceSet swapChoices() const { return m_swapChoices; }
/** @brief What kind of swap selection is requested **initially**? /** @brief What kind of swap selection is requested **initially**?
* *
* @return The swap choice (may be @c NoSwap ) * @return The swap choice (may be @c NoSwap )

@ -84,8 +84,6 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent )
, m_beforePartitionLabelsView( nullptr ) , m_beforePartitionLabelsView( nullptr )
, m_bootloaderComboBox( nullptr ) , m_bootloaderComboBox( nullptr )
, m_enableEncryptionWidget( true ) , m_enableEncryptionWidget( true )
, m_availableSwapChoices( config->swapChoices() )
, m_eraseSwapChoice( config->initialSwapChoice() )
{ {
setupUi( this ); setupUi( this );
@ -247,10 +245,9 @@ ChoicePage::setupChoices()
m_replaceButton->addToGroup( m_grp, InstallChoice::Replace ); m_replaceButton->addToGroup( m_grp, InstallChoice::Replace );
// Fill up swap options // Fill up swap options
// .. TODO: only if enabled in the config if ( m_config->swapChoices().count() > 1 )
if ( m_availableSwapChoices.count() > 1 )
{ {
m_eraseSwapChoiceComboBox = createCombo( m_availableSwapChoices, m_eraseSwapChoice ); m_eraseSwapChoiceComboBox = createCombo( m_config->swapChoices(), m_config->swapChoice() );
m_eraseButton->addOptionsComboBox( m_eraseSwapChoiceComboBox ); m_eraseButton->addOptionsComboBox( m_eraseSwapChoiceComboBox );
} }
@ -431,7 +428,7 @@ ChoicePage::onEraseSwapChoiceChanged()
{ {
if ( m_eraseSwapChoiceComboBox ) if ( m_eraseSwapChoiceComboBox )
{ {
m_eraseSwapChoice = static_cast< Config::SwapChoice >( m_eraseSwapChoiceComboBox->currentData().toInt() ); m_config->setSwapChoice( m_eraseSwapChoiceComboBox->currentData().toInt() );
onActionChanged(); onActionChanged();
} }
} }
@ -456,7 +453,7 @@ ChoicePage::applyActionChoice( InstallChoice choice )
gs->value( "efiSystemPartition" ).toString(), gs->value( "efiSystemPartition" ).toString(),
CalamaresUtils::GiBtoBytes( CalamaresUtils::GiBtoBytes(
gs->value( "requiredStorageGiB" ).toDouble() ), gs->value( "requiredStorageGiB" ).toDouble() ),
m_eraseSwapChoice }; m_config->swapChoice() };
if ( m_core->isDirty() ) if ( m_core->isDirty() )
{ {

@ -156,8 +156,6 @@ private:
QString m_defaultFsType; QString m_defaultFsType;
bool m_enableEncryptionWidget; bool m_enableEncryptionWidget;
SwapChoiceSet m_availableSwapChoices; // What is available
Config::SwapChoice m_eraseSwapChoice; // what is selected
QMutex m_coreMutex; QMutex m_coreMutex;
}; };

Loading…
Cancel
Save