source: src/mvc/event.h @ 7d7659d

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

combined EVENT and VIRTUAL_EVENT => 'EVENT' now

  • Maemo sqlite doesn't support Full-Text-Search
  • Property mode set to 100644
File size: 3.0 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;
22public:
23    static Event getById(int id, int conferenceId);
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
26    static QList<Event> getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy);
27public:
28    int id() const { return value("id").toInt(); }
29    int conferenceId() const { return value("xid_conference").toInt(); }
30    QDateTime start() const { return value("start").toDateTime(); }
31    int duration() const { return value("duration").toInt(); }
32    int trackId() const { return value("xid_track").toInt(); }
33    QString type() const { return value("type").toString(); }
34    QString language() const { return value("language").toString(); }
35    bool isFavourite() const { return value("favourite").toBool(); }
36    bool hasAlarm() const { return value("alarm").toBool(); }
37    bool hasTimeConflict() const { return true; /*return value("warning").toBool()*/; } //TODO
38    QString tag() const { return value("tag").toString(); }
39    QString title() const { return value("title").toString(); }
40    QString subtitle() const { return value("subtitle").toString(); }
41    QString abstract() const { return value("abstract").toString(); }
42    QString description() const { return value("description").toString(); }
43    // records from other tables associated with 'id'
44    QString room() const;
45    QStringList persons() const;
46
47    void setId(int id) { setValue("id", id); }
48    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
49    void setStart(const QDateTime & start) { setValue("start", start); }
50    void setDuration(int duration) { setValue("duration", duration); }
51    void setTrackId(int trackId) { setValue("xid_track", trackId); }
52    void setType(const QString & type) { setValue("type", type); }
53    void setLanguage(const QString & language) { setValue("language", language); }
54    void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); }
55    void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); }
56    void setTag(const QString& tag) { setValue("tag", tag); }
57    void setTitle(const QString& title) { setValue("title", title); }
58    void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
59    void setAbstract(const QString& abstract) { setValue("abstract", abstract); }
60    void setDescription(const QString& description) { setValue("description", description); }
61    // records from other tables associated with 'id'
62    void setRoom(const QString& room);
63    void setPersons(const QStringList &persons);
64
65friend class EventTest;
66};
67
68#endif // EVENT_H
69
Note: See TracBrowser for help on using the repository browser.