From bc9d8fb13a2a9f703ac4517eb0c10f9ea4612fd9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 26 Jul 2021 11:38:15 +0200 Subject: [PATCH] [libcalamares] Rename files Label -> Translation --- src/libcalamares/CMakeLists.txt | 4 ++-- src/libcalamares/locale/Tests.cpp | 2 +- src/libcalamares/locale/TranslatableConfiguration.cpp | 3 ++- src/libcalamares/locale/{Label.cpp => Translation.cpp} | 2 +- src/libcalamares/locale/{Label.h => Translation.h} | 8 ++++---- .../locale/{LabelModel.cpp => TranslationsModel.cpp} | 8 +++++--- .../locale/{LabelModel.h => TranslationsModel.h} | 6 +++--- src/modules/locale/Config.cpp | 2 +- src/modules/welcome/Config.h | 2 +- src/modules/welcome/WelcomePage.cpp | 1 - src/modules/welcome/WelcomePage.h | 2 +- src/modules/welcomeq/WelcomeQmlViewStep.cpp | 2 +- 12 files changed, 22 insertions(+), 20 deletions(-) rename src/libcalamares/locale/{Label.cpp => Translation.cpp} (99%) rename src/libcalamares/locale/{Label.h => Translation.h} (95%) rename src/libcalamares/locale/{LabelModel.cpp => TranslationsModel.cpp} (90%) rename src/libcalamares/locale/{LabelModel.h => TranslationsModel.h} (96%) diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index d4755bde4..645a26d25 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -40,12 +40,12 @@ set( libSources # Locale-data service locale/Global.cpp - locale/Label.cpp - locale/LabelModel.cpp locale/Lookup.cpp locale/TimeZone.cpp locale/TranslatableConfiguration.cpp locale/TranslatableString.cpp + locale/Translation.cpp + locale/TranslationsModel.cpp # Modules modulesystem/Config.cpp diff --git a/src/libcalamares/locale/Tests.cpp b/src/libcalamares/locale/Tests.cpp index 05e8f610c..f234c1596 100644 --- a/src/libcalamares/locale/Tests.cpp +++ b/src/libcalamares/locale/Tests.cpp @@ -9,9 +9,9 @@ */ #include "locale/Global.h" -#include "locale/LabelModel.h" #include "locale/TimeZone.h" #include "locale/TranslatableConfiguration.h" +#include "locale/TranslationsModel.h" #include "CalamaresVersion.h" #include "GlobalStorage.h" diff --git a/src/libcalamares/locale/TranslatableConfiguration.cpp b/src/libcalamares/locale/TranslatableConfiguration.cpp index c10307aee..3a95722d1 100644 --- a/src/libcalamares/locale/TranslatableConfiguration.cpp +++ b/src/libcalamares/locale/TranslatableConfiguration.cpp @@ -10,7 +10,7 @@ #include "TranslatableConfiguration.h" -#include "LabelModel.h" +#include "TranslationsModel.h" #include "utils/Logger.h" #include "utils/Variant.h" @@ -69,6 +69,7 @@ TranslatedString::get() const QString TranslatedString::get( const QLocale& locale ) const { + // TODO: keep track of special cases like sr@latin and ca@valencia QString localeName = locale.name(); // Special case, sr@latin doesn't have the @latin reflected in the name if ( locale.language() == QLocale::Language::Serbian && locale.script() == QLocale::Script::LatinScript ) diff --git a/src/libcalamares/locale/Label.cpp b/src/libcalamares/locale/Translation.cpp similarity index 99% rename from src/libcalamares/locale/Label.cpp rename to src/libcalamares/locale/Translation.cpp index f79d0d3e5..0a2e594be 100644 --- a/src/libcalamares/locale/Label.cpp +++ b/src/libcalamares/locale/Translation.cpp @@ -9,7 +9,7 @@ * */ -#include "Label.h" +#include "Translation.h" #include diff --git a/src/libcalamares/locale/Label.h b/src/libcalamares/locale/Translation.h similarity index 95% rename from src/libcalamares/locale/Label.h rename to src/libcalamares/locale/Translation.h index 04ad4f5e8..a4402ebaa 100644 --- a/src/libcalamares/locale/Label.h +++ b/src/libcalamares/locale/Translation.h @@ -9,8 +9,8 @@ * */ -#ifndef LOCALE_LABEL_H -#define LOCALE_LABEL_H +#ifndef LOCALE_TRANSLATION_H +#define LOCALE_TRANSLATION_H #include #include @@ -56,8 +56,8 @@ public: * in the label (human-readable form) or only if needed for disambiguation. */ Translation( const QString& localeName, - LabelFormat format = LabelFormat::IfNeededWithCountry, - QObject* parent = nullptr ); + LabelFormat format = LabelFormat::IfNeededWithCountry, + QObject* parent = nullptr ); /** @brief Define a sorting order. diff --git a/src/libcalamares/locale/LabelModel.cpp b/src/libcalamares/locale/TranslationsModel.cpp similarity index 90% rename from src/libcalamares/locale/LabelModel.cpp rename to src/libcalamares/locale/TranslationsModel.cpp index 93d0aab3e..af1bd1801 100644 --- a/src/libcalamares/locale/LabelModel.cpp +++ b/src/libcalamares/locale/TranslationsModel.cpp @@ -9,7 +9,7 @@ * */ -#include "LabelModel.h" +#include "TranslationsModel.h" #include "Lookup.h" @@ -121,7 +121,8 @@ TranslationsModel::find( const QString& countryCode ) const } auto c_l = countryData( countryCode ); - int r = find( [&]( const Translation& l ) { return ( l.language() == c_l.second ) && ( l.country() == c_l.first ); } ); + int r = find( + [&]( const Translation& l ) { return ( l.language() == c_l.second ) && ( l.country() == c_l.first ); } ); if ( r >= 0 ) { return r; @@ -132,7 +133,8 @@ TranslationsModel::find( const QString& countryCode ) const TranslationsModel* availableTranslations() { - static TranslationsModel* model = new TranslationsModel( QStringLiteral( CALAMARES_TRANSLATION_LANGUAGES ).split( ';' ) ); + static TranslationsModel* model + = new TranslationsModel( QStringLiteral( CALAMARES_TRANSLATION_LANGUAGES ).split( ';' ) ); return model; } diff --git a/src/libcalamares/locale/LabelModel.h b/src/libcalamares/locale/TranslationsModel.h similarity index 96% rename from src/libcalamares/locale/LabelModel.h rename to src/libcalamares/locale/TranslationsModel.h index 1d12295b3..b87c00027 100644 --- a/src/libcalamares/locale/LabelModel.h +++ b/src/libcalamares/locale/TranslationsModel.h @@ -9,11 +9,11 @@ * */ -#ifndef LOCALE_LABELMODEL_H -#define LOCALE_LABELMODEL_H +#ifndef LOCALE_TRANSLATIONSMODEL_H +#define LOCALE_TRANSLATIONSMODEL_H #include "DllMacro.h" -#include "Label.h" +#include "Translation.h" #include #include diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index 700011258..9627fcfc3 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -15,7 +15,7 @@ #include "JobQueue.h" #include "Settings.h" #include "locale/Global.h" -#include "locale/Label.h" +#include "locale/Translation.h" #include "modulesystem/ModuleManager.h" #include "network/Manager.h" #include "utils/Logger.h" diff --git a/src/modules/welcome/Config.h b/src/modules/welcome/Config.h index 2597ccb5a..ad509a983 100644 --- a/src/modules/welcome/Config.h +++ b/src/modules/welcome/Config.h @@ -10,7 +10,7 @@ #ifndef WELCOME_CONFIG_H #define WELCOME_CONFIG_H -#include "locale/LabelModel.h" +#include "locale/TranslationsModel.h" #include "modulesystem/RequirementsModel.h" #include diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index b56b6754a..a82d873e9 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -20,7 +20,6 @@ #include "Settings.h" #include "ViewManager.h" -#include "locale/LabelModel.h" #include "modulesystem/ModuleManager.h" #include "modulesystem/RequirementsModel.h" #include "utils/CalamaresUtilsGui.h" diff --git a/src/modules/welcome/WelcomePage.h b/src/modules/welcome/WelcomePage.h index ceeb5160b..dba1f6a28 100644 --- a/src/modules/welcome/WelcomePage.h +++ b/src/modules/welcome/WelcomePage.h @@ -11,7 +11,7 @@ #ifndef WELCOMEPAGE_H #define WELCOMEPAGE_H -#include "locale/LabelModel.h" +#include "locale/TranslationsModel.h" #include #include diff --git a/src/modules/welcomeq/WelcomeQmlViewStep.cpp b/src/modules/welcomeq/WelcomeQmlViewStep.cpp index af32f2992..0d1d8cb3c 100644 --- a/src/modules/welcomeq/WelcomeQmlViewStep.cpp +++ b/src/modules/welcomeq/WelcomeQmlViewStep.cpp @@ -12,7 +12,7 @@ #include "checker/GeneralRequirements.h" -#include "locale/LabelModel.h" +#include "locale/TranslationsModel.h" #include "utils/Dirs.h" #include "utils/Logger.h" #include "utils/Variant.h"