Browse Source

Support fallback when selecting theme icons

Fallback icon theme are not supported everywhere. Hence we mimic
signature of QIcon::fromTheme().
adaptive-webui-19844
Eugene Shalygin 8 years ago
parent
commit
9d3378bd3b
  1. 9
      src/gui/guiiconprovider.cpp
  2. 1
      src/gui/guiiconprovider.h

9
src/gui/guiiconprovider.cpp

@ -57,10 +57,17 @@ GuiIconProvider *GuiIconProvider::instance() @@ -57,10 +57,17 @@ GuiIconProvider *GuiIconProvider::instance()
}
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 (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);
return icon;
}

1
src/gui/guiiconprovider.h

@ -44,6 +44,7 @@ public: @@ -44,6 +44,7 @@ public:
static GuiIconProvider *instance();
QIcon getIcon(const QString &iconId);
QIcon getIcon(const QString &iconId, const QString &fallback);
QIcon getFlagIcon(const QString &countryIsoCode);
QString getIconPath(const QString &iconId);

Loading…
Cancel
Save