screensaver/snsrplugins/snsrbigclockscreensaverplugin/src/snsrbigclockscreensaver.cpp
equal
deleted
inserted
replaced
16 */ |
16 */ |
17 |
17 |
18 #include "snsrbigclockscreensaver.h" |
18 #include "snsrbigclockscreensaver.h" |
19 |
19 |
20 #ifdef Q_OS_SYMBIAN |
20 #ifdef Q_OS_SYMBIAN |
21 #include <e32std.h> |
|
22 #include <XQSettingsManager> |
21 #include <XQSettingsManager> |
23 #include <screensaverdomaincrkeys.h> |
22 #include <screensaverdomaincrkeys.h> |
|
23 #include <clockdomaincrkeys.h> |
24 #endif // Q_OS_SYMBIAN |
24 #endif // Q_OS_SYMBIAN |
25 |
25 |
26 #include <QDebug> |
26 #include <QDebug> |
27 #include <QTime> |
27 #include <QTime> |
28 #include <QTimer> |
28 #include <QTimer> |
55 mMainWindow->setRenderHint(QPainter::SmoothPixmapTransform); |
55 mMainWindow->setRenderHint(QPainter::SmoothPixmapTransform); |
56 |
56 |
57 // This model holds indicator status information and must exist as |
57 // This model holds indicator status information and must exist as |
58 // long as screensaver does. |
58 // long as screensaver does. |
59 mIndicatorModel = new SnsrIndicatorModel(this); |
59 mIndicatorModel = new SnsrIndicatorModel(this); |
|
60 |
|
61 // connect timer for time updates |
|
62 connect( &mTimer, SIGNAL(timeout()), SLOT(updateTime()) ); |
60 } |
63 } |
61 |
64 |
62 /*! |
65 /*! |
63 Destructs the class. |
66 Destructs the class. |
64 */ |
67 */ |
115 |
118 |
116 #ifdef Q_OS_SYMBIAN |
119 #ifdef Q_OS_SYMBIAN |
117 // Check ScreensaverStatus from repository |
120 // Check ScreensaverStatus from repository |
118 XQSettingsManager::Error error; |
121 XQSettingsManager::Error error; |
119 XQCentralRepositorySettingsKey settingsKey( |
122 XQCentralRepositorySettingsKey settingsKey( |
120 KCRUidScreensaverSettings.iUid, KScreensaverStatus ); // TUid as same repository used in control panel via Symbian APIs |
123 KCRUidValueScreensaverSettings, KScreensaverStatus ); |
121 XQSettingsManager setManager; |
124 XQSettingsManager setManager; |
122 int screensaverOn = setManager.readItemValue(settingsKey, XQSettingsManager::TypeInt).toInt(); |
125 int screensaverOn = setManager.readItemValue(settingsKey, XQSettingsManager::TypeInt).toInt(); |
123 error = setManager.error(); |
126 error = setManager.error(); |
124 if (error != XQSettingsManager::NoError) { |
127 if (error != XQSettingsManager::NoError) { |
125 qDebug("Error reading value from XQSettingsManager.. error = %d", error); |
128 qDebug("Error reading screensaver status from XQSettingsManager.. error = %d", error); |
126 } |
129 } |
127 #else |
130 #else |
128 int screensaverOn = 1; |
131 int screensaverOn = 1; |
129 #endif // Q_OS_SYMBIAN |
132 #endif // Q_OS_SYMBIAN |
130 |
133 |
296 \retval ClockFormat. |
299 \retval ClockFormat. |
297 */ |
300 */ |
298 SnsrBigClockScreensaver::ClockFormat SnsrBigClockScreensaver::clockFormat() |
301 SnsrBigClockScreensaver::ClockFormat SnsrBigClockScreensaver::clockFormat() |
299 { |
302 { |
300 #ifdef Q_OS_SYMBIAN |
303 #ifdef Q_OS_SYMBIAN |
301 if (TLocale().ClockFormat() == EClockAnalog) { |
304 XQSettingsManager::Error error; |
302 return ClockFormatAnalog; |
305 XQCentralRepositorySettingsKey settingsKey( |
303 } else { |
306 KCRUidClockApp, KClockType ); |
304 return ClockFormatDigital; |
307 XQSettingsManager setManager; |
305 } |
308 int useDigital = setManager.readItemValue(settingsKey, XQSettingsManager::TypeInt).toInt(); |
|
309 error = setManager.error(); |
|
310 if (error != XQSettingsManager::NoError) { |
|
311 qDebug("Error reading clock format from XQSettingsManager.. error = %d", error); |
|
312 } |
|
313 return ( useDigital ? ClockFormatDigital : ClockFormatAnalog ); |
306 #else |
314 #else |
307 // windows build - change the format every 30 seconds for testing purposes |
315 // windows build - change the format every 30 seconds for testing purposes |
308 if (QTime::currentTime().second() < 30) { |
316 if (QTime::currentTime().second() < 30) { |
309 return ClockFormatAnalog; |
317 return ClockFormatAnalog; |
310 } else { |
318 } else { |
314 } |
322 } |
315 |
323 |
316 void SnsrBigClockScreensaver::removeCurrentContainer() |
324 void SnsrBigClockScreensaver::removeCurrentContainer() |
317 { |
325 { |
318 if ( mCurrentContainer ) { |
326 if ( mCurrentContainer ) { |
319 disconnect( |
|
320 &mTimer, SIGNAL(timeout()), |
|
321 this, SLOT(updateTime()) |
|
322 ); |
|
323 disconnect( |
|
324 mCurrentContainer, SIGNAL(unlockRequested()), |
|
325 this, SIGNAL(unlockRequested()) ); |
|
326 if (mTimer.timerId()!= -1) { |
327 if (mTimer.timerId()!= -1) { |
327 mTimer.stop(); |
328 mTimer.stop(); |
328 } |
329 } |
329 emit viewChanged(0); |
330 emit viewChanged(0); |
330 |
331 |
335 |
336 |
336 void SnsrBigClockScreensaver::setCurrentContainer( SnsrBigClockContainer* newContainer ) |
337 void SnsrBigClockScreensaver::setCurrentContainer( SnsrBigClockContainer* newContainer ) |
337 { |
338 { |
338 mCurrentContainer = newContainer; |
339 mCurrentContainer = newContainer; |
339 mCurrentContainer->setParent(this); |
340 mCurrentContainer->setParent(this); |
340 connect( &mTimer, SIGNAL(timeout()), SLOT(updateTime()) ); |
|
341 connect( mCurrentContainer, SIGNAL(unlockRequested()), SIGNAL(unlockRequested()) ); |
341 connect( mCurrentContainer, SIGNAL(unlockRequested()), SIGNAL(unlockRequested()) ); |
342 |
342 |
343 mCurrentContainer->setIndicatorModel(*mIndicatorModel); |
343 mCurrentContainer->setIndicatorModel(*mIndicatorModel); |
344 |
344 |
345 int updateInterval = mCurrentContainer->updateIntervalInMilliseconds(); |
345 int updateInterval = mCurrentContainer->updateIntervalInMilliseconds(); |