source: src/mvc/event.h @ b6cd05c

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

added 'alarm' columnt to the 'EVENT' table to signalize
that the event has/hasn't alarm set

  • Property mode set to 100644
File size: 2.9 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 QSqlRecord const sColumns;
21    //static QString const sTableName;
22    static QString const sTable1Name;
23    static QString const sTable2Name;
24    static int const sTable1ColCount;
25    static int const sTable2ColCount;
26
27public:
28    static Event getById(int id, int conferenceId);
29    static QList<Event> getByDate(const QDate& date, int conferenceId);
30    static QList<Event> getFavByDate(const QDate& date, int conferenceId); // get Favourities by Date
31
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
50    // Table 1
51    void setId(int id) { setValue("id", id); }
52    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
53    void setStart(const QDateTime& start) { setValue("start", start); }
54    void setDuration(int duration) { setValue("duration", duration); }
55    void setActivityId(int activityId) { setValue("xid_activity", activityId); }
56    void setType(const QString& type) { setValue("type", type); }
57    void setLanguage(const QString& language) { setValue("language", language); }
58    void setFavourite(bool favourite) { setValue("favourite", (int)favourite); }
59    void setHasAlarm(bool alarm) { setValue("alarm", (int)alarm); }
60    // Table 2 : virtual table for FTS (Full Text Search)
61    void setTag(const QString& tag) { setValue("tag", tag); }
62    void setTitle(const QString& title) { setValue("title", title); }
63    void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
64    void setAbstract(const QString& abstract) { setValue("abstract", abstract); }
65    void setDescription(const QString& description) { setValue("description", description); }
66
67friend class EventTest;
68};
69
70#endif // EVENT_H
71
Note: See TracBrowser for help on using the repository browser.