From 824dac62d8fab29decefb6d03364fdcbb8b20f60 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 30 Jul 2020 10:44:10 +0200 Subject: [PATCH] [partition] ChoicePage to use Config object --- src/modules/partition/gui/ChoicePage.cpp | 23 ++++++++++--------- src/modules/partition/gui/ChoicePage.h | 6 +++-- .../partition/gui/PartitionViewStep.cpp | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 4640315c8..055595ba0 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -20,7 +20,15 @@ #include "ChoicePage.h" +#include "BootInfoWidget.h" +#include "DeviceInfoWidget.h" +#include "PartitionBarsView.h" +#include "PartitionLabelsView.h" +#include "PartitionSplitterWidget.h" +#include "ReplaceWidget.h" +#include "ScanningDialog.h" #include "core/BootLoaderModel.h" +#include "core/Config.h" #include "core/DeviceModel.h" #include "core/KPMHelpers.h" #include "core/OsproberEntry.h" @@ -30,14 +38,6 @@ #include "core/PartitionInfo.h" #include "core/PartitionModel.h" -#include "BootInfoWidget.h" -#include "DeviceInfoWidget.h" -#include "PartitionBarsView.h" -#include "PartitionLabelsView.h" -#include "PartitionSplitterWidget.h" -#include "ReplaceWidget.h" -#include "ScanningDialog.h" - #include "Branding.h" #include "GlobalStorage.h" #include "JobQueue.h" @@ -75,8 +75,9 @@ using Calamares::PrettyRadioButton; * the module loading code path. * @param parent the QWidget parent. */ -ChoicePage::ChoicePage( const SwapChoiceSet& swapChoices, QWidget* parent ) +ChoicePage::ChoicePage( Config* config, QWidget* parent ) : QWidget( parent ) + , m_config( config ) , m_nextEnabled( false ) , m_core( nullptr ) , m_choice( NoChoice ) @@ -93,8 +94,8 @@ ChoicePage::ChoicePage( const SwapChoiceSet& swapChoices, QWidget* parent ) , m_bootloaderComboBox( nullptr ) , m_lastSelectedDeviceIndex( -1 ) , m_enableEncryptionWidget( true ) - , m_availableSwapChoices( swapChoices ) - , m_eraseSwapChoice( PartitionActions::Choices::pickOne( swapChoices ) ) + , m_availableSwapChoices( config->swapChoices() ) + , m_eraseSwapChoice( PartitionActions::Choices::pickOne( m_availableSwapChoices ) ) , m_allowManualPartitioning( true ) { setupUi( this ); diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index a28892011..f985178d5 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -42,11 +42,12 @@ namespace Calamares class PrettyRadioButton; } +class Config; +class DeviceInfoWidget; class PartitionBarsView; class PartitionSplitterWidget; class PartitionLabelsView; class PartitionCoreModule; -class DeviceInfoWidget; class Device; @@ -70,7 +71,7 @@ public: Manual }; - explicit ChoicePage( const SwapChoiceSet& swapChoices, QWidget* parent = nullptr ); + explicit ChoicePage( Config* config, QWidget* parent = nullptr ); virtual ~ChoicePage(); /** @@ -147,6 +148,7 @@ private: // Translations support void updateSwapChoicesTr( QComboBox* box ); + Config* m_config; bool m_nextEnabled; PartitionCoreModule* m_core; diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index 04f14dd84..999c94505 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -94,7 +94,7 @@ void PartitionViewStep::continueLoading() { Q_ASSERT( !m_choicePage ); - m_choicePage = new ChoicePage( m_config->swapChoices() ); + m_choicePage = new ChoicePage( m_config ); m_choicePage->init( m_core ); m_widget->addWidget( m_choicePage );