AlarmNotifications
PANDA Slow Control Alarm Daemon
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
desktopalarmwidget.h
Go to the documentation of this file.
1 
34 #include "oldgcccompat.h" // Compatibilty macros for GCC < 4.7
35 
36 #include <boost/thread.hpp>
37 #include <QObject>
38 #include <QFuture>
39 #include <QSystemTrayIcon>
40 #include <QWidget>
41 
42 #ifndef DESKTOPALARMWIDGET_H
43 #define DESKTOPALARMWIDGET_H
44 
45 class QMenu; // Forward declarations
46 class QAction;
47 
48 namespace AlarmNotifications
49 {
50 
51 class AlarmServerConnector; // Forward declaration
52 
53 
59 class DesktopAlarmWidget : public QWidget
60 {
61  Q_OBJECT
62 public:
69  {
75  ActiveOK = 0,
88  };
89 private:
95  const bool _activateBeedo;
104 
110  bool _run;
122  QFuture<void> _iconThread;
128  boost::mutex _ascmutex;
129 
136  virtual void createContextMenu() = 0;
143  void observeAlarmStatus();
144 signals:
151  void alarmStatusChanged ( );
159  void notificationSwitchChanged ( bool enabled );
160 protected slots:
167  void toggleNotifications();
174  void exitApplication();
181  virtual void changeTrayIcon () = 0;
196  virtual void notificationSwitchChange ( bool enabled ) = 0;
197 protected:
204  inline bool getAlarmActive() const noexcept
205  {
206  return _alarmActive;
207  }
221  void showStatusMessage ();
222 public:
229  DesktopAlarmWidget ( const bool activateBeedo = false );
235  virtual ~DesktopAlarmWidget();
242  DesktopAlarmWidget ( const DesktopAlarmWidget& other ) = delete;
249  DesktopAlarmWidget ( DesktopAlarmWidget&& other ) = delete;
257  DesktopAlarmWidget& operator= ( const DesktopAlarmWidget& other ) = delete;
265  DesktopAlarmWidget& operator= ( DesktopAlarmWidget&& other ) = delete;
266 };
267 
268 }
269 #endif // DESKTOPALARMWIDGET_H