diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index d6913c1e9..518d8e30b 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -15,3 +15,8 @@ images: productIcon: "squid.png" slideshow: "show.qml" + +style: + sidebarBackground: #292F34 + sidebarText: #FFFFFF + sidebarTextSelect: #292F34 diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 997bb59b4..de13759b7 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -62,6 +62,13 @@ QStringList Branding::s_imageEntryStrings = "productIcon" }; +QStringList Branding::s_styleEntryStrings = +{ + "sidebarBackground", + "sidebarText", + "sidebarTextSelect" +}; + Branding::Branding( const QString& brandingFilePath, QObject* parent ) @@ -146,6 +153,15 @@ Branding::Branding( const QString& brandingFilePath, } else bail( "Syntax error in slideshow sequence." ); + + if ( !doc[ "style" ].IsMap() ) + bail( "Syntax error in style map." ); + + QVariantMap style = + CalamaresUtils::yamlMapToVariant( doc[ "style" ] ).toMap(); + m_style.clear(); + for ( auto it = style.constBegin(); it != style.constEnd(); ++it ) + m_style.insert( it.key(), it.value().toString() ); } catch ( YAML::Exception& e ) diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index bddea1b70..2a2279945 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -52,6 +52,13 @@ public: ProductLogo, ProductIcon }; + + enum StyleEntry : short + { + SidebarBackground, + SidebarText, + SidebarTextSelect + }; static Branding* instance(); @@ -66,6 +73,7 @@ public: QString imagePath( Branding::ImageEntry imageEntry ) const; QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const; QString slideshowPath() const; + QString style( Branding::StyleEntry styleEntry ) const; /** * Creates a map called "branding" in the global storage, and inserts an @@ -79,6 +87,7 @@ private: static QStringList s_stringEntryStrings; static QStringList s_imageEntryStrings; + static QStringList s_styleEntryStrings; void bail( const QString& message ); @@ -86,6 +95,7 @@ private: QString m_componentName; QMap< QString, QString > m_strings; QMap< QString, QString > m_images; + QMap< QString, QString > m_style; QString m_slideshowPath; }; diff --git a/src/libcalamaresui/utils/CalamaresStyle.h b/src/libcalamaresui/utils/CalamaresStyle.h index 8eb24a711..d0db3cf9b 100644 --- a/src/libcalamaresui/utils/CalamaresStyle.h +++ b/src/libcalamaresui/utils/CalamaresStyle.h @@ -23,12 +23,17 @@ #include +#include "Branding.h" + namespace CalamaresStyle { -static const QColor SIDEBAR_BACKGROUND = "#292F34"; -static const QColor SIDEBAR_TEXT = "#FFFFFF"; -static const QColor SIDEBAR_TEXT_SELECT = "#292F34"; +static const QColor SIDEBAR_BACKGROUND = QColor( Calamares::Branding::instance()-> + style( Calamares::Branding::SidebarBackground ) ); +static const QColor SIDEBAR_TEXT = QColor( Calamares::Branding::instance()-> + style( Calamares::Branding::SidebarText ) ); +static const QColor SIDEBAR_TEXT_SELECT = QColor( Calamares::Branding::instance()-> + style( Calamares::Branding::SidebarTextSelect ) ); } // namespace CalamaresStyle