1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cxutils.h" |
|
19 #include "cxuidisplaypropertyhandler.h" |
|
20 |
|
21 namespace { |
|
22 // Refresh period for the timer keeping backlight on. |
|
23 const int CXUI_BACKLIGHT_REFRESH_TIMEOUT = 3000; |
|
24 } |
|
25 |
|
26 CxuiDisplayPropertyHandler::CxuiDisplayPropertyHandler() : |
|
27 mBacklightTimer(this), |
|
28 mUtility(this) |
|
29 { |
|
30 // Setup backlight timer |
|
31 mBacklightTimer.setSingleShot(false); |
|
32 mBacklightTimer.setInterval(CXUI_BACKLIGHT_REFRESH_TIMEOUT); |
|
33 QObject::connect(&mBacklightTimer, |
|
34 SIGNAL(timeout()), |
|
35 this, |
|
36 SLOT(simulateActivity())); |
|
37 } |
|
38 |
|
39 CxuiDisplayPropertyHandler::~CxuiDisplayPropertyHandler() |
|
40 { |
|
41 mBacklightTimer.stop(); |
|
42 } |
|
43 |
|
44 /** |
|
45 * Utility to keep backlight on and screensaver out. |
|
46 * @param enabled True means backlight is kept on and screensaver is disabled. |
|
47 * False means backlight may time out and screensaver may come |
|
48 * on depending of user activity. |
|
49 */ |
|
50 void CxuiDisplayPropertyHandler::setDisplayAlwaysVisible(bool enabled) |
|
51 { |
|
52 CX_DEBUG_ENTER_FUNCTION(); |
|
53 |
|
54 if (enabled) { |
|
55 CX_DEBUG( ("CxuiDisplayPropertyHandler - setting display constantly on") ); |
|
56 simulateActivity(); |
|
57 mBacklightTimer.start(); |
|
58 } else { |
|
59 CX_DEBUG( ("CxuiDisplayPropertyHandler - setting display to normal mode") ); |
|
60 mBacklightTimer.stop(); |
|
61 } |
|
62 |
|
63 CX_DEBUG_EXIT_FUNCTION(); |
|
64 } |
|
65 |
|
66 void CxuiDisplayPropertyHandler::simulateActivity() |
|
67 { |
|
68 mUtility.resetInactivityTime(); |
|
69 } |
|