From 0231619c7ccb109dddea17015a1921acb3a33170 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 4 Dec 2018 10:22:08 +0100 Subject: [PATCH] [partition] Refactor slot for change in action - Let's not go overboard on lambdas, - Needed for others that also want to update the partitioning preview --- src/modules/partition/gui/ChoicePage.cpp | 20 ++++++++++++-------- src/modules/partition/gui/ChoicePage.h | 3 +++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index ba49bd95d..27364e9bb 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -305,14 +305,7 @@ ChoicePage::setupChoices() m_rightLayout->setStretchFactor( m_previewAfterFrame, 0 ); connect( this, &ChoicePage::actionChosen, - this, [=] - { - Device* currd = selectedDevice(); - if ( currd ) - { - applyActionChoice( currentChoice() ); - } - } ); + this, &ChoicePage::onActionChanged ); CALAMARES_RETRANSLATE( updateSwapChoicesTr( m_eraseSwapChoices ); @@ -412,6 +405,17 @@ ChoicePage::continueApplyDeviceChoice() } +void +ChoicePage::onActionChanged() +{ + Device* currd = selectedDevice(); + if ( currd ) + { + applyActionChoice( currentChoice() ); + } +} + + void ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice ) { diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index 07d052c2d..5a5c5ac34 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -109,6 +109,9 @@ private slots: void onEncryptWidgetStateChanged(); void onHomeCheckBoxStateChanged(); + /** @brief Calls applyActionChoice() as needed. */ + void onActionChanged(); + private: void updateNextEnabled(); void setupChoices();