Ignore:
Timestamp:
01/26/10 21:12:21 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
9f367eb
Parents:
3a8dc71
Message:

conflicts refactoring

  • has to be finished
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/delegate.cpp

    r3a8dc71 r336fa33  
    6666
    6767        //Time conflicts are colored differently
    68         if ((static_cast<Event*>(index.internalPointer())->isFavourite())
    69             && (hasTimeConflict(index, index.parent())))
     68        if(hasTimeConflict(index, index.parent()))
    7069        {
    7170            bkgrColor = Qt::yellow;
     
    135134        // Time conflict
    136135        //if(static_cast<Event*>(index.internalPointer())->hasTimeConflict())
    137         if(bkgrColor == Qt::yellow)
    138         {
    139             painter->drawImage(mControls[WarningControlOn]->drawPoint(option.rect),*mControls[WarningControlOn]->image());
    140             mControls[WarningControlOn]->hasConflict=true;
    141         }
    142         else
    143         {
    144             painter->drawImage(mControls[WarningControlOff]->drawPoint(option.rect),*mControls[WarningControlOff]->image());
    145             mControls[WarningControlOn]->hasConflict=false;
    146         }
     136
     137        if(hasTimeConflict(index, index.parent()))
     138            painter->drawImage(mControls[WarningControl]->drawPoint(option.rect),*mControls[WarningControl]->image());
    147139
    148140        // draw texts
     
    316308    {
    317309        ControlId id = i.next();
    318         if((mControls[id]->drawRect(static_cast<QTreeView*>(parent())->visualRect(aIndex)).contains(aPoint))
    319             && (id != WarningControlOn) && (id != WarningControlOff))
    320         {
    321             return id;
    322         }
    323         else if ((mControls[id]->drawRect(static_cast<QTreeView*>(parent())->visualRect(aIndex)).contains(aPoint))
    324             && (mControls[id]->hasConflict))
    325         {
    326             qDebug() << "tengo conflicto";
    327             return id;
    328         }
    329 
     310        if(mControls[id]->drawRect(static_cast<QTreeView*>(parent())->visualRect(aIndex)).contains(aPoint))
     311        {
     312            if(id == WarningControl)
     313            {
     314                if(mControls[id]->hasConflict)
     315                    return id;
     316            }
     317            else
     318                return id;
     319        }
    330320    }
    331321
     
    381371#endif
    382372
    383     // WARNING ICONs
    384     // on
    385     control = new Control(WarningControlOn,QString(":icons/exclamation-iconOn.png"));
     373    // WARNING ICON
     374    control = new Control(WarningControl,QString(":icons/exclamation.png"));
    386375    p = mControls[MapControl]->drawPoint();
    387376    control->hasConflict = false;
    388377    p.setX(p.x()-control->image()->width()-SPACER);
    389378    control->setDrawPoint(p);
    390     mControls.insert(WarningControlOn,control);
    391     // off
    392     control = new Control(WarningControlOff,QString(":icons/exclamation-iconOff.png"));
    393     p = mControls[MapControl]->drawPoint();
    394     control->hasConflict = false;
    395     p.setX(p.x()-control->image()->width()-SPACER);
    396     control->setDrawPoint(p);
    397     mControls.insert(WarningControlOff,control);
     379    mControls.insert(WarningControl,control);
    398380}
    399381
     
    457439    return false;
    458440}
     441
Note: See TracChangeset for help on using the changeset viewer.