[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/ccalendar
From: Davide Bettio <davbet () aliceposta ! it>
Date: 2008-09-01 0:48:10
Message-ID: 1220230090.928491.27036.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 855529 by bettio:
dirty hacks and simpler code.
M +13 -6 calendar.cpp
M +3 -3 calendar.svg
--- trunk/playground/base/plasma/applets/ccalendar/calendar.cpp #855528:855529
@@ -84,6 +84,9 @@
}
}
+#define CELL_Y(week) (rect.y() + (cellW + space) * week + hHeight + hSpace)
+#define CELL_X(weekDay) (rect.x() + (cellW + space) * weekDay + wCSpace + cellW)
+
void Calendar::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, \
const QRect &rect) {
QSizeF m_size = rect.size();
@@ -97,31 +100,35 @@
int cellH = rectSize;
int cellW = rectSize;
+ int space = cellW / 4.5;
+ int hSpace = cellW / 2.25;
+ int wCSpace = cellW / 1.8;
+ int hHeight = cellH / 1.5;
int i = 0;
for (int week = 0; week < 5; week++){
for (int weekDay = 0; weekDay < 7; weekDay++){
if ((week == 0) && (weekDay < 4)){
- m_svg->paint(p, QRectF(rect.x() + (cellW + 5) * weekDay + 10 + \
cellW, rect.y() + (cellW + 5) * week + 40, cellW, cellH), QString::number(i % 31 + \
1) + "-grayed"); + m_svg->paint(p, QRectF(CELL_X(weekDay), \
CELL_Y(week), cellW, cellH), QString::number(i % 31 + 1) + "-grayed"); }else{
- m_svg->paint(p, QRectF(rect.x() + (cellW + 5) * weekDay + 10 + \
cellW, rect.y() + (cellW + 5) * week + 40, cellW, cellH), QString::number(i % 31 + \
1)); + m_svg->paint(p, QRectF(CELL_X(weekDay), CELL_Y(week), cellW, \
cellH), QString::number(i % 31 + 1)); }
i++;
}
}
- m_svg->paint(p, QRectF(rect.x(), rect.y() + 40, cellW, rect.y() + (cellW + 5) * \
5 - 5), "weeksColumn");
- m_svg->paint(p, QRectF(rect.x(), rect.y(), rect.x() + (cellW + 5) * 7 + 40, 25), \
"weekDayHeader"); + m_svg->paint(p, QRectF(rect.x(), CELL_Y(0), cellW, CELL_Y(5) - \
CELL_Y(0) - space), "weeksColumn"); + m_svg->paint(p, QRectF(rect.x(), rect.y(), \
CELL_X(7) - rect.x() - space, hHeight), "weekDayHeader");
for (int i = 0; i < 5; i++){
- m_svg->paint(p, QRectF(rect.x(), rect.y() + (cellW + 5) * i + 40, cellW, \
cellH), "week" + QString::number(i + 1)); + m_svg->paint(p, QRectF(rect.x(), \
CELL_Y(i), cellW, cellH), "week" + QString::number(i + 1)); }
QStringList days = (QStringList() << i18n("Mon") << i18n("Tue") << i18n("Wed") \
<< i18n("Thu") << i18n("Fri") << i18n("Sat") << i18n("Sun"));
p->setPen(Qt::white);
for (int i = 0; i < 7; i++){
- p->drawText(QRectF(rect.x() + (cellW + 5) * i + 10 + cellW, rect.y(), cellW, \
cellH), Qt::AlignCenter, days[i]); + p->drawText(QRectF(CELL_X(i), rect.y(), \
cellW, hHeight), Qt::AlignCenter, days[i]); }
}
--- trunk/playground/base/plasma/applets/ccalendar/calendar.svg #855528:855529
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="6.18142"
- inkscape:cx="480.10777"
- inkscape:cy="203.33167"
+ inkscape:zoom="1.545355"
+ inkscape:cx="519.6217"
+ inkscape:cy="196.66187"
inkscape:current-layer="week5"
showgrid="false"
inkscape:document-units="px"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic