commit
06bd8749a2
4
CHANGES
4
CHANGES
@ -15,6 +15,10 @@ This release contains contributions from (alphabetically by first name):
|
|||||||
- *branding* now supports os-release variables in the *strings* section,
|
- *branding* now supports os-release variables in the *strings* section,
|
||||||
which allows re-using (at runtime) information set in /etc/os-release .
|
which allows re-using (at runtime) information set in /etc/os-release .
|
||||||
This requires KDE Frameworks 5.58. #1150
|
This requires KDE Frameworks 5.58. #1150
|
||||||
|
- *branding* allows the use of FreeDesktop.org icon names for the
|
||||||
|
*productLogo* and *productIcon* keys. If a file is named there, then
|
||||||
|
the file is used, and otherwise the icon is looked up in the current
|
||||||
|
theme.
|
||||||
|
|
||||||
# 3.2.8 (2019-05-10) #
|
# 3.2.8 (2019-05-10) #
|
||||||
|
|
||||||
|
@ -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() )
|
||||||
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();
|
return imageFi.absoluteFilePath();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -289,15 +297,21 @@ Branding::imagePath( Branding::ImageEntry imageEntry ) const
|
|||||||
QPixmap
|
QPixmap
|
||||||
Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const
|
Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const
|
||||||
{
|
{
|
||||||
QPixmap pixmap =
|
const auto path = imagePath( imageEntry );
|
||||||
ImageRegistry::instance()->pixmap( imagePath( imageEntry ), size );
|
if ( path.contains( '/' ) )
|
||||||
|
|
||||||
if ( pixmap.isNull() )
|
|
||||||
{
|
{
|
||||||
Q_ASSERT( false );
|
QPixmap pixmap = ImageRegistry::instance()->pixmap( path, size );
|
||||||
return QPixmap();
|
|
||||||
|
Q_ASSERT( !pixmap.isNull() );
|
||||||
|
return pixmap;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto icon = QIcon::fromTheme(path);
|
||||||
|
|
||||||
|
Q_ASSERT( !icon.isNull() );
|
||||||
|
return icon.pixmap( size );
|
||||||
}
|
}
|
||||||
return pixmap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
|
@ -61,9 +61,9 @@ ImageRegistry::cacheKey( const QSize& size, float opacity, QColor tint )
|
|||||||
QPixmap
|
QPixmap
|
||||||
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, QColor tint )
|
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, QColor tint )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( !(size.width() < 0 || size.height() < 0) );
|
||||||
if ( size.width() < 0 || size.height() < 0 )
|
if ( size.width() < 0 || size.height() < 0 )
|
||||||
{
|
{
|
||||||
Q_ASSERT( false );
|
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,15 +159,9 @@ ImageRegistry::putInCache( const QString& image, const QSize& size, CalamaresUti
|
|||||||
if ( s_cache.contains( image ) )
|
if ( s_cache.contains( image ) )
|
||||||
{
|
{
|
||||||
subcache = s_cache.value( image );
|
subcache = s_cache.value( image );
|
||||||
|
|
||||||
if ( subcache.contains( mode ) )
|
if ( subcache.contains( mode ) )
|
||||||
{
|
{
|
||||||
subsubcache = subcache.value( mode );
|
subsubcache = subcache.value( mode );
|
||||||
|
|
||||||
/* if ( subsubcache.contains( size.width() * size.height() ) )
|
|
||||||
{
|
|
||||||
Q_ASSERT( false );
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user