[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 #ifdef WITH_KOSRelease
KOSRelease relInfo; KOSRelease relInfo;
QHash<QString, QString> relMap;
relMap << "NAME" << relInfo.name() QHash< QString, QString > relMap{
<< "VERSION" << relInfo.version() std::initializer_list< std::pair< QString, QString > > {
<< "ID" << relInfo.id() { QStringLiteral( "NAME" ), relInfo.name() },
<< "ID_LIKE" << relInfo.idLike() { QStringLiteral( "VERSION" ), relInfo.version() },
<< "VERSION_CODENAME" << relInfo.versionCodename() { QStringLiteral( "ID" ), relInfo.id() },
<< "VERSION_ID" << relInfo.versionId() { QStringLiteral( "ID_LIKE" ), relInfo.idLike().join( ' ' ) },
<< "PRETTY_NAME" << relInfo.prettyName() { QStringLiteral( "VERSION_CODENAME" ), relInfo.versionCodename() },
<< "HOME_URL" << relInfo.homeUrl() { QStringLiteral( "VERSION_ID" ), relInfo.versionId() },
<< "DOCUMENTATION_URL" << relInfo.documentationUrl() { QStringLiteral( "PRETTY_NAME" ), relInfo.prettyName() },
<< "SUPPORT_URL" << relInfo.supportUrl() { QStringLiteral( "HOME_URL" ), relInfo.homeUrl() },
<< "BUG_REPORT_URL" << relInfo.bugReportUrl() { QStringLiteral( "DOCUMENTATION_URL" ), relInfo.documentationUrl() },
<< "PRIVACY_POLICY_URL" << relInfo.privacyPolicyUrl() { QStringLiteral( "SUPPORT_URL" ), relInfo.supportUrl() },
<< "BUILD_ID" << relInfo.buildId() { QStringLiteral( "BUG_REPORT_URL" ), relInfo.bugReportUrl() },
<< "VARIANT" << relInfo.variant() { QStringLiteral( "PRIVACY_POLICY_URL" ), relInfo.privacyPolicyUrl() },
<< "VARIANT_ID" << relInfo.variantId() { QStringLiteral( "BUILD_ID" ), relInfo.buildId() },
<< "LOGO" << relInfo.logo(); { QStringLiteral( "VARIANT" ), relInfo.variant() },
{ QStringLiteral( "VARIANT_ID" ), relInfo.variantId() },
{ QStringLiteral( "LOGO" ), relInfo.logo() }
} };
loadStrings( m_strings, doc, "strings", 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 #else
// No support for substituting in os-release values. // 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 find_package( KF5CoreAddons 5.58 QUIET ) # If it's really new
if ( KF5CoreAddons_FOUND ) if ( KF5CoreAddons_FOUND )
target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease ) target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease )
target_link_libraries( calamaresui PRIVATE KF5::CoreAddons )
endif() endif()

Loading…
Cancel
Save