update dversionmangle in watch file to deal with local +svn versions
[debian/fosdem-schedule.git] / src / mvc / eventmodel.h
1 /*
2  * Copyright (C) 2010 Ixonos Plc.
3  *
4  * This file is part of fosdem-schedule.
5  *
6  * fosdem-schedule is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation, either version 2 of the License, or (at your option)
9  * any later version.
10  *
11  * fosdem-schedule is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef EVENTMODEL_H
20 #define EVENTMODEL_H
21
22 #include <QAbstractItemModel>
23
24 #include "event.h"
25
26 class EventModel : public QAbstractItemModel
27 {
28 public:
29     static const QString COMMA_SEPARATOR;
30 public:
31     EventModel();
32     QVariant data(const QModelIndex& index, int role) const;
33     QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
34     QModelIndex parent ( const QModelIndex & index ) const;
35     int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
36     int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
37     void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
38     void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
39     void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events sorted by Track id and Event start from the DB
40     int loadSearchResultEvents(const QDate &aDate, int aConferenceId);
41     void loadNowEvents(int aConferenceId); // loads Now events from the DB
42     void loadEventsByRoom(const QDate &aDate, int aConferenceId);
43     void loadConflictEvents(int aEventId, int aConferenceId); // loads events in conflict
44     void clearModel();
45
46 private:
47     struct Group
48     {
49         Group(const QString & title,
50               int firstEventIndex) :
51
52             mTitle(title),
53             mFirstEventIndex(firstEventIndex),
54             mChildCount(0)
55         {}
56
57         QString mTitle;
58         int mFirstEventIndex;
59         int mChildCount;
60     };
61
62 private:
63     void createTimeGroups();
64     void createTrackGroups();
65     void createTrackGroupsNew();
66     void createRoomGroups();
67
68 public slots:
69     void updateModel(int aEventId);
70
71 private:
72     QList<Event> mEvents;
73     QList<Group> mGroups;
74     QHash<int, int> mParents;
75 };
76
77 #endif // EVENTMODEL_H
78