trayicon.h 866 Bytes
Newer Older
1 2
#ifndef TRAYICON_H_
#define TRAYICON_H_
3 4

#include <QAction>
5
#include <QApplication>
6
#include <QMainWindow>
7
#include <QMenu>
8 9 10
#include <QSystemTrayIcon>
#include <QWidget>

11 12 13 14
/*!
    \class TrayIcon
    \brief Handles the systemtray icon and menu.
 */
15 16
class TrayIcon : public QWidget {
  Q_OBJECT
17

18
public:
19 20 21
  explicit TrayIcon(QMainWindow *parent);
  void showMessage(QString title, QString msg, int time);
  void setVisible(bool visible);
22

23
signals:
24

25
public slots:
26 27
  void showHideParent();
  void iconActivated(QSystemTrayIcon::ActivationReason reason);
28

29
private:
30 31
  void createActions();
  void createTrayIcon();
32

Philip Rinn's avatar
Philip Rinn committed
33 34 35 36 37
  QAction *showAction;
  QAction *hideAction;
  QAction *minimizeAction;
  QAction *maximizeAction;
  QAction *restoreAction;
38 39 40 41 42
  QAction *quitAction;

  QSystemTrayIcon *sysTrayIcon;
  QMenu *trayIconMenu;
  QMainWindow *parentwin;
43 44
};

45
#endif // TRAYICON_H_