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.
This commit is contained in:
Luis Ángel San Martín 2019-09-20 10:07:20 +02:00
parent 4377ad935c
commit 6031c81d81
3 changed files with 12 additions and 3 deletions

View File

@ -71,5 +71,6 @@
<file alias="images/sidebar/delete_sidebar@2x.png">../images/sidebar/delete_sidebar_osx@2x.png</file> <file alias="images/sidebar/delete_sidebar@2x.png">../images/sidebar/delete_sidebar_osx@2x.png</file>
<file alias="images/sidebar/addLabelIcon@2x.png">../images/sidebar/addLabelIcon_osx@2x.png</file> <file alias="images/sidebar/addLabelIcon@2x.png">../images/sidebar/addLabelIcon_osx@2x.png</file>
<file alias="images/sidebar/renameListIcon@2x.png">../images/sidebar/renameListIcon_osx@2x.png</file> <file alias="images/sidebar/renameListIcon@2x.png">../images/sidebar/renameListIcon_osx@2x.png</file>
<file>YACReaderLibrary.icns</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -41,5 +41,6 @@
<file>../images/lists/label_yellow.png</file> <file>../images/lists/label_yellow.png</file>
<file>../images/lists/list.png</file> <file>../images/lists/list.png</file>
<file>../images/empty_reading_list.png</file> <file>../images/empty_reading_list.png</file>
<file>icon.ico</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -143,13 +143,20 @@ void LibraryWindow::setupUI()
// If a window icon was set in main() we reuse it for the tray too. // 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) // This allows support for third party icon themes on Freedesktop(Linux/Unix)
// systems. // systems.
// TODO: Luis, please tweak this to your liking and add OS macros if needed.
if (!QApplication::windowIcon().isNull()) { if (!QApplication::windowIcon().isNull()) {
trayIcon.setIcon(QApplication::windowIcon()); trayIcon.setIcon(QApplication::windowIcon());
} else { } else {
// TODO: Luis: This is a placeholder. Add MacOS, Windows and maybe a fallback #ifdef Q_OS_WIN
// for other systems here. 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")); trayIcon.setIcon(QIcon(":/images/iconLibrary.png"));
#endif
#endif
} }
connect(&trayIcon, &QSystemTrayIcon::activated, connect(&trayIcon, &QSystemTrayIcon::activated,