39 \param parent The parent of type QGraphicsItem. |
44 \param parent The parent of type QGraphicsItem. |
40 */ |
45 */ |
41 AnalogClockWidget::AnalogClockWidget(QGraphicsItem *parent) : |
46 AnalogClockWidget::AnalogClockWidget(QGraphicsItem *parent) : |
42 HbWidget(parent) |
47 HbWidget(parent) |
43 { |
48 { |
|
49 OstTraceFunctionEntry0( ANALOGCLOCKWIDGET_ANALOGCLOCKWIDGET_ENTRY ); |
44 bool result = HbStyleLoader::registerFilePath( |
50 bool result = HbStyleLoader::registerFilePath( |
45 ":/resource/analogclockwidget.widgetml"); |
51 ":/resource/analogclockwidget.widgetml"); |
46 result = HbStyleLoader::registerFilePath( |
52 result = HbStyleLoader::registerFilePath( |
47 ":/resource/analogclockwidget.css"); |
53 ":/resource/analogclockwidget.css"); |
48 |
54 |
49 constructPrimitives(); |
55 constructPrimitives(); |
50 mTimer = new QTimer(this); |
56 mTimer = new QTimer(this); |
51 connect(mTimer, SIGNAL(timeout()), SLOT(tick())); |
57 connect(mTimer, SIGNAL(timeout()), SLOT(tick())); |
|
58 OstTraceFunctionExit0( ANALOGCLOCKWIDGET_ANALOGCLOCKWIDGET_EXIT ); |
52 } |
59 } |
53 |
60 |
54 /*! |
61 /*! |
55 Destructor. |
62 Destructor. |
56 */ |
63 */ |
57 AnalogClockWidget::~AnalogClockWidget() |
64 AnalogClockWidget::~AnalogClockWidget() |
58 { |
65 { |
|
66 OstTraceFunctionEntry0( DUP1_ANALOGCLOCKWIDGET_ANALOGCLOCKWIDGET_ENTRY ); |
59 mTimer->stop(); |
67 mTimer->stop(); |
60 HbStyleLoader::unregisterFilePath(":/resource/analogclockwidget.widgetml"); |
68 HbStyleLoader::unregisterFilePath(":/resource/analogclockwidget.widgetml"); |
61 HbStyleLoader::unregisterFilePath(":/resource/analogclockwidget.css"); |
69 HbStyleLoader::unregisterFilePath(":/resource/analogclockwidget.css"); |
|
70 OstTraceFunctionExit0( DUP1_ANALOGCLOCKWIDGET_ANALOGCLOCKWIDGET_EXIT ); |
62 } |
71 } |
63 |
72 |
64 /*! |
73 /*! |
65 Constructs the widget primitive items. |
74 Constructs the widget primitive items. |
66 */ |
75 */ |
67 void AnalogClockWidget::constructPrimitives() |
76 void AnalogClockWidget::constructPrimitives() |
68 { |
77 { |
|
78 OstTraceFunctionEntry0( ANALOGCLOCKWIDGET_CONSTRUCTPRIMITIVES_ENTRY ); |
69 if (!mClockBackground) { |
79 if (!mClockBackground) { |
70 mClockBackground = new HbIconItem( |
80 mClockBackground = new HbIconItem( |
71 QLatin1String("qtg_graf_clock_day_bg"), this); |
81 QLatin1String("qtg_graf_clock_day_bg"), this); |
72 HbStyle::setItemName( |
82 HbStyle::setItemName( |
73 mClockBackground, QLatin1String("clock_background")); |
83 mClockBackground, QLatin1String("clock_background")); |
91 mClockSecondHand = new HbIconItem( |
101 mClockSecondHand = new HbIconItem( |
92 QLatin1String("qtg_graf_clock_day_sec"), this); |
102 QLatin1String("qtg_graf_clock_day_sec"), this); |
93 HbStyle::setItemName( |
103 HbStyle::setItemName( |
94 mClockSecondHand, QLatin1String("clock_second_hand")); |
104 mClockSecondHand, QLatin1String("clock_second_hand")); |
95 } |
105 } |
|
106 OstTraceFunctionExit0( ANALOGCLOCKWIDGET_CONSTRUCTPRIMITIVES_EXIT ); |
96 } |
107 } |
97 |
108 |
98 /*! |
109 /*! |
99 Called on the derived classes to notify in cases when |
110 Called on the derived classes to notify in cases when |
100 the style primitives need to be updated. |
111 the style primitives need to be updated. |
101 */ |
112 */ |
102 void AnalogClockWidget::updatePrimitives() |
113 void AnalogClockWidget::updatePrimitives() |
103 { |
114 { |
|
115 OstTraceFunctionEntry0( ANALOGCLOCKWIDGET_UPDATEPRIMITIVES_ENTRY ); |
104 if (!mClockBackground) { |
116 if (!mClockBackground) { |
105 mClockBackground = new HbIconItem( |
117 mClockBackground = new HbIconItem( |
106 QLatin1String("qtg_graf_clock_day_bg"), this); |
118 QLatin1String("qtg_graf_clock_day_bg"), this); |
107 HbStyle::setItemName( |
119 HbStyle::setItemName( |
108 mClockBackground, QLatin1String("clock_background")); |
120 mClockBackground, QLatin1String("clock_background")); |
159 } |
171 } |
160 |
172 |
161 if (!mTimer->isActive()) { |
173 if (!mTimer->isActive()) { |
162 mTimer->start(clockUpdateInterval); |
174 mTimer->start(clockUpdateInterval); |
163 } |
175 } |
|
176 OstTraceFunctionExit0( ANALOGCLOCKWIDGET_UPDATEPRIMITIVES_EXIT ); |
164 } |
177 } |
165 |
178 |
166 /*! |
179 /*! |
167 Updates clock visualization according to current time. |
180 Updates clock visualization according to current time. |
168 */ |
181 */ |
169 void AnalogClockWidget::tick() |
182 void AnalogClockWidget::tick() |
170 { |
183 { |
|
184 OstTraceFunctionEntry0( ANALOGCLOCKWIDGET_TICK_ENTRY ); |
171 updatePrimitives(); |
185 updatePrimitives(); |
172 update(); |
186 update(); |
|
187 OstTraceFunctionExit0( ANALOGCLOCKWIDGET_TICK_EXIT ); |
173 } |
188 } |
174 |
189 |
175 /*! |
190 /*! |
176 Sets the item's geometry to rect. |
191 Sets the item's geometry to rect. |
177 */ |
192 */ |
178 void AnalogClockWidget::setGeometry(const QRectF &rect) |
193 void AnalogClockWidget::setGeometry(const QRectF &rect) |
179 { |
194 { |
|
195 OstTraceFunctionEntry0( ANALOGCLOCKWIDGET_SETGEOMETRY_ENTRY ); |
180 HbWidget::setGeometry(rect); |
196 HbWidget::setGeometry(rect); |
181 updatePrimitives(); |
197 updatePrimitives(); |
|
198 OstTraceFunctionExit0( ANALOGCLOCKWIDGET_SETGEOMETRY_EXIT ); |
182 } |
199 } |
183 |
200 |
184 // End of file --Don't remove this. |
201 // End of file --Don't remove this. |