Update to support both Qt 4 and Qt 5
[apps/thermostat-demo.git] / schedulescreen.h
1 #ifndef SCHEDULESCREEN_H
2 #define SCHEDULESCREEN_H
4 #include <qglobal.h>
5 #include <QtGui>
7 #if QT_VERSION >= 0x050000
9 #include <QTimer>
10 #include <QGraphicsProxyWidget>
11 #include <QGraphicsView>
12 #include <QButtonGroup>
13 #include <QPushButton>
14 #include <QHBoxLayout>
15 #include <QVBoxLayout>
16 #include <QLabel>
17 #include <QDesktopWidget>
18 #include <QGraphicsSceneMouseEvent>
20 #endif
22 #include "schedulepoint.h"
24 class GlobalSettings;
26 class ScheduleScreen : public QWidget
27 {
28     Q_OBJECT
29 public:
30     explicit ScheduleScreen(QWidget *parent = 0);
31     
32 signals:
33     void valueChanged();
34     void clicked();
35     
36 public slots:
37     void shiftLeft();
38     void shiftRight();
39     void increaseTemp();
40     void decreaseTemp();
41     void selectDay(SchedulePoint *);
42     void unselectDay();
43     void updateData();
44     void createScheduleScene();
45     void showEvent(QShowEvent *);
46     void addSchedulePoints();
47     void disableRow(bool checked);
48     void initializeScene();
49     void initializeGraphics();
51 private:
52     QButtonGroup *daysButtonGroup;
53     QGraphicsScene *scene;
54     QGraphicsView *view;
56     int seqNumber;
57     QList <SchedulePoint *> pointList;
58     QList <QPair<QPointF, int> > pointSave;
61     SchedulePoint *currentPoint;
62     void showPoint(SchedulePoint *);
63     QLabel *currentTime;
65     QRectF pointArea;
66     qreal weekHeight;
67     qreal timeBlockWidth;
68     qreal timeWidth;
70     GlobalSettings* m_globalSettings;
72     bool m_initialized;
74 protected:
75     void mousePressEvent(QMouseEvent */* event */);
76 };
78 #endif // SCHEDULESCREEN_H