[libcalamares] Reduce clang warnings (only-inline-virtual, unused parameters)
This commit is contained in:
parent
1b62b2f66c
commit
5fbd0169ca
@ -58,7 +58,7 @@ struct TranslationLoader
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~TranslationLoader() {};
|
||||
virtual ~TranslationLoader();
|
||||
/// @brief Loads @p translator with the specific translations of this type
|
||||
virtual bool tryLoad( QTranslator* translator ) = 0;
|
||||
|
||||
@ -66,6 +66,7 @@ struct TranslationLoader
|
||||
QString m_localeName;
|
||||
};
|
||||
|
||||
/// @brief Loads translations for branding
|
||||
struct BrandingLoader : public TranslationLoader
|
||||
{
|
||||
BrandingLoader( const QLocale& locale, const QString& prefix )
|
||||
@ -74,8 +75,30 @@ struct BrandingLoader : public TranslationLoader
|
||||
{
|
||||
}
|
||||
|
||||
bool tryLoad( QTranslator* translator ) override
|
||||
{
|
||||
bool tryLoad( QTranslator* translator ) override;
|
||||
|
||||
QString m_prefix;
|
||||
};
|
||||
|
||||
/// @brief Loads regular Calamares translations (program text)
|
||||
struct CalamaresLoader : public TranslationLoader
|
||||
{
|
||||
using TranslationLoader::TranslationLoader;
|
||||
bool tryLoad( QTranslator* translator ) override;
|
||||
};
|
||||
|
||||
/// @brief Loads timezone name translations
|
||||
struct TZLoader : public TranslationLoader
|
||||
{
|
||||
using TranslationLoader::TranslationLoader;
|
||||
bool tryLoad( QTranslator* translator ) override;
|
||||
};
|
||||
|
||||
TranslationLoader::~TranslationLoader() {}
|
||||
|
||||
bool
|
||||
BrandingLoader::tryLoad( QTranslator* translator )
|
||||
{
|
||||
if ( m_prefix.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
@ -100,17 +123,11 @@ struct BrandingLoader : public TranslationLoader
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QString m_prefix;
|
||||
};
|
||||
|
||||
struct CalamaresLoader : public TranslationLoader
|
||||
bool
|
||||
CalamaresLoader::tryLoad( QTranslator* translator )
|
||||
{
|
||||
using TranslationLoader::TranslationLoader;
|
||||
|
||||
bool tryLoad( QTranslator* translator ) override
|
||||
{
|
||||
if ( translator->load( QString( ":/lang/calamares_" ) + m_localeName ) )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "Calamares using locale:" << m_localeName;
|
||||
@ -121,14 +138,11 @@ struct CalamaresLoader : public TranslationLoader
|
||||
cDebug() << Logger::SubEntry << "Calamares using default, system locale not found:" << m_localeName;
|
||||
return translator->load( QString( ":/lang/calamares_en" ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
struct TZLoader : public TranslationLoader
|
||||
bool
|
||||
TZLoader::tryLoad( QTranslator* translator )
|
||||
{
|
||||
using TranslationLoader::TranslationLoader;
|
||||
bool tryLoad( QTranslator* translator ) override
|
||||
{
|
||||
if ( translator->load( QString( ":/lang/tz_" ) + m_localeName ) )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "Calamares Timezones using locale:" << m_localeName;
|
||||
@ -136,12 +150,10 @@ struct TZLoader : public TranslationLoader
|
||||
}
|
||||
else
|
||||
{
|
||||
cDebug() << Logger::SubEntry
|
||||
<< "Calamares Timezones using default, system locale not found:" << m_localeName;
|
||||
cDebug() << Logger::SubEntry << "Calamares Timezones using default, system locale not found:" << m_localeName;
|
||||
return translator->load( QString( ":/lang/tz_en" ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void
|
||||
loadSingletonTranslator( TranslationLoader&& loader, QTranslator*& translator_p )
|
||||
@ -167,7 +179,7 @@ static QTranslator* s_tztranslator = nullptr;
|
||||
static QString s_translatorLocaleName;
|
||||
|
||||
void
|
||||
installTranslator( const QLocale& locale, const QString& brandingTranslationsPrefix, QObject* parent )
|
||||
installTranslator( const QLocale& locale, const QString& brandingTranslationsPrefix, QObject* )
|
||||
{
|
||||
loadSingletonTranslator( BrandingLoader( locale, brandingTranslationsPrefix ), s_brandingTranslator );
|
||||
loadSingletonTranslator( TZLoader( locale ), s_tztranslator );
|
||||
|
Loading…
Reference in New Issue
Block a user