diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index 4f099dd00..1dd4de03a 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -83,6 +83,8 @@ strings: # any size and proportion, and will be scaled to fit inside # the window. Use `welcomeExpandingLogo` to make it non-scaled. # Recommended size is 320x150. +# +# These strings can also use substitutions from os-release (see above). images: productLogo: "squid.png" productIcon: "squid.png" diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 673b3df42..a27b39ae6 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -152,6 +152,7 @@ Branding::Branding( const QString& brandingFilePath, initSimpleSettings( doc ); #ifdef WITH_KOSRelease + // Copy the os-release information into a QHash for use by KMacroExpander. KOSRelease relInfo; QHash< QString, QString > relMap{ @@ -173,19 +174,18 @@ Branding::Branding( const QString& brandingFilePath, { QStringLiteral( "VARIANT_ID" ), relInfo.variantId() }, { QStringLiteral( "LOGO" ), relInfo.logo() } } }; - loadStrings( m_strings, doc, "strings", - [&]( const QString& s ) -> QString { return KMacroExpander::expandMacros( s, relMap, QLatin1Char( '@' ) ); } - ); + auto expand = [&]( const QString& s ) -> QString { return KMacroExpander::expandMacros( s, relMap, QLatin1Char( '@' ) ); }; #else - // No support for substituting in os-release values. - loadStrings( m_strings, doc, "strings", - []( const QString& s ) -> QString { return s; } - ); + auto expand = []( const QString& s ) -> QString { return s; }; #endif + + + // Massage the strings, images and style sections. + loadStrings( m_strings, doc, "strings", expand ); loadStrings( m_images, doc, "images", [&]( const QString& s ) -> QString { - QFileInfo imageFi( componentDir.absoluteFilePath( s ) ); + QFileInfo imageFi( componentDir.absoluteFilePath( expand( s ) ) ); if ( !imageFi.exists() ) bail( QString( "Image file %1 does not exist." ).arg( imageFi.absoluteFilePath() ) ); return imageFi.absoluteFilePath();