[partition] Use configured swap choices in choice page

This commit is contained in:
Adriaan de Groot 2018-12-04 11:35:35 +01:00
parent 5945e9584d
commit 2998c27545
4 changed files with 14 additions and 4 deletions

View File

@ -72,7 +72,7 @@ using PartitionActions::Choices::SwapChoice;
* will show up as a list view.
* @param parent the QWidget parent.
*/
ChoicePage::ChoicePage( QWidget* parent )
ChoicePage::ChoicePage( const SwapChoiceSet& swapChoices, QWidget* parent )
: QWidget( parent )
, m_nextEnabled( false )
, m_core( nullptr )
@ -92,6 +92,7 @@ ChoicePage::ChoicePage( QWidget* parent )
, m_bootloaderComboBox( nullptr )
, m_lastSelectedDeviceIndex( -1 )
, m_enableEncryptionWidget( true )
, m_swapChoices( swapChoices )
{
setupUi( this );
@ -259,7 +260,7 @@ ChoicePage::setupChoices()
// Fill up swap options
// .. TODO: only if enabled in the config
m_eraseSwapChoices = createCombo( { SwapChoice::NoSwap, SwapChoice::SmallSwap, SwapChoice::FullSwap } );
m_eraseSwapChoices = createCombo( m_swapChoices );
m_eraseButton->addOptionsComboBox( m_eraseSwapChoices );
#if 0

View File

@ -25,6 +25,7 @@
#include <QWidget>
#include "core/OsproberEntry.h"
#include "core/PartitionActions.h"
#include <QMutex>
#include <QPointer>
@ -43,6 +44,7 @@ class DeviceInfoWidget;
class Device;
using SwapChoiceSet = QSet< PartitionActions::Choices::SwapChoice>;
/**
* @brief The ChoicePage class is the first page of the partitioning interface.
@ -62,7 +64,7 @@ public:
Manual
};
explicit ChoicePage( QWidget* parent = nullptr );
explicit ChoicePage( const SwapChoiceSet& swapChoices, QWidget* parent = nullptr );
virtual ~ChoicePage();
/**
@ -167,6 +169,7 @@ private:
QString m_defaultFsType;
bool m_enableEncryptionWidget;
SwapChoiceSet m_swapChoices;
QMutex m_coreMutex;
};

View File

@ -91,7 +91,7 @@ PartitionViewStep::continueLoading()
Q_ASSERT( !m_manualPartitionPage );
m_manualPartitionPage = new PartitionPage( m_core );
m_choicePage = new ChoicePage();
m_choicePage = new ChoicePage( m_swapChoices );
m_choicePage->init( m_core );
@ -534,6 +534,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
else
choices.insert( PartitionActions::Choices::SwapChoice::SmallSwap );
}
m_swapChoices = choices;
// These gs settings seem to be unused (in upstream Calamares) outside of
// the partition module itself.

View File

@ -26,7 +26,10 @@
#include <PluginDllMacro.h>
#include "core/PartitionActions.h"
#include <QObject>
#include <QSet>
class ChoicePage;
class PartitionPage;
@ -76,6 +79,8 @@ private:
PartitionPage* m_manualPartitionPage;
QWidget* m_waitingWidget;
QSet< PartitionActions::Choices::SwapChoice > m_swapChoices;
};
CALAMARES_PLUGIN_FACTORY_DECLARATION( PartitionViewStepFactory )