diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 49c5dab11..82f29d835 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -85,12 +85,17 @@ const QStringList Branding::s_imageEntryStrings = "productWelcome" }; -const QStringList Branding::s_styleEntryStrings = +/** @brief Mapping of enum values to key names + * + * The key names can be found in `branding.desc` and need to match + * that (and the branding schema). + */ +static const QStringList s_styleEntryStrings = { "sidebarBackground", "sidebarText", - "sidebarTextSelect", - "sidebarTextHighlight" + "sidebarTextSelect", // enum value TextCurrent + "sidebarTextHighlight", // enum value BackgroundCurrent }; const QStringList Branding::s_uploadServerStrings = diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 556f2fcff..6e7d780ee 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -72,6 +72,12 @@ public: }; Q_ENUM( ImageEntry ) + /** @brief Names of style entries, for use in code + * + * These names are mapped to names in the branding.desc file through + * an internal table s_styleEntryStrings, which defines which names + * in `branding.desc` key *style* are used for which entry. + */ enum StyleEntry : short { SidebarBackground, @@ -256,6 +262,12 @@ public slots: QString shortProductName() const { return string( ShortProductName ); } QString shortVersionedName() const { return string( ShortVersionedName ); } + /** @brief Map an enum-value to the entry from the *style* key. + * + * e.g. StyleEntry::SidebarTextCurrent maps to the corresponding + * *style* entry, which is (confusingly) named "sidebarTextSelect" + * in the branding file. + */ QString styleString( StyleEntry styleEntry ) const; QString imagePath( ImageEntry imageEntry ) const; @@ -267,7 +279,6 @@ private: static const QStringList s_stringEntryStrings; static const QStringList s_imageEntryStrings; - static const QStringList s_styleEntryStrings; static const QStringList s_uploadServerStrings; QString m_descriptorPath; // Path to descriptor (e.g. "/etc/calamares/default/branding.desc")