]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/mvc/conference.h
fix some more header includes
[toast/confclerk.git] / src / mvc / conference.h
index c16ac747023a916a568e7496a7c774f2e0b2e48d..bc296dd809f18c5bad3e553eb9e79cc432fbffce 100644 (file)
@@ -1,20 +1,21 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
+ * Copyright (C) 2011-2012 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
- * This file is part of fosdem-schedule.
+ * This file is part of ConfClerk.
  *
- * fosdem-schedule is free software: you can redistribute it and/or modify it
+ * 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.
  *
- * fosdem-schedule is distributed in the hope that it will be useful, but
+ * 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
- * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
+ * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
  */
 #ifndef CONFERENCE_H
 #define CONFERENCE_H
@@ -23,7 +24,7 @@
 #include <QVector>
 #include <QStringList>
 
-#include <ormrecord.h>
+#include "ormrecord.h"
 
 class Conference : public OrmRecord<Conference>
 {
@@ -34,7 +35,8 @@ public:
 public:
     static Conference getById(int id);
     static QList<Conference> getAll();
-    static int activeConference();
+    static int activeConference(); ///< returns -1 if no conference is active
+    static void deleteConference(int id);
 
 public:
     int id() const { return value("id").toInt(); }
@@ -48,16 +50,7 @@ public:
     int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00
     int timeslotDuration() const { return value("timeslot_duration").toInt(); } // in seconds
     bool isActive() const { return value("active").toBool(); }
-    QString getUrl() const
-    {
-        QVariant val = value("url");
-        qDebug() << __PRETTY_FUNCTION__ << val;
-        if (val.isValid()) {
-            return val.toString();
-        } else {
-            return QString();
-        }
-    }
+    QString url() const { return stringFromNullable(value("url")); }
 
     #if 0
     void setId(int id) { setValue("id", id); }
@@ -77,6 +70,16 @@ public:
         setValue("url", url.isNull() ? QVariant() : url);
         update("url");
     }
+
+private:
+    static QString stringFromNullable(const QVariant& v)
+    {
+        if (v.isValid()) {
+            return v.toString();
+        } else {
+            return QString();
+        }
+    }
 };
 
 #endif /* CONFERENCE_H */