source: src/mvc/event.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: 4.3 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 EVENT_H
21#define EVENT_H
22
23#include <QDateTime>
24#include <QVector>
25#include <QStringList>
26
27#include <ormrecord.h>
28
29class Room;
30
31/**
32  NoSuchEventException is thrown when required event does not exist.
33*/
34class NoSuchEventException
35{
36};
37
38class Event : public OrmRecord<Event>
39{
40public:
41    Event();
42    static const QSqlRecord sColumns;
43    static QString const sTableName;
44public:
45    static Event getById(int id, int conferenceId);
46    static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy);
47    static QList<Event> getFavByDate(const QDate & date, int conferenceId); // get Favourities by Date
48    static QList<Event> getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy);
49    static QList<Event> nowEvents(int conferenceId, QString orderBy); // get events scheduled NOW
50    static QList<Event> getByTrack(int id);
51    static QList<Event> getByDateAndRoom(const QDate& date, int conferenceId);
52    static QList<Event> conflictEvents(int aEventId, int conferenceId);
53public:
54    int id() const { return value("id").toInt(); }
55    int conferenceId() const { return value("xid_conference").toInt(); }
56    QDateTime start() const { return value("start").toDateTime(); }
57    int duration() const { return value("duration").toInt(); }
58    int trackId() const { return value("xid_track").toInt(); }
59    QString type() const { return value("type").toString(); }
60    QString language() const { return value("language").toString(); }
61    bool isFavourite() const { return value("favourite").toBool(); }
62    bool hasAlarm() const { return value("alarm").toBool(); }
63    bool hasTimeConflict() const;
64    QString tag() const { return value("tag").toString(); }
65    QString title() const { return value("title").toString(); }
66    QString subtitle() const { return value("subtitle").toString(); }
67    QString abstract() const { return value("abstract").toString(); }
68    QString description() const { return value("description").toString(); }
69    // records from other tables associated with 'id'
70    Room* room();
71    QString roomName();
72    int roomId();
73    QStringList persons();
74    QMap<QString,QString> links();
75
76    void setId(int id) { setValue("id", id); }
77    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
78    void setStart(const QDateTime & start) { setValue("start", start); }
79    void setDuration(int duration) { setValue("duration", duration); }
80    void setTrackId(int trackId) { setValue("xid_track", trackId); }
81    void setType(const QString & type) { setValue("type", type); }
82    void setLanguage(const QString & language) { setValue("language", language); }
83    void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); }
84    void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); }
85    void setTag(const QString& tag) { setValue("tag", tag); }
86    void setTitle(const QString& title) { setValue("title", title); }
87    void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
88    void setAbstract(const QString& abstract) { setValue("abstract", abstract); }
89    void setDescription(const QString& description) { setValue("description", description); }
90    // records from other tables associated with 'id'
91    void setRoom(const QString& room);
92    void setPersons(const QStringList &persons);
93    void setLinks(const QMap<QString,QString> &aLinks);
94
95friend class EventTest;
96
97private:
98    QStringList mPersonsList;
99    QMap<QString,QString> mLinksList;
100    int mRoomId;
101    QString mRoomName;
102    Room* room_;
103};
104
105#endif // EVENT_H
106
Note: See TracBrowser for help on using the repository browser.