source: src/mvc/eventmodel.h @ a0f3e32

qt5
Last change on this file since a0f3e32 was a0f3e32, checked in by Philipp Spitzer <philipp@…>, 10 years ago

Added some comments, removed and added some debug information.

  • Property mode set to 100644
File size: 2.6 KB
Line 
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
26class EventModel : public QAbstractItemModel
27{
28public:
29    static const QString COMMA_SEPARATOR; // ", "
30public:
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
46private:
47    struct Group
48    {
49        Group(const QString & title,
50              int firstEventIndex) :
51
52            mTitle(title),                     // e.g. "16:00 - 17:30"
53            mFirstEventIndex(firstEventIndex), // first index within mEvents
54            mChildCount(0)                     // number of events in mEvents
55        {}
56
57        QString mTitle;
58        int mFirstEventIndex;
59        int mChildCount;
60    };
61
62private:
63    void createTimeGroups();
64    void createTrackGroups();
65    void createTrackGroupsNew();
66    void createRoomGroups();
67
68public slots:
69    void updateModel(int aEventId);
70
71private:
72    QList<Event> mEvents;
73    QList<Group> mGroups;
74    QHash<int, int> mParents;
75};
76
77#endif // EVENTMODEL_H
78
Note: See TracBrowser for help on using the repository browser.