camerauis/cameraapp/generic/src/CamVideoPreCaptureContainer.cpp
changeset 0 1ddebce53859
child 1 f5ec9446e5bf
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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:  Container class for video image pre-capture view*
       
    15 */
       
    16 
       
    17 // INCLUDE FILES
       
    18 #include "CamAppUiBase.h"
       
    19 #include "CamVideoPreCaptureContainer.h"
       
    20 #include "CamLogger.h"
       
    21 #include "CamPanic.h"
       
    22 #include "CamUtility.h"
       
    23 #include "CamAppUi.h"
       
    24 #include "CamSidePane.h"
       
    25 #include "CamNaviProgressBarControl.h"
       
    26 #include "CamViewBase.h"
       
    27 #include "CamIndicator.h"
       
    28 #include "CamIndicatorData.h"
       
    29 #include "CamIndicatorResourceReader.h"
       
    30 #include "CameraUiConfigManager.h"
       
    31 #include "camactivepalettehandler.h"
       
    32 #include <eikenv.h>
       
    33 #include <cameraapp.mbg>
       
    34 #include <eikappui.h>	// For CCoeAppUiBase
       
    35 #include <eikapp.h>		// For CEikApplication
       
    36 #include <AknIconUtils.h>
       
    37 #include <akntoolbar.h>
       
    38 #include <barsread.h>
       
    39 #include <cameraapp.rsg>
       
    40 #include <vgacamsettings.rsg>
       
    41 #include <aknlayoutscalable_apps.cdl.h>
       
    42 #include <layoutmetadata.cdl.h>
       
    43 #include "OstTraceDefinitions.h"
       
    44 #ifdef OST_TRACE_COMPILER_IN_USE
       
    45 #include "CamVideoPreCaptureContainerTraces.h"
       
    46 #endif
       
    47 
       
    48 
       
    49 // ================= MEMBER FUNCTIONS =======================
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CCamVideoPreCaptureContainer::NewL
       
    53 // Symbian OS two-phased constructor
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 CCamVideoPreCaptureContainer* CCamVideoPreCaptureContainer::NewL(
       
    57         CCamAppController& aController,
       
    58         CAknView& aView,
       
    59         const TRect& aRect )
       
    60     {
       
    61     CCamVideoPreCaptureContainer* self = new( ELeave ) CCamVideoPreCaptureContainer(
       
    62         aController, aView ); 
       
    63     
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL( aRect );
       
    66     CleanupStack::Pop( self ); 
       
    67     // Return newly created CCamVideoPreCaptureContainer instance
       
    68     return self;
       
    69     }
       
    70 
       
    71 // Destructor
       
    72 CCamVideoPreCaptureContainer::~CCamVideoPreCaptureContainer()
       
    73   {
       
    74   PRINT( _L("Camera => ~CCamVideoPreCaptureContainer") );
       
    75   delete iFileTypeIndicator;
       
    76   PRINT( _L("Camera <= ~CCamVideoPreCaptureContainer") );
       
    77   }
       
    78 
       
    79 // ---------------------------------------------------------
       
    80 // CCamVideoPreCaptureContainer::ConstructL
       
    81 // Symbian OS 2nd phase constructor
       
    82 // ---------------------------------------------------------
       
    83 //
       
    84 void CCamVideoPreCaptureContainer::ConstructL( const TRect& aRect )
       
    85     {
       
    86     PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL"))
       
    87 	PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL C"))
       
    88 	TCamVideoResolution res = iController.GetCurrentVideoResolution();
       
    89 	PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL D"))
       
    90 	iVFRes = iController.VideoViewFinderResourceId( res );
       
    91 	PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL E"))
       
    92 
       
    93     BaseConstructL( aRect );
       
    94     iShowReticule = EFalse;
       
    95 
       
    96     iSidePane->SetCaptureMode( ECamControllerVideo );
       
    97 
       
    98     CreateFiletypeIndicatorL();
       
    99 
       
   100     iRecordState = ECamNotRecording;
       
   101     
       
   102     // Get the co-ordinates where the resolution
       
   103     // icon should move to during video capture
       
   104     TAknLayoutRect layoutRect;
       
   105     TRect rect;
       
   106     TAknLayoutRect vidProgressPane;
       
   107     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   108         {
       
   109         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
       
   110         }
       
   111     else
       
   112         {
       
   113         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
       
   114         }
       
   115     if ( CamUtility::IsNhdDevice() )
       
   116         {
       
   117         TInt variant = Layout_Meta_Data::IsLandscapeOrientation();
       
   118         vidProgressPane.LayoutRect( rect,
       
   119             AknLayoutScalable_Apps::vid4_progress_pane( variant ) );  
       
   120         layoutRect.LayoutRect( vidProgressPane.Rect(),
       
   121             AknLayoutScalable_Apps::vid4_progress_pane_g1() );
       
   122         }
       
   123     else
       
   124         {
       
   125         TInt cba =  AknLayoutUtils::CbaLocation() == 
       
   126                     AknLayoutUtils::EAknCbaLocationLeft;
       
   127         vidProgressPane.LayoutRect( rect, 
       
   128             AknLayoutScalable_Apps::vid6_indi_pane( cba ) ); 
       
   129         layoutRect.LayoutRect( vidProgressPane.Rect(),
       
   130             AknLayoutScalable_Apps::vid6_indi_pane_g1( !cba ) );// quality
       
   131         }
       
   132 
       
   133     iResolutionIndicatorVidcapPosition = layoutRect.Rect();
       
   134     if ( !iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() )
       
   135         {
       
   136         static_cast<CCamPreCaptureContainerBase*>( this )
       
   137             ->SetupActivePaletteL( static_cast<CCamViewBase*>(&iView) );
       
   138         }
       
   139     }
       
   140 
       
   141 // ---------------------------------------------------------------------------
       
   142 // CCamVideoPreCaptureContainer::CCamVideoPreCaptureContainer
       
   143 // C++ constructor
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 
       
   147 CCamVideoPreCaptureContainer::CCamVideoPreCaptureContainer(
       
   148         CCamAppController& aController, 
       
   149         CAknView& aView )
       
   150 : CCamPreCaptureContainerBase( aController, aView )        
       
   151     {
       
   152     }
       
   153 
       
   154 // ---------------------------------------------------------
       
   155 // CCamVideoPreCaptureContainer::HandleControllerEventL
       
   156 // Receives notifications about changes in recording state from the controller
       
   157 // ---------------------------------------------------------
       
   158 //
       
   159 void 
       
   160 CCamVideoPreCaptureContainer
       
   161 ::HandleControllerEventL( TCamControllerEvent aEvent, TInt aError )
       
   162     {
       
   163     PRINT1( _L("Camera => CCamVideoPreCaptureContainer::HandleControllerEventL aEvent:%d"), aEvent )	
       
   164     switch( aEvent )
       
   165       {
       
   166       // ---------------------------------------------------
       
   167       case ECamEventOperationStateChanged:
       
   168         {
       
   169         TCamCaptureOperation operation = iController.CurrentOperation();
       
   170         switch( operation )
       
   171           {
       
   172           case ECamCapturing:
       
   173             {
       
   174             iRecordState = ECamRecording;
       
   175             iFileTypeIndicator->SetRect(iFileTypeIndicatorVidcapPosition);
       
   176             iResolutionIndicators[iCurrentIndicator]->SetRect(iResolutionIndicatorVidcapPosition);
       
   177             break;
       
   178             }
       
   179           case ECamPaused:
       
   180             {
       
   181             iRecordState = ECamRecordPaused;
       
   182             break;
       
   183             }
       
   184           default:
       
   185             {
       
   186             iRecordState = ECamNotRecording;
       
   187             break;
       
   188             }
       
   189           }
       
   190         break;
       
   191         }
       
   192       // ---------------------------------------------------
       
   193       case ECamEventLocationSettingChanged:
       
   194       {
       
   195       // If the location setting was changed on, then the indicator should be visible
       
   196       SetLocationIndicatorVisibility();
       
   197       }
       
   198       // ---------------------------------------------------
       
   199       case ECamEventCameraChanged:
       
   200         {
       
   201         SetFileTypeIndicator();             
       
   202         break;
       
   203         }
       
   204       // ---------------------------------------------------
       
   205       case ECamEventVideoFileTypeChanged:
       
   206         {
       
   207         SetResolutionIndicator();
       
   208         SetFileTypeIndicator();
       
   209         break;
       
   210         }
       
   211       // ---------------------------------------------------
       
   212       case ECamEventImageQualityChanged:
       
   213 	    {
       
   214 	    // To get correct viewfinder resolution:
       
   215 		TCamVideoResolution res = iController.GetCurrentVideoResolution();
       
   216 		iVFRes = iController.VideoViewFinderResourceId( res );
       
   217 		}
       
   218       // ---------------------------------------------------
       
   219       case ECamEventRecordComplete:    
       
   220         {
       
   221         iResolutionIndicators[iCurrentIndicator]->SetRect( ResolutionIndicatorRect() );
       
   222         iFileTypeIndicator->SetRect( iFileTypeIndicatorPosition );
       
   223         break;
       
   224         }
       
   225     // ---------------------------------------------------
       
   226     case ECamEventInitReady:
       
   227         {
       
   228         // event only sent if UIOrientationOverride feature is supported
       
   229         if ( !iController.IsTouchScreenSupported() && 
       
   230              iController.CurrentMode()== ECamControllerVideo )
       
   231             {
       
   232             CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   233             if ( appUi )
       
   234                 {
       
   235                 if ( !appUi->ActivePalette() )
       
   236                     {
       
   237                     OstTrace0( CAMERAAPP_PERFORMANCE, CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_SETUP 1" );
       
   238                     static_cast<CCamPreCaptureContainerBase*>( this )
       
   239                         ->SetupActivePaletteL( static_cast<CCamViewBase*>(&iView) );
       
   240                     OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_SETUP 0" );
       
   241                     }
       
   242                 else 
       
   243                     {
       
   244                     OstTrace0( CAMERAAPP_PERFORMANCE, DUP2_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_UPDATE 1" );
       
   245                     appUi->APHandler()->UpdateActivePaletteL();
       
   246                     OstTrace0( CAMERAAPP_PERFORMANCE, DUP3_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_UPDATE 0" );
       
   247                     }
       
   248                 appUi->SetActivePaletteVisibility( ETrue );
       
   249                 }
       
   250             }
       
   251         break;    
       
   252         }            
       
   253       // ---------------------------------------------------
       
   254       default:
       
   255         {
       
   256         // otherwise, do nothing
       
   257         }        
       
   258       // ---------------------------------------------------
       
   259       }
       
   260 
       
   261     CCamPreCaptureContainerBase::HandleControllerEventL( aEvent, aError );
       
   262     PRINT( _L("Camera <= CCamVideoPreCaptureContainer::HandleControllerEventL"))	
       
   263     }
       
   264 
       
   265 // ---------------------------------------------------------
       
   266 // CCamVideoPreCaptureContainer::HandleForegroundEventL
       
   267 // Handle events sending app to foreground and background
       
   268 // ---------------------------------------------------------
       
   269 
       
   270 void CCamVideoPreCaptureContainer::HandleForegroundEventL( TBool /*aForeground*/ )
       
   271 	{
       
   272 	}
       
   273 
       
   274 
       
   275 // ---------------------------------------------------------
       
   276 // CCamVideoPreCaptureContainer::ViewFinderLayoutResourceIds
       
   277 // Return the layout resource id for the viewfinder
       
   278 // (Note: reticule not required for video viewfinder)
       
   279 // ---------------------------------------------------------
       
   280 //
       
   281 void CCamVideoPreCaptureContainer::ViewFinderLayoutResourceIds(
       
   282                                                 TInt& aViewFinderLayoutId, 
       
   283                                                 TInt& /*aReticuleLayoutId*/ ) const
       
   284     {
       
   285 	aViewFinderLayoutId = iVFRes;			
       
   286     }
       
   287     
       
   288 // ---------------------------------------------------------
       
   289 // CCamVideoPreCaptureContainer::SetResolutionIndicator
       
   290 // Sets the resolution indictator to the required icon
       
   291 // ---------------------------------------------------------
       
   292 //
       
   293 void CCamVideoPreCaptureContainer::SetResolutionIndicator()
       
   294     {
       
   295     iCurrentIndicator = iController.IntegerSettingValue( ECamSettingItemVideoQuality );
       
   296     }
       
   297 
       
   298 // ---------------------------------------------------------
       
   299 // CCamStillPreCaptureContainer::SetLocationIndicatorVisibility
       
   300 // Sets the resolution indicator visibility, if it is set or not.
       
   301 // Do nothing if video taken.
       
   302 // ---------------------------------------------------------
       
   303 //
       
   304 void CCamVideoPreCaptureContainer::SetLocationIndicatorVisibility()
       
   305     {
       
   306     // The setting stored is an index of whether the location setting is on or off
       
   307     iLocationIndicatorVisible = (/*TCamLocationId::ECamLocationOn*/1 == iController.IntegerSettingValue( ECamSettingItemRecLocation ));
       
   308     }
       
   309     
       
   310 // ----------------------------------------------------
       
   311 // CCamStillPreCaptureContainer::LocationtionIndicatorRect
       
   312 // Returns the rectangle defining the position and size
       
   313 // of the location icon
       
   314 // ----------------------------------------------------
       
   315 //
       
   316 TRect CCamVideoPreCaptureContainer::LocationIndicatorRect()
       
   317     {
       
   318     TAknLayoutRect layoutRect;
       
   319     //layoutRect.LayoutRect( Rect(), ROID(R_CAM_VIDEO_PRECAP_LOCATION_ID) );
       
   320     return layoutRect.Rect();
       
   321     }
       
   322     
       
   323 // ----------------------------------------------------
       
   324 // CCamVideoPreCaptureContainer::IncreaseFlashSettingL
       
   325 // Move up through the flash settings
       
   326 // ----------------------------------------------------
       
   327 //
       
   328 void CCamVideoPreCaptureContainer::IncreaseFlashSettingL()  
       
   329     {
       
   330     if ( iController.UiConfigManagerPtr()->IsVideoLightSupported() )
       
   331         {
       
   332         CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() );
       
   333         if ( !iZoomPane->IsVisible()
       
   334              && !appUi->IsSecondCameraEnabled() 
       
   335             )
       
   336             {
       
   337             TCamFlashId flash = 
       
   338             static_cast< TCamFlashId > 
       
   339                  ( iController.IntegerSettingValue( ECamSettingItemDynamicVideoFlash ) );       
       
   340             if ( flash == ECamFlashForced )
       
   341                 {
       
   342                 flash = ECamFlashOff;
       
   343                 }
       
   344             else
       
   345                 {
       
   346                 flash = ECamFlashForced;
       
   347                 }
       
   348             iController.SetIntegerSettingValueL(ECamSettingItemDynamicVideoFlash, flash);
       
   349             }        
       
   350         } // video light supported check
       
   351     }  
       
   352  
       
   353 // ----------------------------------------------------
       
   354 // CCamVideoPreCaptureContainer::DecreaseFlashSettingL
       
   355 // Move down through the flash settings
       
   356 // ----------------------------------------------------
       
   357 //
       
   358 void CCamVideoPreCaptureContainer::DecreaseFlashSettingL()   
       
   359     {
       
   360     //Given we have two flash modes in video, Increase and Decrease are functionally equivalent
       
   361 	IncreaseFlashSettingL();
       
   362     }     
       
   363     
       
   364 // ----------------------------------------------------
       
   365 // CCamVideoPreCaptureContainer::HandleCaptureKeyEventL
       
   366 // Change the current capture state
       
   367 // ----------------------------------------------------
       
   368 //  
       
   369 TKeyResponse 
       
   370 CCamVideoPreCaptureContainer::HandleCaptureKeyEventL( const TKeyEvent& aKeyEvent )
       
   371   {
       
   372   PRINT( _L("Camera => CCamVideoPreCaptureContainer::HandleCaptureKeyEventL") );
       
   373   TKeyResponse keyResponse = EKeyWasNotConsumed;
       
   374 
       
   375   // check our current operation state
       
   376   TCamCaptureOperation operation = iController.CurrentOperation();
       
   377 
       
   378   if ( (ECamCapturing == operation ) ||
       
   379        (ECamPaused    == operation ) )
       
   380     {
       
   381     // iController.StopVideoRecording();
       
   382     // Stop the video recording using ECamCmdStop command,
       
   383     // similarily to what happens when Stop softkey is pressed.
       
   384     iView.HandleCommandL( ECamCmdStop );
       
   385     }
       
   386         
       
   387   else  if ( iController.VideoRecordPending() )
       
   388     {
       
   389     PRINT( _L("Camera <> Video capture already pending") );
       
   390     // Do nothing if already pending
       
   391     keyResponse = EKeyWasConsumed;
       
   392     }
       
   393   else
       
   394     {
       
   395     // Blank out the softkeys if we are capturing
       
   396     if ( EKeyWasConsumed == keyResponse )
       
   397       {
       
   398       BlankSoftkeysL();
       
   399       }
       
   400 
       
   401     CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   402     
       
   403     // neither recording nor paused
       
   404     // so attempt to start recording
       
   405     PRINT( _L("Camera <> starting capture") );
       
   406     keyResponse = appUi->StartCaptureL( aKeyEvent );
       
   407 
       
   408     // Hide the toolbar if we are capturing
       
   409     if( EKeyWasConsumed == keyResponse )
       
   410       {
       
   411       // Repeated key events (MSK) are ignored.
       
   412       iController.SetDemandKeyRelease( ETrue );  
       
   413 
       
   414       // fixed toolbar is used only with touch devices
       
   415       if ( iController.IsTouchScreenSupported() )
       
   416           {
       
   417           CAknToolbar* fixedToolbar = appUi->CurrentFixedToolbar();
       
   418           if ( fixedToolbar )
       
   419             {
       
   420             fixedToolbar->SetToolbarVisibility( EFalse );
       
   421             }
       
   422           }
       
   423       }
       
   424      } 
       
   425   PRINT( _L("Camera <= CCamVideoPreCaptureContainer::HandleCaptureKeyEventL") );
       
   426   return keyResponse;
       
   427   }
       
   428 
       
   429 
       
   430 // ----------------------------------------------------
       
   431 // virtual InitVfGridL
       
   432 // ----------------------------------------------------
       
   433 void 
       
   434 CCamVideoPreCaptureContainer::InitVfGridL( const TRect& /*aRect*/ )
       
   435   {
       
   436   PRINT(_L("CCamVideoPreCaptureContainer::InitVfGridL -->"));
       
   437   // Skip constructing vf grid drawer.
       
   438   // As effect the vf grid is never drawn.
       
   439   PRINT(_L("CCamVideoPreCaptureContainer::InitVfGridL <--"));
       
   440   }
       
   441 
       
   442 
       
   443 // ----------------------------------------------------
       
   444 // CCamVideoPreCaptureContainer::BlankSoftKeysL
       
   445 // Blank the softkeys
       
   446 // ----------------------------------------------------
       
   447 //
       
   448 void CCamVideoPreCaptureContainer::BlankSoftkeysL()
       
   449     {
       
   450     static_cast<CCamViewBase&>(iView).SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
       
   451     }
       
   452 
       
   453 // ----------------------------------------------------
       
   454 // CCamVideoPreCaptureContainer::HandleShutterKeyEventL
       
   455 // Change the current capture state following shutter 
       
   456 // key events
       
   457 // ----------------------------------------------------
       
   458 //  
       
   459 TKeyResponse CCamVideoPreCaptureContainer::HandleShutterKeyEventL( const TKeyEvent& /*aKeyEvent*/,
       
   460                                                                    TEventCode /*aType*/ )
       
   461     {    
       
   462     return EKeyWasNotConsumed;
       
   463     }
       
   464 
       
   465 // ---------------------------------------------------------
       
   466 // CCamVideoPreCaptureContainer::DrawAdditionalIcons
       
   467 // Draw the video file type indicator
       
   468 // ---------------------------------------------------------
       
   469 //
       
   470 void CCamVideoPreCaptureContainer::DrawAdditionalIcons(CBitmapContext& aGc) const
       
   471     {
       
   472     
       
   473     CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   474     TCamCaptureOperation videoOperation = iController.CurrentVideoOperation();
       
   475 
       
   476     // It is essential to check, that the current view state is right.
       
   477     // Draw request could still arrive to precapture view, 
       
   478     // when in fact video is stopped and transition to post capture 
       
   479     // is in progress. During that time, additional icons should
       
   480     // not be drawn.
       
   481     if( appUi
       
   482      && appUi->CurrentViewState() == ECamViewStatePreCapture
       
   483      && appUi->DrawPreCaptureCourtesyUI()
       
   484      && !appUi->IsSecondCameraEnabled() 
       
   485      && ( CamUtility::IsNhdDevice() || videoOperation == ECamNoOperation )
       
   486       )
       
   487       {
       
   488       iFileTypeIndicator->Draw( aGc );
       
   489       }
       
   490     }
       
   491     
       
   492 // ---------------------------------------------------------
       
   493 // CCamVideoPreCaptureContainer::CreateFiletypeIndicatorL
       
   494 // Create the video file type indicator
       
   495 // ---------------------------------------------------------
       
   496 //
       
   497 void CCamVideoPreCaptureContainer::CreateFiletypeIndicatorL()
       
   498     {
       
   499     // Create reader
       
   500     TResourceReader reader;
       
   501     iEikonEnv->CreateResourceReaderLC( reader, ROID(R_CAM_VIDEO_FILETYPE_PANE_ID));
       
   502     CCamIndicatorResourceReader* resourceReader = 
       
   503         CCamIndicatorResourceReader::NewLC( reader );
       
   504 
       
   505     // Get indicator data from reader (there will be just 1)
       
   506     CCamIndicatorData& indData = *( resourceReader->IndicatorData().At( 0 ) );
       
   507     iFileTypeIndicator = CCamIndicator::NewL( indData.IndicatorRect() );
       
   508     TInt numbitmaps = indData.IndicatorBitmapCount(); // no of bitmaps for indicator
       
   509     TInt j;
       
   510     for ( j = 0; j < numbitmaps; j++ )
       
   511         {
       
   512         // Side pane assumes that mask bitmap is defined after the
       
   513         // normal one in the resource file
       
   514         iFileTypeIndicator->AddIconL(
       
   515             indData.IndicatorBitmapId( j ),      // bitmap
       
   516             indData.IndicatorBitmapId( j + 1 )); // mask
       
   517         j++;
       
   518         }
       
   519 
       
   520     CleanupStack::PopAndDestroy( resourceReader );
       
   521     CleanupStack::PopAndDestroy(); // reader
       
   522 
       
   523     TAknLayoutRect layoutRect;
       
   524     TRect rect;
       
   525     TAknLayoutRect vidProgressPane;
       
   526     TAknLayoutRect fileTypeIconLayout;
       
   527     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   528         {
       
   529         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
       
   530         }
       
   531     else
       
   532         {
       
   533         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
       
   534         }
       
   535     if ( CamUtility::IsNhdDevice() )
       
   536         {
       
   537         TInt variant = Layout_Meta_Data::IsLandscapeOrientation();
       
   538         vidProgressPane.LayoutRect( rect,
       
   539             AknLayoutScalable_Apps::vid4_progress_pane( variant ) );  
       
   540         layoutRect.LayoutRect( vidProgressPane.Rect(),
       
   541             AknLayoutScalable_Apps::vid4_progress_pane_g2() );
       
   542 
       
   543         TAknLayoutRect vidIndicatorPane;
       
   544         vidIndicatorPane.LayoutRect( rect,
       
   545             AknLayoutScalable_Apps::vid4_indicators_pane( variant ) );
       
   546 
       
   547         fileTypeIconLayout.LayoutRect( vidIndicatorPane.Rect(),
       
   548                 AknLayoutScalable_Apps::vid4_indicators_pane_g2() );
       
   549         }
       
   550     else
       
   551         {
       
   552         TInt cba =  AknLayoutUtils::CbaLocation() == 
       
   553                     AknLayoutUtils::EAknCbaLocationLeft;
       
   554         vidProgressPane.LayoutRect( rect, 
       
   555             AknLayoutScalable_Apps::vid6_indi_pane( cba ) ); 
       
   556         layoutRect.LayoutRect( vidProgressPane.Rect(),
       
   557             AknLayoutScalable_Apps::vid6_indi_pane_g2( cba ) );// type 
       
   558         fileTypeIconLayout = layoutRect;
       
   559         }
       
   560 
       
   561     iFileTypeIndicatorVidcapPosition = layoutRect.Rect();
       
   562     iFileTypeIndicator->SetRect( fileTypeIconLayout.Rect() );
       
   563     iFileTypeIndicatorPosition = fileTypeIconLayout.Rect();
       
   564     // Initialise the indicator
       
   565     SetFileTypeIndicator();
       
   566     }
       
   567 
       
   568 // ----------------------------------------------------
       
   569 // CCamVideoPreCaptureContainer::SetFileTypeIndicator
       
   570 // Sets the video file type indicator depending on the current 
       
   571 // video file type setting.
       
   572 // ----------------------------------------------------
       
   573 //
       
   574 void CCamVideoPreCaptureContainer::SetFileTypeIndicator()
       
   575     {
       
   576     if ( iFileTypeIndicator )
       
   577         {
       
   578         // If the current mode is video then show the relevant icon
       
   579         // for the current video file type.
       
   580         TCamVideoFileType fileType = static_cast< TCamVideoFileType > 
       
   581             ( iController.IntegerSettingValue( ECamSettingItemVideoFileType ) );
       
   582         if ( fileType == ECamVideoMpeg4 )
       
   583             {
       
   584             iFileTypeIndicator->SetIcon( 0 );
       
   585             }
       
   586 
       
   587         // Otherwise display the H263 icon.
       
   588         else
       
   589             {
       
   590             iFileTypeIndicator->SetIcon( 2 );
       
   591             }       
       
   592         }
       
   593     }
       
   594    
       
   595 // ----------------------------------------------------
       
   596 // CCamVideoPreCaptureContainer::ResolutionIndicatorIconPsiKey
       
   597 // Returns the PSI key relating to the array of resolution
       
   598 // indicator bitmaps.
       
   599 // ----------------------------------------------------
       
   600 //
       
   601 TCamPsiKey CCamVideoPreCaptureContainer::ResolutionIndicatorIconPsiKey() const
       
   602     {
       
   603     return ECamPsiPrecapVideoQualityIconIds;
       
   604     }
       
   605 
       
   606 
       
   607 
       
   608 // ---------------------------------------------------------------------------
       
   609 // virtual GetAPResourceId 
       
   610 // (From CCamPreCaptureContainerBase)
       
   611 // 
       
   612 // Helper method to select the AP resource used to set AP items.
       
   613 // ---------------------------------------------------------------------------
       
   614 //
       
   615 TInt CCamVideoPreCaptureContainer::GetAPResourceId() const
       
   616     {    
       
   617     CCamAppUi* appUi =  static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   618     TBool embedded   = appUi->IsEmbedded();
       
   619     TInt resId = 0;
       
   620     if( embedded )
       
   621         {
       
   622         if ( !appUi->IsSecondCameraEnabled() )
       
   623             {
       
   624             resId = R_CAM_EMB_VIDEO_PRE_CAPTURE_AP_ITEMS_ADVANCED;
       
   625             }
       
   626         }
       
   627     else
       
   628         {
       
   629         if ( !appUi->IsSecondCameraEnabled() )
       
   630             {
       
   631             resId = R_CAM_VIDEO_PRE_CAPTURE_AP_ITEMS_ADVANCED;
       
   632             }
       
   633         else
       
   634             {
       
   635             resId = R_CAM_VIDEO_PRE_CAPTURE_AP_ITEMS_SECONDARY;
       
   636             }
       
   637         }
       
   638     return resId;
       
   639     }
       
   640 
       
   641 // End of File