Add fallback icon0 (#827)

This commit is contained in:
VocalFan 2024-04-13 05:09:34 -04:00 committed by GitHub
parent 2c438c3a4b
commit ad791adbe9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,6 @@
#include "game_models.hpp"
#include "path.hpp"
#include <QFile>
Game::Game(const QString &id, const QString &name, const QString &directory) :
m_id(id),
@ -18,8 +19,14 @@ QPixmap Game::icon() const
auto dir = joinPath(m_directory, "sce_sys");
auto path = joinPath(dir.c_str(), "icon0.png");
// Construct icon object.
QPixmap icon(path.c_str());
QPixmap icon;
if (QFile::exists(path.c_str())) {
icon.load(path.c_str());
} else {
// Load fallback icon if icon0 doesn't exist.
icon.load(":/resources/fallbackicon0.png");
}
// For games with large icon sizes.
if (icon.width() != 512 || icon.height() != 512) {

View file

@ -11,6 +11,7 @@
<file>resources/lightmode/cog-outline.svg</file>
<file>resources/lightmode/folder-open-outline.svg</file>
<file>resources/lightmode/view-comfy.svg</file>
<file>resources/fallbackicon0.png</file>
<file>resources/obliteration-icon.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB