From eea6f686f6abc4735acb3edfdd1a88112c7b5f2f Mon Sep 17 00:00:00 2001 From: Mohammadreza Abdollahzadeh Date: Tue, 17 Apr 2018 11:58:20 +0430 Subject: [PATCH] add possibility to use icon from system theme for tray icon --- mainwindow.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 1521daed..9ac1e3e4 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -590,7 +590,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): if ( cfg.preferences.enableTrayIcon ) { - trayIcon = new QSystemTrayIcon( QIcon( ":/icons/programicon_old.png" ), this ); + trayIcon = new QSystemTrayIcon( QIcon::fromTheme("goldendict-tray", QIcon( ":/icons/programicon_old.png" )), this ); trayIcon->setToolTip( tr( "Loading..." ) ); trayIcon->show(); } @@ -1113,7 +1113,7 @@ void MainWindow::updateTrayIcon() if ( !trayIcon && cfg.preferences.enableTrayIcon ) { // Need to show it - trayIcon = new QSystemTrayIcon( QIcon( ":/icons/programicon_old.png" ), this ); + trayIcon = new QSystemTrayIcon( QIcon::fromTheme("goldendict-tray", QIcon( ":/icons/programicon_old.png" )), this ); trayIcon->setContextMenu( &trayIconMenu ); trayIcon->show(); @@ -1131,10 +1131,9 @@ void MainWindow::updateTrayIcon() if ( trayIcon ) { // Update the icon to reflect the scanning mode - trayIcon->setIcon( QIcon( - enableScanPopup->isChecked() ? - ":/icons/programicon_scan.png" : - ":/icons/programicon_old.png" ) ); + trayIcon->setIcon( enableScanPopup->isChecked() ? + QIcon::fromTheme("goldendict-scan-tray", QIcon( ":/icons/programicon_scan.png" )) : + QIcon::fromTheme("goldendict-tray", QIcon( ":/icons/programicon_old.png" )) ); trayIcon->setToolTip( "GoldenDict" ); }