source: src/mvc/eventmodel.h @ 6df32f2

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

Update GPL blurb in source files.

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[ca90cb1]1/*
2 * Copyright (C) 2010 Ixonos Plc.
3 *
[6df32f2]4 * This file is part of ConfClerk.
[ca90cb1]5 *
[6df32f2]6 * ConfClerk is free software: you can redistribute it and/or modify it
[ca90cb1]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 *
[6df32f2]11 * ConfClerk is distributed in the hope that it will be useful, but
[ca90cb1]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
[6df32f2]17 * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
[ca90cb1]18 */
[d0d0a66]19#ifndef EVENTMODEL_H
20#define EVENTMODEL_H
21
22#include <QAbstractItemModel>
23
24#include "event.h"
25
26class EventModel : public QAbstractItemModel
27{
[d1fb9ee]28public:
[a0f3e32]29    static const QString COMMA_SEPARATOR; // ", "
[d0d0a66]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;
[969a840]37    void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
[6f39595]38    void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
[7620de0]39    void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events sorted by Track id and Event start from the DB
[9d8946b]40    int loadSearchResultEvents(const QDate &aDate, int aConferenceId);
[b8a3ad1]41    void loadNowEvents(int aConferenceId); // loads Now events from the DB
[7620de0]42    void loadEventsByRoom(const QDate &aDate, int aConferenceId);
[d49254d]43    void loadConflictEvents(int aEventId, int aConferenceId); // loads events in conflict
[04acaf9]44    void clearModel();
[d0d0a66]45
46private:
47    struct Group
48    {
49        Group(const QString & title,
50              int firstEventIndex) :
51
[a0f3e32]52            mTitle(title),                     // e.g. "16:00 - 17:30"
53            mFirstEventIndex(firstEventIndex), // first index within mEvents
54            mChildCount(0)                     // number of events in mEvents
[d0d0a66]55        {}
56
57        QString mTitle;
58        int mFirstEventIndex;
59        int mChildCount;
60    };
61
62private:
63    void createTimeGroups();
[4693fa6]64    void createTrackGroups();
[005e2b7]65    void createTrackGroupsNew();
[7620de0]66    void createRoomGroups();
[d0d0a66]67
[c718a77]68public slots:
69    void updateModel(int aEventId);
70
[d0d0a66]71private:
72    QList<Event> mEvents;
73    QList<Group> mGroups;
74    QHash<int, int> mParents;
75};
76
77#endif // EVENTMODEL_H
[69393c0]78
Note: See TracBrowser for help on using the repository browser.