Add ImageRegistry support to Branding.
This commit is contained in:
parent
5e8ab97de4
commit
7594c85f2e
@ -21,9 +21,11 @@
|
||||
#include "utils/CalamaresUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/YamlUtils.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QPixmap>
|
||||
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
@ -39,15 +41,6 @@ Branding::instance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
enum Branding::StringEntry : short
|
||||
{
|
||||
ProductName,
|
||||
Version,
|
||||
ShortVersion,
|
||||
VersionedName,
|
||||
ShortVersionedName
|
||||
};
|
||||
|
||||
|
||||
QStringList Branding::s_stringEntryStrings =
|
||||
{
|
||||
@ -59,13 +52,6 @@ QStringList Branding::s_stringEntryStrings =
|
||||
};
|
||||
|
||||
|
||||
enum Branding::ImageEntry : short
|
||||
{
|
||||
ProductLogo,
|
||||
ProductIcon
|
||||
};
|
||||
|
||||
|
||||
QStringList Branding::s_imageEntryStrings =
|
||||
{
|
||||
"productLogo",
|
||||
@ -186,14 +172,29 @@ Branding::string( Branding::StringEntry stringEntry ) const
|
||||
|
||||
|
||||
QString
|
||||
Branding::image( Branding::ImageEntry imageEntry ) const
|
||||
Branding::imagePath( Branding::ImageEntry imageEntry ) const
|
||||
{
|
||||
return m_images.value( s_imageEntryStrings.value( imageEntry ) );
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const
|
||||
{
|
||||
QPixmap pixmap =
|
||||
ImageRegistry::instance()->pixmap( imagePath( imageEntry ), size );
|
||||
|
||||
if ( pixmap.isNull() )
|
||||
{
|
||||
Q_ASSERT( false );
|
||||
return QPixmap();
|
||||
}
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
QStringList
|
||||
Branding::slideshow() const
|
||||
Branding::slideshowPaths() const
|
||||
{
|
||||
return m_slideshow;
|
||||
}
|
||||
|
@ -34,8 +34,20 @@ class UIDLLEXPORT Branding : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum StringEntry : short;
|
||||
enum ImageEntry : short;
|
||||
enum StringEntry : short
|
||||
{
|
||||
ProductName,
|
||||
Version,
|
||||
ShortVersion,
|
||||
VersionedName,
|
||||
ShortVersionedName
|
||||
};
|
||||
|
||||
enum ImageEntry : short
|
||||
{
|
||||
ProductLogo,
|
||||
ProductIcon
|
||||
};
|
||||
|
||||
static Branding* instance();
|
||||
|
||||
@ -47,8 +59,9 @@ public:
|
||||
QString componentDirectory() const;
|
||||
|
||||
QString string( Branding::StringEntry stringEntry ) const;
|
||||
QString image( Branding::ImageEntry imageEntry ) const;
|
||||
QStringList slideshow() const;
|
||||
QString imagePath( Branding::ImageEntry imageEntry ) const;
|
||||
QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const;
|
||||
QStringList slideshowPaths() const;
|
||||
|
||||
private:
|
||||
static Branding* s_instance;
|
||||
|
Loading…
Reference in New Issue
Block a user