From edc6c6465786e22712d1fde153ff2acfd922d017 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 4 Dec 2018 11:01:16 +0100 Subject: [PATCH] [partition] Create swap-combo from a set - Alternate way to create swap-combobox, using configuration values rather than an initializer list. --- src/modules/partition/gui/ChoicePage.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 17bd06048..2c68b0180 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -194,6 +194,16 @@ createCombo( std::initializer_list< SwapChoice > l ) return box; } +static inline QComboBox* +createCombo( const QSet< SwapChoice >& s ) +{ + QComboBox* box = new QComboBox; + for ( SwapChoice c : { SwapChoice::NoSwap, SwapChoice::SmallSwap, SwapChoice::FullSwap, SwapChoice::ReuseSwap, SwapChoice::SwapFile } ) + if ( s.contains( c ) ) + box->addItem( QString(), c ); + return box; +} + /** * @brief ChoicePage::setupChoices creates PrettyRadioButton objects for the action * choices.