DolphinQt: cache icons instead of single pixmaps

Fixes dynamically changing dpi scaling.
Load resources from svg if possible.
Currently svg support is not in Qt build in Externals,
and image files need to be added later.
This commit is contained in:
Shawn Hoffman
2023-04-23 03:43:49 -07:00
parent 8c2e924255
commit 51e528e45f
15 changed files with 94 additions and 218 deletions

View File

@ -3,8 +3,8 @@
#pragma once
#include <QIcon>
#include <QList>
#include <QPixmap>
#include <string_view>
namespace DiscIO
@ -20,29 +20,26 @@ public:
enum class MiscID
{
BannerMissing,
LogoLarge,
LogoSmall
Logo,
};
static void Init();
static QPixmap GetPlatform(DiscIO::Platform platform);
static QPixmap GetCountry(DiscIO::Country country);
static QIcon GetPlatform(DiscIO::Platform platform);
static QIcon GetCountry(DiscIO::Country country);
static QPixmap GetMisc(MiscID id);
static QIcon GetMisc(MiscID id);
static QIcon GetScaledIcon(std::string_view name);
static QIcon GetScaledThemeIcon(std::string_view name);
static QIcon GetResourceIcon(std::string_view name);
static QIcon GetThemeIcon(std::string_view name);
static QIcon GetAppIcon();
static QPixmap GetScaledPixmap(std::string_view name);
private:
Resources() {}
static QIcon GetIcon(std::string_view name, const QString& dir);
static QPixmap GetPixmap(std::string_view name, const QString& dir);
static QIcon LoadNamedIcon(std::string_view name, const QString& dir);
static QList<QPixmap> m_platforms;
static QList<QPixmap> m_countries;
static QList<QPixmap> m_misc;
static bool m_svg_supported;
static QList<QIcon> m_platforms;
static QList<QIcon> m_countries;
static QList<QIcon> m_misc;
};