- Timestamp:
- 01/27/10 16:31:10 (13 years ago)
- Branches:
- master, qt5
- Children:
- a790a90
- Parents:
- 07ae23a
- Location:
- src/mvc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/conference.cpp
r07ae23a r0bb39f5 11 11 << QSqlField("days", QVariant::Int) 12 12 << QSqlField("day_change", QVariant::Int) 13 << QSqlField("timeslot_duration", QVariant::Int)); 13 << QSqlField("timeslot_duration", QVariant::Int) 14 << QSqlField("active", QVariant::Bool)); 14 15 15 16 QString const Conference::sTableName = QString("conference"); … … 30 31 } 31 32 33 int Conference::activeConference() 34 { 35 QSqlQuery query("SELECT id FROM conference WHERE active = 1"); 36 query.exec(); 37 38 QList<int> activeConfs; 39 while(query.next()) 40 activeConfs.append(query.record().value("id").toInt()); 41 42 if(activeConfs.count()==0) // no active DB 43 return 1; 44 else // even if there are more active confs, the first from the list is confidered active 45 return activeConfs[0]; 46 } 47 -
src/mvc/conference.h
r07ae23a r0bb39f5 17 17 static Conference getById(int id); 18 18 static QList<Conference> getAll(); 19 static int activeConference(); 19 20 20 21 public: … … 29 30 int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00 30 31 int timeslotDuration() const { return value("timeslot_duration").toInt(); } // in seconds 32 bool isActive() const { return value("active").toBool(); } 31 33 32 34 void setId(int id) { setValue("id", id); } … … 35 37 void setVenue(const QString& venue) { setValue("venue", venue); } 36 38 void setCity(const QString& city) { setValue("city", city); } 37 //void setStart(const QDate& start) { setValue("start", QDateTime(start)); }38 39 void setStart(const QDate& start) { setValue("start", start); } 39 //void setEnd(const QDate& end) { setValue("end", QDateTime(end)); }40 40 void setEnd(const QDate& end) { setValue("end", end); } 41 41 void setDays(int days) { setValue("days", days); } 42 42 void setDayChange(int dayChange) { setValue("day_change", dayChange); } 43 43 void setTimeslotDuration(int timeslotDuration) { setValue("timeslot_duration", timeslotDuration); } 44 void setActive(bool active) { setValue("active", (int)((active))); } 44 45 }; 45 46 -
src/mvc/eventmodel.cpp
r07ae23a r0bb39f5 1 1 #include "eventmodel.h" 2 #include <appsettings.h>3 2 #include <conference.h> 4 3 #include <track.h> … … 281 280 { 282 281 if(mEvents[i].id() == aEventId) 283 mEvents[i] = Event::getById(aEventId, AppSettings::confId());282 mEvents[i] = Event::getById(aEventId,Conference::activeConference()); 284 283 } 285 284
Note: See TracChangeset
for help on using the changeset viewer.