camerauis/cameraapp/generic/src/CamVideoPreCaptureContainer.cpp
changeset 19 d9aefe59d544
parent 3 8b2d6d0384b0
child 21 fa6d9f75d6a6
child 28 3075d9b614e6
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
     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:  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             iResolutionIndicators[iCurrentIndicator]->SetRect(iResolutionIndicatorVidcapPosition);
       
   176             break;
       
   177             }
       
   178           case ECamPaused:
       
   179             {
       
   180             iRecordState = ECamRecordPaused;
       
   181             break;
       
   182             }
       
   183           default:
       
   184             {
       
   185             iRecordState = ECamNotRecording;
       
   186             break;
       
   187             }
       
   188           }
       
   189         break;
       
   190         }
       
   191       // ---------------------------------------------------
       
   192       case ECamEventLocationSettingChanged:
       
   193       {
       
   194       // If the location setting was changed on, then the indicator should be visible
       
   195       SetLocationIndicatorVisibility();
       
   196       }
       
   197       // ---------------------------------------------------
       
   198       case ECamEventCameraChanged:
       
   199         {
       
   200         SetFileTypeIndicator();             
       
   201         break;
       
   202         }
       
   203       // ---------------------------------------------------
       
   204       case ECamEventVideoFileTypeChanged:
       
   205         {
       
   206         SetResolutionIndicator();
       
   207         SetFileTypeIndicator();
       
   208         break;
       
   209         }
       
   210       // ---------------------------------------------------
       
   211 //      case ECamEventImageQualityChanged:
       
   212 //	    {
       
   213 //	    // To get correct viewfinder resolution:
       
   214 //		TCamVideoResolution res = iController.GetCurrentVideoResolution();
       
   215 //		iVFRes = iController.VideoViewFinderResourceId( res );
       
   216 //		}
       
   217       // ---------------------------------------------------
       
   218       case ECamEventRecordComplete:    
       
   219         {
       
   220         iResolutionIndicators[iCurrentIndicator]->SetRect( ResolutionIndicatorRect() );
       
   221         iFileTypeIndicator->SetRect( iFileTypeIndicatorPosition );
       
   222         break;
       
   223         }
       
   224     // ---------------------------------------------------
       
   225     case ECamEventInitReady:
       
   226         {
       
   227         // event only sent if UIOrientationOverride feature is supported
       
   228         if ( !iController.IsTouchScreenSupported() && 
       
   229              iController.CurrentMode()== ECamControllerVideo )
       
   230             {
       
   231             CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   232             if ( appUi )
       
   233                 {
       
   234                 if ( !appUi->ActivePalette() )
       
   235                     {
       
   236                     OstTrace0( CAMERAAPP_PERFORMANCE, CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_SETUP 1" );
       
   237                     static_cast<CCamPreCaptureContainerBase*>( this )
       
   238                         ->SetupActivePaletteL( static_cast<CCamViewBase*>(&iView) );
       
   239                     OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_SETUP 0" );
       
   240                     }
       
   241                 else 
       
   242                     {
       
   243                     OstTrace0( CAMERAAPP_PERFORMANCE, DUP2_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_UPDATE 1" );
       
   244                     appUi->APHandler()->UpdateActivePaletteL();
       
   245                     OstTrace0( CAMERAAPP_PERFORMANCE, DUP3_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_UPDATE 0" );
       
   246                     }
       
   247                 appUi->SetActivePaletteVisibility( ETrue );
       
   248                 }
       
   249             }
       
   250         break;    
       
   251         }            
       
   252       // ---------------------------------------------------
       
   253       default:
       
   254         {
       
   255         // otherwise, do nothing
       
   256         }        
       
   257       // ---------------------------------------------------
       
   258       }
       
   259 
       
   260     CCamPreCaptureContainerBase::HandleControllerEventL( aEvent, aError );
       
   261     PRINT( _L("Camera <= CCamVideoPreCaptureContainer::HandleControllerEventL"))	
       
   262     }
       
   263 
       
   264 // ---------------------------------------------------------
       
   265 // CCamVideoPreCaptureContainer::HandleForegroundEventL
       
   266 // Handle events sending app to foreground and background
       
   267 // ---------------------------------------------------------
       
   268 
       
   269 void CCamVideoPreCaptureContainer::HandleForegroundEventL( TBool /*aForeground*/ )
       
   270 	{
       
   271 	}
       
   272 
       
   273 
       
   274 // ---------------------------------------------------------
       
   275 // CCamVideoPreCaptureContainer::ViewFinderLayoutResourceIds
       
   276 // Return the layout resource id for the viewfinder
       
   277 // (Note: reticule not required for video viewfinder)
       
   278 // ---------------------------------------------------------
       
   279 //
       
   280 void CCamVideoPreCaptureContainer::ViewFinderLayoutResourceIds(
       
   281                                                 TInt& aViewFinderLayoutId, 
       
   282                                                 TInt& /*aReticuleLayoutId*/ ) const
       
   283     {
       
   284 	aViewFinderLayoutId = iVFRes;			
       
   285     }
       
   286     
       
   287 // ---------------------------------------------------------
       
   288 // CCamVideoPreCaptureContainer::SetResolutionIndicator
       
   289 // Sets the resolution indictator to the required icon
       
   290 // ---------------------------------------------------------
       
   291 //
       
   292 void CCamVideoPreCaptureContainer::SetResolutionIndicator()
       
   293     {
       
   294     iCurrentIndicator = iController.IntegerSettingValue( ECamSettingItemVideoQuality );
       
   295     }
       
   296 
       
   297 // ---------------------------------------------------------
       
   298 // CCamStillPreCaptureContainer::SetLocationIndicatorVisibility
       
   299 // Sets the resolution indicator visibility, if it is set or not.
       
   300 // Do nothing if video taken.
       
   301 // ---------------------------------------------------------
       
   302 //
       
   303 void CCamVideoPreCaptureContainer::SetLocationIndicatorVisibility()
       
   304     {
       
   305     // The setting stored is an index of whether the location setting is on or off
       
   306     iLocationIndicatorVisible = (/*TCamLocationId::ECamLocationOn*/1 == iController.IntegerSettingValue( ECamSettingItemRecLocation ));
       
   307     }
       
   308     
       
   309 // ----------------------------------------------------
       
   310 // CCamStillPreCaptureContainer::LocationtionIndicatorRect
       
   311 // Returns the rectangle defining the position and size
       
   312 // of the location icon
       
   313 // ----------------------------------------------------
       
   314 //
       
   315 TRect CCamVideoPreCaptureContainer::LocationIndicatorRect()
       
   316     {
       
   317     TAknLayoutRect layoutRect;
       
   318     //layoutRect.LayoutRect( Rect(), ROID(R_CAM_VIDEO_PRECAP_LOCATION_ID) );
       
   319     return layoutRect.Rect();
       
   320     }
       
   321     
       
   322 // ----------------------------------------------------
       
   323 // CCamVideoPreCaptureContainer::IncreaseFlashSettingL
       
   324 // Move up through the flash settings
       
   325 // ----------------------------------------------------
       
   326 //
       
   327 void CCamVideoPreCaptureContainer::IncreaseFlashSettingL()  
       
   328     {
       
   329     if ( iController.UiConfigManagerPtr()->IsVideoLightSupported() )
       
   330         {
       
   331         CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() );
       
   332         if ( !iZoomPane->IsVisible()
       
   333              && !appUi->IsSecondCameraEnabled() 
       
   334             )
       
   335             {
       
   336             TCamFlashId flash = 
       
   337             static_cast< TCamFlashId > 
       
   338                  ( iController.IntegerSettingValue( ECamSettingItemDynamicVideoFlash ) );       
       
   339             if ( flash == ECamFlashForced )
       
   340                 {
       
   341                 flash = ECamFlashOff;
       
   342                 }
       
   343             else
       
   344                 {
       
   345                 flash = ECamFlashForced;
       
   346                 }
       
   347             iController.SetIntegerSettingValueL(ECamSettingItemDynamicVideoFlash, flash);
       
   348             }        
       
   349         } // video light supported check
       
   350     }  
       
   351  
       
   352 // ----------------------------------------------------
       
   353 // CCamVideoPreCaptureContainer::DecreaseFlashSettingL
       
   354 // Move down through the flash settings
       
   355 // ----------------------------------------------------
       
   356 //
       
   357 void CCamVideoPreCaptureContainer::DecreaseFlashSettingL()   
       
   358     {
       
   359     //Given we have two flash modes in video, Increase and Decrease are functionally equivalent
       
   360 	IncreaseFlashSettingL();
       
   361     }     
       
   362     
       
   363 // ----------------------------------------------------
       
   364 // CCamVideoPreCaptureContainer::HandleCaptureKeyEventL
       
   365 // Change the current capture state
       
   366 // ----------------------------------------------------
       
   367 //  
       
   368 TKeyResponse 
       
   369 CCamVideoPreCaptureContainer::HandleCaptureKeyEventL( const TKeyEvent& aKeyEvent )
       
   370   {
       
   371   PRINT( _L("Camera => CCamVideoPreCaptureContainer::HandleCaptureKeyEventL") );
       
   372   TKeyResponse keyResponse = EKeyWasNotConsumed;
       
   373 
       
   374   // check our current operation state
       
   375   TCamCaptureOperation operation = iController.CurrentOperation();
       
   376 
       
   377   if ( (ECamCapturing == operation ) ||
       
   378        (ECamPaused    == operation ) )
       
   379     {
       
   380     // iController.StopVideoRecording();
       
   381     // Stop the video recording using ECamCmdStop command,
       
   382     // similarily to what happens when Stop softkey is pressed.
       
   383     iView.HandleCommandL( ECamCmdStop );
       
   384     }
       
   385         
       
   386   else  if ( iController.VideoRecordPending() )
       
   387     {
       
   388     PRINT( _L("Camera <> Video capture already pending") );
       
   389     // Do nothing if already pending
       
   390     keyResponse = EKeyWasConsumed;
       
   391     }
       
   392   else
       
   393     {
       
   394     // Blank out the softkeys if we are capturing
       
   395     if ( EKeyWasConsumed == keyResponse )
       
   396       {
       
   397       BlankSoftkeysL();
       
   398       }
       
   399 
       
   400     CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   401     
       
   402     // neither recording nor paused
       
   403     // so attempt to start recording
       
   404     PRINT( _L("Camera <> starting capture") );
       
   405     keyResponse = appUi->StartCaptureL( aKeyEvent );
       
   406 
       
   407     // Hide the toolbar if we are capturing
       
   408     if( EKeyWasConsumed == keyResponse )
       
   409       {
       
   410       // Repeated key events (MSK) are ignored.
       
   411       iController.SetDemandKeyRelease( ETrue );  
       
   412 
       
   413       // fixed toolbar is used only with touch devices
       
   414       if ( iController.IsTouchScreenSupported() )
       
   415           {
       
   416           CAknToolbar* fixedToolbar = appUi->CurrentFixedToolbar();
       
   417           if ( fixedToolbar )
       
   418             {
       
   419             fixedToolbar->SetToolbarVisibility( EFalse );
       
   420             }
       
   421           }
       
   422       }
       
   423      } 
       
   424   PRINT( _L("Camera <= CCamVideoPreCaptureContainer::HandleCaptureKeyEventL") );
       
   425   return keyResponse;
       
   426   }
       
   427 
       
   428 
       
   429 // ----------------------------------------------------
       
   430 // virtual InitVfGridL
       
   431 // ----------------------------------------------------
       
   432 void 
       
   433 CCamVideoPreCaptureContainer::InitVfGridL( const TRect& /*aRect*/ )
       
   434   {
       
   435   PRINT(_L("CCamVideoPreCaptureContainer::InitVfGridL -->"));
       
   436   // Skip constructing vf grid drawer.
       
   437   // As effect the vf grid is never drawn.
       
   438   PRINT(_L("CCamVideoPreCaptureContainer::InitVfGridL <--"));
       
   439   }
       
   440 
       
   441 
       
   442 // ----------------------------------------------------
       
   443 // CCamVideoPreCaptureContainer::BlankSoftKeysL
       
   444 // Blank the softkeys
       
   445 // ----------------------------------------------------
       
   446 //
       
   447 void CCamVideoPreCaptureContainer::BlankSoftkeysL()
       
   448     {
       
   449     static_cast<CCamViewBase&>(iView).SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
       
   450     }
       
   451 
       
   452 // ----------------------------------------------------
       
   453 // CCamVideoPreCaptureContainer::HandleShutterKeyEventL
       
   454 // Change the current capture state following shutter 
       
   455 // key events
       
   456 // ----------------------------------------------------
       
   457 //  
       
   458 TKeyResponse CCamVideoPreCaptureContainer::HandleShutterKeyEventL( const TKeyEvent& /*aKeyEvent*/,
       
   459                                                                    TEventCode /*aType*/ )
       
   460     {    
       
   461     return EKeyWasNotConsumed;
       
   462     }
       
   463 
       
   464 // ---------------------------------------------------------
       
   465 // CCamVideoPreCaptureContainer::DrawAdditionalIcons
       
   466 // Draw the video file type indicator
       
   467 // ---------------------------------------------------------
       
   468 //
       
   469 void CCamVideoPreCaptureContainer::DrawAdditionalIcons(CBitmapContext& aGc) const
       
   470     {
       
   471     
       
   472     CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   473     TCamCaptureOperation videoOperation = iController.CurrentVideoOperation();
       
   474 
       
   475     // It is essential to check, that the current view state is right.
       
   476     // Draw request could still arrive to precapture view, 
       
   477     // when in fact video is stopped and transition to post capture 
       
   478     // is in progress. During that time, additional icons should
       
   479     // not be drawn.
       
   480     if( appUi
       
   481      && appUi->CurrentViewState() == ECamViewStatePreCapture
       
   482      && appUi->DrawPreCaptureCourtesyUI()
       
   483      && !appUi->IsSecondCameraEnabled() 
       
   484      && ( CamUtility::IsNhdDevice() || videoOperation == ECamNoOperation )
       
   485       )
       
   486       {
       
   487       iFileTypeIndicator->Draw( aGc );
       
   488       }
       
   489     }
       
   490     
       
   491 // ---------------------------------------------------------
       
   492 // CCamVideoPreCaptureContainer::CreateFiletypeIndicatorL
       
   493 // Create the video file type indicator
       
   494 // ---------------------------------------------------------
       
   495 //
       
   496 void CCamVideoPreCaptureContainer::CreateFiletypeIndicatorL()
       
   497     {
       
   498     // Create reader
       
   499     TResourceReader reader;
       
   500     iEikonEnv->CreateResourceReaderLC( reader, ROID(R_CAM_VIDEO_FILETYPE_PANE_ID));
       
   501     CCamIndicatorResourceReader* resourceReader = 
       
   502         CCamIndicatorResourceReader::NewLC( reader );
       
   503 
       
   504     // Get indicator data from reader (there will be just 1)
       
   505     CCamIndicatorData& indData = *( resourceReader->IndicatorData().At( 0 ) );
       
   506     iFileTypeIndicator = CCamIndicator::NewL( indData.IndicatorRect() );
       
   507     TInt numbitmaps = indData.IndicatorBitmapCount(); // no of bitmaps for indicator
       
   508     TInt j;
       
   509     for ( j = 0; j < numbitmaps; j++ )
       
   510         {
       
   511         // Side pane assumes that mask bitmap is defined after the
       
   512         // normal one in the resource file
       
   513         iFileTypeIndicator->AddIconL(
       
   514             indData.IndicatorBitmapId( j ),      // bitmap
       
   515             indData.IndicatorBitmapId( j + 1 )); // mask
       
   516         j++;
       
   517         }
       
   518 
       
   519     CleanupStack::PopAndDestroy( resourceReader );
       
   520     CleanupStack::PopAndDestroy(); // reader
       
   521 
       
   522     TAknLayoutRect layoutRect;
       
   523     TRect rect;
       
   524     TAknLayoutRect vidProgressPane;
       
   525     TAknLayoutRect fileTypeIconLayout;
       
   526     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   527         {
       
   528         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
       
   529         }
       
   530     else
       
   531         {
       
   532         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
       
   533         }
       
   534     if ( CamUtility::IsNhdDevice() )
       
   535         {
       
   536         TInt variant = Layout_Meta_Data::IsLandscapeOrientation();
       
   537         vidProgressPane.LayoutRect( rect,
       
   538             AknLayoutScalable_Apps::vid4_progress_pane( variant ) );  
       
   539         layoutRect.LayoutRect( vidProgressPane.Rect(),
       
   540             AknLayoutScalable_Apps::vid4_progress_pane_g2() );
       
   541         }
       
   542     else
       
   543         {
       
   544         TInt cba =  AknLayoutUtils::CbaLocation() == 
       
   545                     AknLayoutUtils::EAknCbaLocationLeft;
       
   546         vidProgressPane.LayoutRect( rect, 
       
   547             AknLayoutScalable_Apps::vid6_indi_pane( cba ) ); 
       
   548         layoutRect.LayoutRect( vidProgressPane.Rect(),
       
   549             AknLayoutScalable_Apps::vid6_indi_pane_g2( cba ) );// type 
       
   550         fileTypeIconLayout = layoutRect;
       
   551         }
       
   552 
       
   553     iFileTypeIndicator->SetRect( layoutRect.Rect() );
       
   554     iFileTypeIndicatorPosition = layoutRect.Rect();
       
   555     // Initialise the indicator
       
   556     SetFileTypeIndicator();
       
   557     }
       
   558 
       
   559 // ----------------------------------------------------
       
   560 // CCamVideoPreCaptureContainer::SetFileTypeIndicator
       
   561 // Sets the video file type indicator depending on the current 
       
   562 // video file type setting.
       
   563 // ----------------------------------------------------
       
   564 //
       
   565 void CCamVideoPreCaptureContainer::SetFileTypeIndicator()
       
   566     {
       
   567     if ( iFileTypeIndicator )
       
   568         {
       
   569         // If the current mode is video then show the relevant icon
       
   570         // for the current video file type.
       
   571         TCamVideoFileType fileType = static_cast< TCamVideoFileType > 
       
   572             ( iController.IntegerSettingValue( ECamSettingItemVideoFileType ) );
       
   573         if ( fileType == ECamVideoMpeg4 )
       
   574             {
       
   575             iFileTypeIndicator->SetIcon( 0 );
       
   576             }
       
   577 
       
   578         // Otherwise display the H263 icon.
       
   579         else
       
   580             {
       
   581             iFileTypeIndicator->SetIcon( 2 );
       
   582             }       
       
   583         }
       
   584     }
       
   585    
       
   586 // ----------------------------------------------------
       
   587 // CCamVideoPreCaptureContainer::ResolutionIndicatorIconPsiKey
       
   588 // Returns the PSI key relating to the array of resolution
       
   589 // indicator bitmaps.
       
   590 // ----------------------------------------------------
       
   591 //
       
   592 TCamPsiKey CCamVideoPreCaptureContainer::ResolutionIndicatorIconPsiKey() const
       
   593     {
       
   594     return ECamPsiPrecapVideoQualityIconIds;
       
   595     }
       
   596 
       
   597 
       
   598 
       
   599 // ---------------------------------------------------------------------------
       
   600 // virtual GetAPResourceId 
       
   601 // (From CCamPreCaptureContainerBase)
       
   602 // 
       
   603 // Helper method to select the AP resource used to set AP items.
       
   604 // ---------------------------------------------------------------------------
       
   605 //
       
   606 TInt CCamVideoPreCaptureContainer::GetAPResourceId() const
       
   607     {    
       
   608     CCamAppUi* appUi =  static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   609     TBool embedded   = appUi->IsEmbedded();
       
   610     TInt resId = 0;
       
   611     if( embedded )
       
   612         {
       
   613         if ( !appUi->IsSecondCameraEnabled() )
       
   614             {
       
   615             resId = R_CAM_EMB_VIDEO_PRE_CAPTURE_AP_ITEMS_ADVANCED;
       
   616             }
       
   617         }
       
   618     else
       
   619         {
       
   620         if ( !appUi->IsSecondCameraEnabled() )
       
   621             {
       
   622             resId = R_CAM_VIDEO_PRE_CAPTURE_AP_ITEMS_ADVANCED;
       
   623             }
       
   624         else
       
   625             {
       
   626             resId = R_CAM_VIDEO_PRE_CAPTURE_AP_ITEMS_SECONDARY;
       
   627             }
       
   628         }
       
   629     return resId;
       
   630     }
       
   631 
       
   632 // End of File