mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 18:04:32 +00:00
Support fallback when selecting theme icons
Fallback icon theme are not supported everywhere. Hence we mimic signature of QIcon::fromTheme().
This commit is contained in:
parent
3c1f747c25
commit
9d3378bd3b
@ -57,10 +57,17 @@ GuiIconProvider *GuiIconProvider::instance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QIcon GuiIconProvider::getIcon(const QString &iconId)
|
QIcon GuiIconProvider::getIcon(const QString &iconId)
|
||||||
|
{
|
||||||
|
return getIcon(iconId, iconId);
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon GuiIconProvider::getIcon(const QString &iconId, const QString &fallback)
|
||||||
{
|
{
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||||
if (m_useSystemTheme) {
|
if (m_useSystemTheme) {
|
||||||
QIcon icon = QIcon::fromTheme(iconId, QIcon(IconProvider::getIconPath(iconId)));
|
QIcon icon = QIcon::fromTheme(iconId);
|
||||||
|
if (icon.name() != iconId)
|
||||||
|
icon = QIcon::fromTheme(fallback, QIcon(IconProvider::getIconPath(iconId)));
|
||||||
icon = generateDifferentSizes(icon);
|
icon = generateDifferentSizes(icon);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
static GuiIconProvider *instance();
|
static GuiIconProvider *instance();
|
||||||
|
|
||||||
QIcon getIcon(const QString &iconId);
|
QIcon getIcon(const QString &iconId);
|
||||||
|
QIcon getIcon(const QString &iconId, const QString &fallback);
|
||||||
QIcon getFlagIcon(const QString &countryIsoCode);
|
QIcon getFlagIcon(const QString &countryIsoCode);
|
||||||
QString getIconPath(const QString &iconId);
|
QString getIconPath(const QString &iconId);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user