[summary] Hook up Config message to page
- the Page displays a simple message describing what the summary is all about; Config has the same message, use that. Needed some re-jigging to get the signals and slots right.
This commit is contained in:
parent
9eee00c286
commit
4e588584d7
@ -92,8 +92,8 @@ Config::retranslate()
|
||||
m_message = ( tr( "This is an overview of what will happen once you start "
|
||||
"the install procedure." ) );
|
||||
}
|
||||
Q_EMIT titleChanged();
|
||||
Q_EMIT messageChanged();
|
||||
Q_EMIT titleChanged( m_title );
|
||||
Q_EMIT messageChanged( m_message );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -63,9 +63,9 @@ class Config : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
///@brief Name of this summary (generally, "Summary")
|
||||
Q_PROPERTY( QString title MEMBER m_title NOTIFY titleChanged )
|
||||
Q_PROPERTY( QString title READ title NOTIFY titleChanged )
|
||||
///@brief Description of what the summary means
|
||||
Q_PROPERTY( QString message MEMBER m_message NOTIFY messageChanged )
|
||||
Q_PROPERTY( QString message READ message NOTIFY messageChanged )
|
||||
|
||||
Q_PROPERTY( QAbstractListModel* summaryModel READ summaryModel CONSTANT FINAL )
|
||||
|
||||
@ -77,6 +77,9 @@ public:
|
||||
|
||||
QAbstractListModel* summaryModel() const { return m_summary; }
|
||||
|
||||
QString title() const { return m_title; }
|
||||
QString message() const { return m_message; }
|
||||
|
||||
private:
|
||||
Calamares::ViewStepList stepsForSummary( const Calamares::ViewStepList& allSteps ) const;
|
||||
void retranslate();
|
||||
@ -84,11 +87,11 @@ private:
|
||||
const Calamares::ViewStep* m_thisViewStep;
|
||||
SummaryModel* m_summary;
|
||||
|
||||
QString m_message;
|
||||
QString m_title;
|
||||
QString m_message;
|
||||
|
||||
signals:
|
||||
void messageChanged();
|
||||
void titleChanged();
|
||||
Q_SIGNALS:
|
||||
void titleChanged( QString title );
|
||||
void messageChanged( QString message );
|
||||
};
|
||||
#endif
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
static const int SECTION_SPACING = 12;
|
||||
|
||||
SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent )
|
||||
SummaryPage::SummaryPage( Config* config, const SummaryViewStep* thisViewStep, QWidget* parent )
|
||||
: QWidget()
|
||||
, m_thisViewStep( thisViewStep )
|
||||
, m_contentWidget( nullptr )
|
||||
@ -37,6 +37,7 @@ SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent )
|
||||
{
|
||||
Q_UNUSED( parent )
|
||||
|
||||
|
||||
this->setObjectName( "summaryStep" );
|
||||
|
||||
Q_ASSERT( m_thisViewStep );
|
||||
@ -45,11 +46,8 @@ SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent )
|
||||
|
||||
QLabel* headerLabel = new QLabel( this );
|
||||
headerLabel->setObjectName( "summaryTitle" );
|
||||
CALAMARES_RETRANSLATE( if ( Calamares::Settings::instance()->isSetupMode() )
|
||||
headerLabel->setText( tr( "This is an overview of what will happen once you start "
|
||||
"the setup procedure." ) );
|
||||
else headerLabel->setText( tr( "This is an overview of what will happen once you start "
|
||||
"the install procedure." ) ); );
|
||||
headerLabel->setText( config->message() );
|
||||
connect( config, &Config::messageChanged, headerLabel, &QLabel::setText );
|
||||
layout->addWidget( headerLabel );
|
||||
layout->addWidget( m_scrollArea );
|
||||
m_scrollArea->setWidgetResizable( true );
|
||||
|
@ -14,10 +14,13 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class Config;
|
||||
class SummaryViewStep;
|
||||
|
||||
class QLabel;
|
||||
class QScrollArea;
|
||||
class QVBoxLayout;
|
||||
class SummaryViewStep;
|
||||
|
||||
|
||||
/** @brief Provide a summary view with to-be-done action descriptions.
|
||||
*
|
||||
@ -42,7 +45,7 @@ class SummaryPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent = nullptr );
|
||||
explicit SummaryPage( Config* config, const SummaryViewStep* thisViewStep, QWidget* parent = nullptr );
|
||||
|
||||
/// @brief Create contents showing all of the summary
|
||||
void onActivate();
|
||||
|
@ -15,8 +15,8 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( SummaryViewStepFactory, registerPlugin< Sum
|
||||
|
||||
SummaryViewStep::SummaryViewStep( QObject* parent )
|
||||
: Calamares::ViewStep( parent )
|
||||
, m_widget( new SummaryPage( this ) )
|
||||
, m_config( new Config( this ) )
|
||||
, m_widget( new SummaryPage( m_config, this ) )
|
||||
{
|
||||
emit nextStatusChanged( true );
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ public:
|
||||
void onLeave() override;
|
||||
|
||||
private:
|
||||
SummaryPage* m_widget = nullptr;
|
||||
Config* m_config = nullptr;
|
||||
SummaryPage* m_widget = nullptr;
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( SummaryViewStepFactory )
|
||||
|
Loading…
Reference in New Issue
Block a user