Permalink
Browse files

Redefine visibility and priority bitmask type

Add ability to define priority and visibility with ShowNotificationX(..)
  • Loading branch information...
jyavenard committed Jul 8, 2013
1 parent 28495ce commit 58c6b14bb1fd2ef02e4507f007cf8a3361054971
@@ -12,12 +12,13 @@
#include <QMutex>
#include <QMap>
#include <QImage>
#include <stdint.h>
#include "mythevent.h"
#include "mythuiexp.h"
typedef QMap<QString,QString> DMAP;
typedef unsigned int PNMask;
typedef unsigned int VNMask;
class MUI_PUBLIC MythNotification : public MythEvent
{
@@ -145,11 +146,11 @@ class MUI_PUBLIC MythNotification : public MythEvent
/**
* define a bitmask of Visibility
*/
void SetVisibility(uint32_t n) { m_visibility = n; }
void SetVisibility(VNMask n) { m_visibility = n; }
/**
* For future use, not implemented at this stage
*/
void SetPriority(uint32_t n) { m_priority = n; }
void SetPriority(PNMask n) { m_priority = n; }
// Getter
int GetId(void) { return m_id; }
@@ -159,8 +160,8 @@ class MUI_PUBLIC MythNotification : public MythEvent
DMAP GetMetaData(void) { return m_metadata; }
int GetDuration(void) { return m_duration; };
QString GetStyle(void) { return m_style; }
uint32_t GetVisibility(void) { return m_visibility; }
uint32_t GetPriority(void) { return m_priority; }
VNMask GetVisibility(void) { return m_visibility; }
PNMask GetPriority(void) { return m_priority; }
protected:
MythNotification(const MythNotification &o)
@@ -182,8 +183,8 @@ class MUI_PUBLIC MythNotification : public MythEvent
int m_duration;
DMAP m_metadata;
QString m_style;
uint32_t m_visibility;
uint32_t m_priority;
VNMask m_visibility;
PNMask m_priority;
};
class MUI_PUBLIC MythImageNotification : public virtual MythNotification
@@ -1016,16 +1016,26 @@ void MythUINotificationCenter::UpdateScreen(MythScreenType *screen)
void ShowNotificationError(const QString &msg,
const QString &from,
const QString &detail)
const QString &detail,
const PNMask priority,
const VNMask visibility)
{
MythErrorNotification n(msg, from, detail);
n.SetPriority(priority);
n.SetVisibility(visibility);
MythUINotificationCenter::GetInstance()->Queue(n);
}
void ShowNotification(const QString &msg,
const QString &from,
const QString &detail)
const QString &detail,
const PNMask priority,
const VNMask visibility)
{
MythNotification n(msg, from, detail);
n.SetPriority(priority);
n.SetVisibility(visibility);
MythUINotificationCenter::GetInstance()->Queue(n);
}
@@ -145,10 +145,14 @@ private slots:
*/
MUI_PUBLIC void ShowNotificationError(const QString &msg,
const QString &from = "",
const QString &detail = "");
const QString &detail = "",
const PNMask priority = MythNotification::kDefault,
const VNMask visibility = MythNotification::kAll);
MUI_PUBLIC void ShowNotification(const QString &msg,
const QString &from = "",
const QString &detail = "");
const QString &detail = "",
const PNMask priority = MythNotification::kDefault,
const VNMask visibility = MythNotification::kAll);
#endif /* defined(__MythTV__mythnotifications__) */
@@ -97,8 +97,8 @@ public slots:
MythPoint m_position;
QTimer *m_timer;
QString m_style;
uint32_t m_visibility;
uint32_t m_priority;
VNMask m_visibility;
PNMask m_priority;
};
//// class MythScreenNotificationStack

0 comments on commit 58c6b14

Please sign in to comment.