[partition] Move is-manual-partitioning-allowed to the Config object

main
Adriaan de Groot 4 years ago
parent f79fbd4105
commit 6e30a7b8f6

@ -192,6 +192,14 @@ Config::setSwapChoice( Config::SwapChoice c )
}
}
bool
Config::allowManualPartitioning() const
{
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
return gs->value( "allowManualPartitioning" ).toBool();
}
void
Config::setConfigurationMap( const QVariantMap& configurationMap )
{
@ -212,6 +220,10 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
m_initialSwapChoice = pickOne( m_swapChoices );
}
setSwapChoice( m_initialSwapChoice );
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
gs->insert( "allowManualPartitioning",
CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) );
}
void

@ -24,6 +24,8 @@ class Config : public QObject
///@brief The swap choice (None, Small, Hibernate, ...) which only makes sense when Erase is chosen
Q_PROPERTY( SwapChoice swapChoice READ swapChoice WRITE setSwapChoice NOTIFY swapChoiceChanged )
Q_PROPERTY( bool allowManualPartitioning READ allowManualPartitioning CONSTANT FINAL )
public:
Config( QObject* parent );
virtual ~Config() = default;
@ -86,6 +88,9 @@ public:
*/
SwapChoice swapChoice() const { return m_swapChoice; }
///@brief Is manual partitioning allowed (not explicitly disnabled in the config file)?
bool allowManualPartitioning() const;
public Q_SLOTS:
void setInstallChoice( int ); ///< Translates a button ID or so to InstallChoice
void setInstallChoice( InstallChoice );

@ -86,7 +86,6 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent )
, m_enableEncryptionWidget( true )
, m_availableSwapChoices( config->swapChoices() )
, m_eraseSwapChoice( config->initialSwapChoice() )
, m_allowManualPartitioning( true )
{
setupUi( this );
@ -94,7 +93,6 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent )
m_defaultFsType = gs->value( "defaultFileSystemType" ).toString();
m_enableEncryptionWidget = gs->value( "enableLuksAutomatedPartitioning" ).toBool();
m_allowManualPartitioning = gs->value( "allowManualPartitioning" ).toBool();
if ( FileSystem::typeForName( m_defaultFsType ) == FileSystem::Unknown )
{
@ -1241,7 +1239,7 @@ ChoicePage::setupActions()
m_deviceInfoWidget->setPartitionTableType( PartitionTable::unknownTableType );
}
if ( m_allowManualPartitioning )
if ( m_config->allowManualPartitioning() )
{
m_somethingElseButton->show();
}

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

@ -549,8 +549,6 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) );
gs->insert( "enableLuksAutomatedPartitioning",
CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) );
gs->insert( "allowManualPartitioning",
CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) );
// The defaultFileSystemType setting needs a bit more processing,
// as we want to cover various cases (such as different cases)

Loading…
Cancel
Save