From 295f6f9737ee194caea53959909d21f100075c59 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 11:44:52 +0200 Subject: [PATCH 1/8] Changes: intentions for this branch --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index b668e2496..349e36179 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,8 @@ This release contains contributions from (alphabetically by first name): ## Modules ## - The *partition* module now consistently uses the configured EFI partition size (defaults to 300MiB). + - Internal changes in the *summary* module to increase consistency + between *summary* and *summaryq*. # 3.2.44.2 (2021-09-27) # From 2fdb6fdf374155d8797252d2fe43226081870128 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 12:10:17 +0200 Subject: [PATCH 2/8] [summary] Clear model on leave --- src/modules/summary/Config.cpp | 10 ++++++++-- src/modules/summary/Config.h | 2 ++ src/modules/summary/SummaryViewStep.cpp | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/summary/Config.cpp b/src/modules/summary/Config.cpp index 5110e09a6..1c0dd1e82 100644 --- a/src/modules/summary/Config.cpp +++ b/src/modules/summary/Config.cpp @@ -84,12 +84,12 @@ Config::retranslate() if ( Calamares::Settings::instance()->isSetupMode() ) { m_message = tr( "This is an overview of what will happen once you start " - "the setup procedure." ); + "the setup procedure." ); } else { m_message = tr( "This is an overview of what will happen once you start " - "the install procedure." ); + "the install procedure." ); } Q_EMIT titleChanged( m_title ); Q_EMIT messageChanged( m_message ); @@ -125,3 +125,9 @@ Config::collectSummaries( const Calamares::ViewStep* upToHere ) m_summary->setSummaryList( steps ); } + +void +Config::clearSummaries() +{ + m_summary->setSummaryList( {} ); +} diff --git a/src/modules/summary/Config.h b/src/modules/summary/Config.h index 15604d933..44b021829 100644 --- a/src/modules/summary/Config.h +++ b/src/modules/summary/Config.h @@ -74,6 +74,8 @@ public: ///@brief Called later, to load the model once all viewsteps are there void collectSummaries( const Calamares::ViewStep* upToHere ); + ///@brief Clear the model of steps (to avoid dangling widgets) + void clearSummaries(); QAbstractListModel* summaryModel() const { return m_summary; } diff --git a/src/modules/summary/SummaryViewStep.cpp b/src/modules/summary/SummaryViewStep.cpp index d4e439ae3..508506a4e 100644 --- a/src/modules/summary/SummaryViewStep.cpp +++ b/src/modules/summary/SummaryViewStep.cpp @@ -92,5 +92,6 @@ SummaryViewStep::onActivate() void SummaryViewStep::onLeave() { + m_config->clearSummaries(); m_widget->onLeave(); } From 87af923638208d3e4993e5599953c7b8e2123eda Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 12:15:15 +0200 Subject: [PATCH 3/8] [summary] Make widgets-use explicit --- src/modules/summary/Config.cpp | 6 +++--- src/modules/summary/Config.h | 9 ++++++++- src/modules/summary/SummaryViewStep.cpp | 2 +- src/modules/summaryq/SummaryQmlViewStep.cpp | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/modules/summary/Config.cpp b/src/modules/summary/Config.cpp index 1c0dd1e82..f76b28959 100644 --- a/src/modules/summary/Config.cpp +++ b/src/modules/summary/Config.cpp @@ -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 ); } diff --git a/src/modules/summary/Config.h b/src/modules/summary/Config.h index 44b021829..ac87c7db7 100644 --- a/src/modules/summary/Config.h +++ b/src/modules/summary/Config.h @@ -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(); diff --git a/src/modules/summary/SummaryViewStep.cpp b/src/modules/summary/SummaryViewStep.cpp index 508506a4e..b3b648552 100644 --- a/src/modules/summary/SummaryViewStep.cpp +++ b/src/modules/summary/SummaryViewStep.cpp @@ -84,7 +84,7 @@ SummaryViewStep::jobs() const void SummaryViewStep::onActivate() { - m_config->collectSummaries( this ); + m_config->collectSummaries( this, Config::Widgets::Enabled ); m_widget->onActivate(); } diff --git a/src/modules/summaryq/SummaryQmlViewStep.cpp b/src/modules/summaryq/SummaryQmlViewStep.cpp index 23e18a861..a5acdfddd 100644 --- a/src/modules/summaryq/SummaryQmlViewStep.cpp +++ b/src/modules/summaryq/SummaryQmlViewStep.cpp @@ -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 ); } From 763f29e2b8b96ee2bc7a9a47b4eede95d82459d5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 12:23:17 +0200 Subject: [PATCH 4/8] [summary] Improve naming, shuffle parameters - the page doesn't need to remember what step it belongs to, if the step tells it when creating widgets. - detach naming from the viewstep API that calls it. --- src/modules/summary/SummaryPage.cpp | 17 +++++++---------- src/modules/summary/SummaryPage.h | 13 +++++-------- src/modules/summary/SummaryViewStep.cpp | 6 +++--- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index e0c063e52..82670f603 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -27,18 +27,15 @@ #include #include -SummaryPage::SummaryPage( Config* config, const SummaryViewStep* thisViewStep, QWidget* parent ) +SummaryPage::SummaryPage( Config* config, QWidget* parent ) : QWidget() - , m_thisViewStep( thisViewStep ) , m_contentWidget( nullptr ) , m_scrollArea( new QScrollArea( this ) ) { Q_UNUSED( parent ) - this->setObjectName( "summaryStep" ); - Q_ASSERT( m_thisViewStep ); QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); @@ -85,7 +82,7 @@ createBodyLabel( const QString& text, const QPalette& bodyPalette ) // Adds a widget for those ViewSteps that want a summary; // see SummaryPage documentation and also ViewStep docs. void -SummaryPage::onActivate() +SummaryPage::buildWidgets( Config* config, SummaryViewStep* viewstep ) { const int SECTION_SPACING = 12; @@ -102,7 +99,7 @@ SummaryPage::onActivate() bodyPalette.setColor( WindowBackground, palette().window().color().lighter( 108 ) ); bool first = true; - const Calamares::ViewStepList steps = stepsForSummary( Calamares::ViewManager::instance()->viewSteps() ); + const Calamares::ViewStepList steps = stepsForSummary( Calamares::ViewManager::instance()->viewSteps(), viewstep ); for ( Calamares::ViewStep* step : steps ) { @@ -151,12 +148,12 @@ SummaryPage::onActivate() cDebug() << "Summary widget is larger than viewport, enlarge by" << enlarge << "to" << widgetSize; - emit m_thisViewStep->ensureSize( widgetSize ); // Only expand height + emit viewstep->ensureSize( widgetSize ); // Only expand height } } Calamares::ViewStepList -SummaryPage::stepsForSummary( const Calamares::ViewStepList& allSteps ) const +SummaryPage::stepsForSummary( const Calamares::ViewStepList& allSteps, SummaryViewStep* viewstep ) const { Calamares::ViewStepList steps; for ( Calamares::ViewStep* step : allSteps ) @@ -173,7 +170,7 @@ SummaryPage::stepsForSummary( const Calamares::ViewStepList& allSteps ) const // If we reach the parent step of this page, we're done collecting the list of // steps to summarize. - if ( m_thisViewStep == step ) + if ( viewstep == step ) { break; } @@ -185,7 +182,7 @@ SummaryPage::stepsForSummary( const Calamares::ViewStepList& allSteps ) const } void -SummaryPage::onLeave() +SummaryPage::cleanup() { delete m_contentWidget; m_contentWidget = nullptr; diff --git a/src/modules/summary/SummaryPage.h b/src/modules/summary/SummaryPage.h index 7d98cc711..5e201dc3a 100644 --- a/src/modules/summary/SummaryPage.h +++ b/src/modules/summary/SummaryPage.h @@ -45,22 +45,19 @@ class SummaryPage : public QWidget { Q_OBJECT public: - explicit SummaryPage( Config* config, const SummaryViewStep* thisViewStep, QWidget* parent = nullptr ); + explicit SummaryPage( Config* config, QWidget* parent = nullptr ); /// @brief Create contents showing all of the summary - void onActivate(); + void buildWidgets( Config* config, SummaryViewStep* viewstep ); /// @brief Clean up the widgets - void onLeave(); + void cleanup(); private: - Calamares::ViewStepList stepsForSummary( const Calamares::ViewStepList& allSteps ) const; - - const SummaryViewStep* m_thisViewStep; + Calamares::ViewStepList stepsForSummary( const Calamares::ViewStepList& allSteps, SummaryViewStep* viewstep ) const; QVBoxLayout* m_layout = nullptr; QWidget* m_contentWidget = nullptr; - - QScrollArea* m_scrollArea; + QScrollArea* m_scrollArea = nullptr; }; #endif // SUMMARYPAGE_H diff --git a/src/modules/summary/SummaryViewStep.cpp b/src/modules/summary/SummaryViewStep.cpp index b3b648552..9d63d0d37 100644 --- a/src/modules/summary/SummaryViewStep.cpp +++ b/src/modules/summary/SummaryViewStep.cpp @@ -16,7 +16,7 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( SummaryViewStepFactory, registerPlugin< Sum SummaryViewStep::SummaryViewStep( QObject* parent ) : Calamares::ViewStep( parent ) , m_config( new Config( this ) ) - , m_widget( new SummaryPage( m_config, this ) ) + , m_widget( new SummaryPage( m_config ) ) { emit nextStatusChanged( true ); } @@ -85,7 +85,7 @@ void SummaryViewStep::onActivate() { m_config->collectSummaries( this, Config::Widgets::Enabled ); - m_widget->onActivate(); + m_widget->buildWidgets( m_config, this ); } @@ -93,5 +93,5 @@ void SummaryViewStep::onLeave() { m_config->clearSummaries(); - m_widget->onLeave(); + m_widget->cleanup(); } From 4731d79a4f75d16160c0f62b21b978b534a780a8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 12:48:16 +0200 Subject: [PATCH 5/8] [summary] Reduce code-duplication The summary page can rely on the Config object to create lists of relevant steps; this code was declared but not defined / implemented for Config (but also not called, so it was ok). This is basically shuffling bits around in preparation for using the model directly, rather than re-implementing the widget-creation code. While here, split off the page-resizing into a free function so that the code reads nicer. --- src/modules/summary/Config.cpp | 12 ++++-- src/modules/summary/Config.h | 3 +- src/modules/summary/SummaryPage.cpp | 60 +++++++++-------------------- src/modules/summary/SummaryPage.h | 2 - 4 files changed, 29 insertions(+), 48 deletions(-) diff --git a/src/modules/summary/Config.cpp b/src/modules/summary/Config.cpp index f76b28959..98079cb6d 100644 --- a/src/modules/summary/Config.cpp +++ b/src/modules/summary/Config.cpp @@ -95,8 +95,8 @@ Config::retranslate() Q_EMIT messageChanged( m_message ); } -void -Config::collectSummaries( const Calamares::ViewStep* upToHere, Widgets withWidgets ) +Calamares::ViewStepList +Config::stepsForSummary( const Calamares::ViewStep* upToHere ) { Calamares::ViewStepList steps; for ( Calamares::ViewStep* step : Calamares::ViewManager::instance()->viewSteps() ) @@ -122,8 +122,14 @@ Config::collectSummaries( const Calamares::ViewStep* upToHere, Widgets withWidge steps.append( step ); } + return steps; +} - m_summary->setSummaryList( steps, withWidgets == Widgets::Enabled ); + +void +Config::collectSummaries( const Calamares::ViewStep* upToHere, Widgets withWidgets ) +{ + m_summary->setSummaryList( stepsForSummary( upToHere ), withWidgets == Widgets::Enabled ); } void diff --git a/src/modules/summary/Config.h b/src/modules/summary/Config.h index ac87c7db7..cf819b503 100644 --- a/src/modules/summary/Config.h +++ b/src/modules/summary/Config.h @@ -79,6 +79,8 @@ public: Enabled }; + static Calamares::ViewStepList stepsForSummary( const Calamares::ViewStep* upToHere ); + ///@brief Called later, to load the model once all viewsteps are there void collectSummaries( const Calamares::ViewStep* upToHere, Widgets withWidgets ); ///@brief Clear the model of steps (to avoid dangling widgets) @@ -90,7 +92,6 @@ public: QString message() const { return m_message; } private: - Calamares::ViewStepList stepsForSummary( const Calamares::ViewStepList& allSteps ) const; void retranslate(); SummaryModel* m_summary; diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index 82670f603..f3f05c3cc 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -79,6 +79,22 @@ createBodyLabel( const QString& text, const QPalette& bodyPalette ) return label; } +static void +ensureSize( QWidget* parent, QScrollArea* container, Calamares::ViewStep* viewstep ) +{ + auto summarySize = container->widget()->sizeHint(); + if ( summarySize.height() > container->size().height() ) + { + auto enlarge = 2 + summarySize.height() - container->size().height(); + auto widgetSize = parent->size(); + widgetSize.setHeight( widgetSize.height() + enlarge ); + + cDebug() << "Summary widget is larger than viewport, enlarge by" << enlarge << "to" << widgetSize; + + emit viewstep->ensureSize( widgetSize ); // Only expand height + } +} + // Adds a widget for those ViewSteps that want a summary; // see SummaryPage documentation and also ViewStep docs. void @@ -99,7 +115,7 @@ SummaryPage::buildWidgets( Config* config, SummaryViewStep* viewstep ) bodyPalette.setColor( WindowBackground, palette().window().color().lighter( 108 ) ); bool first = true; - const Calamares::ViewStepList steps = stepsForSummary( Calamares::ViewManager::instance()->viewSteps(), viewstep ); + const Calamares::ViewStepList steps = Config::stepsForSummary( viewstep ); for ( Calamares::ViewStep* step : steps ) { @@ -138,47 +154,7 @@ SummaryPage::buildWidgets( Config* config, SummaryViewStep* viewstep ) m_layout->addStretch(); m_scrollArea->setWidget( m_contentWidget ); - - auto summarySize = m_contentWidget->sizeHint(); - if ( summarySize.height() > m_scrollArea->size().height() ) - { - auto enlarge = 2 + summarySize.height() - m_scrollArea->size().height(); - auto widgetSize = this->size(); - widgetSize.setHeight( widgetSize.height() + enlarge ); - - cDebug() << "Summary widget is larger than viewport, enlarge by" << enlarge << "to" << widgetSize; - - emit viewstep->ensureSize( widgetSize ); // Only expand height - } -} - -Calamares::ViewStepList -SummaryPage::stepsForSummary( const Calamares::ViewStepList& allSteps, SummaryViewStep* viewstep ) const -{ - Calamares::ViewStepList steps; - for ( Calamares::ViewStep* step : allSteps ) - { - // We start from the beginning of the complete steps list. If we encounter any - // ExecutionViewStep, it means there was an execution phase in the past, and any - // jobs from before that phase were already executed, so we can safely clear the - // list of steps to summarize and start collecting from scratch. - if ( qobject_cast< Calamares::ExecutionViewStep* >( step ) ) - { - steps.clear(); - continue; - } - - // If we reach the parent step of this page, we're done collecting the list of - // steps to summarize. - if ( viewstep == step ) - { - break; - } - - steps.append( step ); - } - - return steps; + ensureSize( this, m_scrollArea, viewstep ); } void diff --git a/src/modules/summary/SummaryPage.h b/src/modules/summary/SummaryPage.h index 5e201dc3a..9976020f7 100644 --- a/src/modules/summary/SummaryPage.h +++ b/src/modules/summary/SummaryPage.h @@ -53,8 +53,6 @@ public: void cleanup(); private: - Calamares::ViewStepList stepsForSummary( const Calamares::ViewStepList& allSteps, SummaryViewStep* viewstep ) const; - QVBoxLayout* m_layout = nullptr; QWidget* m_contentWidget = nullptr; QScrollArea* m_scrollArea = nullptr; From d951a9d317ee30777a6a569ecca03ef9e33adf09 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 12:59:50 +0200 Subject: [PATCH 6/8] [summary] Improve role names in SummaryModel --- src/modules/summary/Config.cpp | 18 +++++++++++++++--- src/modules/summary/Config.h | 7 +++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/modules/summary/Config.cpp b/src/modules/summary/Config.cpp index 98079cb6d..9038f786f 100644 --- a/src/modules/summary/Config.cpp +++ b/src/modules/summary/Config.cpp @@ -26,7 +26,9 @@ SummaryModel::SummaryModel( QObject* parent ) QHash< int, QByteArray > SummaryModel::roleNames() const { - return { { Qt::DisplayRole, "title" }, { Qt::UserRole, "message" } }; + // Not including WidgetRole here because that wouldn't make sense + // in a QML context which is where the roleNames are important. + return { { TitleRole, "title" }, { MessageRole, "message" } }; } QVariant @@ -36,8 +38,18 @@ SummaryModel::data( const QModelIndex& index, int role ) const { return QVariant(); } - const auto item = m_summary.at( index.row() ); - return role == Qt::DisplayRole ? item.title : item.message; + auto& item = m_summary.at( index.row() ); + switch ( role ) + { + case TitleRole: + return item.title; + case MessageRole: + return item.message; + case WidgetRole: + return item.widget ? QVariant::fromValue( item.widget ) : QVariant(); + default: + return QVariant(); + } } int diff --git a/src/modules/summary/Config.h b/src/modules/summary/Config.h index cf819b503..f0732f448 100644 --- a/src/modules/summary/Config.h +++ b/src/modules/summary/Config.h @@ -38,6 +38,13 @@ class SummaryModel : public QAbstractListModel friend class Config; public: + enum Roles : int + { + TitleRole = Qt::DisplayRole, // Name of the step + MessageRole = Qt::UserRole, // String saying what it will do + WidgetRole, // Pointer to widget + }; + explicit SummaryModel( QObject* parent = nullptr ); int rowCount( const QModelIndex& = QModelIndex() ) const override; QVariant data( const QModelIndex& index, int role ) const override; From 3bc90e6c06807639c2bb417013dc20987386c07d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 14:25:15 +0200 Subject: [PATCH 7/8] [summary] Factor out widget creation --- src/modules/summary/SummaryPage.cpp | 43 ++++++++++++++++++----------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index f3f05c3cc..2e2199840 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -79,6 +79,32 @@ createBodyLabel( const QString& text, const QPalette& bodyPalette ) return label; } +static QWidget* +createStepWidget( const QString& description, QWidget* innerWidget, const QPalette& palette ) +{ + QWidget* w = new QWidget(); + QHBoxLayout* itemBodyLayout = new QHBoxLayout; + w->setLayout( itemBodyLayout ); + + // Indent the inner box by a bit + itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 ); + QVBoxLayout* itemBodyCoreLayout = new QVBoxLayout; + itemBodyLayout->addLayout( itemBodyCoreLayout ); + CalamaresUtils::unmarginLayout( itemBodyLayout ); + + itemBodyCoreLayout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 ); + if ( !description.isEmpty() ) + { + itemBodyCoreLayout->addWidget( createBodyLabel( description, palette ) ); + } + if ( innerWidget ) + { + itemBodyCoreLayout->addWidget( innerWidget ); + } + + return w; +} + static void ensureSize( QWidget* parent, QScrollArea* container, Calamares::ViewStep* viewstep ) { @@ -134,22 +160,7 @@ SummaryPage::buildWidgets( Config* config, SummaryViewStep* viewstep ) first = false; m_layout->addWidget( createTitleLabel( step->prettyName(), titleFont ) ); - QHBoxLayout* itemBodyLayout = new QHBoxLayout; - m_layout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 ); - m_layout->addLayout( itemBodyLayout ); - itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 ); - QVBoxLayout* itemBodyCoreLayout = new QVBoxLayout; - itemBodyLayout->addLayout( itemBodyCoreLayout ); - CalamaresUtils::unmarginLayout( itemBodyLayout ); - if ( !text.isEmpty() ) - { - itemBodyCoreLayout->addWidget( createBodyLabel( text, bodyPalette ) ); - } - if ( widget ) - { - itemBodyCoreLayout->addWidget( widget ); - } - itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 ); + m_layout->addWidget( createStepWidget( text, widget, bodyPalette ) ); } m_layout->addStretch(); From 6b38985a5fd4494a81061080d03e965ce08dcc5f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 14:44:14 +0200 Subject: [PATCH 8/8] [summary] Start using the model --- src/modules/summary/SummaryPage.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index 2e2199840..c0df7afd7 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -140,26 +140,27 @@ SummaryPage::buildWidgets( Config* config, SummaryViewStep* viewstep ) QPalette bodyPalette( palette() ); bodyPalette.setColor( WindowBackground, palette().window().color().lighter( 108 ) ); - bool first = true; - const Calamares::ViewStepList steps = Config::stepsForSummary( viewstep ); + const auto* model = config->summaryModel(); + const auto rowCount = model->rowCount(); - for ( Calamares::ViewStep* step : steps ) + for ( int row = 0; row < rowCount; row++ ) { - QString text = step->prettyStatus(); - QWidget* widget = step->createSummaryWidget(); + const auto rowIndex = model->index( row ); + QString title = model->data( rowIndex, SummaryModel::TitleRole ).toString(); + QString text = model->data( rowIndex, SummaryModel::MessageRole ).toString(); + QWidget* widget = model->data( rowIndex, SummaryModel::WidgetRole ).value< QWidget* >(); if ( text.isEmpty() && !widget ) { continue; } - if ( !first ) + if ( row > 0 ) { m_layout->addSpacing( SECTION_SPACING ); } - first = false; - m_layout->addWidget( createTitleLabel( step->prettyName(), titleFont ) ); + m_layout->addWidget( createTitleLabel( title, titleFont ) ); m_layout->addWidget( createStepWidget( text, widget, bodyPalette ) ); } m_layout->addStretch();