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

View File

@ -72,8 +72,15 @@ class Config : public QObject
public: public:
explicit Config( QObject* parent = nullptr ); 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 ///@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) ///@brief Clear the model of steps (to avoid dangling widgets)
void clearSummaries(); void clearSummaries();

View File

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

View File

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