[libcalamaresui] Move lambda to a "real" slot.

This commit is contained in:
Adriaan de Groot 2020-04-03 16:38:10 +02:00
parent 7393198f7b
commit af4220331e
2 changed files with 19 additions and 12 deletions

View File

@ -119,18 +119,7 @@ ViewManager::insertViewStep( int before, ViewStep* step )
emit beginInsertRows( QModelIndex(), before, before );
m_steps.insert( before, step );
connect( step, &ViewStep::enlarge, this, &ViewManager::enlarge );
// TODO: this can be a regular slot
connect( step, &ViewStep::nextStatusChanged, this, [this]( bool status ) {
ViewStep* vs = qobject_cast< ViewStep* >( sender() );
if ( vs && currentStepValid() )
{
if ( vs == m_steps.at( m_currentStep ) )
{
m_nextEnabled = status;
emit nextEnabledChanged( m_nextEnabled );
}
}
} );
connect( step, &ViewStep::nextStatusChanged, this, &ViewManager::updateNextStatus );
if ( !step->widget() )
{
@ -250,6 +239,21 @@ ViewManager::onInitComplete()
}
}
void
ViewManager::updateNextStatus( bool status )
{
ViewStep* vs = qobject_cast< ViewStep* >( sender() );
if ( vs && currentStepValid() )
{
if ( vs == m_steps.at( m_currentStep ) )
{
m_nextEnabled = status;
emit nextEnabledChanged( m_nextEnabled );
}
}
}
ViewStepList
ViewManager::viewSteps() const
{

View File

@ -190,6 +190,9 @@ public Q_SLOTS:
*/
void onInitComplete();
/// @brief Connected to ViewStep::nextStatusChanged for all steps
void updateNextStatus( bool enabled );
signals:
void currentStepChanged();
void enlarge( QSize enlarge ) const; // See ViewStep::enlarge()