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:
Kevin Kofler 2014-11-16 04:19:53 +01:00
parent 39e2170b6d
commit 98f99fa5bf
3 changed files with 26 additions and 1 deletions

View file

@ -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 )
{