diff -r f54ad444594d -r 61bc0f252b2b camerauis/cameraxui/cxui/src/cxuidisplaypropertyhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxui/src/cxuidisplaypropertyhandler.cpp Tue Aug 31 15:03:46 2010 +0300 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cxutils.h" +#include "cxuidisplaypropertyhandler.h" + +namespace { + // Refresh period for the timer keeping backlight on. + const int CXUI_BACKLIGHT_REFRESH_TIMEOUT = 3000; +} + +CxuiDisplayPropertyHandler::CxuiDisplayPropertyHandler() : + mBacklightTimer(this), + mUtility(this) +{ + // Setup backlight timer + mBacklightTimer.setSingleShot(false); + mBacklightTimer.setInterval(CXUI_BACKLIGHT_REFRESH_TIMEOUT); + QObject::connect(&mBacklightTimer, + SIGNAL(timeout()), + this, + SLOT(simulateActivity())); +} + +CxuiDisplayPropertyHandler::~CxuiDisplayPropertyHandler() +{ + mBacklightTimer.stop(); +} + +/** +* Utility to keep backlight on and screensaver out. +* @param enabled True means backlight is kept on and screensaver is disabled. +* False means backlight may time out and screensaver may come +* on depending of user activity. +*/ +void CxuiDisplayPropertyHandler::setDisplayAlwaysVisible(bool enabled) +{ + CX_DEBUG_ENTER_FUNCTION(); + + if (enabled) { + CX_DEBUG( ("CxuiDisplayPropertyHandler - setting display constantly on") ); + simulateActivity(); + mBacklightTimer.start(); + } else { + CX_DEBUG( ("CxuiDisplayPropertyHandler - setting display to normal mode") ); + mBacklightTimer.stop(); + } + + CX_DEBUG_EXIT_FUNCTION(); +} + +void CxuiDisplayPropertyHandler::simulateActivity() +{ + mUtility.resetInactivityTime(); +}