67 if (Details.contains(QStringLiteral(
"inputs")))
69 QVariantMap inputs = Details.
value(QStringLiteral(
"inputs")).toMap();
70 QVariantMap::const_iterator it = inputs.constBegin();
71 for ( ; it != inputs.constEnd(); ++it)
73 if (it.key() == QStringLiteral(
"event"))
75 int event = TorcCoreUtils::StringToEnum<Torc::Actions>(it.value().toString().trimmed());
82 if (m_events.isEmpty())
84 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"System notification '%1' has no events to listen for").arg(
uniqueId));
101 result.append(tr(
"System event"));
103 result.append(TorcCoreUtils::EnumToString<Torc::Actions>(event));
113 Data->append(QStringLiteral(
" \"%1\"->\"%2\"\r\n").arg(
uniqueId, notifier->
GetUniqueId()));
124 QMutexLocker locker(&
lock);
126 if (m_events.contains(
event))
128 QMap<QString,QString> custom;
129 custom.insert(QStringLiteral(
"event"), TorcCoreUtils::EnumToString<Torc::Actions>(
event));
136 return TorcNotification::event(Event);
142 TorcNotification* Create(
const QString &Type,
const QVariantMap &Details)
override 144 if (Type == QStringLiteral(
"system") && Details.contains(QStringLiteral(
"inputs")))
QStringList m_notifierNames
TorcLocalContext * gLocalContext
TorcSystemNotification(const QVariantMap &Details)
virtual void SetValid(bool Valid)
bool event(QEvent *Event) override
Listen for system events (TorcEvent).
int GetEvent(void)
Return the Torc action associated with this event.
void Graph(QByteArray *Data) override
QList< TorcNotifier * > m_notifiers
TorcSystemNotificationFactory TorcSystemNotificationFactory
static Type TorcEventType
Register TorcEventType with QEvent.
~TorcSystemNotification()
A general purpose event object.
QStringList GetDescription(void) override
#define LOG(_MASK_, _LEVEL_, _STRING_)
void AddObserver(QObject *Observer)
brief Register the given object to receive events.
QVariantMap SetNotificationText(const QString &Title, const QString &Body, const QMap< QString, QString > &Custom)
Create instances of TorcSystemNotification.
void RemoveObserver(QObject *Observer)
brief Deregister the given object.
void Notify(const QVariantMap &Message)
static TorcNotify * gNotify
QString GetUniqueId(void)