[libcalamaresui] Allow icon names in branding images
- It's ok to use path / filenames in images, but you can also use icon names according to the FDO icon spec. This makes sense for at least *productLogo*, possibly *productIcon*, but not really for *productWelcome*.
This commit is contained in:
parent
b41cac6556
commit
822bbaad9c
@ -1,7 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||||
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
* Copyright 2017-2019, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2018, Raul Rodrigo Segura (raurodse)
|
* Copyright 2018, Raul Rodrigo Segura (raurodse)
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QIcon>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
@ -185,9 +186,16 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
loadStrings( m_images, doc, "images",
|
loadStrings( m_images, doc, "images",
|
||||||
[&]( const QString& s ) -> QString
|
[&]( const QString& s ) -> QString
|
||||||
{
|
{
|
||||||
QFileInfo imageFi( componentDir.absoluteFilePath( expand( s ) ) );
|
const QString imageName( expand( s ) );
|
||||||
|
QFileInfo imageFi( componentDir.absoluteFilePath( imageName ) );
|
||||||
if ( !imageFi.exists() )
|
if ( !imageFi.exists() )
|
||||||
|
{
|
||||||
|
const auto icon = QIcon::fromTheme( imageName );
|
||||||
|
// Not found, bail out with the filename used
|
||||||
|
if ( icon.isNull() )
|
||||||
bail( QString( "Image file %1 does not exist." ).arg( imageFi.absoluteFilePath() ) );
|
bail( QString( "Image file %1 does not exist." ).arg( imageFi.absoluteFilePath() ) );
|
||||||
|
return imageName; // Not turned into a path
|
||||||
|
}
|
||||||
return imageFi.absoluteFilePath();
|
return imageFi.absoluteFilePath();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user