2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr>
|
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2017-05-21 16:36:06 +03:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QIcon>
|
|
|
|
#include <QIconEngine>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
|
2020-01-31 08:12:02 +03:00
|
|
|
class QAction;
|
|
|
|
class QPainter;
|
|
|
|
|
2017-05-21 16:36:06 +03:00
|
|
|
class MsgCountComposedIcon : public QIconEngine
|
|
|
|
{
|
|
|
|
public:
|
2017-09-10 12:59:21 +03:00
|
|
|
MsgCountComposedIcon(const QString &filename);
|
2017-05-21 16:36:06 +03:00
|
|
|
|
2020-02-04 17:18:26 +03:00
|
|
|
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) const override;
|
|
|
|
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
|
2017-05-21 16:36:06 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
int msgCount = 0;
|
2017-05-21 16:36:06 +03:00
|
|
|
|
|
|
|
private:
|
2017-09-10 12:59:21 +03:00
|
|
|
const int BubbleDiameter = 17;
|
2017-05-21 16:36:06 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
QIcon icon_;
|
2017-05-21 16:36:06 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class TrayIcon : public QSystemTrayIcon
|
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
Q_OBJECT
|
2017-05-21 16:36:06 +03:00
|
|
|
public:
|
2017-09-10 12:59:21 +03:00
|
|
|
TrayIcon(const QString &filename, QWidget *parent);
|
2017-05-21 16:36:06 +03:00
|
|
|
|
|
|
|
public slots:
|
2017-09-10 12:59:21 +03:00
|
|
|
void setUnreadCount(int count);
|
2017-05-21 16:36:06 +03:00
|
|
|
|
|
|
|
private:
|
2017-09-10 12:59:21 +03:00
|
|
|
QAction *viewAction_;
|
|
|
|
QAction *quitAction_;
|
2017-05-21 16:36:06 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
MsgCountComposedIcon *icon_;
|
2017-05-21 16:36:06 +03:00
|
|
|
};
|