16 */ |
16 */ |
17 |
17 |
18 #ifndef HSDIGITALCLOCKWIDGET_H |
18 #ifndef HSDIGITALCLOCKWIDGET_H |
19 #define HSDIGITALCLOCKWIDGET_H |
19 #define HSDIGITALCLOCKWIDGET_H |
20 |
20 |
21 #include <hblabel.h> |
21 #include <HbWidget> |
22 |
22 |
23 #include <hstest_global.h> |
23 #include <hstest_global.h> |
24 |
24 |
25 HOMESCREEN_TEST_CLASS(TestClockWidget) |
25 HOMESCREEN_TEST_CLASS(TestClockWidget) |
26 |
26 |
27 class HsDigitalClockWidget : public HbLabel |
27 class HbFrameItem; |
|
28 class HbIconItem; |
|
29 class HbTouchArea; |
|
30 |
|
31 class HsDigitalClockWidget : public HbWidget |
28 { |
32 { |
29 Q_OBJECT |
33 Q_OBJECT |
|
34 |
|
35 public: |
|
36 explicit HsDigitalClockWidget(bool useAmPm = true, QGraphicsItem *parent = 0); |
|
37 ~HsDigitalClockWidget(); |
|
38 |
|
39 bool eventFilter(QObject *watched, QEvent *event); |
|
40 |
|
41 signals: |
|
42 void clockTapped(); |
|
43 |
|
44 public slots: |
|
45 void tick(); |
|
46 void setAmPm(bool useAmPm); |
|
47 |
|
48 protected: |
|
49 void resizeEvent(QGraphicsSceneResizeEvent *event); |
|
50 |
|
51 private: |
|
52 Q_DISABLE_COPY(HsDigitalClockWidget) |
|
53 void createPrimitives(); |
|
54 void updatePrimitives(); |
|
55 void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
|
56 |
|
57 private: |
|
58 HbFrameItem *mBackground; |
|
59 HbIconItem *mDigit1; |
|
60 HbIconItem *mDigit2; |
|
61 HbIconItem *mDigit3; |
|
62 HbIconItem *mDigit4; |
|
63 HbIconItem *mDigit5; |
|
64 HbIconItem *mDigit6; |
|
65 HbIconItem *mAmPm; |
|
66 HbTouchArea *mTouchArea; |
|
67 bool mUseAmPm; |
|
68 QMap<QChar, QString> mDigitMap; |
30 |
69 |
31 public: |
|
32 |
|
33 HsDigitalClockWidget(QGraphicsItem *parent = 0); |
|
34 ~HsDigitalClockWidget(); |
|
35 |
|
36 protected: |
|
37 |
|
38 virtual void changeEvent(QEvent *event); |
|
39 |
|
40 HOMESCREEN_TEST_FRIEND_CLASS(TestClockWidget) |
70 HOMESCREEN_TEST_FRIEND_CLASS(TestClockWidget) |
41 |
|
42 }; |
71 }; |
43 |
72 |
44 #endif // HSDIGITALCLOCKWIDGET_H |
73 #endif // HSDIGITALCLOCKWIDGET_H |