mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[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 changed files with 11 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QIcon>
|
||||
#include <QPixmap>
|
||||
#include <QVariantMap>
|
||||
|
||||
|
@ -185,9 +186,16 @@ Branding::Branding( const QString& brandingFilePath,
|
|||
loadStrings( m_images, doc, "images",
|
||||
[&]( const QString& s ) -> QString
|
||||
{
|
||||
QFileInfo imageFi( componentDir.absoluteFilePath( expand( s ) ) );
|
||||
const QString imageName( expand( s ) );
|
||||
QFileInfo imageFi( componentDir.absoluteFilePath( imageName ) );
|
||||
if ( !imageFi.exists() )
|
||||
bail( QString( "Image file %1 does not exist." ).arg( imageFi.absoluteFilePath() ) );
|
||||
{
|
||||
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() ) );
|
||||
return imageName; // Not turned into a path
|
||||
}
|
||||
return imageFi.absoluteFilePath();
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue