[partition] Select initial swap choice

This commit is contained in:
Adriaan de Groot 2020-09-28 15:32:47 +02:00
parent 9f0f600aa4
commit b518ef7dfe
5 changed files with 27 additions and 6 deletions

View File

@ -116,6 +116,13 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
bool nameFound = false; // In the name table (ignored, falls back to first entry in table)
m_initialInstallChoice = PartitionActions::Choices::installChoiceNames().find(
CalamaresUtils::getString( configurationMap, "initialPartitioningChoice" ), nameFound );
m_initialSwapChoice = PartitionActions::Choices::swapChoiceNames().find(
CalamaresUtils::getString( configurationMap, "initialSwapChoice" ), nameFound );
if ( !m_swapChoices.contains( m_initialSwapChoice ) )
{
cWarning() << "Configuration for *initialSwapChoice* is not one of the *userSwapChoices*";
m_initialSwapChoice = PartitionActions::Choices::pickOne( m_swapChoices );
}
}
void

View File

@ -28,14 +28,20 @@ public:
PartitionActions::Choices::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 by @c NoChoice)
* @return the partitioning choice (may be @c NoChoice)
*/
PartitionActions::Choices::InstallChoice initialInstallChoice() const { return m_initialInstallChoice; }
/** @brief What kind of swap selection is requested **initially**?
*
* @return The swap choice (may be @c NoSwap )
*/
PartitionActions::Choices::SwapChoice initialSwapChoice() const { return m_initialSwapChoice; }
private:
PartitionActions::Choices::SwapChoice m_initialSwapChoice;
PartitionActions::Choices::SwapChoiceSet m_swapChoices;
PartitionActions::Choices::InstallChoice m_initialInstallChoice = PartitionActions::Choices::NoChoice;
qreal m_requiredStorageGiB = 0.0; // May duplicate setting in the welcome module

View File

@ -86,7 +86,7 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent )
, m_lastSelectedDeviceIndex( -1 )
, m_enableEncryptionWidget( true )
, m_availableSwapChoices( config->swapChoices() )
, m_eraseSwapChoice( PartitionActions::Choices::pickOne( m_availableSwapChoices ) )
, m_eraseSwapChoice( config->initialSwapChoice() )
, m_allowManualPartitioning( true )
{
setupUi( this );

View File

@ -74,8 +74,15 @@ alwaysShowPartitionLabels: true
#
# The default is "none"
#
# TODO: this isn't implemented
# initialPartitioningChoice: none
initialPartitioningChoice: none
#
# Similarly, some of the installation choices may offer a choice of swap;
# the available choices depend on *userSwapChoices*, above, and this
# setting can be used to pick a specific one.
#
# The default is "none" (no swap) if that is one of the enabled options, otherwise
# one of the items from the options.
initialSwapChoice: none
# Default filesystem type, used when a "new" partition is made.
#

View File

@ -22,6 +22,7 @@ properties:
allowManualPartitioning: { type: boolean, default: true }
partitionLayout: { type: array } # TODO: specify items
initialPartitioningChoice: { type: string, enum: [ none, erase, replace, alongside, manual ] }
initialSwapChoice: { type: string, enum: [ none, small, suspend, reuse, file ] }
requiredStorage: { type: number }
required: