source: src/mvc/eventmodel.h

Last change on this file was ffb6be7, checked in by gregor herrmann <gregor@…>, 4 months ago

Bump copyright years.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * Copyright (C) 2010 Ixonos Plc.
3 * Copyright (C) 2011-2021 Philipp Spitzer, gregor herrmann, Stefan Stahl
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 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        void setTitle(const QList<Event>& mEvents);
62    };
63
64private:
65    void createTimeGroups();
66    void createTrackGroups();
67    void createTrackGroupsNew();
68    void createRoomGroups();
69
70public slots:
71    void updateModel(int aEventId);
72
73private:
74    QList<Event> mEvents;
75    QList<Group> mGroups;
76    QHash<int, int> mParents; ///< eventId, groupId
77};
78
79#endif // EVENTMODEL_H
80
Note: See TracBrowser for help on using the repository browser.