1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

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.
This commit is contained in:
rku 2015-12-14 16:06:21 +02:00
parent aa20df7144
commit 8231a2b1ae

View File

@ -116,6 +116,10 @@ void Widget::init()
{ {
ui->setupUi(this); ui->setupUi(this);
QIcon themeIcon = QIcon::fromTheme("qtox");
if (!themeIcon.isNull())
setWindowIcon(themeIcon);
timer = new QTimer(); timer = new QTimer();
timer->start(1000); timer->start(1000);
offlineMsgTimer = new QTimer(); offlineMsgTimer = new QTimer();
@ -424,7 +428,7 @@ void Widget::updateIcons()
status = QStringLiteral("offline"); status = QStringLiteral("offline");
} }
QIcon ico; QIcon ico = QIcon::fromTheme("qtox-" + status);
if (ico.isNull()) if (ico.isNull())
{ {
QString color = Settings::getInstance().getLightTrayIcon() ? "light" : "dark"; QString color = Settings::getInstance().getLightTrayIcon() ? "light" : "dark";