vtuis/lcvtplugin/src/common/tlcvtstates.cpp
branchRCL_3
changeset 35 779871d1e4f4
parent 34 f15ac8e65a02
child 37 590f6f022902
equal deleted inserted replaced
34:f15ac8e65a02 35:779871d1e4f4
     1 /*
       
     2 * Copyright (c) 2008 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:  Video UI states class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <cvtengmodel.h>
       
    20 #include <mvtengcamerapreferences.h>
       
    21 #include <cvtlogger.h>
       
    22 
       
    23 #include "tlcvtstates.h"
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // TLcVtStates::TLcVtStates
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 TLcVtStates::TLcVtStates( CVtEngModel& aModel )
       
    30     : iMediaState( aModel.Media(), aModel.CommandHandler() ), iAudioState( aModel ),
       
    31     iModel( aModel ), iExecState( EExecStateStarting)    
       
    32     {
       
    33     // get camera preferences
       
    34     iCameraPref = static_cast<MVtEngCameraPreferences*>
       
    35         ( iModel.Extension( KVtEngExtensionCameraPreferences ) );
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // TLcVtStates::Update
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void TLcVtStates::Update()
       
    43     {
       
    44     __VTPRINTENTER( "TLcVtStates.Update" )
       
    45     iMediaState.Update();
       
    46     iAudioState.Update();
       
    47     __VTPRINTEXIT( "TLcVtStates.Update" )
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // TLcVtStates::IsColorToneSettingAvailable
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 TBool TLcVtStates::IsColorToneSettingAvailable() const
       
    55     {
       
    56     __VTPRINTENTER( "TLcVtStates.IsColorToneSettingAvailable" )
       
    57     TUint32 supportedModes;
       
    58     // Get supported whitebalance modes
       
    59     if ( iCameraPref )
       
    60         {
       
    61         if ( iCameraPref->GetSupportedColorTones( supportedModes ) )
       
    62             {
       
    63             // error occured
       
    64             __VTPRINTEXIT( "TLcVtStates.IsColorToneSettingAvailableErr" )
       
    65             return EFalse;
       
    66             }
       
    67         }
       
    68 
       
    69     // Clean the flag, flags that are possible are
       
    70     // A bitfield of suported colortones
       
    71     // ENormal         = 0x00,
       
    72     // ESepia          = 0x01,
       
    73     // EGrayscale      = 0x02,
       
    74     // ENegative       = 0x04
       
    75     supportedModes &= 0x07;
       
    76 
       
    77     // If supported modes is 0 automatic,then return EFalse
       
    78     __VTPRINTEXIT( "TLcVtStates.IsColorToneSettingAvailable" )
       
    79     return supportedModes;
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // TLcVtStates::IsWhiteBalanceSettingAvailable
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 TBool TLcVtStates::IsWhiteBalanceSettingAvailable() const
       
    87     {
       
    88     __VTPRINTENTER( "TLcVtStates.IsWhiteBalanceSettingAvailable" )
       
    89     TUint32 supportedModes;
       
    90     // Get supported whitebalance modes
       
    91     if ( iCameraPref )
       
    92         {
       
    93         if ( iCameraPref->GetSupportedWhiteBalanceModes( supportedModes ) )
       
    94             {
       
    95             // error occured
       
    96             __VTPRINTEXIT( "TLcVtStates.IsWhiteBalanceSettingAvailableErr" )
       
    97             return EFalse;
       
    98             }
       
    99         }
       
   100     __VTPRINT2( DEBUG_GEN, "IsWhiteBalanceSettingAvailable=%d", supportedModes )
       
   101     // If supported modes is 0 ,then return EFalse
       
   102     __VTPRINTEXIT( "TLcVtStates.IsWhiteBalanceSettingAvailable2" )
       
   103     return supportedModes;
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // TLcVtStates::IsContrastSettingAvailable
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 TBool TLcVtStates::IsContrastSettingAvailable() const
       
   111     {
       
   112     __VTPRINTENTER( "TLcVtStates.IsContrastSettingAvailable" )
       
   113     TBool ret( ETrue );
       
   114     if ( iCameraPref )
       
   115         {
       
   116         TInt temp;
       
   117         ret = !iCameraPref->GetContrast( temp );
       
   118         }
       
   119     return ret;
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // TLcVtStates::IsBrightnessSettingAvailable
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 TBool TLcVtStates::IsBrightnessSettingAvailable() const
       
   127     {
       
   128     __VTPRINTENTER( "TLcVtStates.IsBrightnessSettingAvailable" )
       
   129     TBool ret( ETrue );
       
   130     if ( iCameraPref )
       
   131          {
       
   132          TInt temp;
       
   133          ret = !iCameraPref->GetBrightness( temp );
       
   134          }
       
   135     return ret;
       
   136     }