[d0d0a66] | 1 | #ifndef EVENTMODEL_H |
---|
| 2 | #define EVENTMODEL_H |
---|
| 3 | |
---|
| 4 | #include <QAbstractItemModel> |
---|
| 5 | |
---|
| 6 | #include "event.h" |
---|
| 7 | |
---|
| 8 | class EventModel : public QAbstractItemModel |
---|
| 9 | { |
---|
[d1fb9ee] | 10 | public: |
---|
| 11 | static const QString COMMA_SEPARATOR; |
---|
[d0d0a66] | 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; |
---|
[969a840] | 19 | void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB |
---|
[6f39595] | 20 | void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB |
---|
[7620de0] | 21 | void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events sorted by Track id and Event start from the DB |
---|
[9d8946b] | 22 | int loadSearchResultEvents(const QDate &aDate, int aConferenceId); |
---|
[b8a3ad1] | 23 | void loadNowEvents(int aConferenceId); // loads Now events from the DB |
---|
[7620de0] | 24 | void loadEventsByRoom(const QDate &aDate, int aConferenceId); |
---|
[d49254d] | 25 | void loadConflictEvents(int aEventId, int aConferenceId); // loads events in conflict |
---|
[d0d0a66] | 26 | |
---|
| 27 | private: |
---|
| 28 | struct Group |
---|
| 29 | { |
---|
| 30 | Group(const QString & title, |
---|
| 31 | int firstEventIndex) : |
---|
| 32 | |
---|
| 33 | mTitle(title), |
---|
| 34 | mFirstEventIndex(firstEventIndex), |
---|
| 35 | mChildCount(0) |
---|
| 36 | {} |
---|
| 37 | |
---|
| 38 | QString mTitle; |
---|
| 39 | int mFirstEventIndex; |
---|
| 40 | int mChildCount; |
---|
| 41 | }; |
---|
| 42 | |
---|
| 43 | private: |
---|
| 44 | void createTimeGroups(); |
---|
[4693fa6] | 45 | void createTrackGroups(); |
---|
[005e2b7] | 46 | void createTrackGroupsNew(); |
---|
[f6300c7] | 47 | void clearModel(); |
---|
[7620de0] | 48 | void createRoomGroups(); |
---|
[d0d0a66] | 49 | |
---|
[c718a77] | 50 | public slots: |
---|
| 51 | void updateModel(int aEventId); |
---|
| 52 | |
---|
[d0d0a66] | 53 | private: |
---|
| 54 | QList<Event> mEvents; |
---|
| 55 | QList<Group> mGroups; |
---|
| 56 | QHash<int, int> mParents; |
---|
| 57 | }; |
---|
| 58 | |
---|
| 59 | #endif // EVENTMODEL_H |
---|
[69393c0] | 60 | |
---|