From 338635146f792f448ab59448fc72d01a078634b5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 20 Jul 2020 12:58:35 +0200 Subject: [PATCH] [locale] Hand the Config object also to the page --- src/modules/locale/LocalePage.cpp | 5 +++-- src/modules/locale/LocalePage.h | 7 ++++++- src/modules/locale/LocaleViewStep.cpp | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index 53d97ea02..faeae7edc 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -19,6 +19,7 @@ #include "LocalePage.h" +#include "Config.h" #include "SetTimezoneJob.h" #include "timezonewidget/timezonewidget.h" @@ -26,7 +27,6 @@ #include "JobQueue.h" #include "LCLocaleDialog.h" #include "Settings.h" - #include "locale/Label.h" #include "locale/TimeZone.h" #include "utils/CalamaresUtilsGui.h" @@ -40,8 +40,9 @@ #include #include -LocalePage::LocalePage( QWidget* parent ) +LocalePage::LocalePage( Config* config, QWidget* parent ) : QWidget( parent ) + , m_config( config ) , m_regionList( CalamaresUtils::Locale::TZRegion::fromZoneTab() ) , m_regionModel( std::make_unique< CalamaresUtils::Locale::CStringListModel >( m_regionList ) ) , m_blockTzWidgetSet( false ) diff --git a/src/modules/locale/LocalePage.h b/src/modules/locale/LocalePage.h index f31d81fb6..1e2052223 100644 --- a/src/modules/locale/LocalePage.h +++ b/src/modules/locale/LocalePage.h @@ -32,13 +32,15 @@ class QComboBox; class QLabel; class QPushButton; + +class Config; class TimeZoneWidget; class LocalePage : public QWidget { Q_OBJECT public: - explicit LocalePage( QWidget* parent = nullptr ); + explicit LocalePage( class Config* config, QWidget* parent = nullptr ); virtual ~LocalePage(); void init( const QString& initialRegion, const QString& initialZone, const QString& localeGenPath ); @@ -54,6 +56,9 @@ public: private: LocaleConfiguration guessLocaleConfiguration() const; + /// @brief Non-owning pointer to the ViewStep's config + Config* m_config; + // For the given locale config, return two strings describing // the settings for language and numbers. std::pair< QString, QString > prettyLocaleStatus( const LocaleConfiguration& ) const; diff --git a/src/modules/locale/LocaleViewStep.cpp b/src/modules/locale/LocaleViewStep.cpp index 880f42a7d..173532bf8 100644 --- a/src/modules/locale/LocaleViewStep.cpp +++ b/src/modules/locale/LocaleViewStep.cpp @@ -68,7 +68,7 @@ LocaleViewStep::setUpPage() { if ( !m_actualWidget ) { - m_actualWidget = new LocalePage(); + m_actualWidget = new LocalePage( m_config.get() ); } m_actualWidget->init( m_startingTimezone.first, m_startingTimezone.second, m_localeGenPath ); m_widget->layout()->addWidget( m_actualWidget );