Changeset 969a840 for src/model


Ignore:
Timestamp:
01/13/10 21:51:06 (13 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
6a624f7
Parents:
69393c0
Message:

implemented day navigator widget

  • to switch between conference days
Location:
src/model
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/model/conference.h

    r69393c0 r969a840  
    2424    QString venue() const { return value("venue").toString(); }
    2525    QString city() const { return value("city").toString(); }
    26     QDate start() const { return value("start").toDate(); }
    27     QDate end() const { return value("end").toDate(); }
     26    // TODO: there is some problem with converting "Time_t" to QDateTime: had to manually add 1 day
     27    // NEEDS TO BE FIXED
     28    QDate start() const { return value("start").toDateTime().addDays(1).date(); }
     29    QDate end() const { return value("end").toDateTime().addDays(1).date(); }
     30    //
    2831    int days() const { return value("days").toInt(); }
    2932    int dayChange() const { return value("day_change").toInt(); } // in seconds from 00:00
  • src/model/eventmodel.cpp

    r69393c0 r969a840  
    44EventModel::EventModel()
    55{
    6 
    7     loadEvents();
     6    mEvents.clear();
    87}
    98
     
    119118}
    120119
    121 void EventModel::loadEvents()
     120void EventModel::loadEvents(const QDate &aDate, int aConferenceId)
    122121{
    123122    mEvents.clear();
    124123
    125     mConfId = 1; // current conference selected: we have only one DB so far
    126     // check for existence of conference in the DB
     124    // check for existence of the conference in the DB
    127125    if(Conference::getAll().count())
    128126    {
    129         mCurrentDate = Conference::getById(mConfId).start();
    130         qDebug() << "Loading Conference Data: [" << Conference::getById(mConfId).title() << "] " << mCurrentDate;
    131         mEvents = Event::getByDate(QDate(mCurrentDate.year(), mCurrentDate.month(), mCurrentDate.day()), mConfId);
     127        qDebug() << "Loading Conference Data: [" << Conference::getById(aConferenceId).title() << "] " << aDate;
     128        mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId);
    132129    }
    133     mEvents = Event::getByDate(QDate(mCurrentDate.year(), mCurrentDate.month(), mCurrentDate.day()), mConfId);
    134130    createTimeGroups();
    135131}
  • src/model/eventmodel.h

    r69393c0 r969a840  
    1515    int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
    1616    int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
    17     void loadEvents(); // loads Events from the DB
     17    void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
    1818
    1919private:
     
    4040    QList<Group> mGroups;
    4141    QHash<int, int> mParents;
    42     QDate mCurrentDate;
    43     int mConfId;
    4442};
    4543
Note: See TracChangeset for help on using the changeset viewer.