Changeset 4693fa6 for src/mvc


Ignore:
Timestamp:
01/20/10 22:02:30 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
8fe9bd2
Parents:
926f106
Message:

changed 'Activity' -> 'Track'

Location:
src/mvc
Files:
1 added
1 deleted
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/mvc/delegate.cpp

    r926f106 r4693fa6  
    11#include "delegate.h"
    22#include "eventmodel.h"
    3 #include <activity.h>
     3#include <track.h>
    44
    55#include <QDebug>
     
    6363        QFontMetrics fmBigB(fontBigB);
    6464
    65         int spacer = (fmSmall.boundingRect("999").width() < SPACER) ? SPACER : fmSmall.boundingRect("999").width();
     65        //int spacer = (fmSmall.boundingRect("999").width() < SPACER) ? SPACER : fmSmall.boundingRect("999").width();
    6666
    6767        if(isLast(index))
     
    165165        // track
    166166        titlePointF.setY(titlePointF.y()+fmSmall.height()-fmSmall.descent());
    167         painter->drawText(titlePointF,"Activity(s): " + Activity::getActivityName(event->activityId()));
     167        painter->drawText(titlePointF,"Track: " + Track::getTrackName(event->trackId()));
    168168    }
    169169    else // doesn't have parent - time-groups' elements (top items)
  • src/mvc/event.cpp

    r926f106 r4693fa6  
    88int const Event::sTable1ColCount = 9; // see 'toRecord()' for more details
    99int const Event::sTable2ColCount = 5; // see 'toRecord()' for more details
    10 const QString Event::XID_ACTIVITY = "xid_activity";
    11 const QString Event::START = "start";
    12 
    13 
    1410
    1511QSqlRecord const Event::sColumns = Event::toRecord(QList<QSqlField>()
     
    1915    << QSqlField("start", QVariant::DateTime)
    2016    << QSqlField("duration", QVariant::Int)
    21     << QSqlField("xid_activity", QVariant::Int)
     17    << QSqlField("xid_track", QVariant::Int)
    2218    << QSqlField("type", QVariant::String)
    2319    << QSqlField("language", QVariant::String)
  • src/mvc/event.h

    r926f106 r4693fa6  
    2424    static const int sTable1ColCount;
    2525    static const int sTable2ColCount;
    26     static const QString XID_ACTIVITY;
    27     static const QString START;
    2826public:
    2927    static Event getById(int id, int conferenceId);
     
    3432    int id() const { return value("id").toInt(); }
    3533    int conferenceId() const { return value("xid_conference").toInt(); }
    36     QDateTime start() const { return value(START).toDateTime(); }
     34    QDateTime start() const { return value("start").toDateTime(); }
    3735    int duration() const { return value("duration").toInt(); }
    38     int activityId() const { return value(XID_ACTIVITY).toInt(); }
     36    int trackId() const { return value("xid_track").toInt(); }
    3937    QString type() const { return value("type").toString(); }
    4038    QString language() const { return value("language").toString(); }
     
    5553    void setId(int id) { setValue("id", id); }
    5654    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
    57     void setStart(const QDateTime & start) { setValue(START, start); }
     55    void setStart(const QDateTime & start) { setValue("start", start); }
    5856    void setDuration(int duration) { setValue("duration", duration); }
    59     void setActivityId(int activityId) { setValue(XID_ACTIVITY, activityId); }
     57    void setTrackId(int trackId) { setValue("xid_track", trackId); }
    6058    void setType(const QString & type) { setValue("type", type); }
    6159    void setLanguage(const QString & language) { setValue("language", language); }
  • src/mvc/eventmodel.cpp

    r926f106 r4693fa6  
    11#include "eventmodel.h"
    22#include <conference.h>
    3 #include <activity.h>
    4 
    5 const QString EventModel::COMMA_SEPARATOR = ", ";
     3#include <track.h>
    64
    75EventModel::EventModel()
     
    4644}
    4745
    48 void EventModel::createActivityGroups() {
     46void EventModel::createTrackGroups() {
    4947    mGroups.clear();
    5048    mParents.clear();
     
    5351        return;
    5452    }
    55     int activityId = mEvents.first().activityId();
    56 
    57     mGroups << EventModel::Group(Activity::getActivityName(activityId), 0);
    58     int nextActivityId = activityId;
     53    int trackId = mEvents.first().trackId();
     54
     55    mGroups << EventModel::Group(Track::getTrackName(trackId), 0);
     56    int nextTrackId = trackId;
    5957
    6058    for (int i=0; i<mEvents.count(); i++)
    6159    {
    62         activityId = mEvents.at(i).activityId();
    63         if (nextActivityId != activityId)
     60        trackId = mEvents.at(i).trackId();
     61        if (nextTrackId != trackId)
    6462        {
    6563            mGroups.last().mChildCount = i - mGroups.last().mFirstEventIndex;
    66             mGroups << EventModel::Group(Activity::getActivityName(activityId), i);
    67             nextActivityId = activityId;
     64            mGroups << EventModel::Group(Track::getTrackName(trackId), i);
     65            nextTrackId = trackId;
    6866        }
    6967        // add parent-child relation
     
    168166    {
    169167        qDebug() << "Loading Conference Data: [" << Conference::getById(aConferenceId).title() << "] " << aDate;
    170         mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, Event::START);
     168        mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start");
    171169    }
    172170    createTimeGroups();
     
    185183}
    186184
    187 void EventModel::loadEventsByActivities(const QDate &aDate, int aConferenceId)
     185void EventModel::loadEventsByTrack(const QDate &aDate, int aConferenceId)
    188186{
    189187    clearModel();
    190188    if(Conference::getAll().count())
    191189    {
    192         qDebug() << "Loading Conference Data (by Activities): [" << Conference::getById(aConferenceId).title() << "] " << aDate;
    193         mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, Event::XID_ACTIVITY + COMMA_SEPARATOR + Event::START);
    194     }
    195     createActivityGroups();
     190        qDebug() << "Loading Conference Data (by Track): [" << Conference::getById(aConferenceId).title() << "] " << aDate;
     191        mEvents = Event::getByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "xid_track, start");
     192    }
     193    createTrackGroups();
    196194}
    197195
  • src/mvc/eventmodel.h

    r926f106 r4693fa6  
    1919    void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
    2020    void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
    21     void loadEventsByActivities(const QDate &aDate, int aConferenceId); // loads Events grouped by Activities from the DB
     21    void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events grouped by Track from the DB
    2222    // a method to force 'EventModel' emit signal 'dataChanged()'
    2323    // a 'view', eg. 'TreeView' listens for this signal and redraws changed items(indexes)
     
    4242private:
    4343    void createTimeGroups();
    44     void createActivityGroups();
     44    void createTrackGroups();
    4545    void clearModel();
    4646
  • src/mvc/mvc.pro

    r926f106 r4693fa6  
    1919}
    2020
    21 HEADERS += activity.h \
    22            event.h \
     21HEADERS += event.h \
    2322           conference.h \
     23           track.h \
    2424           delegate.h \
    2525           eventmodel.h \
    2626           treeview.h
    2727
    28 SOURCES += activity.cpp \
    29            event.cpp \
     28SOURCES += event.cpp \
    3029           conference.cpp \
     30           track.cpp \
    3131           delegate.cpp \
    3232           eventmodel.cpp \
  • src/mvc/track.h

    r926f106 r4693fa6  
    11/*
    2  * activity.h
     2 * track.h
    33 *
    44 *  Created on: Dec 27, 2009
     
    66 */
    77
    8 #ifndef ACTIVITY_H_
    9 #define ACTIVITY_H_
     8#ifndef TRACK_H
     9#define TRACK_H
    1010
    1111#include <ormrecord.h>
    1212
    13 class Activity : public OrmRecord<Activity>
     13class Track : public OrmRecord<Track>
    1414{
    1515public:
     
    1818    static const int sTableColCount;
    1919public:
    20     static QMap<int, Activity> mIdToActivity;
     20    static QMap<int, Track> mIdToTrack;
    2121public:
    22     static QList<Activity> getAll();
     22    static QList<Track> getAll();
    2323    int id() const { return value("id").toInt(); }
    2424    void setId(int id) { setValue("id", id); }
     
    2626    void setName(const QString & type) { setValue("name", type); }
    2727public:
    28     static void updateActivityMap();
    29     static QString getActivityName(int id);
     28    static void updateTrackMap();
     29    static QString getTrackName(int id);
    3030};
    3131
    32 #endif /* ACTIVITY_H_ */
     32#endif /* TRACK_H */
     33
Note: See TracChangeset for help on using the changeset viewer.