2013-06-13 09:47:42 +02:00
|
|
|
#ifndef SYSTEMTRAYICON_H
|
|
|
|
#define SYSTEMTRAYICON_H
|
|
|
|
|
|
|
|
#include <QSystemTrayIcon>
|
2013-06-17 20:17:13 +02:00
|
|
|
#include <QPointer>
|
2013-06-13 09:47:42 +02:00
|
|
|
|
2013-06-13 20:11:16 +02:00
|
|
|
|
2013-06-19 15:48:33 +02:00
|
|
|
class FormMain;
|
|
|
|
|
2013-06-13 20:11:16 +02:00
|
|
|
class SystemTrayIcon : public QSystemTrayIcon {
|
2013-06-19 21:28:26 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2013-06-13 09:47:42 +02:00
|
|
|
public:
|
2013-06-18 19:03:55 +02:00
|
|
|
explicit SystemTrayIcon(const QString &normal_icon,
|
|
|
|
const QString &plain_icon,
|
2013-06-19 15:48:33 +02:00
|
|
|
FormMain *parent = 0);
|
2013-06-17 20:17:13 +02:00
|
|
|
~SystemTrayIcon();
|
|
|
|
|
|
|
|
// Returns true if tray icon CAN be constructed on this machine.
|
|
|
|
static bool isSystemTrayAvailable();
|
|
|
|
|
|
|
|
// Returns true if tray icon CAN be costructed and IS enabled in
|
|
|
|
// application settings.
|
|
|
|
static bool isSystemTrayActivated();
|
|
|
|
|
|
|
|
// Creates new tray icon if necessary and returns it.
|
|
|
|
// WARNING: Use this in cooperation with SystemTrayIcon::isSystemTrayActivated().
|
|
|
|
static SystemTrayIcon *getInstance();
|
2013-06-13 09:47:42 +02:00
|
|
|
|
2013-06-18 19:03:55 +02:00
|
|
|
// Sets the number to be visible in the tray icon, -1 removes it.
|
|
|
|
void setNumber(int number = -1);
|
|
|
|
|
2013-06-17 20:17:13 +02:00
|
|
|
// TODO: Implement method for manual clearing of the tray icon. Creating of tray icon
|
|
|
|
// handled by getInstance().
|
2013-06-19 15:48:33 +02:00
|
|
|
static void deleteInstance();
|
2013-06-13 09:47:42 +02:00
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
2013-06-18 19:30:38 +02:00
|
|
|
void show();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void show_private();
|
2013-06-17 20:17:13 +02:00
|
|
|
|
|
|
|
private:
|
2013-06-18 19:03:55 +02:00
|
|
|
QString m_normalIcon;
|
|
|
|
QString m_plainIcon;
|
|
|
|
|
2013-06-19 15:48:33 +02:00
|
|
|
static QPointer<SystemTrayIcon> s_trayIcon;
|
2013-06-13 09:47:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SYSTEMTRAYICON_H
|