]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/mvc/conference.h
Adjust shown event time when displayTimeShift is set.
[toast/confclerk.git] / src / mvc / conference.h
index 1b3157f4340cec346d51ffb383c7a2893bc7a59b..8f8abff35cebdefc11c4dcb6c761342a782a5a3d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011-2012 Philipp Spitzer, gregor herrmann, Stefan Stahl
+ * Copyright (C) 2011-2017 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
  * This file is part of ConfClerk.
  *
@@ -35,7 +35,10 @@ public:
 public:
     static Conference getById(int id);
     static QList<Conference> getAll();
-    static int activeConference(); ///< returns -1 if no conference is active
+
+    /// 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(); }
@@ -46,7 +49,14 @@ public:
     QDate start() const { return value("start").toDate(); }
     QDate end() const { return value("end").toDate(); }
     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")); }
 
@@ -56,6 +66,9 @@ public:
         update("url");
     }
 
+    /// Returns a QTime that is shifted by displayTimeShift minutes
+    QTime shiftTime(const QTime& value) const;
+
 private:
     static QString stringFromNullable(const QVariant& v)
     {