From 6e30a7b8f6fb2dad31a61df99ce8b97d749128f3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 2 Oct 2020 13:04:12 +0200 Subject: [PATCH] [partition] Move is-manual-partitioning-allowed to the Config object --- src/modules/partition/core/Config.cpp | 12 ++++++++++++ src/modules/partition/core/Config.h | 5 +++++ src/modules/partition/gui/ChoicePage.cpp | 4 +--- src/modules/partition/gui/ChoicePage.h | 2 -- src/modules/partition/gui/PartitionViewStep.cpp | 2 -- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/modules/partition/core/Config.cpp b/src/modules/partition/core/Config.cpp index 8bf093be1..d0d6fac11 100644 --- a/src/modules/partition/core/Config.cpp +++ b/src/modules/partition/core/Config.cpp @@ -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 diff --git a/src/modules/partition/core/Config.h b/src/modules/partition/core/Config.h index c949fc77f..87e0d4047 100644 --- a/src/modules/partition/core/Config.h +++ b/src/modules/partition/core/Config.h @@ -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 ); diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index d8926145b..9467720db 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -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(); } diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index b598c92fb..d79b56c56 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -159,8 +159,6 @@ private: SwapChoiceSet m_availableSwapChoices; // What is available Config::SwapChoice m_eraseSwapChoice; // what is selected - bool m_allowManualPartitioning; - QMutex m_coreMutex; }; diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index 946e567f7..d0390aa86 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -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)