From 54250887e1e1136fe34cb30a381ed69ea5f338ba Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 19 Feb 2024 22:59:31 +0100 Subject: [PATCH] [locale] Adapt to changed RegionZonePair - add method that takes a pair directly - don't act like a pair is a std::pair --- src/modules/locale/Config.cpp | 16 ++++++++++++---- src/modules/locale/Config.h | 4 ++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index 54ff5eb64..8fa17a768 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -233,7 +233,7 @@ Config::setCurrentLocation() { if ( !m_currentLocation && m_startingTimezone.isValid() ) { - setCurrentLocation( m_startingTimezone.first, m_startingTimezone.second ); + setCurrentLocation( m_startingTimezone ); } if ( !m_selectedLocaleConfiguration.explicit_lang ) { @@ -248,10 +248,16 @@ Config::setCurrentLocation( const QString& regionzone ) auto r = Calamares::GeoIP::splitTZString( regionzone ); if ( r.isValid() ) { - setCurrentLocation( r.first, r.second ); + setCurrentLocation( r ); } } +void +Config::setCurrentLocation( const Calamares::GeoIP::RegionZonePair& tz ) +{ + setCurrentLocation( tz.region(), tz.zone() ); +} + void Config::setCurrentLocation( const QString& regionName, const QString& zoneName ) { @@ -407,13 +413,15 @@ localeLabel( const QString& s ) QString Config::currentLanguageStatus() const { - return tr( "The system language will be set to %1.", "@info" ).arg( localeLabel( m_selectedLocaleConfiguration.language() ) ); + return tr( "The system language will be set to %1.", "@info" ) + .arg( localeLabel( m_selectedLocaleConfiguration.language() ) ); } QString Config::currentLCStatus() const { - return tr( "The numbers and dates locale will be set to %1.", "@info" ).arg( localeLabel( m_selectedLocaleConfiguration.lc_numeric ) ); + return tr( "The numbers and dates locale will be set to %1.", "@info" ) + .arg( localeLabel( m_selectedLocaleConfiguration.lc_numeric ) ); } QString diff --git a/src/modules/locale/Config.h b/src/modules/locale/Config.h index a0184e6d5..a26d25a9c 100644 --- a/src/modules/locale/Config.h +++ b/src/modules/locale/Config.h @@ -108,6 +108,7 @@ public Q_SLOTS: * change the actual location. */ void setCurrentLocation( const QString& regionzone ); + /** @brief Sets a location by split name * * @p region should be "America" or the like, while @p zone @@ -115,6 +116,9 @@ public Q_SLOTS: */ void setCurrentLocation( const QString& region, const QString& zone ); + /** @brief Sets a location by strongly-typed region+zone name */ + void setCurrentLocation( const Calamares::GeoIP::RegionZonePair& tz ); + /** @brief Sets a location by pointer to zone data. * */