]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/thermostat-demo.git/blob - schedulepoint.h
fix crash problems and update the openweathermap URLs
[apps/thermostat-demo.git] / schedulepoint.h
1 #ifndef SCHEDULEPOINT_H\r
2 #define SCHEDULEPOINT_H\r
3 \r
4 #include <QtGui>\r
5 #include <QApplication>\r
6 #include <QColor>\r
7 #include <QGraphicsItem>\r
8 #include <QSet>\r
9 \r
10 class GlobalSettings;\r
11 \r
12 class SchedulePoint : public QObject, public QGraphicsItem {\r
13     Q_OBJECT\r
14 public:\r
15     explicit SchedulePoint(int);\r
16     ~SchedulePoint();\r
17     void setText(const QString &text);\r
18     QRectF boundingRect() const;\r
19     QPainterPath shape() const;\r
20     void paint(QPainter *painter,\r
21                const QStyleOptionGraphicsItem *option, QWidget *);\r
22     int getID();\r
23     void setID(int);\r
24     int getLocation();\r
25     void setLocation(int);\r
26     void shiftLeft();\r
27     void shiftRight();\r
28     void increaseTemp();\r
29     void decreaseTemp();\r
30     QString time();\r
31     void setTimeBlockWidth(float timeBlockWidth);\r
32     void setPointArea(QRectF pointArea);\r
33     void setWeekHeight(int weekHeight);\r
34     QColor tempToColor(int temp);\r
35     int temp;\r
36 public slots:\r
37     void updateUnit();\r
38     void setDisabled(bool disabled);\r
39     bool disabled();\r
40 \r
41     void setSelected(bool selected);\r
42     bool selected();\r
43     void adjust(int, qreal);\r
44 \r
45 protected:\r
46     void mousePressEvent(QGraphicsSceneMouseEvent */* event */);\r
47     void mouseMoveEvent(QGraphicsSceneMouseEvent * /* event */);\r
48     void mouseReleaseEvent(QGraphicsSceneMouseEvent * /* event */);\r
49     void paintEvent(QPaintEvent */* event */);\r
50 \r
51 private:\r
52     QRectF outlineRect() const;\r
53     int roundness(double size) const;\r
54 \r
55     int positionToTimeBlocks();\r
56 \r
57     QString myText;\r
58     QColor myBackgroundColor;\r
59 \r
60     int ID;\r
61     int location;\r
62     float m_timeBlockWidth;\r
63     int m_weekHeight;\r
64     QRectF m_pointArea;\r
65 \r
66     GlobalSettings* m_globalSettings;\r
67     bool m_pressed;\r
68     int m_xClickPos;\r
69     int m_yClickPos;\r
70     QPen pen; // outline color\r
71 \r
72     bool m_disabled;\r
73     bool m_selected;\r
74     \r
75 signals:\r
76     void clicked(SchedulePoint *);\r
77     void shareAdjustment(int tempAdjust, qreal xPos);\r
78 };\r
79 \r
80 #endif // SCHEDULEPOINT_H\r