From 7e06159e24bccacdeeadaf766bd0e2461cea9c75 Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Thu, 31 Jan 2019 12:14:51 +0200 Subject: [PATCH] Color systray icon for Windows 7 --- systemtray.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/systemtray.cpp b/systemtray.cpp index 85a6175a..7f48a427 100644 --- a/systemtray.cpp +++ b/systemtray.cpp @@ -1,7 +1,7 @@ #include "systemtray.h" #include #include - + #include SystemTray::SystemTray(QObject *parent) : QObject(parent) { @@ -16,7 +16,7 @@ alwaysOnTopAction->setCheckable(true); QAction * quitAction = new QAction(trUtf8("Quit"), this); - + /* to connect the signals clicks on menu items to the appropriate signals for QML. * */ connect(trayIconMenu, &QMenu::aboutToShow, this, &SystemTray::signalIconMenuAboutToShow); @@ -34,8 +34,16 @@ trayIcon = new QSystemTrayIcon(); trayIcon->setContextMenu(trayIconMenu); - QIcon icon = QIcon::fromTheme("smartcode-stremio-tray", QIcon(":/images/stremio_tray_white.png")); - icon.setIsMask(true); + QIcon icon; + + auto winVer = QSysInfo::windowsVersion(); + if(winVer <= QSysInfo::WV_WINDOWS7 && winVer != QSysInfo::WV_None) { + icon = QIcon(":/images/stremio_window.png"); + } else { + icon = QIcon::fromTheme("smartcode-stremio-tray", QIcon(":/images/stremio_tray_white.png")); + icon.setIsMask(true); + } + trayIcon->setIcon(icon); trayIcon->show();