diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index ee2c2a70b..6da84c08c 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -281,7 +281,7 @@ _gettext_languages() Calamares::GlobalStorage* gs = jq ? jq->globalStorage() : CalamaresPython::GlobalStoragePythonWrapper::globalStorageInstance(); - QString lang = CalamaresUtils::Locale::readGS( *gs, QStringLiteral( "LANG" ) ); + QString lang = Calamares::Locale::readGS( *gs, QStringLiteral( "LANG" ) ); if ( !lang.isEmpty() ) { languages.append( lang ); diff --git a/src/libcalamares/locale/CountryData_p.cpp b/src/libcalamares/locale/CountryData_p.cpp index 455027ef8..07ef30e3f 100644 --- a/src/libcalamares/locale/CountryData_p.cpp +++ b/src/libcalamares/locale/CountryData_p.cpp @@ -39,7 +39,6 @@ // *INDENT-OFF* // clang-format off - struct CountryData { QLocale::Language l; @@ -253,5 +252,4 @@ static const CountryData country_data_table[] = { static_assert( (sizeof(country_data_table) / sizeof(CountryData)) == country_data_size, "Table size mismatch for CountryData" ); - // END Generated from CLDR data diff --git a/src/libcalamares/locale/Global.cpp b/src/libcalamares/locale/Global.cpp index c9fb27fbc..9a37fd8a1 100644 --- a/src/libcalamares/locale/Global.cpp +++ b/src/libcalamares/locale/Global.cpp @@ -12,7 +12,7 @@ #include "GlobalStorage.h" #include "utils/Logger.h" -namespace CalamaresUtils +namespace Calamares { namespace Locale { @@ -88,4 +88,4 @@ readGS( Calamares::GlobalStorage& gs, const QString& key ) } } // namespace Locale -} // namespace CalamaresUtils +} // namespace Calamares diff --git a/src/libcalamares/locale/Global.h b/src/libcalamares/locale/Global.h index 326fef109..6a4047b63 100644 --- a/src/libcalamares/locale/Global.h +++ b/src/libcalamares/locale/Global.h @@ -28,10 +28,7 @@ namespace Calamares { class GlobalStorage; -} // namespace Calamares -namespace CalamaresUtils -{ namespace Locale { @@ -81,6 +78,6 @@ DLLEXPORT void clearGS( Calamares::GlobalStorage& gs ); DLLEXPORT QString readGS( Calamares::GlobalStorage& gs, const QString& key ); } // namespace Locale -} // namespace CalamaresUtils +} // namespace Calamares #endif diff --git a/src/libcalamares/locale/Tests.cpp b/src/libcalamares/locale/Tests.cpp index 2b8021730..6ab78b488 100644 --- a/src/libcalamares/locale/Tests.cpp +++ b/src/libcalamares/locale/Tests.cpp @@ -137,7 +137,6 @@ LocaleTests::testInterlingue() QCOMPARE( QLocale( "bork" ).language(), QLocale::C ); } - static const QStringList& someLanguages() { @@ -145,7 +144,6 @@ someLanguages() return languages; } - /** @brief Check consistency of test data * Check that all the languages used in testing, are actually enabled * in Calamares translations. @@ -166,11 +164,11 @@ LocaleTests::testTranslatableLanguages() void LocaleTests::testTranslatableConfig1() { - CalamaresUtils::Locale::TranslatedString ts0; + Calamares::Locale::TranslatedString ts0; QVERIFY( ts0.isEmpty() ); QCOMPARE( ts0.count(), 1 ); // the empty string - CalamaresUtils::Locale::TranslatedString ts1( "Hello" ); + Calamares::Locale::TranslatedString ts1( "Hello" ); QCOMPARE( ts1.count(), 1 ); QVERIFY( !ts1.isEmpty() ); @@ -179,7 +177,7 @@ LocaleTests::testTranslatableConfig1() QVariantMap map; map.insert( "description", "description (no language)" ); - CalamaresUtils::Locale::TranslatedString ts2( map, "description" ); + Calamares::Locale::TranslatedString ts2( map, "description" ); QCOMPARE( ts2.count(), 1 ); QVERIFY( !ts2.isEmpty() ); @@ -205,7 +203,7 @@ LocaleTests::testTranslatableConfig2() } // If there's no untranslated string in the map, it is considered empty - CalamaresUtils::Locale::TranslatedString ts0( map, "description" ); + Calamares::Locale::TranslatedString ts0( map, "description" ); QVERIFY( ts0.isEmpty() ); // Because no untranslated string QCOMPARE( ts0.count(), someLanguages().count() + 1 ); // But there are entries for the translations, plus an empty string @@ -214,7 +212,7 @@ LocaleTests::testTranslatableConfig2() map.insert( QString( "description" ), "description (no language)" ); map.insert( QString( "name" ), "name (no language)" ); - CalamaresUtils::Locale::TranslatedString ts1( map, "description" ); + Calamares::Locale::TranslatedString ts1( map, "description" ); // The +1 is because "" is always also inserted QCOMPARE( ts1.count(), someLanguages().count() + 1 ); QVERIFY( !ts1.isEmpty() ); @@ -237,13 +235,13 @@ LocaleTests::testTranslatableConfig2() QCOMPARE( ts1.get( QLocale( QLocale::Language::Serbian, QLocale::Script::LatinScript, QLocale::Country::Serbia ) ), QStringLiteral( "description (language sr@latin)" ) ); - CalamaresUtils::Locale::TranslatedString ts2( map, "name" ); + Calamares::Locale::TranslatedString ts2( map, "name" ); // We skipped dutch this time QCOMPARE( ts2.count(), someLanguages().count() ); QVERIFY( !ts2.isEmpty() ); // This key doesn't exist - CalamaresUtils::Locale::TranslatedString ts3( map, "front" ); + Calamares::Locale::TranslatedString ts3( map, "front" ); QVERIFY( ts3.isEmpty() ); QCOMPARE( ts3.count(), 1 ); // The empty string } @@ -251,7 +249,7 @@ LocaleTests::testTranslatableConfig2() void LocaleTests::testTranslatableConfigContext() { - using TS = CalamaresUtils::Locale::TranslatedString; + using TS = Calamares::Locale::TranslatedString; const QString original( "Quit" ); TS quitUntranslated( original ); @@ -273,11 +271,10 @@ LocaleTests::testTranslatableConfigContext() QCOMPARE( tr( "Quit" ), QStringLiteral( "Ophouden" ) ); } - void LocaleTests::testRegions() { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; RegionsModel regions; QVERIFY( regions.rowCount( QModelIndex() ) > 3 ); // Africa, America, Asia @@ -295,7 +292,6 @@ LocaleTests::testRegions() QVERIFY( !names.contains( "UTC" ) ); } - static void displayedNames( QAbstractItemModel& model, QStringList& names ) { @@ -312,7 +308,7 @@ displayedNames( QAbstractItemModel& model, QStringList& names ) void LocaleTests::testSimpleZones() { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; ZonesModel zones; QVERIFY( zones.rowCount( QModelIndex() ) > 24 ); @@ -338,7 +334,7 @@ LocaleTests::testSimpleZones() void LocaleTests::testComplexZones() { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; ZonesModel zones; RegionalZonesModel europe( &zones ); @@ -377,7 +373,7 @@ LocaleTests::testComplexZones() void LocaleTests::testTZLookup() { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; ZonesModel zones; QVERIFY( zones.find( "America", "New_York" ) ); @@ -391,7 +387,7 @@ LocaleTests::testTZLookup() void LocaleTests::testTZIterator() { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; const ZonesModel zones; QVERIFY( zones.find( "Europe", "Rome" ) ); @@ -437,7 +433,7 @@ LocaleTests::testLocationLookup_data() void LocaleTests::testLocationLookup() { - const CalamaresUtils::Locale::ZonesModel zones; + const Calamares::Locale::ZonesModel zones; QFETCH( double, latitude ); QFETCH( double, longitude ); @@ -456,7 +452,7 @@ LocaleTests::testLocationLookup2() // Spot patch // "ZA -3230+02259 Africa/Johannesburg\n"; - const CalamaresUtils::Locale::ZonesModel zones; + const Calamares::Locale::ZonesModel zones; const auto* zone = zones.find( -26.15, 28.00 ); QCOMPARE( zone->zone(), QString( "Johannesburg" ) ); // The TZ data sources use minutes-and-seconds notation, @@ -490,7 +486,7 @@ LocaleTests::testGSUpdates() // Insert one { - CalamaresUtils::Locale::insertGS( gs, "LANG", "en_US" ); + Calamares::Locale::insertGS( gs, "LANG", "en_US" ); auto map = gs.value( gsKey ).toMap(); QCOMPARE( map.count(), 1 ); QCOMPARE( map.value( "LANG" ).toString(), QString( "en_US" ) ); @@ -498,7 +494,7 @@ LocaleTests::testGSUpdates() // Overwrite one { - CalamaresUtils::Locale::insertGS( gs, "LANG", "nl_BE" ); + Calamares::Locale::insertGS( gs, "LANG", "nl_BE" ); auto map = gs.value( gsKey ).toMap(); QCOMPARE( map.count(), 1 ); QCOMPARE( map.value( "LANG" ).toString(), QString( "nl_BE" ) ); @@ -506,7 +502,7 @@ LocaleTests::testGSUpdates() // Insert a second value { - CalamaresUtils::Locale::insertGS( gs, "LC_TIME", "UTC" ); + Calamares::Locale::insertGS( gs, "LC_TIME", "UTC" ); auto map = gs.value( gsKey ).toMap(); QCOMPARE( map.count(), 2 ); QCOMPARE( map.value( "LANG" ).toString(), QString( "nl_BE" ) ); @@ -520,7 +516,7 @@ LocaleTests::testGSUpdates() kv.insert( "LC_CURRENCY", "rbl" ); // Overwrite one, add one - CalamaresUtils::Locale::insertGS( gs, kv, CalamaresUtils::Locale::InsertMode::Merge ); + Calamares::Locale::insertGS( gs, kv, Calamares::Locale::InsertMode::Merge ); auto map = gs.value( gsKey ).toMap(); QCOMPARE( map.count(), 3 ); QCOMPARE( map.value( "LANG" ).toString(), QString( "en_SU" ) ); @@ -535,7 +531,7 @@ LocaleTests::testGSUpdates() kv.insert( "LC_CURRENCY", "peso" ); // Overwrite one, add one - CalamaresUtils::Locale::insertGS( gs, kv, CalamaresUtils::Locale::InsertMode::Overwrite ); + Calamares::Locale::insertGS( gs, kv, Calamares::Locale::InsertMode::Overwrite ); auto map = gs.value( gsKey ).toMap(); QCOMPARE( map.count(), 2 ); // the rest were cleared QCOMPARE( map.value( "LANG" ).toString(), QString( "en_US" ) ); @@ -545,7 +541,6 @@ LocaleTests::testGSUpdates() } } - QTEST_GUILESS_MAIN( LocaleTests ) #include "utils/moc-warnings.h" diff --git a/src/libcalamares/locale/TimeZone.cpp b/src/libcalamares/locale/TimeZone.cpp index 274cf7eab..f39aede68 100644 --- a/src/libcalamares/locale/TimeZone.cpp +++ b/src/libcalamares/locale/TimeZone.cpp @@ -20,7 +20,7 @@ static const char TZ_DATA_FILE[] = "/usr/share/zoneinfo/zone.tab"; -namespace CalamaresUtils +namespace Calamares { namespace Locale { @@ -61,7 +61,6 @@ getRightGeoLocation( QString str ) return sign * num; } - TimeZoneData::TimeZoneData( const QString& region, const QString& zone, const QString& country, @@ -83,7 +82,6 @@ TimeZoneData::tr() const return QObject::tr( m_human, "tz_names" ); } - class RegionData : public TranslatableString { public: @@ -384,9 +382,8 @@ find( double startingDistance, const TimeZoneData* ZonesModel::find( const std::function< double( const TimeZoneData* ) >& distanceFunc ) const { - const auto* officialZone = CalamaresUtils::Locale::find( 1000000.0, m_private->m_zones, distanceFunc ); - const auto* altZone - = CalamaresUtils::Locale::find( distanceFunc( officialZone ), m_private->m_altZones, distanceFunc ); + const auto* officialZone = Calamares::Locale::find( 1000000.0, m_private->m_zones, distanceFunc ); + const auto* altZone = Calamares::Locale::find( distanceFunc( officialZone ), m_private->m_altZones, distanceFunc ); // If nothing was closer than the official zone already was, altZone is // nullptr; but if there is a spot-patch, then we need to re-find @@ -444,7 +441,6 @@ ZonesModel::lookup( double latitude, double longitude ) const return const_cast< QObject* >( reinterpret_cast< const QObject* >( p ) ); } - ZonesModel::Iterator::operator bool() const { return 0 <= m_index && m_index < m_p->m_zones.count(); @@ -460,7 +456,7 @@ ZonesModel::Iterator::operator*() const return nullptr; } -RegionalZonesModel::RegionalZonesModel( CalamaresUtils::Locale::ZonesModel* source, QObject* parent ) +RegionalZonesModel::RegionalZonesModel( Calamares::Locale::ZonesModel* source, QObject* parent ) : QSortFilterProxyModel( parent ) , m_private( privateInstance() ) { @@ -497,9 +493,8 @@ RegionalZonesModel::filterAcceptsRow( int sourceRow, const QModelIndex& ) const return ( zone->m_region == m_region ); } - } // namespace Locale -} // namespace CalamaresUtils +} // namespace Calamares #include "utils/moc-warnings.h" diff --git a/src/libcalamares/locale/TimeZone.h b/src/libcalamares/locale/TimeZone.h index e02612f5e..17043032c 100644 --- a/src/libcalamares/locale/TimeZone.h +++ b/src/libcalamares/locale/TimeZone.h @@ -31,7 +31,7 @@ #include #include -namespace CalamaresUtils +namespace Calamares { namespace Locale { @@ -76,7 +76,6 @@ private: double m_longitude; }; - /** @brief The list of timezone regions * * The regions are a short list of global areas (Africa, America, India ..) @@ -229,8 +228,7 @@ private: QString m_region; }; - } // namespace Locale -} // namespace CalamaresUtils +} // namespace Calamares #endif // LOCALE_TIMEZONE_H diff --git a/src/libcalamares/locale/TranslatableConfiguration.cpp b/src/libcalamares/locale/TranslatableConfiguration.cpp index 3a95722d1..c4742d6c2 100644 --- a/src/libcalamares/locale/TranslatableConfiguration.cpp +++ b/src/libcalamares/locale/TranslatableConfiguration.cpp @@ -19,7 +19,7 @@ #include #include -namespace CalamaresUtils +namespace Calamares { namespace Locale { @@ -114,6 +114,5 @@ TranslatedString::get( const QLocale& locale ) const } } - } // namespace Locale -} // namespace CalamaresUtils +} // namespace Calamares diff --git a/src/libcalamares/locale/TranslatableConfiguration.h b/src/libcalamares/locale/TranslatableConfiguration.h index 04897c0a4..1bc95b27b 100644 --- a/src/libcalamares/locale/TranslatableConfiguration.h +++ b/src/libcalamares/locale/TranslatableConfiguration.h @@ -25,7 +25,7 @@ #include #include -namespace CalamaresUtils +namespace Calamares { namespace Locale { @@ -99,6 +99,6 @@ private: const char* m_context = nullptr; }; } // namespace Locale -} // namespace CalamaresUtils +} // namespace Calamares #endif diff --git a/src/libcalamares/locale/TranslatableString.cpp b/src/libcalamares/locale/TranslatableString.cpp index 8f42a4e41..17a449166 100644 --- a/src/libcalamares/locale/TranslatableString.cpp +++ b/src/libcalamares/locale/TranslatableString.cpp @@ -9,7 +9,6 @@ */ #include "TranslatableString.h" - /** @brief Massage an identifier into a human-readable form * * Makes a copy of @p s, caller must free() it. @@ -37,7 +36,7 @@ munge( const char* s ) return t; } -namespace CalamaresUtils +namespace Calamares { namespace Locale { @@ -69,11 +68,10 @@ TranslatableString::TranslatableString( const QString& s ) { } - TranslatableString::~TranslatableString() { free( m_human ); } } // namespace Locale -} // namespace CalamaresUtils +} // namespace Calamares diff --git a/src/libcalamares/locale/TranslatableString.h b/src/libcalamares/locale/TranslatableString.h index 663f6a2c2..005370b23 100644 --- a/src/libcalamares/locale/TranslatableString.h +++ b/src/libcalamares/locale/TranslatableString.h @@ -12,7 +12,7 @@ #include -namespace CalamaresUtils +namespace Calamares { namespace Locale { @@ -53,6 +53,6 @@ protected: }; } // namespace Locale -} // namespace CalamaresUtils +} // namespace Calamares #endif diff --git a/src/libcalamares/locale/Translation.cpp b/src/libcalamares/locale/Translation.cpp index 9d2beafb8..c92468876 100644 --- a/src/libcalamares/locale/Translation.cpp +++ b/src/libcalamares/locale/Translation.cpp @@ -13,6 +13,9 @@ #include +namespace +{ + struct TranslationSpecialCase { const char* id; // The Calamares ID for the translation @@ -127,6 +130,7 @@ specialCaseSystemLanguage() { return ( s.language == language ) && lookup_region( region, s.regions ); } ); return ( it != std::cend( special_cases ) ) ? QString::fromLatin1( it->id ) : QString(); } +} // namespace namespace Calamares { diff --git a/src/libcalamares/locale/Translation.h b/src/libcalamares/locale/Translation.h index e7f066475..bdc58adf3 100644 --- a/src/libcalamares/locale/Translation.h +++ b/src/libcalamares/locale/Translation.h @@ -64,7 +64,6 @@ public: */ Translation( const Id& localeId, LabelFormat format = LabelFormat::IfNeededWithCountry, QObject* parent = nullptr ); - /** @brief Define a sorting order. * * Locales are sorted by their id, which means the ISO 2-letter code + country. diff --git a/src/libcalamares/locale/TranslationsModel.h b/src/libcalamares/locale/TranslationsModel.h index c755f6dca..0fdad0342 100644 --- a/src/libcalamares/locale/TranslationsModel.h +++ b/src/libcalamares/locale/TranslationsModel.h @@ -18,7 +18,6 @@ #include #include - namespace Calamares { namespace Locale diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp index 785f12458..c158efcbf 100644 --- a/src/modules/keyboard/Config.cpp +++ b/src/modules/keyboard/Config.cpp @@ -629,7 +629,7 @@ Config::guessLocaleKeyboardLayout() // Try to preselect a layout, depending on language and locale Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - QString lang = CalamaresUtils::Locale::readGS( *gs, QStringLiteral( "LANG" ) ); + QString lang = Calamares::Locale::readGS( *gs, QStringLiteral( "LANG" ) ); cDebug() << "Got locale language" << lang; if ( !lang.isEmpty() ) diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index 8167aaec2..8d6ff7e30 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -147,7 +147,7 @@ loadLocales( const QString& localeGenPath ) } static bool -updateGSLocation( Calamares::GlobalStorage* gs, const CalamaresUtils::Locale::TimeZoneData* location ) +updateGSLocation( Calamares::GlobalStorage* gs, const Calamares::Locale::TimeZoneData* location ) { const QString regionKey = QStringLiteral( "locationRegion" ); const QString zoneKey = QStringLiteral( "locationZone" ); @@ -176,14 +176,14 @@ updateGSLocation( Calamares::GlobalStorage* gs, const CalamaresUtils::Locale::Ti static void updateGSLocale( Calamares::GlobalStorage* gs, const LocaleConfiguration& locale ) { - CalamaresUtils::Locale::insertGS( *gs, locale.toMap(), CalamaresUtils::Locale::InsertMode::Overwrite ); + Calamares::Locale::insertGS( *gs, locale.toMap(), Calamares::Locale::InsertMode::Overwrite ); } Config::Config( QObject* parent ) : QObject( parent ) - , m_regionModel( std::make_unique< CalamaresUtils::Locale::RegionsModel >() ) - , m_zonesModel( std::make_unique< CalamaresUtils::Locale::ZonesModel >() ) - , m_regionalZonesModel( std::make_unique< CalamaresUtils::Locale::RegionalZonesModel >( m_zonesModel.get() ) ) + , m_regionModel( std::make_unique< Calamares::Locale::RegionsModel >() ) + , m_zonesModel( std::make_unique< Calamares::Locale::ZonesModel >() ) + , m_regionalZonesModel( std::make_unique< Calamares::Locale::RegionalZonesModel >( m_zonesModel.get() ) ) { // Slightly unusual: connect to our *own* signals. Wherever the language // or the location is changed, these signals are emitted, so hook up to @@ -255,7 +255,7 @@ Config::setCurrentLocation( const QString& regionzone ) void Config::setCurrentLocation( const QString& regionName, const QString& zoneName ) { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; auto* zone = m_zonesModel->find( regionName, zoneName ); if ( zone ) { @@ -269,7 +269,7 @@ Config::setCurrentLocation( const QString& regionName, const QString& zoneName ) } void -Config::setCurrentLocation( const CalamaresUtils::Locale::TimeZoneData* location ) +Config::setCurrentLocation( const Calamares::Locale::TimeZoneData* location ) { const bool updateLocation = ( location != m_currentLocation ); if ( updateLocation ) @@ -315,7 +315,7 @@ Config::automaticLocaleConfiguration() const } auto* gs = Calamares::JobQueue::instance()->globalStorage(); - QString lang = CalamaresUtils::Locale::readGS( *gs, QStringLiteral( "LANG" ) ); + QString lang = Calamares::Locale::readGS( *gs, QStringLiteral( "LANG" ) ); if ( lang.isEmpty() ) { lang = QLocale().name(); diff --git a/src/modules/locale/Config.h b/src/modules/locale/Config.h index bcdaf0bbf..8e1ee5ca6 100644 --- a/src/modules/locale/Config.h +++ b/src/modules/locale/Config.h @@ -26,12 +26,12 @@ class Config : public QObject { Q_OBJECT Q_PROPERTY( const QStringList& supportedLocales READ supportedLocales CONSTANT FINAL ) - Q_PROPERTY( CalamaresUtils::Locale::RegionsModel* regionModel READ regionModel CONSTANT FINAL ) - Q_PROPERTY( CalamaresUtils::Locale::ZonesModel* zonesModel READ zonesModel CONSTANT FINAL ) + Q_PROPERTY( Calamares::Locale::RegionsModel* regionModel READ regionModel CONSTANT FINAL ) + Q_PROPERTY( Calamares::Locale::ZonesModel* zonesModel READ zonesModel CONSTANT FINAL ) Q_PROPERTY( QAbstractItemModel* regionalZonesModel READ regionalZonesModel CONSTANT FINAL ) Q_PROPERTY( - CalamaresUtils::Locale::TimeZoneData* currentLocation READ currentLocation_c NOTIFY currentLocationChanged ) + Calamares::Locale::TimeZoneData* currentLocation READ currentLocation_c NOTIFY currentLocationChanged ) // Status are complete, human-readable, messages Q_PROPERTY( QString currentLocationStatus READ currentLocationStatus NOTIFY currentLanguageStatusChanged ) @@ -76,22 +76,22 @@ public: // A long list of locale codes (e.g. en_US.UTF-8) const QStringList& supportedLocales() const { return m_localeGenLines; } // All the regions (Africa, America, ...) - CalamaresUtils::Locale::RegionsModel* regionModel() const { return m_regionModel.get(); } + Calamares::Locale::RegionsModel* regionModel() const { return m_regionModel.get(); } // All of the timezones in the world, according to zone.tab - CalamaresUtils::Locale::ZonesModel* zonesModel() const { return m_zonesModel.get(); } + Calamares::Locale::ZonesModel* zonesModel() const { return m_zonesModel.get(); } // This model can be filtered by region - CalamaresUtils::Locale::RegionalZonesModel* regionalZonesModel() const { return m_regionalZonesModel.get(); } + Calamares::Locale::RegionalZonesModel* regionalZonesModel() const { return m_regionalZonesModel.get(); } - const CalamaresUtils::Locale::TimeZoneData* currentLocation() const { return m_currentLocation; } + const Calamares::Locale::TimeZoneData* currentLocation() const { return m_currentLocation; } /// Special case, set location from starting timezone if not already set void setCurrentLocation(); private: - CalamaresUtils::Locale::TimeZoneData* currentLocation_c() const + Calamares::Locale::TimeZoneData* currentLocation_c() const { - return const_cast< CalamaresUtils::Locale::TimeZoneData* >( m_currentLocation ); + return const_cast< Calamares::Locale::TimeZoneData* >( m_currentLocation ); } public Q_SLOTS: @@ -119,7 +119,7 @@ public Q_SLOTS: /** @brief Sets a location by pointer to zone data. * */ - void setCurrentLocation( const CalamaresUtils::Locale::TimeZoneData* tz ); + void setCurrentLocation( const Calamares::Locale::TimeZoneData* tz ); QString currentLanguageCode() const { return localeConfiguration().language(); } QString currentLCCode() const { return localeConfiguration().lc_numeric; } @@ -127,7 +127,7 @@ public Q_SLOTS: QString currentTimezoneCode() const; signals: - void currentLocationChanged( const CalamaresUtils::Locale::TimeZoneData* location ) const; + void currentLocationChanged( const Calamares::Locale::TimeZoneData* location ) const; void currentLocationStatusChanged( const QString& ) const; void currentLanguageStatusChanged( const QString& ) const; void currentLCStatusChanged( const QString& ) const; @@ -142,11 +142,11 @@ private: QStringList m_localeGenLines; /// The regions (America, Asia, Europe ..) - std::unique_ptr< CalamaresUtils::Locale::RegionsModel > m_regionModel; - std::unique_ptr< CalamaresUtils::Locale::ZonesModel > m_zonesModel; - std::unique_ptr< CalamaresUtils::Locale::RegionalZonesModel > m_regionalZonesModel; + std::unique_ptr< Calamares::Locale::RegionsModel > m_regionModel; + std::unique_ptr< Calamares::Locale::ZonesModel > m_zonesModel; + std::unique_ptr< Calamares::Locale::RegionalZonesModel > m_regionalZonesModel; - const CalamaresUtils::Locale::TimeZoneData* m_currentLocation = nullptr; + const Calamares::Locale::TimeZoneData* m_currentLocation = nullptr; /** @brief Specific locale configurations * diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index 236f63ec3..48ce27782 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -109,7 +109,7 @@ LocalePage::LocalePage( Config* config, QWidget* parent ) connect( m_tzWidget, &TimeZoneWidget::locationChanged, config, - QOverload< const CalamaresUtils::Locale::TimeZoneData* >::of( &Config::setCurrentLocation ) ); + QOverload< const Calamares::Locale::TimeZoneData* >::of( &Config::setCurrentLocation ) ); connect( m_regionCombo, QOverload< int >::of( &QComboBox::currentIndexChanged ), this, &LocalePage::regionChanged ); connect( m_zoneCombo, QOverload< int >::of( &QComboBox::currentIndexChanged ), this, &LocalePage::zoneChanged ); @@ -147,7 +147,7 @@ LocalePage::onActivate() void LocalePage::regionChanged( int currentIndex ) { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; QString selectedRegion = m_regionCombo->itemData( currentIndex ).toString(); { @@ -168,7 +168,7 @@ LocalePage::zoneChanged( int currentIndex ) } void -LocalePage::locationChanged( const CalamaresUtils::Locale::TimeZoneData* location ) +LocalePage::locationChanged( const Calamares::Locale::TimeZoneData* location ) { if ( !location ) { diff --git a/src/modules/locale/LocalePage.h b/src/modules/locale/LocalePage.h index 3b76b77b7..66502e69c 100644 --- a/src/modules/locale/LocalePage.h +++ b/src/modules/locale/LocalePage.h @@ -44,7 +44,7 @@ private: void regionChanged( int currentIndex ); void zoneChanged( int currentIndex ); - void locationChanged( const CalamaresUtils::Locale::TimeZoneData* location ); + void locationChanged( const Calamares::Locale::TimeZoneData* location ); void changeLocale(); void changeFormats(); diff --git a/src/modules/locale/Tests.cpp b/src/modules/locale/Tests.cpp index 56327154a..125ca1d30 100644 --- a/src/modules/locale/Tests.cpp +++ b/src/modules/locale/Tests.cpp @@ -135,7 +135,7 @@ LocaleTests::testTZSanity() QVERIFY( QFile( "/usr/share/zoneinfo/zone.tab" ).exists() ); // Contains a sensible number of total zones - const CalamaresUtils::Locale::ZonesModel zones; + const Calamares::Locale::ZonesModel zones; QVERIFY( zones.rowCount( QModelIndex() ) > 100 ); } @@ -171,7 +171,7 @@ LocaleTests::testTZImages() // Check zones are uniquely-claimed // // - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; const ZonesModel m; int overlapcount = 0; @@ -223,9 +223,9 @@ operator<( const QPoint& l, const QPoint& r ) } void -listAll( const QPoint& p, const CalamaresUtils::Locale::ZonesModel& zones ) +listAll( const QPoint& p, const Calamares::Locale::ZonesModel& zones ) { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; for ( auto it = zones.begin(); it; ++it ) { const auto* zone = *it; @@ -244,7 +244,7 @@ listAll( const QPoint& p, const CalamaresUtils::Locale::ZonesModel& zones ) void LocaleTests::testTZLocations() { - using namespace CalamaresUtils::Locale; + using namespace Calamares::Locale; ZonesModel zones; QVERIFY( zones.rowCount( QModelIndex() ) > 100 ); @@ -273,7 +273,7 @@ LocaleTests::testTZLocations() void LocaleTests::testSpecificLocations() { - CalamaresUtils::Locale::ZonesModel zones; + Calamares::Locale::ZonesModel zones; const auto* gibraltar = zones.find( "Europe", "Gibraltar" ); const auto* ceuta = zones.find( "Africa", "Ceuta" ); QVERIFY( gibraltar ); diff --git a/src/modules/locale/timezonewidget/timezonewidget.cpp b/src/modules/locale/timezonewidget/timezonewidget.cpp index 724bc59f7..519b3fa29 100644 --- a/src/modules/locale/timezonewidget/timezonewidget.cpp +++ b/src/modules/locale/timezonewidget/timezonewidget.cpp @@ -27,13 +27,13 @@ #endif static QPoint -getLocationPosition( const CalamaresUtils::Locale::TimeZoneData* l ) +getLocationPosition( const Calamares::Locale::TimeZoneData* l ) { return TimeZoneImageList::getLocationPosition( l->longitude(), l->latitude() ); } -TimeZoneWidget::TimeZoneWidget( const CalamaresUtils::Locale::ZonesModel* zones, QWidget* parent ) +TimeZoneWidget::TimeZoneWidget( const Calamares::Locale::ZonesModel* zones, QWidget* parent ) : QWidget( parent ) , timeZoneImages( TimeZoneImageList::fromQRC() ) , m_zonesData( zones ) @@ -185,7 +185,7 @@ TimeZoneWidget::mousePressEvent( QMouseEvent* event ) int mX = event->pos().x(); int mY = event->pos().y(); - auto distance = [ & ]( const CalamaresUtils::Locale::TimeZoneData* zone ) + auto distance = [ & ]( const Calamares::Locale::TimeZoneData* zone ) { QPoint locPos = TimeZoneImageList::getLocationPosition( zone->longitude(), zone->latitude() ); return double( abs( mX - locPos.x() ) + abs( mY - locPos.y() ) ); diff --git a/src/modules/locale/timezonewidget/timezonewidget.h b/src/modules/locale/timezonewidget/timezonewidget.h index 7ccfb2b80..f40bb545b 100644 --- a/src/modules/locale/timezonewidget/timezonewidget.h +++ b/src/modules/locale/timezonewidget/timezonewidget.h @@ -43,9 +43,9 @@ class TimeZoneWidget : public QWidget { Q_OBJECT public: - using TimeZoneData = CalamaresUtils::Locale::TimeZoneData; + using TimeZoneData = Calamares::Locale::TimeZoneData; - explicit TimeZoneWidget( const CalamaresUtils::Locale::ZonesModel* zones, QWidget* parent = nullptr ); + explicit TimeZoneWidget( const Calamares::Locale::ZonesModel* zones, QWidget* parent = nullptr ); public Q_SLOTS: /** @brief Sets a location by pointer @@ -63,7 +63,7 @@ private: QImage background, pin, currentZoneImage; TimeZoneImageList timeZoneImages; - const CalamaresUtils::Locale::ZonesModel* m_zonesData; + const Calamares::Locale::ZonesModel* m_zonesData; const TimeZoneData* m_currentLocation = nullptr; // Not owned by me void paintEvent( QPaintEvent* event ) override; diff --git a/src/modules/netinstall/Config.cpp b/src/modules/netinstall/Config.cpp index 9d92324a9..4dadb23da 100644 --- a/src/modules/netinstall/Config.cpp +++ b/src/modules/netinstall/Config.cpp @@ -127,11 +127,11 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) if ( label.contains( "sidebar" ) ) { - m_sidebarLabel = new CalamaresUtils::Locale::TranslatedString( label, "sidebar", className ); + m_sidebarLabel = new Calamares::Locale::TranslatedString( label, "sidebar", className ); } if ( label.contains( "title" ) ) { - m_titleLabel = new CalamaresUtils::Locale::TranslatedString( label, "title", className ); + m_titleLabel = new Calamares::Locale::TranslatedString( label, "title", className ); } // Lastly, load the groups data diff --git a/src/modules/netinstall/Config.h b/src/modules/netinstall/Config.h index 58931c636..85c3e6bbc 100644 --- a/src/modules/netinstall/Config.h +++ b/src/modules/netinstall/Config.h @@ -90,8 +90,8 @@ private Q_SLOTS: void loadingDone(); private: - CalamaresUtils::Locale::TranslatedString* m_sidebarLabel = nullptr; // As it appears in the sidebar - CalamaresUtils::Locale::TranslatedString* m_titleLabel = nullptr; + Calamares::Locale::TranslatedString* m_sidebarLabel = nullptr; // As it appears in the sidebar + Calamares::Locale::TranslatedString* m_titleLabel = nullptr; PackageModel* m_model = nullptr; LoaderQueue* m_queue = nullptr; Status m_status = Status::Ok; diff --git a/src/modules/notesqml/NotesQmlViewStep.cpp b/src/modules/notesqml/NotesQmlViewStep.cpp index 9f57eb615..cacd932b0 100644 --- a/src/modules/notesqml/NotesQmlViewStep.cpp +++ b/src/modules/notesqml/NotesQmlViewStep.cpp @@ -31,7 +31,7 @@ NotesQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap ) if ( qmlLabel.contains( "notes" ) ) { - m_notesName = new CalamaresUtils::Locale::TranslatedString( qmlLabel, "notes" ); + m_notesName = new Calamares::Locale::TranslatedString( qmlLabel, "notes" ); } Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last diff --git a/src/modules/notesqml/NotesQmlViewStep.h b/src/modules/notesqml/NotesQmlViewStep.h index 485a7969e..337378086 100644 --- a/src/modules/notesqml/NotesQmlViewStep.h +++ b/src/modules/notesqml/NotesQmlViewStep.h @@ -29,7 +29,7 @@ public: void setConfigurationMap( const QVariantMap& configurationMap ) override; private: - CalamaresUtils::Locale::TranslatedString* m_notesName; // As it appears in the sidebar + Calamares::Locale::TranslatedString* m_notesName; // As it appears in the sidebar }; CALAMARES_PLUGIN_FACTORY_DECLARATION( NotesQmlViewStepFactory ) diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp index b596fe6e8..00a4f4b6f 100644 --- a/src/modules/packagechooser/Config.cpp +++ b/src/modules/packagechooser/Config.cpp @@ -114,9 +114,9 @@ Config::introductionPackage() const = QT_TR_NOOP( "Please pick a product from the list. The selected product will be installed." ); defaultIntroduction = new PackageItem( QString(), name, description ); defaultIntroduction->screenshot = QPixmap( QStringLiteral( ":/images/no-selection.png" ) ); - defaultIntroduction->name = CalamaresUtils::Locale::TranslatedString( name, metaObject()->className() ); + defaultIntroduction->name = Calamares::Locale::TranslatedString( name, metaObject()->className() ); defaultIntroduction->description - = CalamaresUtils::Locale::TranslatedString( description, metaObject()->className() ); + = Calamares::Locale::TranslatedString( description, metaObject()->className() ); } return *defaultIntroduction; } @@ -357,7 +357,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) { if ( labels.contains( "step" ) ) { - m_stepName = new CalamaresUtils::Locale::TranslatedString( labels, "step" ); + m_stepName = new Calamares::Locale::TranslatedString( labels, "step" ); } } } diff --git a/src/modules/packagechooser/Config.h b/src/modules/packagechooser/Config.h index d1b783a8d..f7a3165c8 100644 --- a/src/modules/packagechooser/Config.h +++ b/src/modules/packagechooser/Config.h @@ -121,7 +121,7 @@ private: * Reading the property will return an empty QString. */ std::optional< QString > m_packageChoice; - CalamaresUtils::Locale::TranslatedString* m_stepName; // As it appears in the sidebar + Calamares::Locale::TranslatedString* m_stepName; // As it appears in the sidebar }; diff --git a/src/modules/packagechooser/PackageModel.cpp b/src/modules/packagechooser/PackageModel.cpp index f1d1184ad..10eaf05db 100644 --- a/src/modules/packagechooser/PackageModel.cpp +++ b/src/modules/packagechooser/PackageModel.cpp @@ -63,8 +63,8 @@ PackageItem::PackageItem( const QString& a_id, PackageItem::PackageItem( const QVariantMap& item_map ) : id( CalamaresUtils::getString( item_map, "id" ) ) - , name( CalamaresUtils::Locale::TranslatedString( item_map, "name" ) ) - , description( CalamaresUtils::Locale::TranslatedString( item_map, "description" ) ) + , name( Calamares::Locale::TranslatedString( item_map, "name" ) ) + , description( Calamares::Locale::TranslatedString( item_map, "description" ) ) , screenshot( loadScreenshot( CalamaresUtils::getString( item_map, "screenshot" ) ) ) , packageNames( CalamaresUtils::getStringList( item_map, "packages" ) ) , netinstallData( getSubMap( item_map, "netinstall" ) ) diff --git a/src/modules/packagechooser/PackageModel.h b/src/modules/packagechooser/PackageModel.h index 18682a121..ed7ffcf0c 100644 --- a/src/modules/packagechooser/PackageModel.h +++ b/src/modules/packagechooser/PackageModel.h @@ -22,8 +22,8 @@ struct PackageItem { QString id; - CalamaresUtils::Locale::TranslatedString name; - CalamaresUtils::Locale::TranslatedString description; + Calamares::Locale::TranslatedString name; + Calamares::Locale::TranslatedString description; QPixmap screenshot; QStringList packageNames; QVariantMap netinstallData; diff --git a/src/modules/shellprocess/ShellProcessJob.cpp b/src/modules/shellprocess/ShellProcessJob.cpp index 0f9a150d2..b30af9a29 100644 --- a/src/modules/shellprocess/ShellProcessJob.cpp +++ b/src/modules/shellprocess/ShellProcessJob.cpp @@ -85,7 +85,7 @@ ShellProcessJob::setConfigurationMap( const QVariantMap& configurationMap ) { if ( labels.contains( "name" ) ) { - m_name = std::make_unique< CalamaresUtils::Locale::TranslatedString >( labels, "name" ); + m_name = std::make_unique< Calamares::Locale::TranslatedString >( labels, "name" ); } } } diff --git a/src/modules/shellprocess/ShellProcessJob.h b/src/modules/shellprocess/ShellProcessJob.h index a931d1e1a..eb61fe801 100644 --- a/src/modules/shellprocess/ShellProcessJob.h +++ b/src/modules/shellprocess/ShellProcessJob.h @@ -38,7 +38,7 @@ public: private: std::unique_ptr< CalamaresUtils::CommandList > m_commands; - std::unique_ptr< CalamaresUtils::Locale::TranslatedString > m_name; + std::unique_ptr< Calamares::Locale::TranslatedString > m_name; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( ShellProcessJobFactory ) diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp index 7847627a0..71020c4c0 100644 --- a/src/modules/welcome/Config.cpp +++ b/src/modules/welcome/Config.cpp @@ -204,7 +204,7 @@ Config::setLocaleIndex( int index ) branding ? branding->translationsDirectory() : QString() ); if ( Calamares::JobQueue::instance() && Calamares::JobQueue::instance()->globalStorage() ) { - CalamaresUtils::Locale::insertGS( *Calamares::JobQueue::instance()->globalStorage(), + Calamares::Locale::insertGS( *Calamares::JobQueue::instance()->globalStorage(), QStringLiteral( "LANG" ), CalamaresUtils::translatorLocaleName().name ); }