Changeset 0bb39f5 for src/mvc


Ignore:
Timestamp:
01/27/10 16:31:10 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
a790a90
Parents:
07ae23a
Message:

removed appsettings

  • created 'active' column in 'conference' table
Location:
src/mvc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/conference.cpp

    r07ae23a r0bb39f5  
    1111    << QSqlField("days", QVariant::Int)
    1212    << QSqlField("day_change", QVariant::Int)
    13     << QSqlField("timeslot_duration", QVariant::Int));
     13    << QSqlField("timeslot_duration", QVariant::Int)
     14    << QSqlField("active", QVariant::Bool));
    1415
    1516QString const Conference::sTableName = QString("conference");
     
    3031}
    3132
     33int 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  
    1717    static Conference getById(int id);
    1818    static QList<Conference> getAll();
     19    static int activeConference();
    1920
    2021public:
     
    2930    int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00
    3031    int timeslotDuration() const { return value("timeslot_duration").toInt(); } // in seconds
     32    bool isActive() const { return value("active").toBool(); }
    3133
    3234    void setId(int id) { setValue("id", id); }
     
    3537    void setVenue(const QString& venue) { setValue("venue", venue); }
    3638    void setCity(const QString& city) { setValue("city", city); }
    37     //void setStart(const QDate& start) { setValue("start", QDateTime(start)); }
    3839    void setStart(const QDate& start) { setValue("start", start); }
    39     //void setEnd(const QDate& end) { setValue("end", QDateTime(end)); }
    4040    void setEnd(const QDate& end) { setValue("end", end); }
    4141    void setDays(int days) { setValue("days", days); }
    4242    void setDayChange(int dayChange) { setValue("day_change", dayChange); }
    4343    void setTimeslotDuration(int timeslotDuration) { setValue("timeslot_duration", timeslotDuration); }
     44    void setActive(bool active) { setValue("active", (int)((active))); }
    4445};
    4546
  • src/mvc/eventmodel.cpp

    r07ae23a r0bb39f5  
    11#include "eventmodel.h"
    2 #include <appsettings.h>
    32#include <conference.h>
    43#include <track.h>
     
    281280    {
    282281        if(mEvents[i].id() == aEventId)
    283             mEvents[i] = Event::getById(aEventId,AppSettings::confId());
     282            mEvents[i] = Event::getById(aEventId,Conference::activeConference());
    284283    }
    285284
Note: See TracChangeset for help on using the changeset viewer.