diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 2dbda3c36..8c4f6a3cd 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -149,28 +149,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) connect( m_viewManager, &Calamares::ViewManager::enlarge, this, &CalamaresWindow::enlarge ); mainLayout->addWidget( m_viewManager->centralWidget() ); - - - - QString brandingComponentName = Calamares::Settings::instance()->brandingComponentName(); - if ( brandingComponentName.simplified().isEmpty() ) - { - cError() << "FATAL: branding component not set in settings.conf"; - ::exit( EXIT_FAILURE ); - } - - QString brandingQSSDescriptorPath = QString( "/etc/calamares/branding/%1/stylesheet.qss" ) - .arg( brandingComponentName ); - - QFileInfo importQSSPath = QFileInfo( brandingQSSDescriptorPath ); - if ( importQSSPath.exists() && importQSSPath.isReadable() ) - { - QFile File(brandingQSSDescriptorPath); - File.open(QFile::ReadOnly); - QString StyleSheet = QLatin1String(File.readAll()); - this->setStyleSheet(StyleSheet); - } - + setStyleSheet( Calamares::Branding::instance()->stylesheet() ); } void diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index f9f66a9fc..8df39a7d4 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -188,6 +188,16 @@ Branding::Branding( const QString& brandingFilePath, m_translationsPathPrefix.append( QString( "%1calamares-%2" ) .arg( QDir::separator() ) .arg( m_componentName ) ); + + QFileInfo importQSSPath( componentDir.filePath( "stylesheet.qss" ) ); + if ( importQSSPath.exists() && importQSSPath.isReadable() ) + { + QFile stylesheetFile( importQSSPath.filePath() ); + stylesheetFile.open( QFile::ReadOnly ); + m_stylesheet = stylesheetFile.readAll(); + } + else + cWarning() << "the branding component" << componentDir.absolutePath() << "does not ship stylesheet.qss."; } else { diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index a3253e500..f7de939f1 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -98,6 +98,8 @@ public: QString styleString( Branding::StyleEntry styleEntry ) const; QString imagePath( Branding::ImageEntry imageEntry ) const; QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const; + /** @brief Stylesheet to apply for this branding. May be empty. */ + QString stylesheet() const { return m_stylesheet; } bool welcomeStyleCalamares() const { return m_welcomeStyleCalamares; } bool welcomeExpandingLogo() const { return m_welcomeExpandingLogo; } @@ -125,6 +127,7 @@ private: QMap< QString, QString > m_style; QString m_slideshowPath; QString m_translationsPathPrefix; + QString m_stylesheet; // Text from file bool m_welcomeStyleCalamares; bool m_welcomeExpandingLogo;