Changeset 6f39595 for src/mvc


Ignore:
Timestamp:
01/17/10 18:18:22 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
9f473ba
Parents:
c790268
Message:

started work on 'favourities'

  • created tavourities tree view in the MainWindow? 'Favourities' tab
  • listed some testing 'fav' events
  • TODO: list isn't updated dynamically, which means that the list isn't updated if the user adds/removes an event(s) to/from the 'favourities' list
Location:
src/mvc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/event.cpp

    rc790268 r6f39595  
    4848}
    4949
     50QList<Event> Event::getFavByDate(const QDate& date, int conferenceId)
     51{
     52    QSqlQuery query;
     53    query.prepare(selectQueryJoin2T("id") + "WHERE event.xid_conference = :conf AND event.start >= :start AND event.start < :end AND event.favourite = 1 ORDER BY event.start");
     54    query.bindValue(":conf", conferenceId);
     55    query.bindValue(":start", convertToDb(date, QVariant::DateTime));
     56    query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime));
     57
     58    return load(query);
     59}
     60
  • src/mvc/event.h

    rc790268 r6f39595  
    2828    static Event getById(int id, int conferenceId);
    2929    static QList<Event> getByDate(const QDate& date, int conferenceId);
     30    static QList<Event> getFavByDate(const QDate& date, int conferenceId); // get Favourities by Date
    3031
    3132public:
     
    5455    void setType(const QString& type) { setValue("type", type); }
    5556    void setLanguage(const QString& language) { setValue("language", language); }
    56     void setFavourite(bool favourite) { setValue("favourite", favourite); }
     57    void setFavourite(bool favourite) { setValue("favourite", (int)favourite); }
    5758    // Table 2 : virtual table for FTS (Full Text Search)
    5859    void setTag(const QString& tag) { setValue("tag", tag); }
  • src/mvc/eventmodel.cpp

    rc790268 r6f39595  
    131131}
    132132
     133void EventModel::loadFavEvents(const QDate &aDate, int aConferenceId)
     134{
     135    mEvents.clear();
     136
     137    // check for existence of the conference in the DB
     138    if(Conference::getAll().count())
     139    {
     140        qDebug() << "Loading FAV Conference Data: [" << Conference::getById(aConferenceId).title() << "] " << aDate;
     141        mEvents = Event::getFavByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId);
     142    }
     143    createTimeGroups();
     144}
     145
  • src/mvc/eventmodel.h

    rc790268 r6f39595  
    1616    int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
    1717    void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
     18    void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
    1819
    1920private:
Note: See TracChangeset for help on using the changeset viewer.