[summary] Move title to Config object
Rather than Config asking its (owning) ViewStep what the title is -- all existing implementations have a prettyName() for that -- move the title into Config and re-do-the ViewSteps to use it. Rename init() to something meaningful.
This commit is contained in:
parent
4e588584d7
commit
5de99d53d2
@ -67,9 +67,8 @@ SummaryModel::setSummaryList( const Calamares::ViewStepList& steps, bool withWid
|
||||
Q_EMIT endResetModel();
|
||||
}
|
||||
|
||||
Config::Config( Calamares::ViewStep* parent )
|
||||
Config::Config( QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_thisViewStep( parent )
|
||||
, m_summary( new SummaryModel( this ) )
|
||||
|
||||
{
|
||||
@ -80,24 +79,24 @@ Config::Config( Calamares::ViewStep* parent )
|
||||
void
|
||||
Config::retranslate()
|
||||
{
|
||||
m_title = m_thisViewStep->prettyName();
|
||||
m_title = tr( "Summary" );
|
||||
|
||||
if ( Calamares::Settings::instance()->isSetupMode() )
|
||||
{
|
||||
m_message = ( tr( "This is an overview of what will happen once you start "
|
||||
"the setup procedure." ) );
|
||||
m_message = tr( "This is an overview of what will happen once you start "
|
||||
"the setup procedure." );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_message = ( tr( "This is an overview of what will happen once you start "
|
||||
"the install procedure." ) );
|
||||
m_message = tr( "This is an overview of what will happen once you start "
|
||||
"the install procedure." );
|
||||
}
|
||||
Q_EMIT titleChanged( m_title );
|
||||
Q_EMIT messageChanged( m_message );
|
||||
}
|
||||
|
||||
void
|
||||
Config::init()
|
||||
Config::collectSummaries( const Calamares::ViewStep* upToHere )
|
||||
{
|
||||
Calamares::ViewStepList steps;
|
||||
for ( Calamares::ViewStep* step : Calamares::ViewManager::instance()->viewSteps() )
|
||||
@ -116,7 +115,7 @@ Config::init()
|
||||
// we know we're providing a summary of steps up until this
|
||||
// view step, so we now have steps since the previous exec, up
|
||||
// to this summary.
|
||||
if ( m_thisViewStep == step )
|
||||
if ( upToHere == step )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -70,10 +70,10 @@ class Config : public QObject
|
||||
Q_PROPERTY( QAbstractListModel* summaryModel READ summaryModel CONSTANT FINAL )
|
||||
|
||||
public:
|
||||
explicit Config( Calamares::ViewStep* parent = nullptr );
|
||||
explicit Config( QObject* parent = nullptr );
|
||||
|
||||
///@brief Called later, to load the model once all viewsteps are there
|
||||
void init();
|
||||
void collectSummaries( const Calamares::ViewStep* upToHere );
|
||||
|
||||
QAbstractListModel* summaryModel() const { return m_summary; }
|
||||
|
||||
@ -84,7 +84,6 @@ private:
|
||||
Calamares::ViewStepList stepsForSummary( const Calamares::ViewStepList& allSteps ) const;
|
||||
void retranslate();
|
||||
|
||||
const Calamares::ViewStep* m_thisViewStep;
|
||||
SummaryModel* m_summary;
|
||||
|
||||
QString m_title;
|
||||
|
@ -35,7 +35,7 @@ SummaryViewStep::~SummaryViewStep()
|
||||
QString
|
||||
SummaryViewStep::prettyName() const
|
||||
{
|
||||
return tr( "Summary" );
|
||||
return m_config->title();
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ SummaryViewStep::jobs() const
|
||||
void
|
||||
SummaryViewStep::onActivate()
|
||||
{
|
||||
m_config->init();
|
||||
m_config->collectSummaries( this );
|
||||
m_widget->onActivate();
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ SummaryQmlViewStep::~SummaryQmlViewStep() {}
|
||||
QString
|
||||
SummaryQmlViewStep::prettyName() const
|
||||
{
|
||||
return tr( "Summary" );
|
||||
return m_config->title();
|
||||
}
|
||||
|
||||
|
||||
@ -69,5 +69,5 @@ SummaryQmlViewStep::onActivate()
|
||||
{
|
||||
// Collect the steps before this one: those need to have their
|
||||
// summary (text or widget) displayed.
|
||||
m_config->init();
|
||||
m_config->collectSummaries( this );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user