limit subtask list
[Sak.git] / sakwidget.h
blob48c97eb3c3c3e8258b3f31967cec84018ba20b06
1 #ifndef SAKWIDGET_H_
2 #define SAKWIDGET_H_
4 #include <QtGui>
5 #include <QFont>
6 #include <QList>
7 #include <QHash>
8 #include <QPair>
9 #include <QObject>
10 #include <QDateTime>
11 #include <QPixmap>
12 #include <QRectF>
13 #include <QDebug>
15 #include "task.h"
17 class SakWidget : public QObject, public QGraphicsItem
19 Q_OBJECT;
20 public:
21 SakWidget(const Task& task);
22 ~SakWidget();
23 void setGeometry(const QRect&);
24 void setStatistics(double dailyWorked, double weeklyWorked, double monthlyWorked, double dailyPercentage, double weeklyPercentage, double monthlyPercentage);
25 QRectF boundingRect() const { return m_rect; }
26 public slots:
27 void showDetails(bool show = true);
28 signals:
29 void clicked(const QString& taskName);
30 void clicked(const QString& taskName, const QString& subtaskName);
31 public:
32 void keyPressEvent (QKeyEvent * event);
33 void mousePressEvent(QGraphicsSceneMouseEvent* e);
34 void mouseReleaseEvent(QGraphicsSceneMouseEvent* e);
35 void mouseMoveEvent(QGraphicsSceneMouseEvent* e);
36 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* e);
37 void timerEvent(QTimerEvent* e);
39 private:
40 bool m_ismoving;
41 QPointF m_position;
42 qreal m_scale;
43 QPoint m_lastPoint;
44 QPalette m_palette;
45 Task m_task;
46 QString m_tooltipText;
48 void drawBasicShape(QPixmap& p);
49 void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
50 QRectF m_rect, m_boundingRect;
51 static QBitmap* m_mask;
52 int m_border;
53 static int m_maxzvalue;
54 QTextDocument* m_text;
55 QPixmap m_cachedPixmap;
56 QPixmap m_cachedPixmapB;
57 QPixmap m_ic;
58 bool m_redrawCachedPixmap, m_redrawCachedPixmapB;
59 void redrawPixmaps();
60 int m_flipTimer;
61 // is painting side B??
62 bool m_sideB;
63 // is animating??
64 bool m_showingDetails;
65 double m_animItr;
66 double m_dailyWorked, m_weeklyWorked, m_monthlyWorked, m_dailyPercentage, m_weeklyPercentage, m_monthlyPercentage;
71 #endif