[locale] Add prettyStatus to Config

- this is present in the previous config, and helps make the modules
  consistent by returning prettyStatus in both ViewSteps.
This commit is contained in:
Adriaan de Groot 2020-07-24 11:53:32 +02:00
parent 07c096673d
commit a080e47f4b
4 changed files with 21 additions and 4 deletions

View File

@ -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( "<br/>" ) );
}
static inline void
getLocaleGenLines( const QVariantMap& configurationMap, QStringList& localeGenLines )
{

View File

@ -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;

View File

@ -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( "<br/>" ) );
return m_config->prettyStatus();
}

View File

@ -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( "<br/>" ) );
return m_config->prettyStatus();
}
bool