[partition] Add swap choice to config object
This commit is contained in:
parent
0f4fe6294c
commit
f79fbd4105
@ -171,6 +171,26 @@ Config::setInstallChoice( InstallChoice c )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Config::setSwapChoice( int c )
|
||||||
|
{
|
||||||
|
if ( ( c < SwapChoice::NoSwap ) || ( c > SwapChoice::SwapFile ) )
|
||||||
|
{
|
||||||
|
cWarning() << "Instalid swap choice (int)" << c;
|
||||||
|
c = SwapChoice::NoSwap;
|
||||||
|
}
|
||||||
|
setSwapChoice( static_cast< SwapChoice >( c ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Config::setSwapChoice( Config::SwapChoice c )
|
||||||
|
{
|
||||||
|
if ( c != m_swapChoice )
|
||||||
|
{
|
||||||
|
m_swapChoice = c;
|
||||||
|
emit swapChoiceChanged( c );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Config::setConfigurationMap( const QVariantMap& configurationMap )
|
Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
@ -191,6 +211,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
cWarning() << "Configuration for *initialSwapChoice* is not one of the *userSwapChoices*";
|
cWarning() << "Configuration for *initialSwapChoice* is not one of the *userSwapChoices*";
|
||||||
m_initialSwapChoice = pickOne( m_swapChoices );
|
m_initialSwapChoice = pickOne( m_swapChoices );
|
||||||
}
|
}
|
||||||
|
setSwapChoice( m_initialSwapChoice );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -18,13 +18,12 @@
|
|||||||
class Config : public QObject
|
class Config : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
/** @brief The installation choice (Erase, Alongside, ...)
|
///@brief The installation choice (Erase, Alongside, ...)
|
||||||
*
|
|
||||||
* This is an int because exposing the enum values is slightly complicated
|
|
||||||
* by the source layout.
|
|
||||||
*/
|
|
||||||
Q_PROPERTY( InstallChoice installChoice READ installChoice WRITE setInstallChoice NOTIFY installChoiceChanged )
|
Q_PROPERTY( InstallChoice installChoice READ installChoice WRITE setInstallChoice NOTIFY installChoiceChanged )
|
||||||
|
|
||||||
|
///@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 )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Config( QObject* parent );
|
Config( QObject* parent );
|
||||||
virtual ~Config() = default;
|
virtual ~Config() = default;
|
||||||
@ -73,23 +72,34 @@ public:
|
|||||||
*/
|
*/
|
||||||
InstallChoice installChoice() const { return m_installChoice; }
|
InstallChoice installChoice() const { return m_installChoice; }
|
||||||
|
|
||||||
|
|
||||||
/** @brief What kind of swap selection is requested **initially**?
|
/** @brief What kind of swap selection is requested **initially**?
|
||||||
*
|
*
|
||||||
* @return The swap choice (may be @c NoSwap )
|
* @return The swap choice (may be @c NoSwap )
|
||||||
*/
|
*/
|
||||||
SwapChoice initialSwapChoice() const { return m_initialSwapChoice; }
|
SwapChoice initialSwapChoice() const { return m_initialSwapChoice; }
|
||||||
|
|
||||||
|
/** @brief What kind of swap selection is requested **now**?
|
||||||
|
*
|
||||||
|
* A choice of swap only makes sense when install choice Erase is made.
|
||||||
|
*
|
||||||
|
* @return The swap choice (may be @c NoSwap).
|
||||||
|
*/
|
||||||
|
SwapChoice swapChoice() const { return m_swapChoice; }
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setInstallChoice( int );
|
void setInstallChoice( int ); ///< Translates a button ID or so to InstallChoice
|
||||||
void setInstallChoice( InstallChoice );
|
void setInstallChoice( InstallChoice );
|
||||||
|
void setSwapChoice( int ); ///< Translates a button ID or so to SwapChoice
|
||||||
|
void setSwapChoice( SwapChoice );
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void installChoiceChanged( InstallChoice );
|
void installChoiceChanged( InstallChoice );
|
||||||
|
void swapChoiceChanged( SwapChoice );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SwapChoice m_initialSwapChoice;
|
|
||||||
SwapChoiceSet m_swapChoices;
|
SwapChoiceSet m_swapChoices;
|
||||||
|
SwapChoice m_initialSwapChoice = NoSwap;
|
||||||
|
SwapChoice m_swapChoice = NoSwap;
|
||||||
InstallChoice m_initialInstallChoice = NoChoice;
|
InstallChoice m_initialInstallChoice = NoChoice;
|
||||||
InstallChoice m_installChoice = NoChoice;
|
InstallChoice m_installChoice = NoChoice;
|
||||||
qreal m_requiredStorageGiB = 0.0; // May duplicate setting in the welcome module
|
qreal m_requiredStorageGiB = 0.0; // May duplicate setting in the welcome module
|
||||||
|
Loading…
Reference in New Issue
Block a user