source: src/mvc/event.h @ d23aa6a

qt5
Last change on this file since d23aa6a was 5842349, checked in by fortefr <fortefr@…>, 13 years ago

Fav table update
M trunk/src/gui/mainwindow.h
M trunk/src/gui/mainwindow.cpp
M trunk/src/mvc/treeview.h
M trunk/src/mvc/eventmodel.cpp
M trunk/src/mvc/event.h
M trunk/src/fosdem.pro

  • Property mode set to 100644
File size: 2.7 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    // Table 2 : virtual table for FTS (Full Text Search)
43    QString tag() const { return value("tag").toString(); }
44    QString title() const { return value("title").toString(); }
45    QString subtitle() const { return value("subtitle").toString(); }
46    QString abstract() const { return value("abstract").toString(); }
47    QString description() const { return value("description").toString(); }
48
49    // Table 1
50    void setId(int id) { setValue("id", id); }
51    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
52    void setStart(const QDateTime& start) { setValue("start", start); }
53    void setDuration(int duration) { setValue("duration", duration); }
54    void setActivityId(int activityId) { setValue("xid_activity", activityId); }
55    void setType(const QString& type) { setValue("type", type); }
56    void setLanguage(const QString& language) { setValue("language", language); }
57    void setFavourite(bool favourite) { setValue("favourite", (int)favourite); }
58    // Table 2 : virtual table for FTS (Full Text Search)
59    void setTag(const QString& tag) { setValue("tag", tag); }
60    void setTitle(const QString& title) { setValue("title", title); }
61    void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
62    void setAbstract(const QString& abstract) { setValue("abstract", abstract); }
63    void setDescription(const QString& description) { setValue("description", description); }
64
65friend class EventTest;
66};
67
68#endif // EVENT_H
69
Note: See TracBrowser for help on using the repository browser.