[summary] Create Config object

- Create Config object, even if it's not used just yet
- Introduce onLeave() for the Page, better name than
  (re-)creating the content (!?) when leaving
main
Adriaan de Groot 3 years ago
parent aba212d700
commit 9eee00c286

@ -166,6 +166,13 @@ SummaryPage::createContentWidget()
CalamaresUtils::unmarginLayout( m_layout );
}
void
SummaryPage::onLeave()
{
delete m_contentWidget;
m_contentWidget = nullptr;
}
QLabel*
SummaryPage::createTitleLabel( const QString& text ) const
{

@ -44,11 +44,14 @@ class SummaryPage : public QWidget
public:
explicit SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent = nullptr );
/// @brief Create contents showing all of the summary
void onActivate();
void createContentWidget();
/// @brief Clean up the widgets
void onLeave();
private:
Calamares::ViewStepList stepsForSummary( const Calamares::ViewStepList& allSteps ) const;
void createContentWidget();
const SummaryViewStep* m_thisViewStep;

@ -16,6 +16,7 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( SummaryViewStepFactory, registerPlugin< Sum
SummaryViewStep::SummaryViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_widget( new SummaryPage( this ) )
, m_config( new Config( this ) )
{
emit nextStatusChanged( true );
}
@ -27,6 +28,7 @@ SummaryViewStep::~SummaryViewStep()
{
m_widget->deleteLater();
}
delete m_config;
}
@ -82,6 +84,7 @@ SummaryViewStep::jobs() const
void
SummaryViewStep::onActivate()
{
m_config->init();
m_widget->onActivate();
}
@ -89,5 +92,5 @@ SummaryViewStep::onActivate()
void
SummaryViewStep::onLeave()
{
m_widget->createContentWidget();
m_widget->onLeave();
}

@ -10,6 +10,8 @@
#ifndef SUMMARYPAGEPLUGIN_H
#define SUMMARYPAGEPLUGIN_H
#include "Config.h"
#include "DllMacro.h"
#include "utils/PluginFactory.h"
#include "viewpages/ViewStep.h"
@ -40,7 +42,8 @@ public:
void onLeave() override;
private:
SummaryPage* m_widget;
SummaryPage* m_widget = nullptr;
Config* m_config = nullptr;
};
CALAMARES_PLUGIN_FACTORY_DECLARATION( SummaryViewStepFactory )

Loading…
Cancel
Save