[libcalamaresui] Fix build with KOSRelease

- initialization of the hash was all wrong
 - special-case ID_LIKE
 - typo's
 - link to CoreAddons
main
Adriaan de Groot 6 years ago
parent fbbbe63642
commit af73d90b7b

@ -153,27 +153,28 @@ Branding::Branding( const QString& brandingFilePath,
#ifdef WITH_KOSRelease
KOSRelease relInfo;
QHash<QString, QString> relMap;
relMap << "NAME" << relInfo.name()
<< "VERSION" << relInfo.version()
<< "ID" << relInfo.id()
<< "ID_LIKE" << relInfo.idLike()
<< "VERSION_CODENAME" << relInfo.versionCodename()
<< "VERSION_ID" << relInfo.versionId()
<< "PRETTY_NAME" << relInfo.prettyName()
<< "HOME_URL" << relInfo.homeUrl()
<< "DOCUMENTATION_URL" << relInfo.documentationUrl()
<< "SUPPORT_URL" << relInfo.supportUrl()
<< "BUG_REPORT_URL" << relInfo.bugReportUrl()
<< "PRIVACY_POLICY_URL" << relInfo.privacyPolicyUrl()
<< "BUILD_ID" << relInfo.buildId()
<< "VARIANT" << relInfo.variant()
<< "VARIANT_ID" << relInfo.variantId()
<< "LOGO" << relInfo.logo();
QHash< QString, QString > relMap{
std::initializer_list< std::pair< QString, QString > > {
{ QStringLiteral( "NAME" ), relInfo.name() },
{ QStringLiteral( "VERSION" ), relInfo.version() },
{ QStringLiteral( "ID" ), relInfo.id() },
{ QStringLiteral( "ID_LIKE" ), relInfo.idLike().join( ' ' ) },
{ QStringLiteral( "VERSION_CODENAME" ), relInfo.versionCodename() },
{ QStringLiteral( "VERSION_ID" ), relInfo.versionId() },
{ QStringLiteral( "PRETTY_NAME" ), relInfo.prettyName() },
{ QStringLiteral( "HOME_URL" ), relInfo.homeUrl() },
{ QStringLiteral( "DOCUMENTATION_URL" ), relInfo.documentationUrl() },
{ QStringLiteral( "SUPPORT_URL" ), relInfo.supportUrl() },
{ QStringLiteral( "BUG_REPORT_URL" ), relInfo.bugReportUrl() },
{ QStringLiteral( "PRIVACY_POLICY_URL" ), relInfo.privacyPolicyUrl() },
{ QStringLiteral( "BUILD_ID" ), relInfo.buildId() },
{ QStringLiteral( "VARIANT" ), relInfo.variant() },
{ QStringLiteral( "VARIANT_ID" ), relInfo.variantId() },
{ QStringLiteral( "LOGO" ), relInfo.logo() }
} };
loadStrings( m_strings, doc, "strings",
[&]( const QString& s ) -> QString { return KMacroExpander::expandMacros{ s, relMap, '@' ); }
[&]( const QString& s ) -> QString { return KMacroExpander::expandMacros( s, relMap, QLatin1Char( '@' ) ); }
);
#else
// No support for substituting in os-release values.

@ -87,4 +87,5 @@ calamares_add_library( calamaresui
find_package( KF5CoreAddons 5.58 QUIET ) # If it's really new
if ( KF5CoreAddons_FOUND )
target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease )
target_link_libraries( calamaresui PRIVATE KF5::CoreAddons )
endif()

Loading…
Cancel
Save