diff options
Diffstat (limited to 'libsowatch/notificationsmodel.h')
-rw-r--r-- | libsowatch/notificationsmodel.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libsowatch/notificationsmodel.h b/libsowatch/notificationsmodel.h new file mode 100644 index 0000000..5e7e029 --- /dev/null +++ b/libsowatch/notificationsmodel.h @@ -0,0 +1,37 @@ +#ifndef SOWATCH_NOTIFICATIONSMODEL_H +#define SOWATCH_NOTIFICATIONSMODEL_H + +#include <QtCore/QAbstractListModel> + +#include "notification.h" + +namespace sowatch +{ + +class NotificationsModel : public QAbstractListModel +{ + Q_OBJECT +public: + explicit NotificationsModel(QObject *parent = 0); + + int rowCount(const QModelIndex &parent) const; + QVariant data(const QModelIndex &index, int role) const; + + void add(Notification *n); + void remove(Notification *n); + + int fullCount() const; + int fullCountByType(Notification::Type type) const; + + bool removeDeletedNotification(Notification *n); + +private: + int getOffsetForType(Notification::Type type); + +private: + QList<Notification*> _list[Notification::TypeCount]; +}; + +} + +#endif // SOWATCH_NOTIFICATIONSMODEL_H |