screensaver/devicedialogplugins/snsrdevicedialogplugin/src/snsrdevicedialogdisplaycontrol.cpp
changeset 86 e4f038c420f7
child 98 e6f74eb7f69f
equal deleted inserted replaced
81:7dd137878ff8 86:e4f038c420f7
       
     1 /*
       
     2 * Copyright (c) 2010 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: Platform agnostic Qt wrapper class for controlling display
       
    15 *              power save mode. The power save mode gets actually activated
       
    16 *              only on Symbian environment; in other environments the provided
       
    17 *              functions do nothing.
       
    18 *              The use of Symbian display power save API has been wrapped with
       
    19 *              client-server pair because HbDeviceDialogs don't have enough
       
    20 *              capabilities to call that API directly.
       
    21 */
       
    22 
       
    23 #include <qglobal.h>
       
    24 #include <qdebug.h>
       
    25 #include "snsrdevicedialogdisplaycontrol.h"
       
    26 
       
    27 /*!
       
    28     Constructor
       
    29  */
       
    30 SnsrDeviceDialogDisplayControl::SnsrDeviceDialogDisplayControl()
       
    31 {
       
    32 #ifdef Q_OS_SYMBIAN
       
    33     int error = mDisplayClient.Open();
       
    34     if ( error ) {
       
    35         qWarning() << QString("Opening Display Control Client failed, error code %1").arg(error);
       
    36     }
       
    37 #endif
       
    38 }
       
    39 
       
    40 /*!
       
    41     Destructor
       
    42  */
       
    43 SnsrDeviceDialogDisplayControl::~SnsrDeviceDialogDisplayControl()
       
    44 {
       
    45 #ifdef Q_OS_SYMBIAN
       
    46     mDisplayClient.Close();
       
    47 #endif
       
    48 }
       
    49 
       
    50 /*!
       
    51     Set display to full power mode (the normal mode).
       
    52 */
       
    53 void SnsrDeviceDialogDisplayControl::setDisplayFullPower()
       
    54 {
       
    55 #ifdef Q_OS_SYMBIAN
       
    56     mDisplayClient.SetDisplayFullPower();
       
    57 #endif
       
    58 }
       
    59 
       
    60 /*!
       
    61     Set display to low-power/partial mode. The area outside of set active area
       
    62     is left completely black.
       
    63     \param  startRow    The first active screen row in the native orientation of the display device.
       
    64     \param  endRow      The last active screen row in the native orientation of the display device. 
       
    65  */
       
    66 void SnsrDeviceDialogDisplayControl::setDisplayLowPower( int startRow, int endRow )
       
    67 {
       
    68 #ifdef Q_OS_SYMBIAN
       
    69     mDisplayClient.SetDisplayLowPower( startRow, endRow );
       
    70 #else
       
    71     Q_UNUSED( startRow );
       
    72     Q_UNUSED( endRow );
       
    73 #endif
       
    74 }
       
    75 
       
    76 /*!
       
    77     Set display device off.
       
    78 */
       
    79 void SnsrDeviceDialogDisplayControl::setDisplayOff()
       
    80 {
       
    81 #ifdef Q_OS_SYMBIAN
       
    82     mDisplayClient.SetDisplayOff();
       
    83 #endif
       
    84 }
       
    85