MythTV  master
mythnotificationcenter.h
Go to the documentation of this file.
1 //
2 // mythnotificationcenter.h
3 // MythTV
4 //
5 // Created by Jean-Yves Avenard on 25/06/13.
6 // Copyright (c) 2013 Bubblestuff Pty Ltd. All rights reserved.
7 //
8 
9 #ifndef MYTHTV_MYTHNOTIFICATIONCENTER_H
10 #define MYTHTV_MYTHNOTIFICATIONCENTER_H
11 
12 #include <QList>
13 #include <QDateTime>
14 #include <QMutex>
15 
16 #include "mythuiexp.h"
17 
18 #include "mythnotification.h"
19 
20 // .h
21 
22 class MythScreenType;
23 class NCPrivate;
24 
26 {
27 public:
29 
30  static Type kEventType;
31 
32  // No implicit copying.
35 protected:
38 };
39 
41 {
42 public:
44  virtual ~MythNotificationCenter();
45 
51  bool Queue(const MythNotification &notification);
52 
56  static MythNotificationCenter *GetInstance(void);
57 
67  int Register(void *from);
74  void UnRegister(void *from, int id, bool closeimemdiately = false);
75 
76  /*
77  * OSD drawing utilities
78  */
79 
84  static QDateTime ScreenExpiryTime(const MythScreenType *screen);
89  static bool ScreenCreated(const MythScreenType *screen);
95  void GetNotificationScreens(QList<MythScreenType*> &screens);
100  static void UpdateScreen(MythScreenType *screen);
104  int DisplayedNotifications(void) const;
108  int QueuedNotifications(void) const;
113  bool RemoveFirst(void);
119  void ProcessQueue(void);
120 
121 private:
122  NCPrivate *d {nullptr}; // NOLINT(readability-identifier-naming)
123 };
124 
128 MUI_PUBLIC void ShowNotificationError(const QString &msg,
129  const QString &from = QString(),
130  const QString &detail = QString(),
131  VNMask visibility = MythNotification::kAll,
133 
134 MUI_PUBLIC void ShowNotification(const QString &msg,
135  const QString &from = QString(),
136  const QString &detail = QString(),
137  VNMask visibility = MythNotification::kAll,
139 
141  const QString &msg,
142  const QString &origin = QString(),
143  const QString &detail = QString(),
144  const QString &image = QString(),
145  const QString &extra = QString(),
146  const QString &progress_text = QString(),
147  float progress = -1.0F,
148  std::chrono::seconds duration = -1s,
149  bool fullscreen = false,
150  VNMask visibility = MythNotification::kAll,
152  const QString &style = QString());
153 
154 MUI_PUBLIC void ShowNotification(MythNotification::Type type,
155  const QString &msg,
156  const QString &origin = QString(),
157  const QString &detail = QString(),
158  const QString &image = QString(),
159  const QString &extra = QString(),
160  const QString &progress_text = QString(),
161  float progress = -1.0F,
162  std::chrono::seconds duration = -1s,
163  bool fullscreen = false,
164  VNMask visibility = MythNotification::kAll,
166  const QString &style = QString());
167 
168 #endif /* defined(MYTHTV_MYTHNOTIFICATIONCENTER_H) */
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
error
static void error(const char *str,...)
Definition: vbi.cpp:35
progress
bool progress
Definition: mythtv/programs/mythcommflag/main.cpp:72
MythEvent
This class is used as a container for messages.
Definition: mythevent.h:16
MythNotification
Definition: mythnotification.h:29
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
ShowNotificationError
MUI_PUBLIC void ShowNotificationError(const QString &msg, const QString &from=QString(), const QString &detail=QString(), VNMask visibility=MythNotification::kAll, MythNotification::Priority priority=MythNotification::kDefault)
convenience utility to display error message as notification
Definition: mythnotificationcenter.cpp:1428
NCPrivate
Definition: mythnotificationcenter_private.h:33
ShowNotification
MUI_PUBLIC void ShowNotification(const QString &msg, const QString &from=QString(), const QString &detail=QString(), VNMask visibility=MythNotification::kAll, MythNotification::Priority priority=MythNotification::kDefault)
Definition: mythnotificationcenter.cpp:1439
VNMask
unsigned int VNMask
Definition: mythnotification.h:27
MythEvent::operator=
MythEvent & operator=(const MythEvent &other)=default
MythNotification::Priority
Priority
Definition: mythnotification.h:58
mythnotification.h
MythNotification::kDefault
@ kDefault
Definition: mythnotification.h:60
MythNotificationCenterEvent
Definition: mythnotificationcenter.h:25
MythNotificationCenterEvent::MythNotificationCenterEvent
MythNotificationCenterEvent()
Definition: mythnotificationcenter.h:28
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
MythNotificationCenter
Definition: mythnotificationcenter.h:40
MythNotification::kAll
@ kAll
Definition: mythnotification.h:77
mythuiexp.h
MythNotificationCenterEvent::kEventType
static Type kEventType
Definition: mythnotificationcenter.h:30