[libcalamaresui] Refactor loading of stylesheet

- prep-work for adding special-case styling for productWallpaper
This commit is contained in:
Adriaan de Groot 2020-04-30 12:18:15 +02:00
parent ddde817abf
commit 1d44c88e0a

View File

@ -359,11 +359,10 @@ Branding::image( const QString& imageName, const QSize& size ) const
return ImageRegistry::instance()->pixmap( imageFi.absoluteFilePath(), size ); return ImageRegistry::instance()->pixmap( imageFi.absoluteFilePath(), size );
} }
QString static QString
Branding::stylesheet() const _stylesheet( const QDir& dir )
{ {
QFileInfo fi( m_descriptorPath ); QFileInfo importQSSPath( dir.filePath( "stylesheet.qss" ) );
QFileInfo importQSSPath( fi.absoluteDir().filePath( "stylesheet.qss" ) );
if ( importQSSPath.exists() && importQSSPath.isReadable() ) if ( importQSSPath.exists() && importQSSPath.isReadable() )
{ {
QFile stylesheetFile( importQSSPath.filePath() ); QFile stylesheetFile( importQSSPath.filePath() );
@ -372,11 +371,17 @@ Branding::stylesheet() const
} }
else else
{ {
cWarning() << "The branding component" << fi.absoluteDir().absolutePath() << "does not ship stylesheet.qss."; cWarning() << "The branding component" << dir.absolutePath() << "does not ship stylesheet.qss.";
} }
return QString(); return QString();
} }
QString
Branding::stylesheet() const
{
return _stylesheet( QFileInfo( m_descriptorPath ).absoluteDir() );
}
void void
Branding::setGlobals( GlobalStorage* globalStorage ) const Branding::setGlobals( GlobalStorage* globalStorage ) const
{ {