From 8231a2b1ae9fd26d824661ea909299c7f1e3d7cb Mon Sep 17 00:00:00 2001 From: rku Date: Mon, 14 Dec 2015 16:06:21 +0200 Subject: [PATCH] Support for theming qTox tray and window icons This patch adds ability to override qTox window and tray icons with ones from user's desktop theme. Some people prefer keeping tray icons consistent to achieve best looks. Following theme icons used: * qtox: general window icon which is also used in taskbar * qtox-online, qtox-offline, qtox-busy, qtox-away, qtox-invisible, qtox-event: tray icons If theme icon is not available then default built-in icon will be used. --- src/widget/widget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 363f3d082..470912d46 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -116,6 +116,10 @@ void Widget::init() { ui->setupUi(this); + QIcon themeIcon = QIcon::fromTheme("qtox"); + if (!themeIcon.isNull()) + setWindowIcon(themeIcon); + timer = new QTimer(); timer->start(1000); offlineMsgTimer = new QTimer(); @@ -424,7 +428,7 @@ void Widget::updateIcons() status = QStringLiteral("offline"); } - QIcon ico; + QIcon ico = QIcon::fromTheme("qtox-" + status); if (ico.isNull()) { QString color = Settings::getInstance().getLightTrayIcon() ? "light" : "dark";