summaryrefslogtreecommitdiff
path: root/libsowatch/notificationsmodel.h
blob: 5e7e02913d4b3e6e478dc8130753e4ee2822ce8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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