summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorIntegral <integral@member.fsf.org>2024-10-13 20:55:58 +0800
committerIntegral <integral@member.fsf.org>2024-10-13 20:55:58 +0800
commit3b0df06629badca83b90c98fc6d0607e75937714 (patch)
tree2a2b61aab9446e0b04dbadf4bb530d053f961fc9 /src
parentFix media deletion of animated files (diff)
downloadnheko-3b0df06629badca83b90c98fc6d0607e75937714.tar.xz
Add profile name to tooltip & fix message count
Diffstat (limited to 'src')
-rw-r--r--src/TrayIcon.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/TrayIcon.cpp b/src/TrayIcon.cpp

index 33e1e787..5fe6b4dc 100644 --- a/src/TrayIcon.cpp +++ b/src/TrayIcon.cpp
@@ -11,6 +11,7 @@ #include <QWindow> #include "TrayIcon.h" +#include "UserSettingsPage.h" MsgCountComposedIcon::MsgCountComposedIcon(const QIcon &icon) : QIconEngine() @@ -114,12 +115,30 @@ TrayIcon::TrayIcon(const QString &filename, QWindow *parent) menu->addAction(viewAction_); menu->addAction(quitAction_); + + QString toolTip = QLatin1String("nheko"); + QString profile = UserSettings::instance()->profile(); + if (!profile.isEmpty()) + toolTip.append(QStringLiteral(" | %1").arg(profile)); + + setToolTip(toolTip); } void TrayIcon::setUnreadCount(int count) { qGuiApp->setBadgeNumber(count); + if (count != previousCount) { + QString toolTip = QLatin1String("nheko"); + QString profile = UserSettings::instance()->profile(); + if (!profile.isEmpty()) + toolTip.append(QStringLiteral(" | %1").arg(profile)); + + if (count != 0) + toolTip.append(tr("\n%n unread message(s)", "", count)); + + setToolTip(toolTip); + } #if !defined(Q_OS_MACOS) && !defined(Q_OS_WIN) if (count != previousCount) { @@ -131,13 +150,6 @@ TrayIcon::setUnreadCount(int count) #else (void)previousCount; #endif - - QString toolTip = QLatin1String("nheko"); - if (count > 0) { - toolTip.append(tr("\n%n unread message(s)", "", count)); - } - - setToolTip(toolTip); } #include "moc_TrayIcon.cpp"