Ignore:
Timestamp:
01/27/10 07:41:47 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
001c8cf
Parents:
336fa33
Message:

'conflicts' modifications

  • preparing for the dialog showing also list of events in the conflict
  • created 'EVENT_CONFLICT' for flaging events in conflict state
  • TODO: not finished
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/delegate.cpp

    r336fa33 r9f367eb  
    6666
    6767        //Time conflicts are colored differently
    68         if(hasTimeConflict(index, index.parent()))
     68        if(static_cast<Event*>(index.internalPointer())->isFavourite())
     69        if(static_cast<Event*>(index.internalPointer())->hasTimeConflict())
    6970        {
    7071            bkgrColor = Qt::yellow;
     
    133134        painter->drawImage(mControls[MapControl]->drawPoint(option.rect),*mControls[MapControl]->image());
    134135        // Time conflict
    135         //if(static_cast<Event*>(index.internalPointer())->hasTimeConflict())
    136 
    137         if(hasTimeConflict(index, index.parent()))
     136        if(static_cast<Event*>(index.internalPointer())->hasTimeConflict())
    138137            painter->drawImage(mControls[WarningControl]->drawPoint(option.rect),*mControls[WarningControl]->image());
    139138
     
    312311            if(id == WarningControl)
    313312            {
    314                 if(mControls[id]->hasConflict)
     313                if(static_cast<Event*>(aIndex.internalPointer())->hasTimeConflict())
    315314                    return id;
    316315            }
     
    374373    control = new Control(WarningControl,QString(":icons/exclamation.png"));
    375374    p = mControls[MapControl]->drawPoint();
    376     control->hasConflict = false;
    377375    p.setX(p.x()-control->image()->width()-SPACER);
    378376    control->setDrawPoint(p);
     
    414412}
    415413
    416 bool Delegate::hasTimeConflict(const QModelIndex &index, const QModelIndex &parent) const
    417 {
    418     Event *event = static_cast<Event*>(index.internalPointer());
    419     QTime start = event->start().time();
    420     QTime end = start.addSecs(event->duration());
    421     for(int i=0; i<parent.model()->rowCount(parent); i++)
    422     {
    423         if((event->id()!=static_cast<Event*>(parent.child(i,0).internalPointer())->id())
    424         &&
    425         (static_cast<Event*>(parent.child(i,0).internalPointer())->isFavourite()))
    426         {
    427             if (((start >= static_cast<Event*>(parent.child(i,0).internalPointer())->start().time())
    428             &&
    429             (start < static_cast<Event*>(parent.child(i,0).internalPointer())->start().time().addSecs(static_cast<Event*>(parent.child(i,0).internalPointer())->duration())))
    430             ||
    431             ((end > static_cast<Event*>(parent.child(i,0).internalPointer())->start().time())
    432             &&
    433             (end <= static_cast<Event*>(parent.child(i,0).internalPointer())->start().time().addSecs(static_cast<Event*>(parent.child(i,0).internalPointer())->duration()))))
    434             {
    435                 return true;
    436             }
    437         }
    438     }
    439     return false;
    440 }
    441 
Note: See TracChangeset for help on using the changeset viewer.