[packagechooser] Look for screenshots in more places.
It is easier to put screenshots somewhere where they can be searched-for, rather than requiring either absolute paths (inconvenient to try out someone's settings) or relative paths (because who knows where Calamares will be run during testing).
This commit is contained in:
parent
be398d7edb
commit
748b16ba7f
@ -9,15 +9,28 @@
|
||||
|
||||
#include "PackageModel.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
|
||||
static QPixmap loadScreenshot( const QString& path )
|
||||
#include <QFileInfo>
|
||||
|
||||
static QPixmap
|
||||
loadScreenshot( const QString& path )
|
||||
{
|
||||
if ( QFileInfo::exists( path ) )
|
||||
{
|
||||
cDebug() << path;
|
||||
return QPixmap( path );
|
||||
}
|
||||
|
||||
const auto* branding = Calamares::Branding::instance();
|
||||
if ( !branding )
|
||||
{
|
||||
return QPixmap();
|
||||
}
|
||||
return QPixmap( branding->componentDirectory() + QStringLiteral( "/" ) + path );
|
||||
}
|
||||
|
||||
PackageItem::PackageItem() {}
|
||||
|
||||
PackageItem::PackageItem( const QString& a_id, const QString& a_name, const QString& a_description )
|
||||
|
@ -95,7 +95,11 @@ labels:
|
||||
# Human-readable description. These can be translated as well.
|
||||
# - *screenshot*
|
||||
# Path to a single screenshot of the product. May be a filesystem
|
||||
# path or a QRC path, e.g. ":/images/no-selection.png".
|
||||
# path or a QRC path, e.g. ":/images/no-selection.png". If the path
|
||||
# is not found (e.g. is a non-existent absolute path, or is a relative
|
||||
# path that does not exist in the current working directory) then
|
||||
# an additional attempt is made to load the image from the **branding**
|
||||
# directory.
|
||||
#
|
||||
# The following field is **optional** for an item:
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user