source: src/mvc/conference.h @ 6df32f2

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

Update GPL blurb in source files.

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