[libcalamaresui] Document accessors in Branding

- document accessors
 - put all path and directory accessors together
 - make simple accessors inline
 - rename "pathprefix" to "directory" to be consistent with others
This commit is contained in:
Adriaan de Groot 2018-05-22 05:21:20 -04:00
parent 47805209c6
commit 975004fc63
3 changed files with 18 additions and 35 deletions

View File

@ -81,7 +81,6 @@ Branding::Branding( const QString& brandingFilePath,
QObject* parent ) QObject* parent )
: QObject( parent ) : QObject( parent )
, m_descriptorPath( brandingFilePath ) , m_descriptorPath( brandingFilePath )
, m_componentName()
, m_welcomeStyleCalamares( false ) , m_welcomeStyleCalamares( false )
, m_welcomeExpandingLogo( true ) , m_welcomeExpandingLogo( true )
{ {
@ -207,20 +206,6 @@ Branding::Branding( const QString& brandingFilePath,
} }
QString
Branding::descriptorPath() const
{
return m_descriptorPath;
}
QString
Branding::componentName() const
{
return m_componentName;
}
QString QString
Branding::componentDirectory() const Branding::componentDirectory() const
{ {
@ -229,13 +214,6 @@ Branding::componentDirectory() const
} }
QString
Branding::translationsPathPrefix() const
{
return m_translationsPathPrefix;
}
QString QString
Branding::string( Branding::StringEntry stringEntry ) const Branding::string( Branding::StringEntry stringEntry ) const
{ {
@ -272,12 +250,6 @@ Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const
} }
QString
Branding::slideshowPath() const
{
return m_slideshowPath;
}
void void
Branding::setGlobals( GlobalStorage* globalStorage ) const Branding::setGlobals( GlobalStorage* globalStorage ) const
{ {

View File

@ -77,16 +77,27 @@ public:
explicit Branding( const QString& brandingFilePath, explicit Branding( const QString& brandingFilePath,
QObject* parent = nullptr ); QObject* parent = nullptr );
QString descriptorPath() const; /** @brief Complete path of the branding descriptor file. */
QString componentName() const; QString descriptorPath() const { return m_descriptorPath; }
/** @brief The component name found in the descriptor file.
*
* The component name always matches the last directory name in the path.
*/
QString componentName() const { return m_componentName; }
/** @brief The directory holding all of the branding assets. */
QString componentDirectory() const; QString componentDirectory() const;
QString translationsPathPrefix() const; /** @brief The directory where branding translations live.
*
* This is componentDir + "/lang".
*/
QString translationsDirectory() const { return m_translationsPathPrefix; }
/** @brief Path to the slideshow QML file, if any. */
QString slideshowPath() const { return m_slideshowPath; }
QString string( Branding::StringEntry stringEntry ) const; QString string( Branding::StringEntry stringEntry ) const;
QString styleString( Branding::StyleEntry styleEntry ) const; QString styleString( Branding::StyleEntry styleEntry ) const;
QString imagePath( Branding::ImageEntry imageEntry ) const; QString imagePath( Branding::ImageEntry imageEntry ) const;
QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const; QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const;
QString slideshowPath() const;
bool welcomeStyleCalamares() const { return m_welcomeStyleCalamares; } bool welcomeStyleCalamares() const { return m_welcomeStyleCalamares; }
bool welcomeExpandingLogo() const { return m_welcomeExpandingLogo; } bool welcomeExpandingLogo() const { return m_welcomeExpandingLogo; }

View File

@ -257,7 +257,7 @@ WelcomePage::initLanguages()
if ( isTranslationAvailable ) if ( isTranslationAvailable )
CalamaresUtils::installTranslator( matchedLocale.name(), CalamaresUtils::installTranslator( matchedLocale.name(),
Calamares::Branding::instance()->translationsPathPrefix(), Calamares::Branding::instance()->translationsDirectory(),
qApp ); qApp );
else else
cWarning() << "No available translation matched" << defaultLocale; cWarning() << "No available translation matched" << defaultLocale;
@ -272,7 +272,7 @@ WelcomePage::initLanguages()
QLocale::setDefault( selectedLocale ); QLocale::setDefault( selectedLocale );
CalamaresUtils::installTranslator( selectedLocale, CalamaresUtils::installTranslator( selectedLocale,
Calamares::Branding::instance()->translationsPathPrefix(), Calamares::Branding::instance()->translationsDirectory(),
qApp ); qApp );
} ); } );
} }