Hook up the branding component code path in CalamaresApplication.

main
Teo Mrnjavac 10 years ago
parent 2182918476
commit a58857baa6

@ -28,6 +28,7 @@
#include "utils/CalamaresUtilsGui.h"
#include "utils/Logger.h"
#include "JobQueue.h"
#include "Branding.h"
#include "Settings.h"
#include "viewpages/ViewStep.h"
#include "ViewManager.h"
@ -188,7 +189,69 @@ CalamaresApplication::initSettings()
void
CalamaresApplication::initBranding()
{
QString brandingComponentName = Calamares::Settings::instance()->brandingComponentName();
if ( brandingComponentName.simplified().isEmpty() )
{
cLog() << "FATAL ERROR: branding component not set in settings.conf";
::exit( EXIT_FAILURE );
}
QString brandingDescriptorSubpath = QString( "branding/%1/branding.desc" )
.arg( brandingComponentName );
QFileInfo brandingFile;
if ( CalamaresUtils::isAppDataDirOverridden() )
{
brandingFile = QFileInfo( CalamaresUtils::appDataDir()
.absoluteFilePath( brandingDescriptorSubpath ) );
if ( !brandingFile.exists() || !brandingFile.isReadable() )
{
cLog() << "FATAL ERROR: explicitly configured application data directory"
<< CalamaresUtils::appDataDir().absolutePath()
<< "does not contain a valid branding component descriptor at"
<< brandingFile.absoluteFilePath()
<< "\nCowardly refusing to continue startup without branding.";
::exit( EXIT_FAILURE );
}
}
else
{
QStringList brandingFileCandidatesByPriority;
if ( isDebug() )
{
brandingFileCandidatesByPriority.append(
QDir::currentPath() +
QDir::separator() +
"src" +
QDir::separator() +
brandingDescriptorSubpath );
}
brandingFileCandidatesByPriority.append( QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" )
.absoluteFilePath( brandingDescriptorSubpath ) );
brandingFileCandidatesByPriority.append( CalamaresUtils::appDataDir()
.absoluteFilePath( brandingDescriptorSubpath ) );
foreach ( const QString& path, brandingFileCandidatesByPriority )
{
QFileInfo pathFi( path );
if ( pathFi.exists() && pathFi.isReadable() )
{
brandingFile = pathFi;
break;
}
}
if ( !brandingFile.exists() || !brandingFile.isReadable() )
{
cLog() << "FATAL ERROR: none of the expected branding descriptor file paths ("
<< brandingFileCandidatesByPriority.join( ", " )
<< ") contain a valid branding.desc file."
<< "\nCowardly refusing to continue startup without branding.";
::exit( EXIT_FAILURE );
}
}
new Calamares::Branding( brandingFile.absoluteFilePath(), this );
}

Loading…
Cancel
Save