source: src/mvc/event.h @ cfd615d

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

map-name to map-path implemented

  • correct map is displayed
  • Property mode set to 100644
File size: 3.1 KB
Line 
1#ifndef EVENT_H
2#define EVENT_H
3
4#include <QDateTime>
5#include <QVector>
6#include <QStringList>
7
8#include <ormrecord.h>
9
10/**
11  NoSuchEventException is thrown when required event does not exist.
12*/
13class NoSuchEventException
14{
15};
16
17class Event : public OrmRecord<Event>
18{
19public:
20    static const QSqlRecord sColumns;
21    //static QString const sTableName;
22    static const QString sTable1Name;
23    static const QString sTable2Name;
24    static const int sTable1ColCount;
25    static const int sTable2ColCount;
26    static const QString XID_ACTIVITY;
27    static const QString START;
28public:
29    static Event getById(int id, int conferenceId);
30    static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy);
31    static QList<Event> getFavByDate(const QDate & date, int conferenceId); // get Favourities by Date
32public:
33    // Table 1
34    int id() const { return value("id").toInt(); }
35    int conferenceId() const { return value("xid_conference").toInt(); }
36    QDateTime start() const { return value(START).toDateTime(); }
37    int duration() const { return value("duration").toInt(); }
38    int activityId() const { return value(XID_ACTIVITY).toInt(); }
39    QString type() const { return value("type").toString(); }
40    QString language() const { return value("language").toString(); }
41    bool isFavourite() const { return value("favourite").toBool(); }
42    bool hasAlarm() const { return value("alarm").toBool(); }
43    // Table 2 : virtual table for FTS (Full Text Search)
44    QString tag() const { return value("tag").toString(); }
45    QString title() const { return value("title").toString(); }
46    QString subtitle() const { return value("subtitle").toString(); }
47    QString abstract() const { return value("abstract").toString(); }
48    QString description() const { return value("description").toString(); }
49    // records from other tables associated with 'id'
50    QString room() const;
51
52    // Table 1
53    void setId(int id) { setValue("id", id); }
54    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
55    void setStart(const QDateTime & start) { setValue(START, start); }
56    void setDuration(int duration) { setValue("duration", duration); }
57    void setActivityId(int activityId) { setValue(XID_ACTIVITY, activityId); }
58    void setType(const QString & type) { setValue("type", type); }
59    void setLanguage(const QString & language) { setValue("language", language); }
60    void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); }
61    void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); }
62    // Table 2 : virtual table for FTS (Full Text Search)
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); }
68    // records from other tables associated with 'id'
69    void setRoom(const QString& room);
70
71friend class EventTest;
72};
73
74#endif // EVENT_H
75
Note: See TracBrowser for help on using the repository browser.