Introduce and use a Calamares::Branding::setGlobals method.
The method 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. The method is called by CalamaresApplication::initJobQueue. This is necessary because the Branding class is in libcalamaresui, so Python modules cannot access it directly.
This commit is contained in:
parent
39e2170b6d
commit
98f99fa5bf
@ -316,5 +316,6 @@ CalamaresApplication::onPluginsReady()
|
||||
void
|
||||
CalamaresApplication::initJobQueue()
|
||||
{
|
||||
new Calamares::JobQueue( this );
|
||||
Calamares::JobQueue *jobQueue = new Calamares::JobQueue( this );
|
||||
Calamares::Branding::instance()->setGlobals( jobQueue->globalStorage() );
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "Branding.h"
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "utils/CalamaresUtils.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/YamlUtils.h"
|
||||
@ -26,6 +27,7 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QPixmap>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
@ -200,6 +202,19 @@ Branding::slideshowPaths() const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Branding::setGlobals( GlobalStorage* globalStorage ) const
|
||||
{
|
||||
QVariantMap brandingMap;
|
||||
brandingMap.insert( "productName", string( ProductName ) );
|
||||
brandingMap.insert( "version", string( Version ) );
|
||||
brandingMap.insert( "shortVersion", string( ShortVersion ) );
|
||||
brandingMap.insert( "versionedName", string( VersionedName ) );
|
||||
brandingMap.insert( "shortVersionedName", string( ShortVersionedName ) );
|
||||
globalStorage->insert( "branding", brandingMap );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Branding::bail( const QString& message )
|
||||
{
|
||||
|
@ -30,6 +30,8 @@
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
class GlobalStorage;
|
||||
|
||||
class UIDLLEXPORT Branding : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -63,6 +65,13 @@ public:
|
||||
QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const;
|
||||
QStringList slideshowPaths() const;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
private:
|
||||
static Branding* s_instance;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user