source: src/mvc/event.h @ d49254d

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

'conflict' dialog now contains list of events in conflict with given eventId

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[e5bc908]1#ifndef EVENT_H
2#define EVENT_H
3
4#include <QDateTime>
[5a73d27]5#include <QVector>
6#include <QStringList>
[e5bc908]7
[5a73d27]8#include <ormrecord.h>
9
10/**
11  NoSuchEventException is thrown when required event does not exist.
12*/
13class NoSuchEventException
14{
15};
16
[20a6010]17class Event : public OrmRecord<Event>
[e5bc908]18{
19public:
[64122f1]20    static const QSqlRecord sColumns;
[7d7659d]21    static QString const sTableName;
[5a73d27]22public:
[20a6010]23    static Event getById(int id, int conferenceId);
[64122f1]24    static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy);
25    static QList<Event> getFavByDate(const QDate & date, int conferenceId); // get Favourities by Date
[e662750]26    static QList<Event> getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy);
[b8a3ad1]27    static QList<Event> nowEvents(int conferenceId, QString orderBy); // get events scheduled NOW
[005e2b7]28    static QList<Event> getByTrack(int id);
[7620de0]29    static QList<Event> getByDateAndRoom(const QDate& date, int conferenceId);
[d49254d]30    static QList<Event> conflictEvents(int aEventId, int conferenceId);
[e5bc908]31public:
[46a5aba]32    int id() const { return value("id").toInt(); }
33    int conferenceId() const { return value("xid_conference").toInt(); }
[4693fa6]34    QDateTime start() const { return value("start").toDateTime(); }
[46a5aba]35    int duration() const { return value("duration").toInt(); }
[4693fa6]36    int trackId() const { return value("xid_track").toInt(); }
[46a5aba]37    QString type() const { return value("type").toString(); }
38    QString language() const { return value("language").toString(); }
39    bool isFavourite() const { return value("favourite").toBool(); }
40    bool hasAlarm() const { return value("alarm").toBool(); }
[9f367eb]41    bool hasTimeConflict() const;
[46a5aba]42    QString tag() const { return value("tag").toString(); }
43    QString title() const { return value("title").toString(); }
44    QString subtitle() const { return value("subtitle").toString(); }
45    QString abstract() const { return value("abstract").toString(); }
46    QString description() const { return value("description").toString(); }
[f9db452]47    // records from other tables associated with 'id'
48    QString room() const;
[7620de0]49    int roomId() const;
[395d6d3]50    QStringList persons() const;
[9f367eb]51    QList<int> conflicts() const;
[6123b48]52    QMap<QString,QString> links() const;
[20a6010]53
[46a5aba]54    void setId(int id) { setValue("id", id); }
55    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
[4693fa6]56    void setStart(const QDateTime & start) { setValue("start", start); }
[46a5aba]57    void setDuration(int duration) { setValue("duration", duration); }
[4693fa6]58    void setTrackId(int trackId) { setValue("xid_track", trackId); }
[46a5aba]59    void setType(const QString & type) { setValue("type", type); }
60    void setLanguage(const QString & language) { setValue("language", language); }
61    void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); }
62    void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); }
[c790268]63    void setTag(const QString& tag) { setValue("tag", tag); }
64    void setTitle(const QString& title) { setValue("title", title); }
65    void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
66    void setAbstract(const QString& abstract) { setValue("abstract", abstract); }
67    void setDescription(const QString& description) { setValue("description", description); }
[f9db452]68    // records from other tables associated with 'id'
69    void setRoom(const QString& room);
[395d6d3]70    void setPersons(const QStringList &persons);
[6123b48]71    void setLinks(const QMap<QString,QString> &aLinks);
[9f367eb]72    void updateConflicts();
[20a6010]73
74friend class EventTest;
[e5bc908]75};
76
77#endif // EVENT_H
[680a4da]78
Note: See TracBrowser for help on using the repository browser.