mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-30 11:38:50 -07:00
Simplify tray icon related code
This commit is contained in:
parent
b8a84dbd83
commit
85777ea491
8 changed files with 125 additions and 140 deletions
|
@ -157,6 +157,36 @@ QColor UIThemeManager::getColor(const QString &id, const QColor &defaultColor) c
|
|||
return m_colors.value(id, defaultColor);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_MACOS
|
||||
QIcon UIThemeManager::getSystrayIcon() const
|
||||
{
|
||||
const TrayIcon::Style style = Preferences::instance()->trayIconStyle();
|
||||
switch (style)
|
||||
{
|
||||
#if defined(Q_OS_UNIX)
|
||||
case TrayIcon::Style::Normal:
|
||||
return QIcon::fromTheme(QLatin1String("qbittorrent-tray"));
|
||||
case TrayIcon::Style::MonoDark:
|
||||
return QIcon::fromTheme(QLatin1String("qbittorrent-tray-dark"));
|
||||
case TrayIcon::Style::MonoLight:
|
||||
return QIcon::fromTheme(QLatin1String("qbittorrent-tray-light"));
|
||||
#else
|
||||
case TrayIcon::Style::Normal:
|
||||
return getIcon(QLatin1String("qbittorrent-tray"));
|
||||
case TrayIcon::Style::MonoDark:
|
||||
return getIcon(QLatin1String("qbittorrent-tray-dark"));
|
||||
case TrayIcon::Style::MonoLight:
|
||||
return getIcon(QLatin1String("qbittorrent-tray-light"));
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// As a failsafe in case the enum is invalid
|
||||
return getIcon(QLatin1String("qbittorrent-tray"));
|
||||
}
|
||||
#endif
|
||||
|
||||
QString UIThemeManager::getIconPath(const QString &iconId) const
|
||||
{
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue