Changeset b1a201a
- Timestamp:
- 01/20/10 14:30:34 (13 years ago)
- Branches:
- master, qt5
- Children:
- 990afd5
- Parents:
- d1fb9ee
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/app/app.pro
rd1fb9ee rb1a201a 1 #include(../global.pri)1 include(../global.pri) 2 2 TEMPLATE = app 3 3 TARGET = fosdem … … 10 10 DEPENDPATH += . ../gui 11 11 TARGETDEPS += $$DESTDIR/libmvc.a $$DESTDIR/libgui.a $$DESTDIR/libsql.a 12 #maemo {13 #LIBS += -L$$DESTDIR -lqalarm -lalarm14 #INCLUDEPATH += ../alarm15 #DEPENDPATH += ../alarm16 #TARGETDEPS += $$DESTDIR/libqalarm.a17 #}12 maemo { 13 LIBS += -L$$DESTDIR -lqalarm -lalarm 14 INCLUDEPATH += ../alarm 15 DEPENDPATH += ../alarm 16 TARGETDEPS += $$DESTDIR/libqalarm.a 17 } 18 18 19 19 SOURCES += main.cpp -
src/mvc/delegate.cpp
rd1fb9ee rb1a201a 1 1 #include "delegate.h" 2 2 #include "eventmodel.h" 3 #include <activity.h> 3 4 4 5 #include <QDebug> … … 6 7 7 8 const int RADIUS = 10; 8 const int SPACER = 23;9 const int SPACER = 10; 9 10 10 11 const double scaleFactor1 = 0.4; … … 33 34 return; 34 35 35 QFont fontSmall = option.font;36 fontSmall.setBold(true);37 fontSmall.setPixelSize(option.rect.height()*scaleFactor1);38 QFontMetrics fmSmall(fontSmall);39 40 QFont fontBig = option.font;41 fontBig.setBold(true);42 fontBig.setPixelSize(option.rect.height()*scaleFactor2);43 QFontMetrics fmBig(fontBig);44 45 int spacer = (fmSmall.boundingRect("999").width() < SPACER) ? SPACER : fmSmall.boundingRect("999").width();46 47 36 painter->save(); 48 37 49 38 QColor bkgrColor = Qt::cyan; 50 39 QPen borderPen(bkgrColor.darker()); 40 //QColor bkgrColor = QColor(0,0,113); 41 //QPen borderPen(Qt::cyan); 51 42 if(hasParent(index)) 52 43 { 44 int aux = option.rect.height() - mControls[FavouriteControlOn]->drawPoint().y() - mControls[FavouriteControlOn]->image()->height(); 45 // font SMALL 46 QFont fontSmall = option.font; 47 fontSmall.setBold(false); 48 fontSmall.setPixelSize(aux*0.2); 49 QFontMetrics fmSmall(fontSmall); 50 // font SMALL bold 51 QFont fontSmallB = fontSmall; 52 fontSmallB.setBold(true); 53 QFontMetrics fmSmallB(fontSmallB); 54 55 // font BIG 56 QFont fontBig = option.font; 57 fontBig.setBold(false); 58 fontBig.setPixelSize(aux*0.33); 59 QFontMetrics fmBig(fontBig); 60 // font BIG bold 61 QFont fontBigB = fontBig; 62 fontBigB.setBold(true); 63 QFontMetrics fmBigB(fontBigB); 64 65 int spacer = (fmSmall.boundingRect("999").width() < SPACER) ? SPACER : fmSmall.boundingRect("999").width(); 66 53 67 if(isLast(index)) 54 68 { … … 66 80 endPath.lineTo(option.rect.topRight()); 67 81 68 //painter->setBrush( bkgrColor );69 painter->setBrush(lastGradient);82 painter->setBrush( bkgrColor ); 83 //painter->setBrush(lastGradient); 70 84 painter->setPen(borderPen); 71 85 painter->drawPath(endPath); … … 75 89 else // middle elements 76 90 { 77 78 91 QLinearGradient middleGradient(option.rect.topLeft(), option.rect.bottomLeft()); 79 92 middleGradient.setColorAt(0.0, Qt::white); … … 83 96 middleGradient.setColorAt(1.0, Qt::white); 84 97 85 //painter->setBrush( bkgrColor );86 painter->setBrush(middleGradient);98 painter->setBrush( bkgrColor ); 99 //painter->setBrush(middleGradient); 87 100 painter->setPen(Qt::NoPen); 88 101 painter->drawRect(option.rect); … … 113 126 114 127 // draw texts 115 QPointF titlePointF; 116 titlePointF = QPoint(option.rect.x()+SPACER,option.rect.y()+option.rect.height()-10); 117 QString text = qVariantValue<QString>(index.data()) + ": " + static_cast<Event*>(index.internalPointer())->title(); 118 painter->drawText(titlePointF,text); 128 Event *event = static_cast<Event*>(index.internalPointer()); 129 QPointF titlePointF(mControls[FavouriteControlOn]->drawPoint(option.rect)); 130 titlePointF.setX(option.rect.x()+SPACER); 131 titlePointF.setY(titlePointF.y()+mControls[FavouriteControlOn]->image()->height()); 132 QTime start = event->start().time(); 133 painter->setFont(fontBig); 134 painter->drawText(titlePointF,start.toString("hh:mm") + "-" + start.addSecs(event->duration()).toString("hh:mm") + ", " + event->room()); 135 // title 136 titlePointF.setY(titlePointF.y()+fmBig.height()-fmBig.descent()); 137 painter->setFont(fontBigB); 138 QString title = event->title(); 139 if(fmBigB.boundingRect(title).width() > (option.rect.width()-2*SPACER)) // the title won't fit the screen 140 { 141 // chop words from the end 142 while( (fmBigB.boundingRect(title + "...").width() > (option.rect.width()-2*SPACER)) && !title.isEmpty()) 143 { 144 title.chop(1); 145 // chop characters one-by-one from the end 146 while( (!title.at(title.length()-1).isSpace()) && !title.isEmpty()) 147 { 148 title.chop(1); 149 } 150 } 151 title += "..."; 152 } 153 painter->drawText(titlePointF,title); 154 // persons 155 titlePointF.setY(titlePointF.y()+fmSmall.height()-fmSmall.descent()); 156 painter->setFont(fontSmall); 157 painter->drawText(titlePointF,"Presenter(s): " + event->persons().join(" and ")); 158 // track 159 titlePointF.setY(titlePointF.y()+fmSmall.height()-fmSmall.descent()); 160 painter->drawText(titlePointF,"Activity(s): " + Activity::getActivityName(event->activityId())); 119 161 } 120 162 else // doesn't have parent - time-groups' elements (top items) 121 163 { 164 QFont fontSmall = option.font; 165 fontSmall.setBold(true); 166 fontSmall.setPixelSize(option.rect.height()*scaleFactor1); 167 QFontMetrics fmSmall(fontSmall); 168 169 QFont fontBig = option.font; 170 fontBig.setBold(true); 171 fontBig.setPixelSize(option.rect.height()*scaleFactor2); 172 QFontMetrics fmBig(fontBig); 173 174 int spacer = (fmSmall.boundingRect("999").width() < SPACER) ? SPACER : fmSmall.boundingRect("999").width(); 175 122 176 QLinearGradient titleGradient(option.rect.topLeft(), option.rect.topRight()); 123 177 //titleGradient.setColorAt(0.0, Qt::white);
Note: See TracChangeset
for help on using the changeset viewer.