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