summaryrefslogtreecommitdiff
path: root/libsowatch/notificationsmodel.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-08-13 21:31:52 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-08-13 21:31:52 +0200
commitabdf3b1eaba8151f1b8e862750c38cb7a5411d2a (patch)
tree69e314d80a332295dd5475fc91f45c2078eaead5 /libsowatch/notificationsmodel.h
parent51701e30d710ad016ddf2d306cdd7be122ddf25b (diff)
downloadsowatch-abdf3b1eaba8151f1b8e862750c38cb7a5411d2a.tar.gz
sowatch-abdf3b1eaba8151f1b8e862750c38cb7a5411d2a.zip
make watchsimulator work again
Diffstat (limited to 'libsowatch/notificationsmodel.h')
-rw-r--r--libsowatch/notificationsmodel.h37
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