comunicwatcher/trayicon.h

44 lines
652 B
C++

/**
* Tray icon
*
* @author Pierre Hubert
*/
#pragma once
#include <QObject>
#include <QSystemTrayIcon>
#include "notificationsnumber.h"
class TrayIcon : public QObject
{
Q_OBJECT
public:
explicit TrayIcon(QObject *parent = nullptr);
~TrayIcon();
public slots:
void onNewNumber(const NotificationsNumber &number);
signals:
private slots:
void onQuit();
private:
/**
* Show a notification
*
* @param n The number of unread conversations
*/
void showNotification(const NotificationsNumber &n);
// Class members
QMenu *mMenu;
QSystemTrayIcon mTrayIcon;
int mOldNumber = 0;
};