vtuis/videotelui/src/features/volume/cvtuivolume.cpp
branchRCL_3
changeset 35 779871d1e4f4
parent 0 ed9695c8bcbe
equal deleted inserted replaced
34:f15ac8e65a02 35:779871d1e4f4
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Volume feature implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include    <cvtlogger.h>
       
    20 #include    "cvtuivolume.h"
       
    21 #include    "tvtuifeatureids.h"
       
    22 #include    "cvtuivolumepopup.h"
       
    23 #include    "cvtuifeaturemanager.h"
       
    24 #include    "tvtuifeatureids.h"
       
    25 #include    "tvtuistates.h"
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // CVtUiVolume::NewL
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 CVtUiVolume* CVtUiVolume::NewL( CVtUiFeatureManager&
       
    32     aFeatureManager )
       
    33     {
       
    34     __VTPRINTENTER( "CVtUiVolume.NewL" )
       
    35     CVtUiVolume* self =
       
    36         new ( ELeave ) CVtUiVolume( aFeatureManager );
       
    37     CleanupStack::PushL( self );
       
    38     self->ConstructL();
       
    39     CleanupStack::Pop();
       
    40     __VTPRINTEXIT( "CVtUiVolume.NewL" )
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // CVtUiVolume::~CVtUiVolume
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CVtUiVolume::~CVtUiVolume()
       
    49     {
       
    50     __VTPRINTENTER( "CVtUiVolume.~" )
       
    51     __VTPRINTEXIT( "CVtUiVolume.~" )
       
    52     }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CVtUiVolume::RefreshL
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 void CVtUiVolume::RefreshL()
       
    59     {
       
    60     __VTPRINTENTER( "CVtUiVolume.RefreshL" )
       
    61     if ( State() == EActive )
       
    62         {
       
    63         __VTPRINT( DEBUG_GEN, "CVtUiPopupBase.RefreshL.EActive" )
       
    64         static_cast< CVtUiVolumePopup& >( Popup() ).RefreshL();
       
    65         }
       
    66     else
       
    67         {
       
    68         __VTPRINT( DEBUG_GEN, "CVtUiVolume.RefreshL.Else" )
       
    69         static_cast< CVtUiVolumePopup& >( Popup() ).UpdateVolumeAndRoutingL();
       
    70         }        
       
    71     __VTPRINTEXIT( "CVtUiVolume.RefreshL" )
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CVtUiVolume::StartL
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 void CVtUiVolume::StartL()
       
    79     {
       
    80     __VTPRINTENTER( "CVtUiVolume.StartL" )
       
    81     // if brightness or contrast slider is active stop those
       
    82     MVtUiFeature* br = iFeatureManager.
       
    83     	GetFeatureById( EVtUiFeatureIdBrightness );
       
    84     if ( br && br->State() == EActive )
       
    85     	{
       
    86         __VTPRINT( DEBUG_GEN, "CVtUiPopupBase.StartL.br->Stop" )
       
    87     	br->Stop();
       
    88     	}
       
    89     
       
    90     MVtUiFeature* cr = iFeatureManager.
       
    91 	GetFeatureById( EVtUiFeatureIdContrast );
       
    92 		if ( cr && cr->State() == EActive )
       
    93 			{
       
    94 			__VTPRINT( DEBUG_GEN, "CVtUiPopupBase.StartL.cr->Stop" )
       
    95 			cr->Stop();
       
    96 			}
       
    97 
       
    98     if ( State() == EActive )
       
    99         {
       
   100         // need to refresh when already active to replenish the close timer
       
   101         RefreshL();
       
   102         }
       
   103     else
       
   104         {
       
   105         iFeatureManager.UiStates().SetIsFloatingToolbarVisible( ETrue );
       
   106         CVtUiSliderBase::StartL();
       
   107         iFeatureManager.UiStates().SetVolumeModeOn( ETrue );
       
   108         // Toolbar needs to be refreshed if contrat and brightness were dismissed
       
   109         
       
   110         }
       
   111     __VTPRINTEXIT( "CVtUiVolume.StartL" )
       
   112     }
       
   113     
       
   114 // ---------------------------------------------------------------------------
       
   115 // CVtUiVolume::Stop
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 void CVtUiVolume::Stop()
       
   119     {
       
   120     __VTPRINTENTER( "CVtUiVolume.Stop" )    	
       
   121     iFeatureManager.UiStates().SetVolumeModeOn( EFalse );
       
   122     CVtUiSliderBase::Stop();
       
   123     __VTPRINTEXIT( "CVtUiVolume.Stop" )
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CVtUiVolume::GetVolumeValue
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 TInt CVtUiVolume::GetVolumeValue()
       
   131     {
       
   132     __VTPRINTENTER( "CVtUiVolume.GetVolumeValue" )    	
       
   133     __VTPRINTEXITR( "CVtUiVolume.GetVolumeValue%d", Popup().Value() )
       
   134     return Popup().Value();
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // CVtUiVolume::CVtUiVolume
       
   139 // ---------------------------------------------------------------------------
       
   140 //
       
   141 CVtUiVolume::CVtUiVolume( CVtUiFeatureManager& aFeatureManager )
       
   142     : CVtUiSliderBase( aFeatureManager, EVtUiFeatureIdVolume )
       
   143     {
       
   144 
       
   145     __VTPRINTENTER( "CVtUiVolume.CVtUiVolume" )
       
   146     __VTPRINTEXIT( "CVtUiVolume.CVtUiVolume" )
       
   147     }
       
   148 
       
   149 // ---------------------------------------------------------------------------
       
   150 // CVtUiVolume::CVtUiVolume
       
   151 // ---------------------------------------------------------------------------
       
   152 //
       
   153 void CVtUiVolume:: ConstructL()
       
   154     {
       
   155     __VTPRINTENTER( "CVtUiVolume.ConstructL" )
       
   156     BaseConstructL();
       
   157     SetPopup( CVtUiVolumePopup::NewL( iFeatureManager ) );
       
   158     __VTPRINTEXIT( "CVtUiVolume.ConstructL" )
       
   159     }