Commit 664e5ed3 authored by Jonathan Marten's avatar Jonathan Marten
Browse files

MPRIS2: Fallback icon for Firefox

Supports MPRIS2, but not completely so need the icon name here.  There
may be multiple possibilities (also for Chrome), so return a list of
names and use the first one found in ToggleToolButton::setIndicatorIcon().
parent 2c33f44f
...@@ -369,15 +369,15 @@ static QString getIconNameFromPlayerId(const QString &id) ...@@ -369,15 +369,15 @@ static QString getIconNameFromPlayerId(const QString &id)
if (id.startsWith(QLatin1String("tomahawk"))) return ("tomahawk"); if (id.startsWith(QLatin1String("tomahawk"))) return ("tomahawk");
if (id.startsWith(QLatin1String("clementine"))) return ("application-x-clementine"); if (id.startsWith(QLatin1String("clementine"))) return ("application-x-clementine");
// Partially supports MPRIS2 from version 75 onwards.
// Some systems seem to have really old icon names.
if (id.startsWith(QLatin1String("firefox"))) return ("firefox;netscape");
// Surprisingly, claims to support MPRIS2 but does not fully. // Surprisingly, claims to support MPRIS2 but does not fully.
// The installed icon name may vary depending on whether the application // The installed icon name may vary depending on whether the application
// is really Chrome or Chromium. // is really Chrome or Chromium.
if (id.startsWith(QLatin1String("chrome")) || id.startsWith(QLatin1String("chromium"))) if (id.startsWith(QLatin1String("chrome")) || id.startsWith(QLatin1String("chromium")))
{ return ("chromium-browser;chrome-browser;google-chrome");
if (QIcon::hasThemeIcon("chromium-browser")) return ("chromium-browser");
if (QIcon::hasThemeIcon("chrome-browser")) return ("chrome-browser");
if (QIcon::hasThemeIcon("google-chrome")) return ("google-chrome");
}
// Uses QtWebEngine which is based on Chromium, so as above... // Uses QtWebEngine which is based on Chromium, so as above...
if (id.startsWith(QLatin1String("akregator"))) return ("akregator"); if (id.startsWith(QLatin1String("akregator"))) return ("akregator");
......
...@@ -137,7 +137,15 @@ void ToggleToolButton::setActive(bool active) ...@@ -137,7 +137,15 @@ void ToggleToolButton::setActive(bool active)
*/ */
void ToggleToolButton::setIndicatorIcon(const QString &iconName, QWidget *label, bool small) void ToggleToolButton::setIndicatorIcon(const QString &iconName, QWidget *label, bool small)
{ {
const auto icon = QIcon::fromTheme(iconName); const QStringList iconNames = iconName.split(';');
QIcon icon;
for (const auto &name : iconNames)
{
if (!QIcon::hasThemeIcon(name)) continue;
icon = QIcon::fromTheme(name);
break;
}
if (icon.isNull()) if (icon.isNull())
{ {
qCWarning(KMIX_LOG) << "Could not get icon for" << iconName; qCWarning(KMIX_LOG) << "Could not get icon for" << iconName;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment