|
|
@ -16,8 +16,8 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#include <QApplication> |
|
|
|
#include <QApplication> |
|
|
|
#include <QTimer> |
|
|
|
|
|
|
|
#include <QList> |
|
|
|
#include <QList> |
|
|
|
|
|
|
|
#include <QTimer> |
|
|
|
|
|
|
|
|
|
|
|
#include "TrayIcon.h" |
|
|
|
#include "TrayIcon.h" |
|
|
|
|
|
|
|
|
|
|
@ -89,7 +89,7 @@ MsgCountComposedIcon::availableSizes(QIcon::Mode mode, QIcon::State state) const |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QPixmap |
|
|
|
QPixmap |
|
|
|
MsgCountComposedIcon::pixmap(const QSize& size, QIcon::Mode mode, QIcon::State state) |
|
|
|
MsgCountComposedIcon::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QImage img(size, QImage::Format_ARGB32); |
|
|
|
QImage img(size, QImage::Format_ARGB32); |
|
|
|
img.fill(qRgba(0, 0, 0, 0)); |
|
|
|
img.fill(qRgba(0, 0, 0, 0)); |
|
|
@ -132,15 +132,19 @@ TrayIcon::setUnreadCount(int count) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Use the native badge counter in MacOS.
|
|
|
|
// Use the native badge counter in MacOS.
|
|
|
|
#if defined(Q_OS_MAC) |
|
|
|
#if defined(Q_OS_MAC) |
|
|
|
if (count == 0) |
|
|
|
auto labelText = count == 0 ? "" : QString::number(count); |
|
|
|
QtMac::setBadgeLabelText(""); |
|
|
|
|
|
|
|
else |
|
|
|
if (labelText == QtMac::badgeLabelText()) |
|
|
|
QtMac::setBadgeLabelText(QString::number(count)); |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QtMac::setBadgeLabelText(labelText); |
|
|
|
#elif defined(Q_OS_WIN) |
|
|
|
#elif defined(Q_OS_WIN) |
|
|
|
// FIXME: Find a way to use Windows apis for the badge counter (if any).
|
|
|
|
// FIXME: Find a way to use Windows apis for the badge counter (if any).
|
|
|
|
#else |
|
|
|
#else |
|
|
|
|
|
|
|
if (count == icon_->msgCount) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// Custom drawing on Linux.
|
|
|
|
// Custom drawing on Linux.
|
|
|
|
// FIXME: It doesn't seem to work on KDE.
|
|
|
|
|
|
|
|
MsgCountComposedIcon *tmp = static_cast<MsgCountComposedIcon *>(icon_->clone()); |
|
|
|
MsgCountComposedIcon *tmp = static_cast<MsgCountComposedIcon *>(icon_->clone()); |
|
|
|
tmp->msgCount = count; |
|
|
|
tmp->msgCount = count; |
|
|
|
|
|
|
|
|
|
|
|