source: src/mvc/eventmodel.h @ c718a77

qt5
Last change on this file since c718a77 was c718a77, checked in by pavelpa <pavelpa@…>, 13 years ago

EventModel? signaling changed

  • if some of the data (favourite,alarm) has changed on the event, signal 'eventHasChanged' is emitted
  • all treeViews (eg. DayView?, FavsView?, TracksView?, ...) have to listen on this signal

Only favouritiesView is 'reset' when current tab is changed in mainWindow

  • 'cause time groupings have to be recreated, since favs may have changed
  • Property mode set to 100644
File size: 1.5 KB
Line 
1#ifndef EVENTMODEL_H
2#define EVENTMODEL_H
3
4#include <QAbstractItemModel>
5
6#include "event.h"
7
8class EventModel : public QAbstractItemModel
9{
10public:
11    static const QString COMMA_SEPARATOR;
12public:
13    EventModel();
14    QVariant data(const QModelIndex& index, int role) const;
15    QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
16    QModelIndex parent ( const QModelIndex & index ) const;
17    int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
18    int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
19    void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
20    void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
21    void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events grouped by Track from the DB
22    int loadSearchResultEvents(const QDate &aDate, int aConferenceId);
23
24private:
25    struct Group
26    {
27        Group(const QString & title,
28              int firstEventIndex) :
29
30            mTitle(title),
31            mFirstEventIndex(firstEventIndex),
32            mChildCount(0)
33        {}
34
35        QString mTitle;
36        int mFirstEventIndex;
37        int mChildCount;
38    };
39
40private:
41    void createTimeGroups();
42    void createTrackGroups();
43    void clearModel();
44
45public slots:
46    void updateModel(int aEventId);
47
48private:
49    QList<Event> mEvents;
50    QList<Group> mGroups;
51    QHash<int, int> mParents;
52};
53
54#endif // EVENTMODEL_H
55
Note: See TracBrowser for help on using the repository browser.