source: src/mvc/event.h @ b6cd05c

qt5
Last change on this file since b6cd05c was b6cd05c, checked in by pavelpa <pavelpa@…>, 13 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
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:
[20a6010]20    static QSqlRecord const sColumns;
[c790268]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;
[5a73d27]26
27public:
[20a6010]28    static Event getById(int id, int conferenceId);
[d0d0a66]29    static QList<Event> getByDate(const QDate& date, int conferenceId);
[6f39595]30    static QList<Event> getFavByDate(const QDate& date, int conferenceId); // get Favourities by Date
[e5bc908]31
32public:
[c790268]33    // Table 1
[20a6010]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(); }
[489f262]39    QString type() const { return value("type").toString(); }
40    QString language() const { return value("language").toString(); }
[680a4da]41    bool isFavourite() const { return value("favourite").toBool(); }
[b6cd05c]42    bool hasAlarm() const { return value("alarm").toBool(); }
[c790268]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(); }
[20a6010]49
[c790268]50    // Table 1
[20a6010]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); }
[489f262]56    void setType(const QString& type) { setValue("type", type); }
57    void setLanguage(const QString& language) { setValue("language", language); }
[6f39595]58    void setFavourite(bool favourite) { setValue("favourite", (int)favourite); }
[b6cd05c]59    void setHasAlarm(bool alarm) { setValue("alarm", (int)alarm); }
[c790268]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); }
[20a6010]66
67friend class EventTest;
[e5bc908]68};
69
70#endif // EVENT_H
[680a4da]71
Note: See TracBrowser for help on using the repository browser.