]> ToastFreeware Gitweb - toast/confclerk.git/blob - src/model/conference.h
implemented day navigator widget
[toast/confclerk.git] / src / model / conference.h
1 #ifndef CONFERENCE_H
2 #define CONFERENCE_H
3
4 #include <QDateTime>
5 #include <QVector>
6 #include <QStringList>
7
8 #include <ormrecord.h>
9
10 class Conference : public OrmRecord<Conference>
11 {
12 public:
13     static QSqlRecord const sColumns;
14     static QString const sTableName;
15
16 public:
17     static Conference getById(int id);
18     static QList<Conference> getAll();
19
20 public:
21     int id() const { return value("id").toInt(); }
22     QString title() const { return value("title").toString(); }
23     QString subtitle() const { return value("subtitle").toString(); }
24     QString venue() const { return value("venue").toString(); }
25     QString city() const { return value("city").toString(); }
26     // TODO: there is some problem with converting "Time_t" to QDateTime: had to manually add 1 day
27     // NEEDS TO BE FIXED
28     QDate start() const { return value("start").toDateTime().addDays(1).date(); }
29     QDate end() const { return value("end").toDateTime().addDays(1).date(); }
30     //
31     int days() const { return value("days").toInt(); }
32     int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00
33     int timeslotDuration() const { return value("timeslot_duration").toInt(); } // in seconds
34
35     void setId(int id) { setValue("id", id); }
36     void setTitle(const QString& title) { setValue("title", title); }
37     void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
38     void setVenue(const QString& venue) { setValue("venue", venue); }
39     void setCity(const QString& city) { setValue("city", city); }
40     //void setStart(const QDate& start) { setValue("start", QDateTime(start)); }
41     void setStart(const QDate& start) { setValue("start", start); }
42     //void setEnd(const QDate& end) { setValue("end", QDateTime(end)); }
43     void setEnd(const QDate& end) { setValue("end", end); }
44     void setDays(int days) { setValue("days", days); }
45     void setDayChange(int dayChange) { setValue("day_change", dayChange); }
46     void setTimeslotDuration(int timeslotDuration) { setValue("timeslot_duration", timeslotDuration); }
47 };
48
49 #endif /* CONFERENCE_H */
50