mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 01:30:46 +03:00
Merge pull request #1825 from Integral-Tech/fix-tooltip
Add profile name to tooltip & fix message count
This commit is contained in:
commit
2f967978f2
1 changed files with 19 additions and 7 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
#include "TrayIcon.h"
|
#include "TrayIcon.h"
|
||||||
|
#include "UserSettingsPage.h"
|
||||||
|
|
||||||
MsgCountComposedIcon::MsgCountComposedIcon(const QIcon &icon)
|
MsgCountComposedIcon::MsgCountComposedIcon(const QIcon &icon)
|
||||||
: QIconEngine()
|
: QIconEngine()
|
||||||
|
@ -114,12 +115,30 @@ TrayIcon::TrayIcon(const QString &filename, QWindow *parent)
|
||||||
|
|
||||||
menu->addAction(viewAction_);
|
menu->addAction(viewAction_);
|
||||||
menu->addAction(quitAction_);
|
menu->addAction(quitAction_);
|
||||||
|
|
||||||
|
QString toolTip = QLatin1String("nheko");
|
||||||
|
QString profile = UserSettings::instance()->profile();
|
||||||
|
if (!profile.isEmpty())
|
||||||
|
toolTip.append(QStringLiteral(" | %1").arg(profile));
|
||||||
|
|
||||||
|
setToolTip(toolTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrayIcon::setUnreadCount(int count)
|
TrayIcon::setUnreadCount(int count)
|
||||||
{
|
{
|
||||||
qGuiApp->setBadgeNumber(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 !defined(Q_OS_MACOS) && !defined(Q_OS_WIN)
|
||||||
if (count != previousCount) {
|
if (count != previousCount) {
|
||||||
|
@ -131,13 +150,6 @@ TrayIcon::setUnreadCount(int count)
|
||||||
#else
|
#else
|
||||||
(void)previousCount;
|
(void)previousCount;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString toolTip = QLatin1String("nheko");
|
|
||||||
if (count > 0) {
|
|
||||||
toolTip.append(tr("\n%n unread message(s)", "", count));
|
|
||||||
}
|
|
||||||
|
|
||||||
setToolTip(toolTip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_TrayIcon.cpp"
|
#include "moc_TrayIcon.cpp"
|
||||||
|
|
Loading…
Reference in a new issue