start of trial to add sidebar style options
use a new style section in branding.desc, doesn't build as is
This commit is contained in:
parent
c7f46136fc
commit
56afa45812
@ -15,3 +15,8 @@ images:
|
||||
productIcon: "squid.png"
|
||||
|
||||
slideshow: "show.qml"
|
||||
|
||||
style:
|
||||
sidebarBackground: #292F34
|
||||
sidebarText: #FFFFFF
|
||||
sidebarTextSelect: #292F34
|
||||
|
@ -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 )
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -23,12 +23,17 @@
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user