camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamQualitySettingContainer.cpp
branchRCL_3
changeset 24 bac7acad7cb3
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Implements the quality slider for image and video settings*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <gscamerapluginrsc.rsg>
       
    21 #include <cameraapp.mbg>
       
    22 #include <barsread.h>
       
    23 #include <AknQueryValue.h>
       
    24 #include <AknIconUtils.h>
       
    25 #include <StringLoader.h>
       
    26 #include <AknsUtils.h>
       
    27 #include <AknsDrawUtils.h>
       
    28 #include <aknlayoutscalable_apps.cdl.h>
       
    29 #include <akniconconfig.h>
       
    30 #include <akntitle.h>  // CAknTitlePane
       
    31 #include <aknappui.h>
       
    32 #include <touchfeedback.h>  
       
    33 
       
    34 #include "CamAppUiBase.h"
       
    35 #include "GSCamQualitySettingContainer.h"
       
    36 #include "GSCamQualitySettingSlider.h"
       
    37 #include "CamUtility.h"
       
    38 #include "camuiconstants.h"
       
    39 #include "MCamAppController.h"
       
    40 #include "CamControllerObservers.h"
       
    41 #include "MCamStaticSettings.h"
       
    42 
       
    43 #include "camconfiguration.h"
       
    44 
       
    45 // CONSTANTS
       
    46 const TUint KMaxRemainingImagesShown = 9999;
       
    47 
       
    48 _LIT( KRemainingImagesNumberFormat, "%04d" );
       
    49 
       
    50 // MACROS
       
    51 
       
    52 
       
    53 // ============================ MEMBER FUNCTIONS ===============================
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CGSCamQualitySettingContainer::CGSCamQualitySettingContainer
       
    57 // C++ default constructor can NOT contain any code, that
       
    58 // might leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CGSCamQualitySettingContainer::CGSCamQualitySettingContainer(
       
    62     MCamAppController& aController,
       
    63     TCamCameraMode     aMode,
       
    64     CCoeControl*       aParent )
       
    65   : iController( aController ),
       
    66     iParent( aParent ),
       
    67     iMode      ( aMode       )
       
    68   {
       
    69 
       
    70   }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CGSCamQualitySettingContainer::ConstructL
       
    74 // Symbian 2nd phase constructor can leave.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 void CGSCamQualitySettingContainer::ConstructL()
       
    78   {
       
    79   CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( CCoeEnv::Static()->AppUi() );
       
    80   MCamStaticSettings& model = appUi->StaticSettingsModel();
       
    81   iController.AddControllerObserverL( this );
       
    82 
       
    83   TCamSettingItemIds settingType = ( ECamControllerVideo == iMode )
       
    84                                    ? ECamSettingItemVideoQuality
       
    85                                    : ECamSettingItemPhotoQuality;
       
    86 
       
    87   iSlider = CGSCamQualitySettingSlider::NewL( iParent, this, settingType, 0,
       
    88                                               &(model.Configuration()) );
       
    89 
       
    90     
       
    91   iSelectedQuality = model.IntegerSettingValue( settingType );
       
    92   
       
    93   iTimeFormat = ( ECamControllerVideo == iMode )                                   
       
    94               ? iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_LONG )
       
    95               : KRemainingImagesNumberFormat().AllocL();
       
    96 
       
    97   TFileName resFileName;
       
    98   CamUtility::ResourceFileName( resFileName );
       
    99   TPtrC resname = resFileName;
       
   100   
       
   101   // ...phone memory icon
       
   102   AknIconUtils::CreateIconL( iPhoneIcon,
       
   103                              iPhoneIconMask,
       
   104                              resname,
       
   105                              EMbmCameraappQgn_indi_cam4_memory_phone,
       
   106                              EMbmCameraappQgn_indi_cam4_memory_phone_mask );
       
   107 
       
   108   // ...mmc icon
       
   109   AknIconUtils::CreateIconL( iMMCIcon,
       
   110                              iMMCIconMask,
       
   111                              resname, 
       
   112                              EMbmCameraappQgn_indi_cam4_memory_mmc,
       
   113                              EMbmCameraappQgn_indi_cam4_memory_mmc_mask );
       
   114 
       
   115    // ...mass storage icon
       
   116   AknIconUtils::CreateIconL( iMassStorageIcon,
       
   117                              iMassStorageIconMask,
       
   118                              resname, 
       
   119                              EMbmCameraappQgn_indi_cam4_memory_mass,
       
   120                              EMbmCameraappQgn_indi_cam4_memory_mass_mask );
       
   121 
       
   122   UpdateRemainingTextL();
       
   123   }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CGSCamQualitySettingContainer::NewL
       
   127 // Two-phased constructor.
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 CGSCamQualitySettingContainer* 
       
   131 CGSCamQualitySettingContainer::NewL( MCamAppController& aController,
       
   132                                      TCamCameraMode     aMode,
       
   133                                      CCoeControl*       aParent )
       
   134   {
       
   135   CGSCamQualitySettingContainer* self = 
       
   136       new( ELeave ) CGSCamQualitySettingContainer( aController, aMode, aParent );
       
   137   CleanupStack::PushL( self );
       
   138   self->ConstructL();
       
   139   CleanupStack::Pop();
       
   140   return self;
       
   141   }
       
   142 
       
   143     
       
   144 // -----------------------------------------------------------------------------
       
   145 // CGSCamQualitySettingContainer::~CGSCamQualitySettingContainer
       
   146 // Destructor
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 CGSCamQualitySettingContainer::~CGSCamQualitySettingContainer()
       
   150   {
       
   151   PRINT( _L("Camera => ~CGSCamQualitySettingContainer") );
       
   152   CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() );
       
   153   if ( appUi )
       
   154     {
       
   155     TInt resId = ( ECamControllerVideo == iMode )
       
   156                ? R_CAM_VIDEO_SETTINGS_TITLE_NAME
       
   157                : R_CAM_PHOTO_SETTINGS_TITLE_NAME;
       
   158     
       
   159     TRAP_IGNORE( appUi->SetTitleL( resId ) );
       
   160     }
       
   161   iController.RemoveControllerObserver( this );
       
   162   delete iPhoneIcon;
       
   163   delete iPhoneIconMask;
       
   164   delete iMMCIcon;
       
   165   delete iMMCIconMask;
       
   166   delete iMassStorageIcon;
       
   167   delete iMassStorageIconMask;
       
   168 
       
   169   delete iTimeFormat;
       
   170 
       
   171   // delete descriptors from arrays
       
   172   if ( iTitleArray )
       
   173     {
       
   174     iTitleArray->Reset();
       
   175     delete iTitleArray;
       
   176     }
       
   177   if ( iDescArray )
       
   178     {
       
   179     iDescArray->Reset();
       
   180     delete iDescArray;
       
   181     }
       
   182   if ( iCurrentDescLineArray )
       
   183     {
       
   184     iCurrentDescLineArray->Reset();
       
   185     delete iCurrentDescLineArray;
       
   186     }
       
   187 
       
   188   iLayoutSettingDescLines.Reset();
       
   189   iEnumArray.Reset();
       
   190 
       
   191   delete iSlider;
       
   192   delete iTextTitle;
       
   193   delete iTextTopSubtitle;
       
   194   delete iTextBottomSubtitle;
       
   195   delete iTextRemainingTitle;
       
   196 
       
   197   iSupportedQualitiesArray.Close();
       
   198   PRINT( _L("Camera <= ~CGSCamQualitySettingContainer") );
       
   199   }
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CGSCamQualitySettingContainer::SelectedQuality
       
   203 // Returns the quality selected by the slider
       
   204 // -----------------------------------------------------------------------------
       
   205 //
       
   206 TInt CGSCamQualitySettingContainer::SelectedQuality() const
       
   207   {
       
   208   return iSelectedQuality;
       
   209   }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CGSCamQualitySettingContainer::ConstructFromResourceL
       
   213 // Constructs the container from the resource
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 void CGSCamQualitySettingContainer::ConstructFromResourceL( TResourceReader& aReader )
       
   217   {
       
   218   CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() );
       
   219   // set up the container windows here as setting page window
       
   220   // isn't created until CAknSettingPage::ConstructFromResourceL is called
       
   221   SetContainerWindowL( *iParent );
       
   222   iSlider->SetContainerWindowL( *iParent );
       
   223 
       
   224   // read the texts from the resource file
       
   225   iTextTitle = aReader.ReadHBufCL();
       
   226   appUi->SetTitleL( iTextTitle->Des() );
       
   227   iTextTopSubtitle    = aReader.ReadHBufCL();
       
   228   iTextBottomSubtitle = aReader.ReadHBufCL();
       
   229   iTextRemainingTitle = aReader.ReadHBufCL();
       
   230   
       
   231   TCamPsiKey key = ( ECamControllerVideo == iMode )
       
   232                    ? ECamPsiSupportedVideoQualities
       
   233                    : ECamPsiSupportedStillQualities;
       
   234 
       
   235 
       
   236   iConfiguration = &(appUi->StaticSettingsModel().Configuration());
       
   237   iConfiguration->GetPsiIntArrayL( key, iSupportedQualitiesArray );  
       
   238 
       
   239   iTitleArray = new( ELeave ) CDesCArrayFlat( 1 );
       
   240   iDescArray  = new( ELeave ) CDesCArrayFlat( 1 );
       
   241 
       
   242   // read the descriptive text and split the text into 3 lines
       
   243   ReadInTextArrayL( aReader, *iTitleArray );
       
   244   ReadInTextArrayL( aReader, *iDescArray ); 
       
   245             
       
   246   // Read the setting enums that match with the text arrays.
       
   247   TInt count = aReader.ReadInt16();
       
   248   TInt suppCount = iSupportedQualitiesArray.Count();
       
   249    
       
   250   TInt i = 0;    
       
   251   TInt j = 0;
       
   252    
       
   253   for ( i = 0; i < count && j < suppCount ; i++ )
       
   254     {
       
   255     TInt val = aReader.ReadInt16();
       
   256     
       
   257     // check if it's a supported quality level
       
   258     if ( i == iSupportedQualitiesArray[j] )
       
   259       {
       
   260       if ( ECamControllerVideo == iMode )
       
   261         {
       
   262         User::LeaveIfError( iEnumArray.Append( static_cast<TCamVideoQualitySettings>( val ) ) );                
       
   263         }
       
   264       else
       
   265         {
       
   266         User::LeaveIfError( iEnumArray.Append( static_cast<TCamImageQualitySetting>( val ) ) );
       
   267         }                           
       
   268       j++;
       
   269       }
       
   270     }
       
   271 
       
   272   // TCamImageQualitySetting enum starts with highest quality == 0
       
   273   // so convert this to value the slider understands i.e. 0 == lowest
       
   274   TInt sliderValue = iEnumArray.Count() - 1 - iSelectedQuality;
       
   275 
       
   276   iSlider->InitializeL( sliderValue, iTextTopSubtitle, iTextBottomSubtitle );
       
   277       
       
   278   // Set the new range of values
       
   279   iSlider->SetRange( 0, iEnumArray.Count() - 1 );
       
   280           
       
   281   iCurrentDescLineArray = new( ELeave ) CArrayFixFlat<TPtrC>( 3 );
       
   282   // Use the layout info from the first line for width and font
       
   283   TAknLayoutText layout = iLayoutSettingDescLines[0];
       
   284   AknTextUtils::WrapToArrayL( ( *iDescArray )[iSelectedQuality], 
       
   285                               layout.TextRect().Width(), 
       
   286                               *( layout.Font() ), 
       
   287                               *iCurrentDescLineArray );   
       
   288   }
       
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // CGSCamQualitySettingContainer::CountComponentControls
       
   292 // return the number of component controls
       
   293 // -----------------------------------------------------------------------------
       
   294 //
       
   295 TInt CGSCamQualitySettingContainer::CountComponentControls() const
       
   296   {
       
   297   return 1; // the slider
       
   298   }
       
   299 
       
   300 // -----------------------------------------------------------------------------
       
   301 // CGSCamQualitySettingContainer::ComponentControl
       
   302 // return the control at a given index
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 CCoeControl* CGSCamQualitySettingContainer::ComponentControl( TInt /*aIndex*/ ) const
       
   306   {
       
   307   return iSlider;
       
   308   }
       
   309 
       
   310 // -----------------------------------------------------------------------------
       
   311 // CGSCamQualitySettingContainer::Draw
       
   312 // Draws the container
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 void CGSCamQualitySettingContainer::Draw( const TRect& /*aRect*/ ) const
       
   316   {
       
   317   PRINT( _L("Camera => CGSCamQualitySettingContainer::Draw") );
       
   318   CWindowGc& gc = SystemGc();
       
   319 
       
   320   // Draw skin background
       
   321   MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   322   MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
   323   AknsDrawUtils::Background( skin, cc, gc, Rect() );
       
   324   
       
   325   // draw the title text   
       
   326   TRgb color;
       
   327   AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
       
   328                              EAknsCIQsnTextColorsCG6 );
       
   329   
       
   330   // draw the quality description text
       
   331   DrawQualityTexts( gc, color );
       
   332 
       
   333   // draw the remaining images/remaining video time
       
   334   iLayoutRemainingTitle.DrawText( gc, iTextRemainingTitle->Des(), ETrue, color );
       
   335   
       
   336   // draw the remaining images/remaining video time
       
   337   TBufC<40> Buf( iTextRemaining );
       
   338   TPtr Pointer = Buf.Des();
       
   339   AknTextUtils::LanguageSpecificNumberConversion( Pointer );
       
   340   iLayoutRemainingText.DrawText( gc, /*iTextRemaining*/Buf, ETrue, color );
       
   341 
       
   342   // draw the current location icon
       
   343   DrawStorageIcon( gc );
       
   344 
       
   345   PRINT( _L("Camera <= CGSCamQualitySettingContainer::Draw") );
       
   346   }
       
   347 
       
   348 // -----------------------------------------------------------------------------
       
   349 // CGSCamQualitySettingContainer::SizeChanged
       
   350 // Handles a change in the size of the control
       
   351 // -----------------------------------------------------------------------------
       
   352 //
       
   353 void CGSCamQualitySettingContainer::SizeChanged()
       
   354   {
       
   355   TRAP_IGNORE( ReadLayoutL() );
       
   356   }
       
   357 
       
   358 // -----------------------------------------------------------------------------
       
   359 // CGSCamQualitySettingContainer::OfferKeyEventL
       
   360 // Handles key events
       
   361 // -----------------------------------------------------------------------------
       
   362 //
       
   363 TKeyResponse CGSCamQualitySettingContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
   364                                                             TEventCode aType ) 
       
   365   {
       
   366   TKeyResponse keyResponse = iSlider->OfferKeyEventL( aKeyEvent, aType );
       
   367   if ( keyResponse == EKeyWasConsumed )
       
   368     {
       
   369     ReportEventL( MCoeControlObserver::EEventStateChanged );
       
   370     }
       
   371   return keyResponse;
       
   372   }
       
   373 
       
   374 // -----------------------------------------------------------------------------
       
   375 // CGSCamQualitySettingContainer::HandleSettingValueUpdateL
       
   376 // Handles a change to the setting value of the slider
       
   377 // -----------------------------------------------------------------------------
       
   378 //
       
   379 void CGSCamQualitySettingContainer::HandleSettingValueUpdateL( TInt aNewValue )
       
   380   {
       
   381   ASSERT ( aNewValue >= 0 && 
       
   382            aNewValue < iEnumArray.Count() );            
       
   383   
       
   384   // The slider values range from Max at the top (eg 5) to Min at the bottom (0).
       
   385   // For quality settings enum (0 is Max, 4 is Min) need to invert this
       
   386   TInt index = iSlider->MaxValue() - aNewValue;
       
   387   if ( ECamControllerVideo == iMode )
       
   388       {
       
   389       iSelectedQuality = index;
       
   390       }
       
   391   else
       
   392       {
       
   393       iSelectedQuality = index;
       
   394       }
       
   395       
       
   396   // remove the old lines
       
   397   iCurrentDescLineArray->Reset();
       
   398   // Use the layout info from the first line for width and font
       
   399   TAknLayoutText layout = iLayoutSettingDescLines[0];
       
   400   AknTextUtils::WrapToArrayL( ( *iDescArray )[iSelectedQuality], 
       
   401                               layout.TextRect().Width(), 
       
   402                               *( layout.Font() ), 
       
   403                               *iCurrentDescLineArray );
       
   404 
       
   405   /* -
       
   406   // Update the number of images remaining
       
   407   UpdateRemainingTextL();
       
   408   */
       
   409   // +
       
   410   ResetRemainingTextL();
       
   411 
       
   412   // Results in a call to CCamQualitySettingPage::UpdateSettingL()
       
   413   ReportEventL( MCoeControlObserver::EEventStateChanged );
       
   414 
       
   415   /*ActivateGc();
       
   416   Window().Invalidate( iLayoutDescRect.Rect() );
       
   417   DeactivateGc();*/
       
   418   DrawNow();
       
   419   }
       
   420 
       
   421 // -----------------------------------------------------------------------------
       
   422 // CGSCamQualitySettingContainer::HandleControllerEventL
       
   423 // Handles a change in the controller
       
   424 // -----------------------------------------------------------------------------
       
   425 //
       
   426 
       
   427 void CGSCamQualitySettingContainer::HandleControllerEventL( 
       
   428                          TCamControllerEvent aEvent, TInt /*aError*/ )
       
   429 
       
   430   {
       
   431   PRINT( _L("Camera => CGSCamQualitySettingContainer::HandleControllerEventL") );
       
   432   CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() );
       
   433   TBool redrawNeeded = EFalse;
       
   434   // If this is a capture complete event, or the image quality or save
       
   435   // location has changed...
       
   436   if ( aEvent == ECamEventImageQualityChanged ||
       
   437        aEvent == ECamEventSaveLocationChanged ||
       
   438        aEvent == ECamEventVideoQualityChanged  )
       
   439     {
       
   440     UpdateRemainingTextL();
       
   441   
       
   442     if ( aEvent == ECamEventSaveLocationChanged )
       
   443       {
       
   444       /*TCamSettingItemIds storageLocation = ( ECamControllerVideo == iMode) 
       
   445                                          ? ECamSettingItemVideoMediaStorage 
       
   446                                          : ECamSettingItemPhotoMediaStorage;*/
       
   447       // update location
       
   448       /*if ( static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->IsMMCRemovedNotePending() )
       
   449       	{
       
   450       	iStorageLocation = static_cast< TCamMediaStorage >
       
   451       		( iController.IntegerSettingValueUnfiltered( storageLocation ) );
       
   452       	}
       
   453       else
       
   454       	{
       
   455       	iStorageLocation = static_cast< TCamMediaStorage > 
       
   456       		( iController.IntegerSettingValue( storageLocation ) );
       
   457       	}*/
       
   458       }
       
   459 
       
   460     redrawNeeded = ETrue;
       
   461     }
       
   462   else
       
   463     {
       
   464     // Other events: no action
       
   465     }
       
   466 
       
   467   
       
   468   if ( redrawNeeded )        
       
   469     {
       
   470     DrawNow();
       
   471     }
       
   472   PRINT( _L("Camera <= CGSCamQualitySettingContainer::HandleControllerEventL") );
       
   473   }
       
   474 
       
   475 
       
   476 // -----------------------------------------------------------------------------
       
   477 // CGSCamQualitySettingContainer::ReadLayoutL
       
   478 // Reads the layout information from the resource file
       
   479 // -----------------------------------------------------------------------------
       
   480 //
       
   481 void CGSCamQualitySettingContainer::ReadLayoutL()
       
   482     {
       
   483     TAknLayoutRect settingLayout;
       
   484     settingLayout.LayoutRect( Rect(), AknLayoutScalable_Apps::main_cam_set_pane( 0 ) );
       
   485     TRect settingRect( settingLayout.Rect() );
       
   486 
       
   487     AknLayoutUtils::LayoutControl( iSlider, settingRect, AknLayoutScalable_Apps::main_cset_slider_pane( 2 ) );
       
   488 
       
   489     // set the layouts for the rects
       
   490     // containing the descriptions
       
   491     TRect infoboxRect;
       
   492     iLayoutDescRect.LayoutRect( settingRect, AknLayoutScalable_Apps::main_cset_text_pane( 0 ) );
       
   493     infoboxRect = iLayoutDescRect.Rect();
       
   494     
       
   495     // set quality setting title layout
       
   496     iLayoutSettingTitle.LayoutText( infoboxRect,  AknLayoutScalable_Apps::main_cset_text_pane_t1( 0 ) );
       
   497     
       
   498     // set layouts for 3 lines of descriptive text
       
   499     iLayoutSettingDescLines.Reset();
       
   500     TAknLayoutText layout;
       
   501     layout.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t2( 0 ) );
       
   502     User::LeaveIfError( iLayoutSettingDescLines.Append( layout ) );
       
   503     layout.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t3( 0 ) );
       
   504     User::LeaveIfError( iLayoutSettingDescLines.Append( layout ) );
       
   505     layout.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t4( 0 ) );
       
   506     User::LeaveIfError( iLayoutSettingDescLines.Append( layout ) );
       
   507 
       
   508     // set remaining text layouts
       
   509     iLayoutRemainingTitle.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t6( 0 ) );
       
   510     iLayoutRemainingText.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t7( 0 )  );
       
   511     // read the storage icon layout
       
   512     iLayoutIcon.LayoutRect( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_g1( 0 ) );
       
   513 
       
   514     // set size for different memory type icons
       
   515     TSize iconSize ( iLayoutIcon.Rect().Size() );
       
   516     AknIconUtils::SetSize( iPhoneIcon, iconSize, EAspectRatioPreserved );
       
   517     AknIconUtils::SetSize( iMMCIcon, iconSize, EAspectRatioPreserved );
       
   518     AknIconUtils::SetSize( iMassStorageIcon, iconSize, EAspectRatioPreserved );
       
   519     }
       
   520 
       
   521 // -----------------------------------------------------------------------------
       
   522 // CGSCamQualitySettingContainer::DrawQualityTexts
       
   523 // Draws the quality information texts
       
   524 // -----------------------------------------------------------------------------
       
   525 //
       
   526 void CGSCamQualitySettingContainer::DrawQualityTexts( CWindowGc& aGc, TRgb aColor ) const
       
   527     {
       
   528     // Set the brushstyle to ENullBrush in order to not show the 
       
   529     // text background box. Otherwise it would show slightly from
       
   530     // beneath the shaded background
       
   531     //aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
       
   532     iLayoutSettingTitle.DrawText
       
   533         ( aGc, ( *iTitleArray )[iSelectedQuality], ETrue, aColor );
       
   534 
       
   535     TInt count = Min( iCurrentDescLineArray->Count(), iLayoutSettingDescLines.Count() );
       
   536     
       
   537     for ( TInt i = 0; i < count; i++ )
       
   538         {
       
   539         if ( i < count )
       
   540             {
       
   541             iLayoutSettingDescLines[i].
       
   542                 DrawText( aGc, ( *iCurrentDescLineArray )[i], ETrue, aColor );
       
   543             }
       
   544         }       
       
   545     }
       
   546 
       
   547 // ---------------------------------------------------------
       
   548 // CGSCamQualitySettingContainer::DrawStorageIcon
       
   549 // Draw the icon for the media storage location
       
   550 // ---------------------------------------------------------
       
   551 //
       
   552 void CGSCamQualitySettingContainer::DrawStorageIcon( CWindowGc& aGc ) const
       
   553     {
       
   554     TInt key = (ECamControllerVideo == iMode)
       
   555              ? ECamSettingItemVideoMediaStorage
       
   556              : ECamSettingItemPhotoMediaStorage;
       
   557     TCamMediaStorage storageLocation = 
       
   558         static_cast<TCamMediaStorage>( iController.IntegerSettingValue( key ) );
       
   559     CFbsBitmap* icon = NULL;
       
   560     CFbsBitmap* mask = NULL;
       
   561 
       
   562     switch( storageLocation )
       
   563         {
       
   564         case ECamMediaStoragePhone:
       
   565             {
       
   566             icon = iPhoneIcon;
       
   567             mask = iPhoneIconMask;
       
   568             }
       
   569             break;
       
   570         case ECamMediaStorageMassStorage:
       
   571             {
       
   572             icon = iMassStorageIcon;
       
   573             mask = iMassStorageIconMask;
       
   574             }
       
   575             break;            
       
   576         case ECamMediaStorageCard:
       
   577             {
       
   578             icon = iMMCIcon;
       
   579             mask = iMMCIconMask;
       
   580             }
       
   581             break;            
       
   582         case ECamMediaStorageNone:
       
   583         default:
       
   584             {
       
   585             //TODO: Get icons when none is available
       
   586             }
       
   587             break;
       
   588         }
       
   589 
       
   590     iLayoutIcon.DrawImage( aGc, icon, mask );
       
   591     }
       
   592 
       
   593 // ---------------------------------------------------------
       
   594 // CGSCamQualitySettingContainer::DrawRemainingText
       
   595 // Draw the remaining image count/video time
       
   596 // ---------------------------------------------------------
       
   597 //
       
   598 void CGSCamQualitySettingContainer::DrawRemainingText( CWindowGc& aGc ) const
       
   599     {
       
   600     // Set the brushstyle to ENullBrush in order to not show the 
       
   601     // text background box. Otherwise it would show slightly from
       
   602     // beneath the shaded background
       
   603     aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
       
   604     aGc.Clear( iLayoutRemainingText.TextRect() );
       
   605     iLayoutRemainingText.DrawText( aGc, iTextRemaining );
       
   606     }
       
   607 
       
   608 // ---------------------------------------------------------
       
   609 // CGSCamQualitySettingContainer::UpdateRemainingTextL
       
   610 // Update the remaining image count/video time remaining 
       
   611 // ---------------------------------------------------------
       
   612 //
       
   613 void CGSCamQualitySettingContainer::UpdateRemainingTextL()
       
   614   {
       
   615   PRINT( _L("Camera => CGSCamQualitySettingContainer::UpdateRemainingTextL") );
       
   616 
       
   617   if ( ECamControllerVideo == iMode )
       
   618     {
       
   619     // Get the total remaining record time from the controller
       
   620     TTime time ( iController.RecordTimeRemaining().Int64() );
       
   621 /* -
       
   622     HBufC* timeFormat = 
       
   623       iEikonEnv->AllocReadResourceLC( R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO );
       
   624     time.FormatL( iTextRemaining, *timeFormat );
       
   625     CleanupStack::PopAndDestroy( timeFormat );
       
   626 */
       
   627 // +
       
   628     time.FormatL( iTextRemaining, *iTimeFormat );
       
   629     }
       
   630   else
       
   631     {
       
   632     // use the stored image resolution to calculated the remaining images
       
   633     TBool burstActive = static_cast<CCamAppUiBase*>
       
   634                         ( iEikonEnv->AppUi() )->IsBurstEnabled();
       
   635     
       
   636     TInt imagesLeft = iController.ImagesRemaining( ECamMediaStorageCurrent, 
       
   637                                                    burstActive, 
       
   638                                                    iSelectedQuality );
       
   639     TInt showLeft   = Min( imagesLeft, KMaxRemainingImagesShown );
       
   640 // -
       
   641 //    iTextRemaining.Format( KRemainingImagesNumberFormat, showLeft );
       
   642 // +
       
   643     iTextRemaining.Format( *iTimeFormat, showLeft );
       
   644     }
       
   645 
       
   646   PRINT( _L("Camera <= CGSCamQualitySettingContainer::UpdateRemainingTextL") );
       
   647   }
       
   648 
       
   649 // ---------------------------------------------------------
       
   650 // ResetRemainingTextL
       
   651 // ---------------------------------------------------------
       
   652 //
       
   653 void 
       
   654 CGSCamQualitySettingContainer::ResetRemainingTextL()
       
   655   {
       
   656   /* mm: Disabled for now. Below code sets to 00:00.
       
   657          Proposed --:-- for video, no action for image (too fast).
       
   658   if ( ECamControllerVideo == iMode )
       
   659     {
       
   660     TTime time( TInt64( 0 ) );
       
   661     time.FormatL( iTextRemaining, *iTimeFormat );
       
   662     }
       
   663   else 
       
   664     {
       
   665     }
       
   666   */
       
   667   }
       
   668  
       
   669 // ---------------------------------------------------------
       
   670 // CGSCamQualitySettingContainer::ReadInTextArrayL
       
   671 // Populate a text array from the resource definition of available
       
   672 // quality texts using the supported quality values
       
   673 // ---------------------------------------------------------
       
   674 //   
       
   675 void CGSCamQualitySettingContainer::ReadInTextArrayL( TResourceReader& aReader, CDesCArrayFlat& aArray )
       
   676   {               
       
   677   CDesCArrayFlat* tempArray;
       
   678   tempArray = aReader.ReadDesC16ArrayL();
       
   679   
       
   680   TInt descCount = tempArray->Count();
       
   681   TInt suppCount = iSupportedQualitiesArray.Count();
       
   682    
       
   683   TInt i = 0;    
       
   684    
       
   685   for ( i = 0; i < suppCount; i++ )
       
   686     {
       
   687     TInt descriptionIndex = 
       
   688       iConfiguration->MapSupportedQualityToQualityDescriptor( 
       
   689           iMode == ECamControllerVideo, 
       
   690           iSupportedQualitiesArray[i] ); 
       
   691 
       
   692     if ( descriptionIndex >= 0 
       
   693       && descriptionIndex < descCount )   
       
   694       {
       
   695       aArray.AppendL( ( *tempArray )[descriptionIndex] );
       
   696       }        
       
   697     } 
       
   698   tempArray->Reset();
       
   699   delete tempArray;     
       
   700   tempArray = NULL;   
       
   701   } 
       
   702 
       
   703 //  End of File