camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCustomQualitySettingItem.cpp
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Location Setting item type for Image settings*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "GSCustomQualitySettingItem.h"
       
    21 #include "CamLocationSettingPage.h"
       
    22 #include "CamUtility.h"
       
    23 #include "GSCamcorderPlugin.h"
       
    24 #include "CamAppUiBase.h"
       
    25 
       
    26 #include "camconfiguration.h"
       
    27 
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 // ---------------------------------------------------------------------------
       
    33 // CGSCustomQualitySettingItem::CGSCustomQualitySettingItem
       
    34 // C++ constructor
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CGSCustomQualitySettingItem::CGSCustomQualitySettingItem( 
       
    38     TInt                 aIdentifier, 
       
    39     TInt&                aValue,
       
    40     CCamStaticSettingsModel& aModel,
       
    41     TCamCameraMode       aMode )
       
    42   : CAknEnumeratedTextPopupSettingItem( aIdentifier, aValue ),
       
    43     iModel( aModel ),
       
    44     iMode( aMode )
       
    45   {
       
    46   }
       
    47 
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CGSCustomQualitySettingItem::~CGSCustomQualitySettingItem
       
    51 // Destructor.
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 CGSCustomQualitySettingItem::~CGSCustomQualitySettingItem()
       
    55     {
       
    56     iSupportedQualityLevels.Close();
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // CGSCustomQualitySettingItem::CompleteConstructionL
       
    61 // Gets the correct text for a currently selected album
       
    62 // ---------------------------------------------------------------------------
       
    63 //	
       
    64 void CGSCustomQualitySettingItem::CompleteConstructionL()
       
    65     {
       
    66     PRINT( _L("Camera => CGSCustomQualitySettingItem::CompleteConstructionL") );
       
    67     
       
    68     CAknEnumeratedTextPopupSettingItem::CompleteConstructionL();
       
    69   
       
    70   // make sure we only have the supported items in our text array
       
    71   CArrayPtr<CAknEnumeratedText>* array = EnumeratedTextArray();
       
    72   
       
    73   TBool isVideoMode = (ECamControllerVideo == iMode);
       
    74 
       
    75   TCamPsiKey key = isVideoMode
       
    76                  ? ECamPsiSupportedVideoQualities
       
    77                  : ECamPsiSupportedStillQualities;
       
    78                  
       
    79   iModel.Configuration().GetPsiIntArrayL( key, iSupportedQualityLevels );
       
    80 
       
    81   iSupportedQualityLevels.Sort();
       
    82   
       
    83   // amend list of supported settings
       
    84   TInt sCount = iSupportedQualityLevels.Count();
       
    85   
       
    86   TInt cnt = array->Count();
       
    87   TInt j = --sCount;
       
    88   TInt i;
       
    89    
       
    90   for ( i = cnt; --i >= 0; )
       
    91     {
       
    92     if( j < 0 ||
       
    93         i != iModel.Configuration().MapSupportedQualityToQualityDescriptor(         
       
    94                       isVideoMode, 
       
    95                       iSupportedQualityLevels[j] )
       
    96       )
       
    97       {
       
    98       delete ( array->At( i ) );
       
    99       array->Delete( i );
       
   100       }
       
   101     else
       
   102       {
       
   103       j--;
       
   104       }
       
   105     }
       
   106   
       
   107   // Reset the enum values in the resource, so that the updated list has the
       
   108   // new values starting from 0
       
   109   for( i = 0; i < array->Count(); i++ )
       
   110     {
       
   111     array->At(i)->SetEnumerationValue( i );
       
   112     }
       
   113 
       
   114 #ifdef _DEBUG
       
   115   PRINT( _L("Camera <> ===============================================") );
       
   116   PRINT( _L("Camera <> Quality setting item texts left:") );
       
   117   for( i = 0; i < array->Count(); i++ )
       
   118     {
       
   119     PRINT2( _L("Camera <> Quality (%d): %S"), 
       
   120             i, 
       
   121             array->At(i)->Value() );
       
   122     }
       
   123   PRINT( _L("Camera <> ===============================================") );
       
   124 #endif
       
   125 
       
   126     
       
   127     PRINT( _L("Camera <= CGSCustomQualitySettingItem::CompleteConstructionL") );
       
   128     }
       
   129 
       
   130 
       
   131 
       
   132 //  End of file