source: src/mvc/eventmodel.h @ 68b2df2

qt5
Last change on this file since 68b2df2 was 68b2df2, checked in by gregor herrmann <gregoa@…>, 10 years ago

Add copyright to source.

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