86 SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onForeground") |
86 SCREENSAVER_TEST_FUNC_ENTRY("SnsrBigClockScreensaver::onForeground") |
87 qDebug() << "SnsrBigClockScreensaver::onForeground()"; |
87 qDebug() << "SnsrBigClockScreensaver::onForeground()"; |
88 |
88 |
89 removeCurrentContainer(); |
89 removeCurrentContainer(); |
90 |
90 |
91 emit screenPowerModeRequested( Screensaver::ScreenModeFullPower ); |
|
92 |
|
93 SnsrBigClockContainer* newContainer( 0 ); |
91 SnsrBigClockContainer* newContainer( 0 ); |
94 if (clockFormat() == ClockFormatAnalog) { |
92 if (clockFormat() == ClockFormatAnalog) { |
95 newContainer = new SnsrAnalogClockContainer(); |
93 newContainer = new SnsrAnalogClockContainer(); |
96 } |
94 } |
97 else { |
95 else { |
220 { |
218 { |
221 mIndicatorModel->handleDeactivatedIndicator(deactivatedIndicator); |
219 mIndicatorModel->handleDeactivatedIndicator(deactivatedIndicator); |
222 } |
220 } |
223 |
221 |
224 /*! |
222 /*! |
|
223 @copydoc Screensaver::currentPowerMode |
|
224 */ |
|
225 Screensaver::ScreenPowerMode SnsrBigClockScreensaver::currentPowerMode() |
|
226 { |
|
227 Screensaver::ScreenPowerMode mode( Screensaver::ScreenModeFullPower ); |
|
228 if ( mCurrentContainer ) { |
|
229 mode = mCurrentContainer->displayPowerMode(); |
|
230 } |
|
231 else { |
|
232 qWarning() << "No current container when current power mode queried."; |
|
233 } |
|
234 return mode; |
|
235 } |
|
236 |
|
237 /*! |
225 @copydoc Screensaver::getActiveScreenRows |
238 @copydoc Screensaver::getActiveScreenRows |
226 */ |
239 */ |
227 void SnsrBigClockScreensaver::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) |
240 void SnsrBigClockScreensaver::getActiveScreenRows(int *firstActiveRow, int *lastActiveRow) |
228 { |
241 { |
229 if ( mCurrentContainer ) { |
242 if ( mCurrentContainer ) { |
252 qWarning() << "No current container when updateLayout called."; |
265 qWarning() << "No current container when updateLayout called."; |
253 } |
266 } |
254 } |
267 } |
255 |
268 |
256 /*! |
269 /*! |
257 Update the area visible in the power save screen mode. Power save mode gets |
270 Update clock time when timer is triggered |
258 also activated on call if not already active. |
271 */ |
259 */ |
272 void SnsrBigClockScreensaver::updateTime() |
260 void SnsrBigClockScreensaver::updateActiveAreaForLowPower() |
273 { |
261 { |
274 if ( mCurrentContainer ) { |
262 emit screenPowerModeRequested( Screensaver::ScreenModeLowPower ); |
275 mCurrentContainer->update(); |
|
276 |
|
277 // Move the active area of display device if current container uses the power save mode. |
|
278 if ( mCurrentContainer->displayPowerMode() == Screensaver::ScreenModeLowPower ) { |
|
279 emit activeAreaMoved(); |
|
280 } |
|
281 } |
263 } |
282 } |
264 |
283 |
265 /*! |
284 /*! |
266 Determines the curent clock format settings. |
285 Determines the curent clock format settings. |
267 \retval ClockFormat. |
286 \retval ClockFormat. |
287 void SnsrBigClockScreensaver::removeCurrentContainer() |
306 void SnsrBigClockScreensaver::removeCurrentContainer() |
288 { |
307 { |
289 if ( mCurrentContainer ) { |
308 if ( mCurrentContainer ) { |
290 disconnect( |
309 disconnect( |
291 &mTimer, SIGNAL(timeout()), |
310 &mTimer, SIGNAL(timeout()), |
292 mCurrentContainer, SLOT(update()) |
311 this, SLOT(updateTime()) |
293 ); |
312 ); |
294 disconnect( |
313 disconnect( |
295 mCurrentContainer, SIGNAL(unlockRequested()), |
314 mCurrentContainer, SIGNAL(unlockRequested()), |
296 this, SIGNAL(unlockRequested()) ); |
315 this, SIGNAL(unlockRequested()) ); |
297 if (mTimer.timerId()!= -1) { |
316 if (mTimer.timerId()!= -1) { |
308 |
327 |
309 void SnsrBigClockScreensaver::setCurrentContainer( SnsrBigClockContainer* newContainer ) |
328 void SnsrBigClockScreensaver::setCurrentContainer( SnsrBigClockContainer* newContainer ) |
310 { |
329 { |
311 mCurrentContainer = newContainer; |
330 mCurrentContainer = newContainer; |
312 mCurrentContainer->setParent(this); |
331 mCurrentContainer->setParent(this); |
313 connect( &mTimer, SIGNAL(timeout()), mCurrentContainer, SLOT(update()) ); |
332 connect( &mTimer, SIGNAL(timeout()), SLOT(updateTime()) ); |
314 connect( mCurrentContainer, SIGNAL(unlockRequested()), SIGNAL(unlockRequested()) ); |
333 connect( mCurrentContainer, SIGNAL(unlockRequested()), SIGNAL(unlockRequested()) ); |
315 connect( mCurrentContainer, SIGNAL(activeAreaMoved()), SLOT(updateActiveAreaForLowPower()) ); |
334 |
316 |
|
317 mCurrentContainer->setIndicatorModel(*mIndicatorModel); |
335 mCurrentContainer->setIndicatorModel(*mIndicatorModel); |
318 |
336 |
319 int updateInterval = mCurrentContainer->updateIntervalInMilliseconds(); |
337 int updateInterval = mCurrentContainer->updateIntervalInMilliseconds(); |
320 // blankcontainer is empty one, don't start timer with -1 return value |
338 // blankcontainer is empty one, don't start timer with -1 return value |
321 if ( updateInterval != -1) { |
339 if ( updateInterval != -1) { |
322 mTimer.start(updateInterval); |
340 mTimer.start(updateInterval); |
323 } |
341 } |
324 |
342 |
325 |
|
326 emit viewChanged(mCurrentContainer); |
343 emit viewChanged(mCurrentContainer); |
327 } |
344 } |
328 |
345 |