X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/blobdiff_plain/92995da45a4d853eac6a4209e854f147b00e801d..080dc7d603d45ba0662aa731418993ddd45b5fe8:/src/mvc/conference.h
diff --git a/src/mvc/conference.h b/src/mvc/conference.h
index c6c8e01..51b2bd9 100644
--- a/src/mvc/conference.h
+++ b/src/mvc/conference.h
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 2010 Ixonos Plc.
+ * Copyright (C) 2011-2024 Philipp Spitzer, gregor herrmann, Stefan Stahl
+ *
+ * This file is part of ConfClerk.
+ *
+ * ConfClerk is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * ConfClerk is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * ConfClerk. If not, see .
+ */
#ifndef CONFERENCE_H
#define CONFERENCE_H
@@ -5,7 +24,7 @@
#include
#include
-#include
+#include "ormrecord.h"
class Conference : public OrmRecord
{
@@ -17,6 +36,10 @@ public:
static Conference getById(int id);
static QList getAll();
+ /// Returns the active conference. If no active conference can be found, it returns the conference with the lowest id.
+ /// If no conference exists or database errors occur, it returns -1.
+ static int activeConference();
+
public:
int id() const { return value("id").toInt(); }
QString title() const { return value("title").toString(); }
@@ -25,22 +48,36 @@ public:
QString city() const { return value("city").toString(); }
QDate start() const { return value("start").toDate(); }
QDate end() const { return value("end").toDate(); }
- int days() const { return value("days").toInt(); }
int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00
+ QTime dayChangeTime() const {QTime dayChangeTime(0, 0); return dayChangeTime.addSecs(dayChange());}
int timeslotDuration() const { return value("timeslot_duration").toInt(); } // in seconds
+ bool hasUtcOffset() const {return !value("utc_offset").isNull();}
+ int utcOffset() const {return value("utc_offset").toInt();}
+ bool hasDisplayTimeShift() const {return !value("display_time_shift").isNull();}
+ int displayTimeShift() const {return value("display_time_shift").toInt();}
+ void setDisplayTimeShift(int newValue) {setValue("display_time_shift", newValue); update("display_time_shift");}
+
+ bool isActive() const { return value("active").toBool(); }
+ QString url() const { return stringFromNullable(value("url")); }
+
+ void setUrl(const QString& url)
+ {
+ setValue("url", url.isNull() ? QVariant() : url);
+ update("url");
+ }
+
+ /// Returns a QTime that is shifted by displayTimeShift minutes
+ QTime shiftTime(const QTime& value) const;
- void setId(int id) { setValue("id", id); }
- void setTitle(const QString& title) { setValue("title", title); }
- void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
- void setVenue(const QString& venue) { setValue("venue", venue); }
- void setCity(const QString& city) { setValue("city", city); }
- //void setStart(const QDate& start) { setValue("start", QDateTime(start)); }
- void setStart(const QDate& start) { setValue("start", start); }
- //void setEnd(const QDate& end) { setValue("end", QDateTime(end)); }
- void setEnd(const QDate& end) { setValue("end", end); }
- void setDays(int days) { setValue("days", days); }
- void setDayChange(int dayChange) { setValue("day_change", dayChange); }
- void setTimeslotDuration(int timeslotDuration) { setValue("timeslot_duration", timeslotDuration); }
+private:
+ static QString stringFromNullable(const QVariant& v)
+ {
+ if (v.isValid()) {
+ return v.toString();
+ } else {
+ return QString();
+ }
+ }
};
#endif /* CONFERENCE_H */