qt5
Last change
on this file since 0d4ecc2 was
005e2b7,
checked in by korrco <korrco@…>, 13 years ago
|
caching removed
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | #ifndef EVENTMODEL_H |
---|
2 | #define EVENTMODEL_H |
---|
3 | |
---|
4 | #include <QAbstractItemModel> |
---|
5 | |
---|
6 | #include "event.h" |
---|
7 | |
---|
8 | class EventModel : public QAbstractItemModel |
---|
9 | { |
---|
10 | public: |
---|
11 | static const QString COMMA_SEPARATOR; |
---|
12 | public: |
---|
13 | EventModel(); |
---|
14 | QVariant data(const QModelIndex& index, int role) const; |
---|
15 | QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; |
---|
16 | QModelIndex parent ( const QModelIndex & index ) const; |
---|
17 | int columnCount ( const QModelIndex & parent = QModelIndex() ) const; |
---|
18 | int rowCount ( const QModelIndex & parent = QModelIndex() ) const; |
---|
19 | void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB |
---|
20 | void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB |
---|
21 | void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events grouped by Track from the DB |
---|
22 | int loadSearchResultEvents(const QDate &aDate, int aConferenceId); |
---|
23 | void loadNowEvents(int aConferenceId); // loads Now events from the DB |
---|
24 | |
---|
25 | private: |
---|
26 | struct Group |
---|
27 | { |
---|
28 | Group(const QString & title, |
---|
29 | int firstEventIndex) : |
---|
30 | |
---|
31 | mTitle(title), |
---|
32 | mFirstEventIndex(firstEventIndex), |
---|
33 | mChildCount(0) |
---|
34 | {} |
---|
35 | |
---|
36 | QString mTitle; |
---|
37 | int mFirstEventIndex; |
---|
38 | int mChildCount; |
---|
39 | }; |
---|
40 | |
---|
41 | private: |
---|
42 | void createTimeGroups(); |
---|
43 | void createTrackGroups(); |
---|
44 | void createTrackGroupsNew(); |
---|
45 | void clearModel(); |
---|
46 | |
---|
47 | public slots: |
---|
48 | void updateModel(int aEventId); |
---|
49 | |
---|
50 | private: |
---|
51 | QList<Event> mEvents; |
---|
52 | QList<Group> mGroups; |
---|
53 | QHash<int, int> mParents; |
---|
54 | }; |
---|
55 | |
---|
56 | #endif // EVENTMODEL_H |
---|
57 | |
---|
Note: See
TracBrowser
for help on using the repository browser.