Fixed painting of lcdTimer.

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent 73b9f1b265
commit 2b88e1212c
  1. 237
      src/domain/UBGraphicsItemDelegate.cpp
  2. 2
      src/domain/UBGraphicsItemDelegate.h

@ -852,128 +852,127 @@ void MediaTimer::drawSegment(const QPoint &pos, char segmentNo, QPainter &p,
#define LIGHT #define LIGHT
#define DARK #define DARK
if (fill) { QPolygon a(0);
QPolygon a(0); switch (segmentNo) {
switch (segmentNo) { case 0 :
case 0 : ppt = pt;
ppt = pt; LIGHT;
LIGHT; LINETO(segLen - 1,0);
LINETO(segLen - 1,0); DARK;
DARK; LINETO(segLen - width - 1,width);
LINETO(segLen - width - 1,width); LINETO(width,width);
LINETO(width,width); LINETO(0,0);
LINETO(0,0); break;
break; case 1 :
case 1 : pt += QPoint(0 , 1);
pt += QPoint(0 , 1); ppt = pt;
ppt = pt; LIGHT;
LIGHT; LINETO(width,width);
LINETO(width,width); DARK;
DARK; LINETO(width,segLen - width/2 - 2);
LINETO(width,segLen - width/2 - 2); LINETO(0,segLen - 2);
LINETO(0,segLen - 2); LIGHT;
LIGHT; LINETO(0,0);
LINETO(0,0); break;
break; case 2 :
case 2 : pt += QPoint(segLen - 1 , 1);
pt += QPoint(segLen - 1 , 1); ppt = pt;
ppt = pt; DARK;
DARK; LINETO(0,segLen - 2);
LINETO(0,segLen - 2); LINETO(-width,segLen - width/2 - 2);
LINETO(-width,segLen - width/2 - 2); LIGHT;
LIGHT; LINETO(-width,width);
LINETO(-width,width); LINETO(0,0);
LINETO(0,0); break;
break; case 3 :
case 3 : pt += QPoint(0 , segLen);
pt += QPoint(0 , segLen); ppt = pt;
ppt = pt; LIGHT;
LIGHT; LINETO(width,-width/2);
LINETO(width,-width/2); LINETO(segLen - width - 1,-width/2);
LINETO(segLen - width - 1,-width/2); LINETO(segLen - 1,0);
LINETO(segLen - 1,0); DARK;
DARK; if (width & 1) { // adjust for integer division error
if (width & 1) { // adjust for integer division error LINETO(segLen - width - 3,width/2 + 1);
LINETO(segLen - width - 3,width/2 + 1); LINETO(width + 2,width/2 + 1);
LINETO(width + 2,width/2 + 1); } else {
} else { LINETO(segLen - width - 1,width/2);
LINETO(segLen - width - 1,width/2);
LINETO(width,width/2);
}
LINETO(0,0);
break;
case 4 :
pt += QPoint(0 , segLen + 1);
ppt = pt;
LIGHT;
LINETO(width,width/2); LINETO(width,width/2);
DARK;
LINETO(width,segLen - width - 2);
LINETO(0,segLen - 2);
LIGHT;
LINETO(0,0);
break;
case 5 :
pt += QPoint(segLen - 1 , segLen + 1);
ppt = pt;
DARK;
LINETO(0,segLen - 2);
LINETO(-width,segLen - width - 2);
LIGHT;
LINETO(-width,width/2);
LINETO(0,0);
break;
case 6 :
pt += QPoint(0 , segLen*2);
ppt = pt;
LIGHT;
LINETO(width,-width);
LINETO(segLen - width - 1,-width);
LINETO(segLen - 1,0);
DARK;
LINETO(0,0);
break;
case 7 :
pt += QPoint(segLen/2 , segLen*2);
ppt = pt;
DARK;
LINETO(width,0);
LINETO(width,-width);
LIGHT;
LINETO(0,-width);
LINETO(0,0);
break;
case 8 :
pt += QPoint(segLen/2 - width/2 + 1 , segLen/2 + width);
ppt = pt;
DARK;
LINETO(width,0);
LINETO(width,-width);
LIGHT;
LINETO(0,-width);
LINETO(0,0);
break;
case 9 :
pt += QPoint(segLen/2 - width/2 + 1 , 3*segLen/2 + width);
ppt = pt;
DARK;
LINETO(width,0);
LINETO(width,-width);
LIGHT;
LINETO(0,-width);
LINETO(0,0);
break;
default :
break;
} }
// End exact copy LINETO(0,0);
p.setPen(Qt::white); break;
p.setBrush(Qt::white); case 4 :
p.drawPolygon(a); pt += QPoint(0 , segLen + 1);
p.setBrush(Qt::NoBrush); ppt = pt;
LIGHT;
pt = pos; LINETO(width,width/2);
DARK;
LINETO(width,segLen - width - 2);
LINETO(0,segLen - 2);
LIGHT;
LINETO(0,0);
break;
case 5 :
pt += QPoint(segLen - 1 , segLen + 1);
ppt = pt;
DARK;
LINETO(0,segLen - 2);
LINETO(-width,segLen - width - 2);
LIGHT;
LINETO(-width,width/2);
LINETO(0,0);
break;
case 6 :
pt += QPoint(0 , segLen*2);
ppt = pt;
LIGHT;
LINETO(width,-width);
LINETO(segLen - width - 1,-width);
LINETO(segLen - 1,0);
DARK;
LINETO(0,0);
break;
case 7 :
pt += QPoint(segLen/2 , segLen*2);
ppt = pt;
DARK;
LINETO(width,0);
LINETO(width,-width);
LIGHT;
LINETO(0,-width);
LINETO(0,0);
break;
case 8 :
pt += QPoint(segLen/2 - width/2 + 1 , segLen/2 + width);
ppt = pt;
DARK;
LINETO(width,0);
LINETO(width,-width);
LIGHT;
LINETO(0,-width);
LINETO(0,0);
break;
case 9 :
pt += QPoint(segLen/2 - width/2 + 1 , 3*segLen/2 + width);
ppt = pt;
DARK;
LINETO(width,0);
LINETO(width,-width);
LIGHT;
LINETO(0,-width);
LINETO(0,0);
break;
default :
break;
} }
// End exact copy
p.setPen(Qt::white);
p.setBrush(Qt::white);
p.drawPolygon(a);
p.setBrush(Qt::NoBrush);
pt = pos;
#undef LINETO #undef LINETO
#undef LIGHT #undef LIGHT
#undef DARK #undef DARK

@ -95,8 +95,6 @@ private:
QBitArray points; QBitArray points;
double val; double val;
uint fill : 1;
uint shadow : 1; uint shadow : 1;
uint smallPoint : 1; uint smallPoint : 1;

Loading…
Cancel
Save