Ignore:
Timestamp:
06/12/12 20:51:20 (10 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
8f15208
Parents:
b686173
Message:

Philipp's comments to r1444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/eventmodel.cpp

    rb686173 r6bf226b  
    4949    if (mEvents.empty()) return;
    5050
    51     const int minTimeSpan = 3600; // one hour
    52     const int minChildCount = 3; // minimum number of events in one group
     51    const int minTimeSpan = 3600; // one hour // minimum duration of a group
     52    const int minChildCount = 3;  // minimum number of events in one group
    5353
    5454    // Create the first time group. The events have to be sorted by start time at this point!
    55     QDateTime groupStartDateTime(mEvents.first().start().date(), mEvents.first().start().time());
     55    //    Remarks for the following non-comment line:
     56    //    * As it is right now it could be written as
     57    //      QDateTime groupStartDateTime = mEvents.first().start();
     58    //    * Before r1444 the minutes were set to zero so that the time groups started at
     59    //      whole hours.
     60
     61    // QDateTime groupStartDateTime(mEvents.first().start().date(), QTime(mEvents.first().start().time().hour(), 0));
     62    QDateTime groupStartDateTime = mEvents.first().start();
    5663    QDateTime groupEndDateTime = groupStartDateTime.addSecs(mEvents.first().duration());
    5764    mGroups << EventModel::Group("", 0);
     
    5966
    6067    for (int i = 0; i != mEvents.count(); ++i) {
    61         QDateTime eventStartDateTime (mEvents.at(i).start().date(), mEvents.at(i).start().time());
     68        QDateTime eventStartDateTime = mEvents.at(i).start();
    6269        QDateTime eventEndDateTime = eventStartDateTime.addSecs(mEvents.at(i).duration());
    6370
     
    6774                // too few events in the group => no new group
    6875                // except a gap in time would occur that is longer than minTimeSpan
    69                 QDateTime prevEventStartDateTime (mEvents.at(i).start().date(), mEvents.at(i).start().time());
     76                QDateTime prevEventStartDateTime = mEvents.at(i).start();
    7077                if (i > 0 && qMax(prevEventStartDateTime.addSecs(mEvents.at(i-1).duration()), groupEndDateTime).secsTo(eventStartDateTime) < minTimeSpan) {
    7178                    timeSpan += minTimeSpan;
Note: See TracChangeset for help on using the changeset viewer.