diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-07-01 16:34:36 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-07-01 16:34:36 +0300 |
commit | 06cacc13d1ddcc4fb7f9dcd21debe826107fac5a (patch) | |
tree | a81199319d787b8aa9d761b60edc7d5ca12d5cd9 /src | |
parent | Remove hardcoded font sizes on the top bars and text input (diff) | |
download | nheko-06cacc13d1ddcc4fb7f9dcd21debe826107fac5a.tar.xz |
Show unread count on MacOs toolbar
Diffstat (limited to 'src')
-rw-r--r-- | src/TrayIcon.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/TrayIcon.cc b/src/TrayIcon.cc index beaf00df..7e649077 100644 --- a/src/TrayIcon.cc +++ b/src/TrayIcon.cc @@ -20,6 +20,10 @@ #include "TrayIcon.h" +#if defined(Q_OS_MAC) +#include <QtMacExtras> +#endif + MsgCountComposedIcon::MsgCountComposedIcon(const QString &filename) : QIconEngine() { @@ -91,10 +95,17 @@ TrayIcon::TrayIcon(const QString &filename, QWidget *parent) void TrayIcon::setUnreadCount(int count) { +#if defined(Q_OS_MAC) + if (count == 0) + QtMac::setBadgeLabelText(""); + else + QtMac::setBadgeLabelText(QString::number(count)); +#else MsgCountComposedIcon *tmp = static_cast<MsgCountComposedIcon *>(icon_->clone()); tmp->msgCount = count; setIcon(QIcon(tmp)); icon_ = tmp; +#endif } |