source: src/mvc/conference.h @ 68b2df2

qt5
Last change on this file since 68b2df2 was 68b2df2, checked in by gregor herrmann <gregoa@…>, 10 years ago

Add copyright to source.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (C) 2010 Ixonos Plc.
3 * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
4 *
5 * This file is part of ConfClerk.
6 *
7 * ConfClerk is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * ConfClerk is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef CONFERENCE_H
21#define CONFERENCE_H
22
23#include <QDateTime>
24#include <QVector>
25#include <QStringList>
26
27#include <ormrecord.h>
28
29class Conference : public OrmRecord<Conference>
30{
31public:
32    static QSqlRecord const sColumns;
33    static QString const sTableName;
34
35public:
36    static Conference getById(int id);
37    static QList<Conference> getAll();
38    static int activeConference();
39    static void deleteConference(int id);
40
41public:
42    int id() const { return value("id").toInt(); }
43    QString title() const { return value("title").toString(); }
44    QString subtitle() const { return value("subtitle").toString(); }
45    QString venue() const { return value("venue").toString(); }
46    QString city() const { return value("city").toString(); }
47    QDate start() const { return value("start").toDate(); }
48    QDate end() const { return value("end").toDate(); }
49    int days() const { return value("days").toInt(); }
50    int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00
51    int timeslotDuration() const { return value("timeslot_duration").toInt(); } // in seconds
52    bool isActive() const { return value("active").toBool(); }
53    QString url() const { return stringFromNullable(value("url")); }
54    QString map() const { return stringFromNullable(value("map")); }
55
56    #if 0
57    void setId(int id) { setValue("id", id); }
58    void setTitle(const QString& title) { setValue("title", title); }
59    void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
60    void setVenue(const QString& venue) { setValue("venue", venue); }
61    void setCity(const QString& city) { setValue("city", city); }
62    void setStart(const QDate& start) { setValue("start", start); }
63    void setEnd(const QDate& end) { setValue("end", end); }
64    void setDays(int days) { setValue("days", days); }
65    void setDayChange(int dayChange) { setValue("day_change", dayChange); }
66    void setTimeslotDuration(int timeslotDuration) { setValue("timeslot_duration", timeslotDuration); }
67    void setActive(bool active) { setValue("active", (int)((active))); }
68    #endif
69    void setUrl(const QString& url)
70    {
71        setValue("url", url.isNull() ? QVariant() : url);
72        update("url");
73    }
74
75private:
76    static QString stringFromNullable(const QVariant& v)
77    {
78        if (v.isValid()) {
79            return v.toString();
80        } else {
81            return QString();
82        }
83    }
84};
85
86#endif /* CONFERENCE_H */
87
Note: See TracBrowser for help on using the repository browser.