]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/mvc/conference.h
Bump copyright years.
[toast/confclerk.git] / src / mvc / conference.h
index bc25d08058b2ba1075325046480d26006b8b2bd1..51b2bd947bd302a4cdd1a114919020f64127337f 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
+ * Copyright (C) 2011-2024 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
  * This file is part of ConfClerk.
  *
@@ -23,7 +24,7 @@
 #include <QVector>
 #include <QStringList>
 
-#include <ormrecord.h>
+#include "ormrecord.h"
 
 class Conference : public OrmRecord<Conference>
 {
@@ -34,8 +35,10 @@ public:
 public:
     static Conference getById(int id);
     static QList<Conference> 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();
-    static void deleteConference(int id);
 
 public:
     int id() const { return value("id").toInt(); }
@@ -45,32 +48,27 @@ 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")); }
-    QString map() const { return stringFromNullable(value("map")); }
 
-    #if 0
-    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", start); }
-    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); }
-    void setActive(bool active) { setValue("active", (int)((active))); }
-    #endif
     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;
+
 private:
     static QString stringFromNullable(const QVariant& v)
     {