From 6b38985a5fd4494a81061080d03e965ce08dcc5f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 Oct 2021 14:44:14 +0200 Subject: [PATCH] [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();