From 6031c81d81cb17d455aa3f72439e4dbcff67425b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Fri, 20 Sep 2019 10:07:20 +0200 Subject: [PATCH] Add better icons for the system tray in macos and windows I would like to design specific icons for the system tray at some point, but for now this is what we have. --- YACReaderLibrary/images_osx.qrc | 1 + YACReaderLibrary/images_win.qrc | 1 + YACReaderLibrary/library_window.cpp | 13 ++++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/YACReaderLibrary/images_osx.qrc b/YACReaderLibrary/images_osx.qrc index 14398e66..804d8810 100644 --- a/YACReaderLibrary/images_osx.qrc +++ b/YACReaderLibrary/images_osx.qrc @@ -71,5 +71,6 @@ ../images/sidebar/delete_sidebar_osx@2x.png ../images/sidebar/addLabelIcon_osx@2x.png ../images/sidebar/renameListIcon_osx@2x.png + YACReaderLibrary.icns diff --git a/YACReaderLibrary/images_win.qrc b/YACReaderLibrary/images_win.qrc index fdb1ea0b..cb87e0cf 100644 --- a/YACReaderLibrary/images_win.qrc +++ b/YACReaderLibrary/images_win.qrc @@ -41,5 +41,6 @@ ../images/lists/label_yellow.png ../images/lists/list.png ../images/empty_reading_list.png + icon.ico diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 21c8610c..46cb5cd1 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -143,13 +143,20 @@ void LibraryWindow::setupUI() // If a window icon was set in main() we reuse it for the tray too. // This allows support for third party icon themes on Freedesktop(Linux/Unix) // systems. - // TODO: Luis, please tweak this to your liking and add OS macros if needed. if (!QApplication::windowIcon().isNull()) { trayIcon.setIcon(QApplication::windowIcon()); } else { - // TODO: Luis: This is a placeholder. Add MacOS, Windows and maybe a fallback - // for other systems here. +#ifdef Q_OS_WIN + trayIcon.setIcon(QIcon(":/icon.ico")); +#else +#ifdef Q_OS_MACOS + auto icon = QIcon(":/YACReaderLibrary.icns"); + icon.setIsMask(true); + trayIcon.setIcon(icon); +#else trayIcon.setIcon(QIcon(":/images/iconLibrary.png")); +#endif +#endif } connect(&trayIcon, &QSystemTrayIcon::activated,