40 lines
951 B
C
Raw Normal View History

2019-08-17 20:07:11 +03:00
#ifndef NOTIFICATIONSERVICE_H
#define NOTIFICATIONSERVICE_H
2019-08-19 18:02:40 +03:00
#include "notificationdata.h"
2019-08-17 20:07:11 +03:00
#include <QObject>
2019-08-17 20:33:18 +03:00
class NotificationService: public QObject
2019-08-17 20:07:11 +03:00
{
2019-08-17 20:33:18 +03:00
Q_OBJECT
2019-08-19 18:02:40 +03:00
Q_PROPERTY(NotificationData notify READ notify NOTIFY notifyChanged)
Q_PROPERTY(QList<NotificationData> history READ history NOTIFY notifyChanged)
2019-08-17 20:33:18 +03:00
private:
explicit NotificationService(QObject *ptr = nullptr);
2019-08-19 18:02:40 +03:00
NotificationData _notify;
QList<NotificationData> _history;
2019-08-17 20:33:18 +03:00
2019-08-17 20:07:11 +03:00
public:
2019-08-19 18:02:40 +03:00
NotificationData notify() const;
void setNotify(const NotificationData &notify);
Q_INVOKABLE void setNotify(const QString& title = "",
const QString& text = "",
const QString& img = "",
2019-08-22 09:53:48 +03:00
int type = NotificationData::Normal);
2019-08-17 20:33:18 +03:00
static NotificationService* getService();
2019-08-19 18:02:40 +03:00
const QList<NotificationData> & history() const;
2019-08-17 20:33:18 +03:00
signals:
2019-08-19 18:02:40 +03:00
void notifyChanged();
2019-08-17 20:07:11 +03:00
};
2019-08-17 20:33:18 +03:00
2019-08-17 20:07:11 +03:00
#endif // NOTIFICATIONSERVICE_H