From e2801daf33790040caa879dad6bb679476093720 Mon Sep 17 00:00:00 2001 From: Raul Rodrigo Segura Date: Sun, 20 May 2018 16:47:20 +0200 Subject: [PATCH] check path --- src/calamares/CalamaresWindow.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 55ee9c69b..6fc0a3622 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -53,7 +53,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) QSize availableSize = qApp->desktop()->availableGeometry( this ).size(); this->setObjectName("mainApp"); - + cDebug() << "Available size" << availableSize; if ( ( availableSize.width() < windowPreferredWidth ) || ( availableSize.height() < windowPreferredHeight ) ) @@ -148,10 +148,27 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) connect( m_viewManager, &Calamares::ViewManager::enlarge, this, &CalamaresWindow::enlarge ); mainLayout->addWidget( m_viewManager->centralWidget() ); - QFile File("/etc/calamares/stylesheet.qss"); - File.open(QFile::ReadOnly); - QString StyleSheet = QLatin1String(File.readAll()); - this->setStyleSheet(StyleSheet); + + + + 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 ); + + importQSSPath = QFileInfo( brandingQSSDescriptorPath ); + if ( importQSSPath.exists() && importQSSPath.isReadable() ) + { + QFile File(importQSSPath); + File.open(QFile::ReadOnly); + QString StyleSheet = QLatin1String(File.readAll()); + this->setStyleSheet(StyleSheet); + } }