From 01cc12fede5462c788a8fd022ae95701b08e104e Mon Sep 17 00:00:00 2001 From: Integral Date: Sun, 7 Jul 2024 23:28:36 +0800 Subject: Add number of unread messages to tray icon toolIip --- src/TrayIcon.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/TrayIcon.cpp b/src/TrayIcon.cpp index c62fecea..776140f2 100644 --- a/src/TrayIcon.cpp +++ b/src/TrayIcon.cpp @@ -129,6 +129,13 @@ TrayIcon::setUnreadCount(int count) previousCount = count; } #endif + + QString toolTip = QLatin1String("nheko"); + if (count > 0) { + toolTip.append(tr("\n%1 unread message(s)").arg(count)); + } + + setToolTip(toolTip); } #include "moc_TrayIcon.cpp" -- cgit 1.5.1 From aac96d6f50aea7d3daf2875c92f2311fbb5e4e15 Mon Sep 17 00:00:00 2001 From: Integral Date: Sun, 28 Jul 2024 00:57:25 +0800 Subject: Use %n to make the plural forms work properly --- src/TrayIcon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/TrayIcon.cpp b/src/TrayIcon.cpp index 776140f2..44bfb6ca 100644 --- a/src/TrayIcon.cpp +++ b/src/TrayIcon.cpp @@ -132,7 +132,7 @@ TrayIcon::setUnreadCount(int count) QString toolTip = QLatin1String("nheko"); if (count > 0) { - toolTip.append(tr("\n%1 unread message(s)").arg(count)); + toolTip.append(tr("\n%n unread message(s)", "", count)); } setToolTip(toolTip); -- cgit 1.5.1