Skip to content

Commit

Permalink
Color systray icon for Windows 7
Browse files Browse the repository at this point in the history
  • Loading branch information
core1024 committed Jan 31, 2019
1 parent 79376dc commit 7e06159
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions systemtray.cpp
@@ -1,7 +1,7 @@
#include "systemtray.h"
#include <QMenu>
#include <QSystemTrayIcon>
#include <QSysInfo>
SystemTray::SystemTray(QObject *parent) : QObject(parent)
{

Expand All @@ -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);
Expand All @@ -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();

Expand Down

0 comments on commit 7e06159

Please sign in to comment.