[summary] Make widgets-use explicit

This commit is contained in:
Adriaan de Groot 2021-10-04 12:15:15 +02:00
parent 2fdb6fdf37
commit 87af923638
4 changed files with 13 additions and 6 deletions

View File

@ -96,7 +96,7 @@ Config::retranslate()
}
void
Config::collectSummaries( const Calamares::ViewStep* upToHere )
Config::collectSummaries( const Calamares::ViewStep* upToHere, Widgets withWidgets )
{
Calamares::ViewStepList steps;
for ( Calamares::ViewStep* step : Calamares::ViewManager::instance()->viewSteps() )
@ -123,11 +123,11 @@ Config::collectSummaries( const Calamares::ViewStep* upToHere )
steps.append( step );
}
m_summary->setSummaryList( steps );
m_summary->setSummaryList( steps, withWidgets == Widgets::Enabled );
}
void
Config::clearSummaries()
{
m_summary->setSummaryList( {} );
m_summary->setSummaryList( {}, false );
}

View File

@ -72,8 +72,15 @@ class Config : public QObject
public:
explicit Config( QObject* parent = nullptr );
///@brief Include widgets in the model?
enum class Widgets
{
Disabled,
Enabled
};
///@brief Called later, to load the model once all viewsteps are there
void collectSummaries( const Calamares::ViewStep* upToHere );
void collectSummaries( const Calamares::ViewStep* upToHere, Widgets withWidgets );
///@brief Clear the model of steps (to avoid dangling widgets)
void clearSummaries();

View File

@ -84,7 +84,7 @@ SummaryViewStep::jobs() const
void
SummaryViewStep::onActivate()
{
m_config->collectSummaries( this );
m_config->collectSummaries( this, Config::Widgets::Enabled );
m_widget->onActivate();
}

View File

@ -69,5 +69,5 @@ SummaryQmlViewStep::onActivate()
{
// Collect the steps before this one: those need to have their
// summary (text or widget) displayed.
m_config->collectSummaries( this );
m_config->collectSummaries( this, Config::Widgets::Disabled );
}