Ignore:
Timestamp:
01/25/10 13:52:01 (12 years ago)
Author:
korrco <korrco@…>
Branches:
master, qt5
Children:
c7b58d4
Parents:
7b70507
Message:

room view added - need to test it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/eventmodel.cpp

    r7b70507 r7620de0  
    33#include <conference.h>
    44#include <track.h>
     5#include <room.h>
    56
    67const QString EventModel::COMMA_SEPARATOR = ", ";
     
    7475}
    7576
    76 void EventModel::createTrackGroupsNew() {
     77void EventModel::createRoomGroups()
     78{
    7779    mGroups.clear();
    7880    mParents.clear();
     
    8183        return;
    8284    }
    83     QList<Track> trackList = Track::getAll();
    84     QList<Track>::iterator track = trackList.begin();
    85     while (track != trackList.end())
    86     {
    87         QList<Event> eventList = Event::getByTrack(track->id());
    88         QList<Event>::iterator event = eventList.begin();
    89         while (event != eventList.end())
    90         {
    91             //TODO korinpa: pokracuj
    92             event++;
    93         }
    94         track++;
    95     }
     85    int roomId = mEvents.first().roomId();
     86
     87    mGroups << EventModel::Group(Room::retrieveRoomName(roomId), 0);
     88    int nextRoomId = roomId;
     89
     90    QList<Event>::iterator event = mEvents.begin();
     91    int i = 0;
     92    while (event != mEvents.end())
     93    {
     94        roomId = event->roomId();
     95        if (nextRoomId != roomId)
     96        {
     97            mGroups.last().mChildCount = i - mGroups.last().mFirstEventIndex;
     98            mGroups << EventModel::Group(Room::retrieveRoomName(roomId), i);
     99            nextRoomId = roomId;
     100        }
     101        mParents[event->id()] = mGroups.count() - 1;
     102        event++;
     103        i++;
     104    }
     105    mGroups.last().mChildCount = mEvents.count() - mGroups.last().mFirstEventIndex;
    96106}
    97107
     
    235245{
    236246    clearModel();
    237     if(Conference::getAll().count())
     247    if (Conference::getAll().count())
    238248    {
    239249        qDebug() << "Loading Conference Data (by Track): [" << Conference::getById(aConferenceId).title() << "] " << aDate;
     
    241251    }
    242252    createTrackGroups();
     253}
     254
     255void EventModel::loadEventsByRoom(const QDate &aDate, int aConferenceId)
     256{
     257    clearModel();
     258    if (Conference::getAll().count())
     259    {
     260        qDebug() << "Loading Conference Data (by Room): [" << Conference::getById(aConferenceId).title() << "] " << aDate;
     261        mEvents = Event::getByDateAndRoom(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId);
     262    }
     263    createRoomGroups();
    243264}
    244265
Note: See TracChangeset for help on using the changeset viewer.