2014-10-10 18:18:35 +02:00
|
|
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
|
|
|
*
|
2015-05-07 16:10:04 +02:00
|
|
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
2014-10-10 18:18:35 +02:00
|
|
|
*
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calamares is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BRANDING_H
|
|
|
|
#define BRANDING_H
|
|
|
|
|
|
|
|
#include "UiDllMacro.h"
|
|
|
|
#include "Typedefs.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
2014-10-16 16:14:48 +02:00
|
|
|
#include <QStringList>
|
|
|
|
#include <QMap>
|
2014-10-10 18:18:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
namespace Calamares
|
|
|
|
{
|
|
|
|
|
2014-11-16 04:19:53 +01:00
|
|
|
class GlobalStorage;
|
|
|
|
|
2014-10-10 18:18:35 +02:00
|
|
|
class UIDLLEXPORT Branding : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-10-16 16:57:52 +02:00
|
|
|
enum StringEntry : short
|
|
|
|
{
|
|
|
|
ProductName,
|
|
|
|
Version,
|
|
|
|
ShortVersion,
|
|
|
|
VersionedName,
|
2014-11-16 05:14:57 +01:00
|
|
|
ShortVersionedName,
|
2014-11-19 16:50:15 +01:00
|
|
|
ShortProductName,
|
2015-04-01 18:03:17 +02:00
|
|
|
BootloaderEntryName,
|
|
|
|
ProductUrl,
|
2015-04-01 19:00:52 +02:00
|
|
|
SupportUrl,
|
|
|
|
KnownIssuesUrl,
|
|
|
|
ReleaseNotesUrl
|
2014-10-16 16:57:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum ImageEntry : short
|
|
|
|
{
|
|
|
|
ProductLogo,
|
|
|
|
ProductIcon
|
|
|
|
};
|
2015-03-19 16:26:22 +01:00
|
|
|
|
|
|
|
enum StyleEntry : short
|
|
|
|
{
|
|
|
|
SidebarBackground,
|
|
|
|
SidebarText,
|
|
|
|
SidebarTextSelect
|
|
|
|
};
|
2014-10-16 16:14:48 +02:00
|
|
|
|
2014-10-10 18:18:35 +02:00
|
|
|
static Branding* instance();
|
|
|
|
|
|
|
|
explicit Branding( const QString& brandingFilePath,
|
2015-02-26 01:57:19 +01:00
|
|
|
QObject* parent = nullptr );
|
2014-10-10 18:18:35 +02:00
|
|
|
|
|
|
|
QString descriptorPath() const;
|
|
|
|
QString componentName() const;
|
|
|
|
QString componentDirectory() const;
|
2015-05-07 16:10:04 +02:00
|
|
|
QString translationsPathPrefix() const;
|
2014-10-10 18:18:35 +02:00
|
|
|
|
2014-10-16 16:14:48 +02:00
|
|
|
QString string( Branding::StringEntry stringEntry ) const;
|
2015-03-19 17:58:18 +01:00
|
|
|
QString styleString( Branding::StyleEntry styleEntry ) const;
|
2014-10-16 16:57:52 +02:00
|
|
|
QString imagePath( Branding::ImageEntry imageEntry ) const;
|
|
|
|
QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const;
|
2015-01-23 14:02:40 +01:00
|
|
|
QString slideshowPath() const;
|
2014-10-10 18:18:35 +02:00
|
|
|
|
2014-11-16 04:19:53 +01:00
|
|
|
/**
|
|
|
|
* Creates a map called "branding" in the global storage, and inserts an
|
|
|
|
* entry for each of the branding strings. This makes the branding
|
|
|
|
* information accessible to the Python modules.
|
|
|
|
*/
|
|
|
|
void setGlobals( GlobalStorage* globalStorage ) const;
|
|
|
|
|
2014-10-10 18:18:35 +02:00
|
|
|
private:
|
|
|
|
static Branding* s_instance;
|
|
|
|
|
2014-10-16 16:14:48 +02:00
|
|
|
static QStringList s_stringEntryStrings;
|
|
|
|
static QStringList s_imageEntryStrings;
|
2015-03-19 16:26:22 +01:00
|
|
|
static QStringList s_styleEntryStrings;
|
2014-10-16 16:14:48 +02:00
|
|
|
|
|
|
|
void bail( const QString& message );
|
|
|
|
|
2014-10-10 18:18:35 +02:00
|
|
|
QString m_descriptorPath;
|
|
|
|
QString m_componentName;
|
2014-10-16 16:14:48 +02:00
|
|
|
QMap< QString, QString > m_strings;
|
|
|
|
QMap< QString, QString > m_images;
|
2015-03-19 16:26:22 +01:00
|
|
|
QMap< QString, QString > m_style;
|
2015-01-23 14:02:40 +01:00
|
|
|
QString m_slideshowPath;
|
2015-05-07 16:10:04 +02:00
|
|
|
QString m_translationsPathPrefix;
|
2014-10-10 18:18:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // BRANDING_H
|