diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index f28a2d0b5..7a49525f2 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -199,6 +199,11 @@ Config::Config( QObject* parent ) { "set-timezone", location->region() + '/' + location->zone() } ); } } ); + + auto prettyStatusNotify = [&]() { emit prettyStatusChanged( prettyStatus() ); }; + connect( this, &Config::currentLanguageStatusChanged, prettyStatusNotify ); + connect( this, &Config::currentLCStatusChanged, prettyStatusNotify ); + connect( this, &Config::currentLocationStatusChanged, prettyStatusNotify ); } Config::~Config() {} @@ -351,6 +356,13 @@ Config::currentLCStatus() const .arg( localeLabel( m_selectedLocaleConfiguration.lc_numeric ) ); } +QString +Config::prettyStatus() const +{ + QStringList l { currentLocationStatus(), currentLanguageStatus(), currentLCStatus() }; + return l.join( QStringLiteral( "
" ) ); +} + static inline void getLocaleGenLines( const QVariantMap& configurationMap, QStringList& localeGenLines ) { diff --git a/src/modules/locale/Config.h b/src/modules/locale/Config.h index d74555ee5..e9a8e6373 100644 --- a/src/modules/locale/Config.h +++ b/src/modules/locale/Config.h @@ -51,6 +51,9 @@ class Config : public QObject Q_PROPERTY( QString currentLanguageCode READ currentLanguageCode WRITE setLanguageExplicitly NOTIFY currentLanguageCodeChanged ) Q_PROPERTY( QString currentLCCode READ currentLCCode WRITE setLCLocaleExplicitly NOTIFY currentLCCodeChanged ) + // This is a long human-readable string with all three statuses + Q_PROPERTY( QString prettyStatus READ prettyStatus NOTIFY prettyStatusChanged FINAL ) + public: Config( QObject* parent = nullptr ); ~Config(); @@ -79,6 +82,9 @@ public: /// The human-readable description of what locale (LC_*) is used QString currentLCStatus() const; + /// The human-readable summary of what the module will do + QString prettyStatus() const; + const QStringList& supportedLocales() const { return m_localeGenLines; } CalamaresUtils::Locale::CStringListModel* regionModel() const { return m_regionModel.get(); } CalamaresUtils::Locale::CStringListModel* zonesModel() const { return m_zonesModel.get(); } @@ -122,6 +128,7 @@ signals: void currentLocationStatusChanged( const QString& ) const; void currentLanguageStatusChanged( const QString& ) const; void currentLCStatusChanged( const QString& ) const; + void prettyStatusChanged( const QString& ) const; void currentLanguageCodeChanged( const QString& ) const; void currentLCCodeChanged( const QString& ) const; diff --git a/src/modules/locale/LocaleViewStep.cpp b/src/modules/locale/LocaleViewStep.cpp index 8ae894aa8..a85c87e4f 100644 --- a/src/modules/locale/LocaleViewStep.cpp +++ b/src/modules/locale/LocaleViewStep.cpp @@ -89,8 +89,7 @@ LocaleViewStep::prettyName() const QString LocaleViewStep::prettyStatus() const { - QStringList l { m_config->currentLocationStatus(), m_config->currentLanguageStatus(), m_config->currentLCStatus() }; - return l.join( QStringLiteral( "
" ) ); + return m_config->prettyStatus(); } diff --git a/src/modules/localeq/LocaleQmlViewStep.cpp b/src/modules/localeq/LocaleQmlViewStep.cpp index d1186af1f..ead2e2673 100644 --- a/src/modules/localeq/LocaleQmlViewStep.cpp +++ b/src/modules/localeq/LocaleQmlViewStep.cpp @@ -44,8 +44,7 @@ LocaleQmlViewStep::prettyName() const QString LocaleQmlViewStep::prettyStatus() const { - QStringList l { m_config->currentLocationStatus(), m_config->currentLanguageStatus(), m_config->currentLCStatus() }; - return l.join( QStringLiteral( "
" ) ); + return m_config->prettyStatus(); } bool