comunicwatcher/trayicon.h

55 lines
907 B
C
Raw Permalink Normal View History

2020-06-13 12:39:34 +00:00
/**
* Tray icon
*
* @author Pierre Hubert
*/
#pragma once
#include <QAction>
2020-06-13 12:39:34 +00:00
#include <QObject>
#include <QSystemTrayIcon>
#include "notificationsnumber.h"
2020-06-13 12:39:34 +00:00
class TrayIcon : public QObject
{
Q_OBJECT
public:
explicit TrayIcon(QObject *parent = nullptr);
~TrayIcon();
public slots:
void onNewNumber(const NotificationsNumber &number);
2020-06-13 12:39:34 +00:00
signals:
2020-06-13 15:56:09 +00:00
void onOpenComunic();
void showAboutDialog();
2020-06-13 16:05:06 +00:00
void askForSignOut();
2020-06-13 12:39:34 +00:00
private slots:
void onQuit();
private:
/**
* Show a notification
*
* @param n The number of unread conversations
*/
void showNotification(const NotificationsNumber &n);
2020-06-13 15:19:43 +00:00
/**
* Refresh the icon shown in the taskbar
*/
void refreshIcon();
// Class members
2020-06-13 12:39:34 +00:00
QMenu *mMenu;
QAction *mUnreadNotifications;
QAction *mUnreadConversations;
2020-06-13 12:39:34 +00:00
QSystemTrayIcon mTrayIcon;
int mOldNumber = 0;
2020-06-13 12:39:34 +00:00
};