mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 21:18:48 +03:00
96f791daf1
See also: https://daniel.haxx.se/blog/2023/01/08/copyright-without-years/ https://hynek.me/til/copyright-years/
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
// SPDX-FileCopyrightText: Nheko Contributors
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QIcon>
|
|
#include <QIconEngine>
|
|
#include <QRect>
|
|
#include <QSystemTrayIcon>
|
|
|
|
class QAction;
|
|
class QPainter;
|
|
|
|
class MsgCountComposedIcon final : public QIconEngine
|
|
{
|
|
public:
|
|
MsgCountComposedIcon(const QString &filename);
|
|
|
|
void paint(QPainter *p, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
|
|
QIconEngine *clone() const override;
|
|
QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state)
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
const
|
|
#endif
|
|
override;
|
|
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
|
|
|
|
int msgCount = 0;
|
|
|
|
private:
|
|
const int BubbleDiameter = 17;
|
|
|
|
QIcon icon_;
|
|
};
|
|
|
|
class TrayIcon final : public QSystemTrayIcon
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
TrayIcon(const QString &filename, QWindow *parent);
|
|
|
|
public slots:
|
|
void setUnreadCount(int count);
|
|
|
|
private:
|
|
QAction *viewAction_;
|
|
QAction *quitAction_;
|
|
|
|
MsgCountComposedIcon *icon_;
|
|
};
|