camerauis/cameraapp/generic/src/CamVideoPreCaptureView.cpp
changeset 0 1ddebce53859
child 7 dbec5787fa68
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Video pre-capture view class for Camera application*
       
    15 */
       
    16 
       
    17 
       
    18 // INCLUDE FILES
       
    19 
       
    20  
       
    21 #include "CamUtility.h"
       
    22 #include "CamAppUiBase.h"
       
    23 #include "CamAppController.h"
       
    24 #include "CamVideoPreCaptureView.h"
       
    25 #include "CamLogger.h"
       
    26 #include "CamContainerBase.h"
       
    27 #include "CamAppUi.h"
       
    28 #include <eikmenub.h>
       
    29 #include <eikapp.h>
       
    30 #include <avkon.rsg>
       
    31 #include <CaeEngine.h>
       
    32 #include <akntoolbar.h>
       
    33 #include <akntoolbarextension.h>
       
    34 #include <gulicon.h>
       
    35 #include <AknIconUtils.h>
       
    36 #include <aknbutton.h>
       
    37 #include <StringLoader.h>
       
    38 #include <AknsUtils.h>
       
    39 #include <AknsConstants.h>
       
    40 #include <cameraapp.mbg>
       
    41 #include "CamCaptureSetupMenu.h"
       
    42 #include "CamPanic.h"
       
    43 
       
    44 #include "CamShootingModeContainer.h"
       
    45 #include "CamVideoPreCaptureContainer.h"
       
    46 #include "Cam.hrh"
       
    47 #include "CamAppUid.h"
       
    48 #include <csxhelp/lcam.hlp.hrh>
       
    49 #include <cameraapp.rsg>
       
    50 #include <vgacamsettings.rsg>
       
    51 #include "CamUtility.h"
       
    52 #include "camactivepalettehandler.h"
       
    53 #include "CameraUiConfigManager.h"
       
    54 #include "CamLocalViewIds.h"
       
    55 #include "OstTraceDefinitions.h"
       
    56 #ifdef OST_TRACE_COMPILER_IN_USE
       
    57 #include "CamVideoPreCaptureViewTraces.h"
       
    58 #endif
       
    59 
       
    60 
       
    61 
       
    62 
       
    63 // ========================= MEMBER FUNCTIONS ================================
       
    64 // ---------------------------------------------------------------------------
       
    65 // CCamVideoPreCaptureView::NewLC
       
    66 // Symbian OS two-phased constructor
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CCamVideoPreCaptureView* CCamVideoPreCaptureView::NewLC( CCamAppController& aController )
       
    70     {
       
    71     CCamVideoPreCaptureView* self = 
       
    72         new( ELeave ) CCamVideoPreCaptureView( aController );
       
    73 
       
    74     CleanupStack::PushL( self );
       
    75     self->ConstructL();
       
    76     return self;
       
    77     }
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CCamVideoPreCaptureView destructor
       
    81 // 
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 CCamVideoPreCaptureView::~CCamVideoPreCaptureView()
       
    85     {
       
    86     }
       
    87     
       
    88 // ---------------------------------------------------------------------------
       
    89 // CCamVideoPreCaptureView::Id
       
    90 // Returns UID of view
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 TUid CCamVideoPreCaptureView::Id() const
       
    94     {
       
    95   	return TUid::Uid( ECamViewIdVideoPreCapture );
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CCamVideoPreCaptureView::DoDeactivate
       
   100 // Deactivate this view
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 void CCamVideoPreCaptureView::DoDeactivate()
       
   104     {
       
   105     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMVIDEOPRECAPTUREVIEW_DODEACTIVATE, "e_CCamVideoPreCaptureView_DoDeactivate 1" );
       
   106     PERF_EVENT_START_L2( EPerfEventVideoPreCaptureViewDeactivation ); 
       
   107     CCamPreCaptureViewBase::DoDeactivate();
       
   108     PERF_EVENT_END_L2( EPerfEventVideoPreCaptureViewDeactivation ); 
       
   109     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMVIDEOPRECAPTUREVIEW_DODEACTIVATE, "e_CCamVideoPreCaptureView_DoDeactivate 0" );
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CCamVideoPreCaptureView::HandleCommandL
       
   114 // Handle commands
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void 
       
   118 CCamVideoPreCaptureView::HandleCommandL( TInt aCommand )
       
   119   {
       
   120   PRINT( _L("Camera => CCamVideoPreCaptureView::HandleCommandL") );
       
   121   // check our current operation state
       
   122   TCamCaptureOperation operation = iController.CurrentVideoOperation();
       
   123   CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); 
       
   124   TCamOrientation orientation = appUi->CamOrientation();
       
   125   switch ( aCommand )
       
   126     {
       
   127     case ECamMSKCmdSelect:
       
   128     case ECamMSKCmdAppRecord:
       
   129     	{
       
   130         if( orientation == ECamOrientationCamcorder || 
       
   131             orientation == ECamOrientationCamcorderLeft ||
       
   132 			orientation == ECamOrientationPortrait )
       
   133         	{ 
       
   134    		    if ( !StartMskCaptureL() )
       
   135        		    {
       
   136             	  // If in the Landscape mode, MSK event is mapped 
       
   137             	  // like a normal selection key so that AP items
       
   138             	  // are selected and respective setting pages are launched
       
   139             	TKeyEvent aKeyEvent;
       
   140         		aKeyEvent.iCode =  aKeyEvent.iRepeats = aKeyEvent.iModifiers = 0;
       
   141         		aKeyEvent.iScanCode = EStdKeyDevice3;
       
   142             	static_cast<CCamVideoPreCaptureContainer*>
       
   143             			( Container() )->OfferKeyEventL( aKeyEvent, EEventKey );	
       
   144        		    }
       
   145         	}
       
   146         else if ( aCommand == ECamMSKCmdAppRecord )
       
   147              // if the Camera in the Portrait mode
       
   148              // MSK event is handled like a capture key
       
   149             {
       
   150             if ( iController.IsViewFinding() && appUi->CheckMemoryL() )
       
   151                 {
       
   152                 iController.StartVideoRecordingL();
       
   153                 // fixed toolbar is used only with touch devices
       
   154                 if ( iController.IsTouchScreenSupported() )
       
   155                     {
       
   156                     CAknToolbar* fixedToolbar = Toolbar();
       
   157                     if ( fixedToolbar )
       
   158                         {
       
   159                         fixedToolbar->SetToolbarVisibility( EFalse );
       
   160                         }
       
   161                     }
       
   162                 }
       
   163             }	
       
   164         break;
       
   165     	}
       
   166     case ECamCmdRecord:
       
   167         {
       
   168         	TInt callType( EPSCTsyCallTypeUninitialized );
       
   169             RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType );
       
   170             if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
       
   171             {
       
   172             SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
       
   173             appUi->SetLensCoverExit( EFalse );
       
   174             iController.StartVideoRecordingL();
       
   175             // fixed toolbar is used only with touch devices
       
   176             if ( iController.IsTouchScreenSupported() )
       
   177                 {
       
   178                 CAknToolbar* fixedToolbar = Toolbar();
       
   179                 if ( fixedToolbar )
       
   180                     {
       
   181                     fixedToolbar->SetToolbarVisibility( EFalse );
       
   182                     }
       
   183                 }
       
   184             }
       
   185         break;
       
   186         }
       
   187         
       
   188     case EAknSoftkeySelect:
       
   189       {
       
   190       switch( operation )
       
   191         {
       
   192         // -------------------------
       
   193         case ECamNoOperation:
       
   194           {
       
   195           if ( !iController.VideoRecordPending() )
       
   196             {                    
       
   197             CCamPreCaptureViewBase::HandleCommandL( aCommand );
       
   198             }
       
   199           break;
       
   200           }
       
   201         // -------------------------
       
   202         // ...Otherwise, if we are in video recording or paused mode
       
   203         // ...then stop the recording.
       
   204         case ECamCapturing:
       
   205         case ECamPaused:
       
   206           {
       
   207           iController.StopVideoRecording();
       
   208           break;
       
   209           }
       
   210         // -------------------------
       
   211         default:
       
   212           break;
       
   213         // -------------------------
       
   214         }
       
   215       break;
       
   216       }
       
   217     // ---------------------------------------------------
       
   218     case ECamCmdPause:
       
   219       {
       
   220       iController.PauseVideoRecording();
       
   221       break;
       
   222       }
       
   223     // ---------------------------------------------------
       
   224     case ECamCmdContinue:
       
   225       {
       
   226       iController.ContinueVideoRecording();
       
   227       break;
       
   228       }
       
   229     // ---------------------------------------------------
       
   230     case ECamCmdShootSetup:
       
   231       {
       
   232       // If currently recording or paused recording then don't
       
   233       // popup the capture setup menu.
       
   234       if ( ECamPaused     == operation 
       
   235         || ECamCapturing == operation )
       
   236         {
       
   237         return;
       
   238         }
       
   239       // Otherwise popup the capture setup menu
       
   240       else
       
   241         {
       
   242         CCamPreCaptureViewBase::HandleCommandL( aCommand );
       
   243         }
       
   244       break;
       
   245       }
       
   246     // ---------------------------------------------------
       
   247     case ECamCmdGoToStandby:
       
   248       {
       
   249       PRINT( _L("Camera <> CCamVideoPreCaptureView::HandleCommandL: case ECamCmdGoToStandby") );
       
   250 
       
   251       //PRINT1( _L("Camera => CCamVideoPreCaptureView::HandleCommandL standby error (%d)"), iStandbyError)
       
   252       //SwitchToStandbyModeL( ECamViewIdVideoPreCapture, iStandbyError );
       
   253       SwitchToStandbyModeL( ECamViewIdVideoPreCapture, appUi->StandbyStatus() );
       
   254       break;
       
   255       }
       
   256     // ---------------------------------------------------
       
   257     case ECamCmdExitStandby:
       
   258       {
       
   259       PRINT( _L("Camera <> CCamVideoPreCaptureView::HandleCommandL: case ECamCmdExitStandby") );
       
   260       ExitStandbyModeL();
       
   261       break;
       
   262       }
       
   263     // ---------------------------------------------------
       
   264     case ECamCmdMute:
       
   265       {
       
   266       MuteEmbeddedAudioL( ETrue );
       
   267       break;
       
   268       }
       
   269     // ---------------------------------------------------
       
   270     case ECamCmdUnmute:
       
   271       {
       
   272       MuteEmbeddedAudioL( EFalse );
       
   273       break;
       
   274       }
       
   275     // ---------------------------------------------------
       
   276     case ECamCmdStop:
       
   277       {
       
   278       CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() );
       
   279       appUi->EndCapture();
       
   280       break;
       
   281       }
       
   282     // ---------------------------------------------------
       
   283     case ECamCmdToggleVideoFlash:
       
   284       {
       
   285       if ( iController.UiConfigManagerPtr()->IsVideoLightSupported() )
       
   286           {
       
   287           TCamFlashId flash = static_cast< TCamFlashId > 
       
   288                         ( iController.IntegerSettingValue( ECamSettingItemDynamicVideoFlash ) );       
       
   289           if( flash == ECamFlashForced )
       
   290             {
       
   291             flash = ECamFlashOff;
       
   292             }
       
   293           else
       
   294             {
       
   295             flash = ECamFlashForced;
       
   296             }
       
   297           iController.SetIntegerSettingValueL(ECamSettingItemDynamicVideoFlash, flash);             
       
   298 
       
   299           CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() );
       
   300           if ( appUi && 
       
   301                appUi->APHandler() &&
       
   302                ( appUi->CamOrientation() == ECamOrientationCamcorder || appUi->CamOrientation() == ECamOrientationCamcorderLeft ) )
       
   303             {
       
   304             appUi->APHandler()->UpdateActivePaletteL();
       
   305             }          
       
   306           }
       
   307       UpdateToolbarIconsL();
       
   308       break;
       
   309       }
       
   310     // ---------------------------------------------------
       
   311     default:
       
   312       {
       
   313       CCamPreCaptureViewBase::HandleCommandL( aCommand );
       
   314       break;
       
   315       }
       
   316     // ---------------------------------------------------
       
   317     }
       
   318 
       
   319   PRINT( _L("Camera <= CCamVideoPreCaptureView::HandleCommandL") );
       
   320   }
       
   321 
       
   322 // -----------------------------------------------------------------------------
       
   323 // CCamVideoPreCaptureView::HandleForegroundEventL
       
   324 // Handle foreground event
       
   325 // -----------------------------------------------------------------------------
       
   326 //
       
   327 void 
       
   328 CCamVideoPreCaptureView::HandleForegroundEventL( TBool aForeground )
       
   329   {
       
   330   PRINT1( _L( "Camera => CCamVideoPreCaptureView::HandleForegroundEventL %d" ), aForeground );
       
   331   
       
   332   CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() );
       
   333   
       
   334   // -------------------------------------------------------
       
   335   // reset menu and cba as appropriate
       
   336   if( aForeground )
       
   337     {
       
   338     // ignore event if received in postcapture or if uiorientationoverride
       
   339     // is supported and going to stillmode
       
   340     if ( ECamViewStatePostCapture == appUi->CurrentViewState() ||
       
   341        ( iController.UiConfigManagerPtr() && 
       
   342          iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() &&
       
   343          appUi->TargetMode() == ECamControllerImage ) ) 
       
   344       {
       
   345       return;	
       
   346       }	
       
   347       
       
   348     if ( appUi->IsInPretendExit() )
       
   349       {
       
   350       // The view can get a foreground event while the application is
       
   351       // actually in a pretend exit situation. This occurs when the view switch
       
   352       // was called before the exit event, but didn't complete until after the
       
   353       // exit event. In this case the view should not register an interest in
       
   354       // the engine as the application is really in the background and the resources
       
   355       // need to be released
       
   356       PRINT( _L( "Camera <= CCamVideoPreCaptureView::HandleForegroundEventL, in pretend exit" ) );
       
   357       return;
       
   358       }
       
   359     // if foreground event is received while in videocall, go to standby with error
       
   360     if ( iController.InVideocallOrRinging() && ECamNoOperation == iController.CurrentOperation() )
       
   361         {
       
   362         ExitAllModesL();
       
   363         appUi->SetStandbyStatus( KErrInUse );
       
   364         appUi->HandleCommandL( ECamCmdGoToStandby );
       
   365         SetTitlePaneTextL();	
       
   366         return;
       
   367         }
       
   368 
       
   369     // make sure CBA is correct
       
   370     UpdateCbaL();
       
   371 
       
   372     // check for silent profile whenever we come to foreground, we dont need it here,
       
   373     // but we keep track of this in appcontroller.
       
   374     iController.IsProfileSilent();
       
   375 
       
   376     // set embedded flag here
       
   377     iEmbedded = appUi->IsEmbedded();
       
   378     PRINT1( _L("Camera <> CCamVideoPreCaptureView::HandleForegroundEventL - iEmbedded:%d"), iEmbedded );
       
   379 
       
   380     // update menu bar as required
       
   381     SetMenuBar();
       
   382 
       
   383     // if video is currently saving, it can be in either of the states:
       
   384     // ECamVideoRecordInProgress orECamVideoRecordPaused
       
   385     // but the recording has already been stopped
       
   386     if ( iController.CurrentlySavingVideo() )
       
   387       {
       
   388       UpdateCbaL();
       
   389       // if the app was behind an eikon server window then the resources
       
   390       // were not released. 
       
   391       if ( iContinueInBackground )
       
   392         {
       
   393         iContinueInBackground = EFalse;
       
   394         PRINT( _L( "Camera <= CCamVideoPreCaptureView::HandleForegroundEvent, returned behind notification" ) );                
       
   395         return;
       
   396         }
       
   397 
       
   398       // Register that we want to use the engine
       
   399       IncrementCameraUsers();
       
   400       PRINT( _L( "Camera <= CCamVideoPreCaptureView::HandleForegroundEvent, waiting for postcapture" ) );                
       
   401       return;
       
   402       }
       
   403 
       
   404     }
       
   405   // -------------------------------------------------------
       
   406   // if going to the background, stop any current video recording
       
   407   // unless already saving or it is only an eikon server window
       
   408   else
       
   409     {
       
   410     TCamCaptureOperation operation( iController.CurrentVideoOperation() );
       
   411 
       
   412     PRINT1( _L("Camera <> CCamVideoPreCaptureView::HandleForegroundEventL - operation=%d"), operation );
       
   413     if( !iController.CurrentlySavingVideo() && 
       
   414     	( ( ECamCapturing == operation || ECamPaused    == operation ) 
       
   415     	   && appUi->AppInBackground( EFalse )
       
   416     	   || ( iController.UiConfigManagerPtr()->IsKeyLockWatcherSupported() && iController.IsKeyLockOn() ) ) )
       
   417       {
       
   418         PRINT( _L("Camera <> CCamVideoPreCaptureView::HandleForegroundEventL  stopping video") );
       
   419       // If the video stops for an active call then inform the controller
       
   420       // this info is needed so that the stop tone isn't played
       
   421       if ( appUi->ForegroundAppIsPhoneApp() )
       
   422         {
       
   423         PRINT( _L("Camera <> CCamVideoPreCaptureView::HandleForegroundEventL  SetVideoStoppedForPhoneApp") );
       
   424         iController.SetVideoStoppedForPhoneApp( ETrue );
       
   425         }
       
   426       
       
   427       // If AknCapServer has NOT got foreground, (which would possibly 
       
   428       // indicate a "charging" note) stop video recording
       
   429       iController.StopVideoRecording();
       
   430       // reset the stopped for call flag
       
   431       iController.SetVideoStoppedForPhoneApp( EFalse );
       
   432       }
       
   433     
       
   434     /*
       
   435     const TInt KWindowGroupId( iCoeEnv->WsSession().GetFocusWindowGroup() );
       
   436     TCamCaptureOperation operation( iController.CurrentVideoOperation() );
       
   437 
       
   438     if ( KWindowGroupId != iEikonServerWindowGroupId
       
   439       && KWindowGroupId != iBTServerWindowGroupId
       
   440       && ( ECamCapturing == operation
       
   441         || ECamPaused    == operation ) )
       
   442       {
       
   443       if ( !CamUtility::IdMatchesName( KWindowGroupId, KAknCapServer ) )
       
   444         {
       
   445         // If the video stops for an active call then inform the controller
       
   446         // this info is needed so that the stop tone isn't played
       
   447         if ( appUi->ForegroundAppIsPhoneApp() )
       
   448           {
       
   449           iController.SetVideoStoppedForPhoneApp( ETrue );
       
   450           }
       
   451 
       
   452         // If AknCapServer has NOT got foreground, (which would possibly 
       
   453         // indicate a "charging" note) stop video recording
       
   454         iController.StopVideoRecording();
       
   455         // reset the stopped for call flag
       
   456         iController.SetVideoStoppedForPhoneApp( EFalse );
       
   457         }
       
   458       }
       
   459       */
       
   460     }
       
   461   // -------------------------------------------------------
       
   462 
       
   463   CCamPreCaptureViewBase::HandleForegroundEventL( aForeground );
       
   464 
       
   465   PRINT( _L( "Camera <= CCamVideoPreCaptureView::HandleForegroundEventL" ) );    
       
   466   }
       
   467 
       
   468 // -----------------------------------------------------------------------------
       
   469 // CCamVideoPreCaptureView::HandleFocusLossL
       
   470 // Handle change of focus
       
   471 // -----------------------------------------------------------------------------
       
   472 //
       
   473 void CCamVideoPreCaptureView::HandleFocusLossL()
       
   474   {
       
   475   PRINT( _L( "Camera => CCamVideoPreCaptureView::HandleFocusLossL" ) );    
       
   476   // if the application was already in the background, but behind an
       
   477   // eikon server window, then handle backgrounding properly now.
       
   478   // Otherwise the backgrounding will be handled in the normal
       
   479   // HandleForeground() method.
       
   480   if ( iContinueInBackground )
       
   481     {
       
   482     const TCamCaptureOperation operation( iController.CurrentOperation() );
       
   483     if ( ECamCapturing == operation
       
   484       || ECamPaused    == operation )
       
   485       {
       
   486       iController.StopVideoRecording();
       
   487       }
       
   488     }
       
   489   CCamPreCaptureViewBase::HandleFocusLossL();
       
   490   PRINT( _L( "Camera <= CCamVideoPreCaptureView::HandleFocusLossL" ) );    
       
   491   }
       
   492 
       
   493 // -----------------------------------------------------------------------------
       
   494 // CCamVideoPreCaptureView::HandleControllerEventL
       
   495 // Handle controller events
       
   496 // -----------------------------------------------------------------------------
       
   497 //
       
   498 void CCamVideoPreCaptureView::HandleControllerEventL( TCamControllerEvent aEvent, 
       
   499                                                      TInt aError )
       
   500   {
       
   501   PRINT2( _L("Camera => CCamVideoPreCaptureView::HandleControllerEventL event (%d) error (%d)"), aEvent, aError );
       
   502   switch( aEvent )
       
   503     {
       
   504     // -----------------------------------------------------
       
   505     // If the recording state of the camera has changed (started/paused/stopped)
       
   506     // we may need to update the CBA labels
       
   507     case ECamEventOperationStateChanged:
       
   508       {
       
   509       if( iController.IsAppUiAvailable() )
       
   510           {
       
   511           const TCamCaptureOperation operation( iController.CurrentOperation() );
       
   512           if ( ECamCapturing == operation )
       
   513             {
       
   514             const TCamOrientation camOrientation = 
       
   515                 static_cast<CCamAppUiBase*>( AppUi() )->CamOrientation();
       
   516             // if in camcorder mode need to show navi-ctr
       
   517             if( ECamOrientationCamcorder     == camOrientation 
       
   518              || ECamOrientationCamcorderLeft == camOrientation 
       
   519              || ECamOrientationPortrait == camOrientation )
       
   520               {
       
   521               iContainer->SetupNaviPanesL( CCamContainerBase::ECamPaneProgress );
       
   522               }
       
   523             else
       
   524               {
       
   525               static_cast<CCamAppUiBase*>( AppUi() )->PushNaviPaneProgressBarL(); 
       
   526               }
       
   527             }
       
   528           else if ( ECamCompleting == operation )
       
   529               {        
       
   530               iContainer->SetupNaviPanesL( CCamContainerBase::ECamPaneCounter );
       
   531               }
       
   532         else
       
   533           {
       
   534           // empty else statement to remove LINT error
       
   535           }
       
   536         UpdateCbaL();
       
   537         }
       
   538       break;
       
   539       }
       
   540     // -----------------------------------------------------
       
   541     case ECamEventRecordComplete:
       
   542       {
       
   543       static_cast<CCamAppUiBase*>( AppUi() )->PushNaviPaneCounterL();
       
   544       // if the recording failed due to a problem with the MMC
       
   545       if ( KErrNone != aError
       
   546               && iController.IntegerSettingValue( ECamSettingItemVideoMediaStorage ) 
       
   547               == ECamMediaStorageCard 
       
   548               && CamUtility::MemoryCardStatus() != ECamMemoryCardInserted )
       
   549           {
       
   550           StopViewFinder();
       
   551           StartViewFinder();
       
   552           }
       
   553       if ( static_cast<CCamAppUi*>( AppUi() )->ShowPostCaptureView() == EFalse 
       
   554               && !iController.IsCaptureStoppedForUsb() )
       
   555           {
       
   556           // fixed toolbar is used only with touch devices
       
   557           if ( iController.IsTouchScreenSupported() )
       
   558               {
       
   559               CAknToolbar* toolbar = Toolbar();
       
   560               if ( toolbar )
       
   561                   {
       
   562                   toolbar->SetToolbarVisibility( ETrue );
       
   563                   }
       
   564               }
       
   565           }
       
   566 
       
   567       if ( iController.IsCaptureStoppedForUsb() )
       
   568           {
       
   569           iContainer->SetupNaviPanesL( CCamContainerBase::ECamPaneCounter );
       
   570           }
       
   571 
       
   572       if ( EFalse == static_cast<CCamAppUi*>( AppUi() )->ShowPostCaptureView() )          
       
   573           {
       
   574           // Vf was stopped when stopping video recording, need to restart here
       
   575           // if postcapture is off.
       
   576           StartViewFinder();  
       
   577           } 
       
   578       break;
       
   579       }
       
   580     // -----------------------------------------------------
       
   581     case ECamEventEngineStateChanged:
       
   582       {
       
   583       CCamPreCaptureViewBase::HandleControllerEventL( aEvent, aError );
       
   584       break;
       
   585       }
       
   586     // -----------------------------------------------------
       
   587     case ECamEventSliderOpen:
       
   588         {
       
   589         iController.StartViewFinder();
       
   590         break;
       
   591         }
       
   592     default:
       
   593       {
       
   594       // Other events ignored
       
   595       break;
       
   596       }
       
   597     // -----------------------------------------------------
       
   598     }  
       
   599   PRINT ( _L("Camera <= CCamVideoPreCaptureView::HandleControllerEventL") );
       
   600   }
       
   601 
       
   602 
       
   603 // ---------------------------------------------------------------------------
       
   604 // CCamVideoPreCaptureView::CCamVideoPreCaptureView
       
   605 // C++ constructor
       
   606 // ---------------------------------------------------------------------------
       
   607 //
       
   608 CCamVideoPreCaptureView::CCamVideoPreCaptureView( CCamAppController& aController )
       
   609     : CCamPreCaptureViewBase( aController )
       
   610     {
       
   611     }
       
   612 
       
   613 // ---------------------------------------------------------------------------
       
   614 // CCamVideoPreCaptureView::ConstructL
       
   615 // Symbian OS 2nd phase constructor
       
   616 // ---------------------------------------------------------------------------
       
   617 //
       
   618 void CCamVideoPreCaptureView::ConstructL()
       
   619     {
       
   620     BaseConstructL( ROID(R_CAM_VIDEO_PRE_CAPTURE_VIEW_ID));
       
   621     if(iController.UiConfigManagerPtr()->IsXenonFlashSupported())
       
   622         {
       
   623         CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR);
       
   624         UpdateToolbarIconsL();
       
   625         }
       
   626     else
       
   627         {
       
   628         CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR_VIDEOLIGHT);
       
   629         }
       
   630     CCamPreCaptureViewBase::ConstructL();
       
   631     }
       
   632 
       
   633 // ---------------------------------------------------------------------------
       
   634 // CCamVideoPreCaptureView::UpdateCbaL
       
   635 // Update softkeys to reflect current state
       
   636 // ---------------------------------------------------------------------------
       
   637 //
       
   638 void CCamVideoPreCaptureView::UpdateCbaL()
       
   639   {
       
   640   PRINT( _L("Camera => CCamVideoPreCaptureView::UpdateCbaL") );
       
   641 
       
   642   CCamAppUi* appui = static_cast<CCamAppUi*>( AppUi() );
       
   643  
       
   644   // if videocall is active, set the softkeys already here 
       
   645   if ( iController.InVideocallOrRinging() )
       
   646       {
       
   647       SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT );	
       
   648       }	
       
   649   // if the view is in capture setup menu mode
       
   650   if (  iCaptureSetupMenuModeActive 
       
   651     && !iCaptureSetupModeActive 
       
   652     && !iSceneSettingModeActive )
       
   653     {
       
   654     SetSoftKeysL( R_AVKON_SOFTKEYS_SELECT_BACK );
       
   655     }
       
   656   // if the view is in capture setup mode
       
   657   else if ( iCaptureSetupModeActive )
       
   658     {
       
   659     SetSoftKeysL( R_AVKON_SOFTKEYS_OK_CANCEL__OK );
       
   660     }
       
   661   // if the view is in scene settings mode
       
   662   else if ( iSceneSettingModeActive )
       
   663     {
       
   664     // R_AVKON_SOFTKEYS_OPTIONS_BACK
       
   665     SetSoftKeysL( R_CAM_SOFTKEYS_SETTINGS_SELECT_BACK__CHANGE ); //R_CAM_SOFTKEYS_OPTIONS_BACK__CHANGE );
       
   666     }
       
   667   else if ( iStandbyModeActive )
       
   668     {
       
   669     if( KErrNone == appui->StandbyStatus() )
       
   670       SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__CONTINUE );
       
   671     else
       
   672       SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT );
       
   673     }
       
   674         
       
   675   else // otherwise, show the default softkeys
       
   676     {
       
   677     switch ( iController.CurrentVideoOperation() )
       
   678       {
       
   679       // -------------------------------
       
   680       case ECamCapturing:
       
   681         {
       
   682         if(appui->IsSecondCameraEnabled() && !appui->IsQwerty2ndCamera())
       
   683             {
       
   684             SetSoftKeysL( R_CAM_SOFTKEYS_PAUSE_STOP_SECONDARY );
       
   685             }
       
   686         else
       
   687             {
       
   688             SetSoftKeysL( R_CAM_SOFTKEYS_PAUSE_STOP );
       
   689             }
       
   690         break;
       
   691         }
       
   692       // -------------------------------
       
   693       case ECamPaused:
       
   694         {
       
   695         if(appui->IsSecondCameraEnabled() && !appui->IsQwerty2ndCamera())
       
   696             {
       
   697             SetSoftKeysL( R_CAM_SOFTKEYS_CONTINUE_STOP_SECONDARY );
       
   698             }
       
   699         else
       
   700             {
       
   701             SetSoftKeysL( R_CAM_SOFTKEYS_CONTINUE_STOP );
       
   702             }
       
   703         break;
       
   704         }
       
   705       // -------------------------------
       
   706       case ECamNoOperation:
       
   707         {
       
   708         if ( iController.CaptureModeTransitionInProgress() )
       
   709           {
       
   710           if(iEmbedded )
       
   711               {
       
   712               if(appui->IsSecondCameraEnabled() && !appui->IsQwerty2ndCamera())
       
   713                   {
       
   714                   SetSoftKeysL(R_CAM_SOFTKEYS_BACK_SECONDARY);
       
   715                   }
       
   716               else
       
   717                   {
       
   718                   SetSoftKeysL(R_CAM_SOFTKEYS_BACK);
       
   719                   }
       
   720               }
       
   721           else
       
   722               {
       
   723               if(appui->IsSecondCameraEnabled() && !appui->IsQwerty2ndCamera())
       
   724                   {
       
   725                   SetSoftKeysL(R_CAM_SOFTKEYS_BLANK_EXIT_SECONDARY);
       
   726                   }
       
   727               else
       
   728                   {
       
   729                   SetSoftKeysL(R_CAM_SOFTKEYS_BLANK_EXIT);
       
   730                   }
       
   731               }
       
   732           }
       
   733         else
       
   734           {
       
   735           if ( appui->TargetViewState() != ECamViewStatePostCapture )
       
   736             {
       
   737             if ( iEmbedded )
       
   738                 {
       
   739                 if(appui->IsSecondCameraEnabled() && !appui->IsQwerty2ndCamera())
       
   740                     {
       
   741                     SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_BACK__RECORD_SECONDARY );
       
   742                     }
       
   743                 else
       
   744                     {
       
   745                     SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_BACK__RECORD );
       
   746                     }
       
   747                 
       
   748                 }
       
   749             else 
       
   750                 {
       
   751                 if ( !appui->IsToolBarVisible()
       
   752                     && appui->IsSecondCameraEnabled() 
       
   753                     && !appui->IsQwerty2ndCamera())
       
   754                     {
       
   755                     SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__RECORD_TXT );
       
   756                     }
       
   757                 else if ( appui->DrawPreCaptureCourtesyUI() )
       
   758                     {
       
   759                     if(appui->IsSecondCameraEnabled() && !appui->IsQwerty2ndCamera())
       
   760                         {
       
   761                         SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__RECORD_SECONDARY );
       
   762                         }
       
   763                     else
       
   764                         {
       
   765                         SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__RECORD );
       
   766                         }
       
   767                     }
       
   768                 else
       
   769                     {
       
   770                     SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
       
   771                     }
       
   772                 }            
       
   773             }
       
   774           }
       
   775         break;
       
   776         }
       
   777       // -------------------------------
       
   778       case ECamCompleting:
       
   779         {
       
   780         if ( iController.IntegerSettingValue( ECamSettingItemVideoShowCapturedVideo ) == ECamSettOn &&
       
   781              !iController.IsCaptureStoppedForUsb() && appui->TargetViewState() == ECamViewStatePostCapture )
       
   782           { 
       
   783           //We need to blank the precapture view CBA here to prevent
       
   784           //blinking when changing back to precapture from postcapture.
       
   785           SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
       
   786           }
       
   787         break;	
       
   788         }
       
   789       // -------------------------------
       
   790       default:
       
   791         {
       
   792         // do nothing
       
   793         break;
       
   794         }
       
   795       // -------------------------------
       
   796       }
       
   797     }
       
   798   PRINT( _L("Camera <= CCamVideoPreCaptureView::UpdateCbaL") );
       
   799   }
       
   800 
       
   801 // ---------------------------------------------------------------------------
       
   802 // CCamVideoPreCaptureView::SetTitlePaneTextL
       
   803 // Set the view's title text
       
   804 // ---------------------------------------------------------------------------
       
   805 //
       
   806 void CCamVideoPreCaptureView::SetTitlePaneTextL()
       
   807     {
       
   808     CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() );
       
   809 #ifndef __WINS__
       
   810     if ( iEmbedded /*&& !appUi->IsInCallSend()*/ )
       
   811         {
       
   812         // only set the title if the construction is complete
       
   813         // otherwise the application is not yet set up correctly
       
   814         // as embedded
       
   815         if ( appUi->IsConstructionComplete() )
       
   816             {
       
   817             // set title to name of embedding application
       
   818             appUi->SetTitleEmbeddedL();
       
   819             }   
       
   820         }
       
   821     else
       
   822 #endif  
       
   823         {
       
   824         TInt titleResourceId = R_CAM_VIDEO_PRE_CAPTURE_TITLE_NAME;
       
   825        
       
   826         if ( iCaptureSetupModeActive || iSceneSettingModeActive )
       
   827             {
       
   828             titleResourceId = CCamCaptureSetupViewBase::SetupModeTitlePaneResourceId();
       
   829             }
       
   830 
       
   831         appUi->SetTitleL( titleResourceId );
       
   832         }
       
   833     }
       
   834 
       
   835 // ---------------------------------------------------------------------------
       
   836 // CCamVideoPreCaptureView::StartViewFinder
       
   837 // Enter viewfinder mode
       
   838 // ---------------------------------------------------------------------------
       
   839 //
       
   840 void CCamVideoPreCaptureView::StartViewFinder()
       
   841     {
       
   842     iController.EnterViewfinderMode( ECamControllerVideo );
       
   843     }
       
   844 
       
   845 // ---------------------------------------------------------------------------
       
   846 // CCamVideoPreCaptureView::StopViewFinder
       
   847 // Exit viewfinder mode
       
   848 // ---------------------------------------------------------------------------
       
   849 //
       
   850 void CCamVideoPreCaptureView::StopViewFinder()
       
   851     {
       
   852     iController.ExitViewfinderMode( ECamControllerVideo );
       
   853     }
       
   854 
       
   855 // ---------------------------------------------------------------------------
       
   856 // CCamVideoPreCaptureView::CreateContainerL
       
   857 // Create container control
       
   858 // ---------------------------------------------------------------------------
       
   859 //
       
   860 void CCamVideoPreCaptureView::CreateContainerL()
       
   861     {
       
   862     TRect screen;
       
   863     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
       
   864 
       
   865     iContainer = CCamVideoPreCaptureContainer::NewL(
       
   866         iController,
       
   867         *this,
       
   868         screen );
       
   869 
       
   870     iContainer->SetMopParent( this );
       
   871     }
       
   872 
       
   873 // ---------------------------------------------------------------------------
       
   874 // CCamVideoPreCaptureView::DynInitMenuPaneL
       
   875 // Changes MenuPane dynamically
       
   876 // ---------------------------------------------------------------------------
       
   877 //
       
   878 void CCamVideoPreCaptureView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   879     {
       
   880     PRINT( _L("Camera => CCamVideoPreCaptureView::DynInitMenuPaneL" ));
       
   881 
       
   882     if ( iContainer )
       
   883         {
       
   884         iContainer->Window().SetNonFading( ETrue );
       
   885         }
       
   886 
       
   887     CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() );
       
   888 	__ASSERT_DEBUG(appUi, CamPanic(ECamPanicNullPointer));
       
   889     TInt itemPos(0);
       
   890     if( aMenuPane->MenuItemExists(ECamCmdToggleCourtesyUI, itemPos) )
       
   891         {
       
   892         if ( !appUi->AlwaysDrawPreCaptureCourtesyUI() )
       
   893             {
       
   894             aMenuPane->SetItemTextL( ECamCmdToggleCourtesyUI, 
       
   895                                       R_CAM_CAPTURE_DISPLAY_ON_TEXT);
       
   896             }
       
   897         }
       
   898 
       
   899 //    if ( aResourceId == R_CAM_STANDBY_MENU && iStandbyError != KErrNone )
       
   900     if ( aResourceId == R_CAM_STANDBY_MENU && appUi->StandbyStatus() != KErrNone )
       
   901         {
       
   902         aMenuPane->SetItemDimmed( ECamCmdExitStandby, ETrue );
       
   903         }
       
   904     else if ( aResourceId == ROID(R_CAM_VIDEO_PRE_CAPTURE_MENU_ID))
       
   905         {
       
   906         DynInitSwitchCameraMenuItemL( aMenuPane ); 
       
   907         }
       
   908     else // otherwise, not in burst mode or menu pane is not default
       
   909         {
       
   910         // if embedded video set mute/unmute option appropriately, and set up
       
   911         // Switch camera item
       
   912         if( aResourceId == ROID(R_CAM_VIDEO_EMBEDDED_PRE_CAPTURE_MENU_ID))
       
   913             {
       
   914             DynInitSwitchCameraMenuItemL( aMenuPane );
       
   915             iAudioEnabled = iController.IntegerSettingValue( ECamSettingItemVideoAudioRec );
       
   916             // if audio off replace mute with unmute
       
   917             if( iAudioEnabled == ECamSettOff )
       
   918                 {
       
   919                 aMenuPane->SetItemDimmed( ECamCmdMute, ETrue );
       
   920                 aMenuPane->SetItemDimmed( ECamCmdUnmute, EFalse );
       
   921                 }
       
   922             else
       
   923                 {
       
   924                 aMenuPane->SetItemDimmed( ECamCmdMute, EFalse );
       
   925                 aMenuPane->SetItemDimmed( ECamCmdUnmute, ETrue );
       
   926                 }
       
   927 /*#ifndef __WINS__
       
   928             // if embedded and not in in-call send
       
   929             if ( !appUi->IsInCallSend() )
       
   930 #endif*/
       
   931         //        {
       
   932                 aMenuPane->SetItemDimmed( ECamCmdNewPhoto, ETrue );
       
   933         //        }
       
   934             }
       
   935 
       
   936         CCamCaptureSetupViewBase::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   937         }
       
   938     PRINT( _L("Camera <= CCamVideoPreCaptureView::DynInitMenuPaneL" ))  
       
   939     }
       
   940 
       
   941 
       
   942 // ---------------------------------------------------------------------------
       
   943 // CCamVideoPreCaptureView::CreateCaptureSetupMenuL
       
   944 // Creates a video capture setup menu
       
   945 // ---------------------------------------------------------------------------
       
   946 //
       
   947 void CCamVideoPreCaptureView::CreateCaptureSetupMenuL()
       
   948     {
       
   949     TInt resource;
       
   950     // check if we are Western or Arabic/Hebrew layout
       
   951     if ( !AknLayoutUtils::LayoutMirrored() )
       
   952         {
       
   953         if( AknLayoutUtils::Variant() == EApacVariant )
       
   954             {
       
   955             resource = ROID(R_CAM_CAPTURE_SETUP_MENU_VIDEO_DATA_APAC_ID);
       
   956             }
       
   957         else
       
   958             {
       
   959             // use Western resource
       
   960             resource = ROID(R_CAM_CAPTURE_SETUP_MENU_VIDEO_DATA_ID);
       
   961             }
       
   962         }
       
   963     else
       
   964         {
       
   965         resource = ROID(R_CAM_CAPTURE_SETUP_MENU_VIDEO_DATA_AH_ID);
       
   966         }
       
   967 
       
   968     // Use capture setup menu for second camera
       
   969     if ( static_cast<CCamAppUiBase*>( AppUi() )->IsSecondCameraEnabled() )
       
   970         {
       
   971         resource = ROID(R_CAM_CAPTURE_SETUP_MENU_VIDEO_DATA_ID);
       
   972         }
       
   973 
       
   974     iCaptureSetupMenuContainer = 
       
   975         CCamCaptureSetupMenu::NewL( iController, *this, AppUi()->ClientRect(),
       
   976         resource, iCaptureSetupMenuLastItemIndex );
       
   977 
       
   978     }
       
   979 
       
   980 // ---------------------------------------------------------------------------
       
   981 // CCamPreCaptureViewBase::SwitchToSceneSettingModeL
       
   982 // Switches the current mode to scene setting and activates a 
       
   983 // specific control.
       
   984 // ---------------------------------------------------------------------------
       
   985 //
       
   986 void CCamVideoPreCaptureView::SwitchToSceneSettingModeL()
       
   987     {
       
   988     if ( !iSceneSettingContainer )
       
   989     	{
       
   990 	    // Create the scene setting container for video mode.
       
   991 	    iSceneSettingContainer = CCamShootingModeContainer::NewL( AppUi()->ApplicationRect(),
       
   992 	                                                           *this,
       
   993 	                                                           ECamControllerVideo,
       
   994 	                                                           iController );
       
   995 	    iSceneSettingContainer->DrawableWindow()->SetOrdinalPosition(-1);
       
   996     	}
       
   997     
       
   998     iSettingModeTitleResourceId = R_CAM_VIDEO_SCENE_SETTING_TITLE;
       
   999 
       
  1000     if ( iEmbedded )
       
  1001         {
       
  1002         iPreviousMenuResourceId = ROID(R_CAM_VIDEO_EMBEDDED_PRE_CAPTURE_MENUBAR_ID);
       
  1003         }
       
  1004     else
       
  1005         {
       
  1006         iPreviousMenuResourceId = ROID(R_CAM_VIDEO_PRE_CAPTURE_MENUBAR_ID);
       
  1007         }
       
  1008     // Remove the view's main container, and add the capture setup 
       
  1009     // control associated with the input command to the container stack.
       
  1010     CCamCaptureSetupViewBase::SwitchToSceneSettingModeL();
       
  1011 
       
  1012     // only remove the capture setup menu container after 
       
  1013     // the switch completes successfully
       
  1014     RemoveCaptureSetupMenuContainers();
       
  1015 
       
  1016     // Stop the viewfinder as it isn't required for scene settings
       
  1017     StopViewFinder();
       
  1018     
       
  1019     }
       
  1020  
       
  1021 
       
  1022 // ---------------------------------------------------------------------------
       
  1023 // CCamVideoPreCaptureView::DoActivateL
       
  1024 // Activate this view
       
  1025 // ---------------------------------------------------------------------------
       
  1026 //
       
  1027 void 
       
  1028 CCamVideoPreCaptureView::DoActivateL( const TVwsViewId& aPrevViewId, 
       
  1029                                             TUid        aCustomMessageId,
       
  1030                                       const TDesC8&     aCustomMessage )
       
  1031     {
       
  1032     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMVIDEOPRECAPTUREVIEW_DOACTIVATEL, "e_CCamVideoPreCaptureView_DoActivateL 1" );
       
  1033     PRINT( _L("Camera => CCamVideoPreCaptureView::DoActivateL") );
       
  1034     PERF_EVENT_START_L2( EPerfEventVideoPreCaptureViewActivation );        
       
  1035     // Ensure the correct menu is used for the current mode.
       
  1036     CCamAppUi* appUi =  static_cast<CCamAppUi*>( AppUi() );
       
  1037     
       
  1038     // fixed toolbar is used only with touch devices
       
  1039     if ( iController.IsTouchScreenSupported() )
       
  1040         {
       
  1041         if ( appUi->IsEmbedded() )
       
  1042             {
       
  1043             CAknToolbar* toolbar = Toolbar();
       
  1044             toolbar->SetToolbarVisibility(EFalse);
       
  1045             }
       
  1046         }
       
  1047     else
       
  1048         {
       
  1049         // handled in CamPreCaptureViewBase
       
  1050         }
       
  1051 
       
  1052     // Check if view is activated internally or externally
       
  1053     TUid appUid = aPrevViewId.iAppUid;
       
  1054     if( appUid != appUi->Application()->AppDllUid() )
       
  1055       {
       
  1056       // set capture mode 
       
  1057       appUi->SetCaptureMode( ECamControllerVideo );
       
  1058       }
       
  1059 
       
  1060     SetMenuBar();
       
  1061 
       
  1062     CCamPreCaptureViewBase::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );  
       
  1063               
       
  1064     PERF_EVENT_END_L2( EPerfEventVideoPreCaptureViewActivation );
       
  1065     PRINT( _L("Camera <= CCamVideoPreCaptureView::DoActivateL") );
       
  1066     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMVIDEOPRECAPTUREVIEW_DOACTIVATEL, "e_CCamVideoPreCaptureView_DoActivateL 0" );
       
  1067     }
       
  1068 
       
  1069 // ---------------------------------------------------------------------------
       
  1070 // SetMenuBar <<virtual>>
       
  1071 // ---------------------------------------------------------------------------
       
  1072 //
       
  1073 void 
       
  1074 CCamVideoPreCaptureView::SetMenuBar()
       
  1075   {
       
  1076   PRINT( _L("Camera => CCamVideoPreCaptureView::SetMenuBar") );  
       
  1077   CEikMenuBar* menuBar = MenuBar();
       
  1078   if ( menuBar )
       
  1079     {
       
  1080     if ( iStandbyModeActive ) 
       
  1081       {
       
  1082       PRINT( _L("Camera <> CCamVideoPreCaptureView::SetMenuBar: setting standby menubar..") );
       
  1083       menuBar->SetMenuTitleResourceId( R_CAM_STANDBY_MENUBAR );
       
  1084       }
       
  1085     else if ( iEmbedded )
       
  1086       {
       
  1087       PRINT( _L("Camera <> CCamVideoPreCaptureView::SetMenuBar: setting menu resource to R_CAM_VIDEO_EMBEDDED_PRE_CAPTURE_MENUBAR_ID") );
       
  1088       menuBar->SetMenuTitleResourceId( ROID(R_CAM_VIDEO_EMBEDDED_PRE_CAPTURE_MENUBAR_ID));
       
  1089       }
       
  1090     else
       
  1091       {
       
  1092       PRINT( _L("Camera <> CCamVideoPreCaptureView::SetMenuBar: setting menu resource to R_CAM_VIDEO_PRE_CAPTURE_MENUBAR_ID") );
       
  1093       menuBar->SetMenuTitleResourceId( ROID(R_CAM_VIDEO_PRE_CAPTURE_MENUBAR_ID) );
       
  1094       }
       
  1095     }
       
  1096   PRINT( _L("Camera <= CCamVideoPreCaptureView::SetMenuBar") );
       
  1097   }
       
  1098 
       
  1099 
       
  1100 // ---------------------------------------------------------------------------
       
  1101 // CCamVideoPreCaptureView::GetHelpContext
       
  1102 // Called to identify the help context for this view
       
  1103 // ---------------------------------------------------------------------------
       
  1104 //
       
  1105 void CCamVideoPreCaptureView::GetHelpContext( TCoeHelpContext& aContext ) const
       
  1106     {
       
  1107     aContext.iMajor = TUid::Uid( KCameraappUID );
       
  1108      
       
  1109     // First check to see if the scene settings list is open
       
  1110     if ( iSceneSettingModeActive )
       
  1111         {
       
  1112         aContext.iContext = KLCAM_HLP_SCENES_VIDEO;
       
  1113         }
       
  1114     // Else check for standby mode
       
  1115     else if ( iStandbyModeActive )
       
  1116         {
       
  1117         // Also check to see if this is embedded standby
       
  1118         if ( iEmbedded )
       
  1119             {
       
  1120             aContext.iContext = KLCAM_HLP_STANDYBY_EM;
       
  1121             }
       
  1122         else
       
  1123             {
       
  1124             aContext.iContext = KLCAM_HLP_STANDYBY_EM;
       
  1125             }        
       
  1126         }
       
  1127     // Else check for embedded mode
       
  1128     else if ( iEmbedded )
       
  1129         {
       
  1130         aContext.iContext = KLCAM_HLP_VIEWFINDER_VIDEO_EM;
       
  1131         }
       
  1132     // Else this is the plain photo viewfinder
       
  1133     else
       
  1134         {
       
  1135         aContext.iContext = KLCAM_HLP_VIEWFINDER_VIDEO;
       
  1136         }
       
  1137     }
       
  1138 
       
  1139 // ---------------------------------------------------------------------------
       
  1140 // CCamVideoPreCaptureView::MuteEmbeddedAudioL
       
  1141 // Mute or unmute audio for embedded video
       
  1142 // ---------------------------------------------------------------------------
       
  1143 //
       
  1144 void CCamVideoPreCaptureView::MuteEmbeddedAudioL( TBool aMuteAudio )
       
  1145     {
       
  1146     if( aMuteAudio )
       
  1147         {
       
  1148         iController.SetIntegerSettingValueL( ECamSettingItemVideoAudioRec, ECamSettOff );
       
  1149         }
       
  1150     else
       
  1151         {
       
  1152         iController.SetIntegerSettingValueL( ECamSettingItemVideoAudioRec, ECamSettOn );
       
  1153         }
       
  1154     }
       
  1155 
       
  1156 // ---------------------------------------------------------------------------
       
  1157 // CCamVideoPreCaptureView::DynInitToolbarL
       
  1158 // Dynamically initialize toolbar contents
       
  1159 // ---------------------------------------------------------------------------
       
  1160 //
       
  1161 void CCamVideoPreCaptureView::DynInitToolbarL( TInt aResourceId, 
       
  1162                                        CAknToolbar* aToolbar )
       
  1163     {
       
  1164     PRINT2( _L("Camera => CCamVideoPreCaptureView::DynInitToolbarL(%d, 0x%X)" ), aResourceId, aToolbar )
       
  1165     (void)aResourceId; // remove compiler warning
       
  1166     
       
  1167     CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() );
       
  1168 
       
  1169     iController.StartIdleTimer();
       
  1170     // fixed toolbar is used only with touch devices
       
  1171     if ( iController.IsTouchScreenSupported() )
       
  1172         {
       
  1173         UpdateToolbarIconsL();
       
  1174         if( aToolbar )
       
  1175             {            
       
  1176             if ( iEmbedded && appUi->IsSecondCameraEnabled() )
       
  1177                 {
       
  1178                 aToolbar->SetItemDimmed(ECamCmdNewPhoto, ETrue, ETrue);
       
  1179                 }
       
  1180             CAknToolbarExtension* extension = aToolbar->ToolbarExtension();
       
  1181             if( extension )
       
  1182                 {
       
  1183                 if ( iEmbedded )
       
  1184                     {
       
  1185 					extension->HideItemL( ECamCmdNewPhoto, ETrue );
       
  1186                     extension->HideItemL( ECamCmdPhotos, ETrue );
       
  1187                     }
       
  1188                 else
       
  1189                     {
       
  1190                     extension->HideItemL( ECamCmdNewPhoto, EFalse );
       
  1191                     extension->HideItemL( ECamCmdPhotos, EFalse );
       
  1192                     }
       
  1193                 if(aResourceId == ECamCmdToolbarExtension)
       
  1194                     {
       
  1195                     appUi->ZoomPane()->MakeVisible(EFalse,ETrue);
       
  1196                     }
       
  1197                 }
       
  1198             }
       
  1199         }
       
  1200 
       
  1201 
       
  1202     PRINT2( _L("Camera <= CCamVideoPreCaptureView::DynInitToolbarL(%d, 0x%X)" ), aResourceId, aToolbar )
       
  1203     }
       
  1204 
       
  1205 // ---------------------------------------------------------------------------
       
  1206 // CCamVideoPreCaptureView::UpdateToolbarIconsL
       
  1207 // Update fixed toolbar icons according to current settings
       
  1208 // ---------------------------------------------------------------------------
       
  1209 //
       
  1210 void CCamVideoPreCaptureView::UpdateToolbarIconsL()
       
  1211     {
       
  1212     // fixed toolbar is used only with touch devices
       
  1213     if (!iController.IsTouchScreenSupported() )
       
  1214         return;
       
  1215      UpdateVideoFlashIconsL();
       
  1216      UpdateVideoSceneModeIconsL();
       
  1217      UpdateVideoColorToneIconsL();
       
  1218      UpdateVideoWhitebalanceIconsL();
       
  1219 	 RedrawToolBar();
       
  1220     }
       
  1221 
       
  1222 // ---------------------------------------------------------------------------
       
  1223 // CCamVideoPreCaptureView::OfferToolbarEventL
       
  1224 // Handle commands from toolbar
       
  1225 // ---------------------------------------------------------------------------
       
  1226 //
       
  1227 void CCamVideoPreCaptureView::OfferToolbarEventL( TInt aCommand )
       
  1228     {
       
  1229     PRINT1( _L("Camera => CCamVideoPreCaptureView::OfferToolbarEventL(%d)" ), aCommand );
       
  1230 
       
  1231     iController.StartIdleTimer();
       
  1232     // fixed toolbar is used only with touch devices
       
  1233     if ( iController.IsTouchScreenSupported() )
       
  1234         {
       
  1235         CCamPreCaptureViewBase::OfferToolbarEventL( aCommand );
       
  1236 
       
  1237 
       
  1238         // Redraw video light button
       
  1239         CAknToolbar* toolbar = Toolbar();
       
  1240         if ( aCommand == ECamCmdToggleVideoFlash && 
       
  1241              toolbar )
       
  1242             {
       
  1243              CAknButton* button = static_cast<CAknButton*>( 
       
  1244                                   toolbar->ControlOrNull( aCommand ) );
       
  1245 			 if ( button )
       
  1246                 {
       
  1247                 button->DrawDeferred();
       
  1248                 }
       
  1249             } 
       
  1250         }
       
  1251        
       
  1252     PRINT1( _L("Camera <= CCamVideoPreCaptureView::OfferToolbarEventL(%d)" ), aCommand );
       
  1253     }
       
  1254 
       
  1255 
       
  1256 // ---------------------------------------------------------------------------
       
  1257 // CCamVideoPreCaptureView::StartMskCapture()
       
  1258 // Try to start the capture with MSK command. Return true if started.
       
  1259 // ---------------------------------------------------------------------------
       
  1260 //
       
  1261 TBool CCamVideoPreCaptureView::StartMskCaptureL()
       
  1262     {
       
  1263     CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
  1264     TCamOrientation orientation = appUi->CamOrientation();
       
  1265     TBool startedCapture(EFalse);
       
  1266     if( orientation == ECamOrientationCamcorder || 
       
  1267         orientation == ECamOrientationCamcorderLeft ||
       
  1268 		orientation == ECamOrientationPortrait )
       
  1269     	{ 
       
  1270    		if ( appUi && !appUi->IsToolBarVisible()
       
  1271        		 && iController.UiConfigManagerPtr() 
       
  1272        		 && !iController.UiConfigManagerPtr()->IsOpticalJoyStickSupported() )
       
  1273    		    {
       
  1274     		// In case of MSK if no AP on screen, it should work as record
       
  1275     		// If optical joystic is not available, we will start the 
       
  1276     		// recording here. Otherwise it is handled
       
  1277     		// in CCamVideoPreCaptureContainer
       
  1278         	TInt callType( EPSCTsyCallTypeUninitialized );
       
  1279             RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType );
       
  1280             if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
       
  1281             {
       
  1282                 SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
       
  1283                 iController.StartVideoRecordingL();
       
  1284                 startedCapture = ETrue;
       
  1285                 // fixed toolbar is used only with touch devices
       
  1286                 if ( iController.IsTouchScreenSupported() )
       
  1287                     {
       
  1288                     CAknToolbar* fixedToolbar = Toolbar();
       
  1289                     if ( fixedToolbar )
       
  1290                         {
       
  1291                         fixedToolbar->SetToolbarVisibility( EFalse );
       
  1292                         }
       
  1293                     }
       
  1294                 }
       
  1295    		    }
       
  1296 	    // else let the calling function take care of capturing
       
  1297     	}
       
  1298         return startedCapture;
       
  1299     }
       
  1300 
       
  1301 
       
  1302 // ---------------------------------------------------------------------------
       
  1303 // CCamVideoPreCaptureView::UpdateVideoFlashIconsL()
       
  1304 // ---------------------------------------------------------------------------
       
  1305 //
       
  1306  void CCamVideoPreCaptureView::UpdateVideoFlashIconsL()
       
  1307      {
       
  1308      CAknButton* button = ToolbarButtonById(ECamCmdToggleVideoFlash);
       
  1309      if(!button)
       
  1310          return;
       
  1311      MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
  1312      TFileName iconFileName;
       
  1313      CamUtility::ResourceFileName( iconFileName );
       
  1314      TCamFlashId flash = static_cast< TCamFlashId > 
       
  1315          ( iController.IntegerSettingValue(
       
  1316                  ECamSettingItemDynamicVideoFlash ) );
       
  1317 
       
  1318      CAknButtonState* state = button->State();
       
  1319      if ( state )
       
  1320          {
       
  1321          switch ( flash )
       
  1322              {
       
  1323              case ECamFlashOff:
       
  1324                  {
       
  1325                  SetIconL(
       
  1326                      button,
       
  1327                      iconFileName,
       
  1328                      EMbmCameraappQgn_indi_cam4_tb_light_off,
       
  1329                      EMbmCameraappQgn_indi_cam4_tb_light_off_mask,
       
  1330                      skinInstance,
       
  1331                      KAknsIIDQgnIndiCam4TbLightOff );
       
  1332                  HBufC* tooltipText = 
       
  1333                      StringLoader::LoadLC( R_QTN_LCAM_TT_VIDEOFLASH );
       
  1334                  state->SetHelpTextL( *tooltipText );
       
  1335                  CleanupStack::PopAndDestroy( tooltipText );
       
  1336                  break;
       
  1337                  }
       
  1338              case ECamFlashForced:
       
  1339                  {
       
  1340                  SetIconL(
       
  1341                      button,
       
  1342                      iconFileName,
       
  1343                      EMbmCameraappQgn_indi_cam4_tb_light,
       
  1344                      EMbmCameraappQgn_indi_cam4_tb_light_mask,
       
  1345                      skinInstance,
       
  1346                      KAknsIIDQgnIndiCam4TbLight ); 
       
  1347                  HBufC* tooltipText =
       
  1348                      StringLoader::LoadLC( R_QTN_LCAM_TT_FLASHOFF );
       
  1349                  state->SetHelpTextL( *tooltipText );
       
  1350                  CleanupStack::PopAndDestroy( tooltipText );
       
  1351                  break;
       
  1352                  }
       
  1353              default:
       
  1354                  break;
       
  1355              }
       
  1356          }
       
  1357      }
       
  1358 
       
  1359  // ---------------------------------------------------------------------------
       
  1360  // CCamVideoPreCaptureView::UpdateVideoSceneModeIconsL()
       
  1361  // ---------------------------------------------------------------------------
       
  1362  //
       
  1363  void CCamVideoPreCaptureView::UpdateVideoSceneModeIconsL()
       
  1364      {
       
  1365      CAknButton* button = ToolbarButtonById(ECamCmdCaptureSetupSceneVideo);
       
  1366      if(!button)
       
  1367          {
       
  1368          return;
       
  1369          }
       
  1370          
       
  1371      MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
  1372      TFileName iconFileName;
       
  1373      CamUtility::ResourceFileName( iconFileName );
       
  1374      TCamSceneId scene = static_cast< TCamSceneId > ( 
       
  1375          iController.IntegerSettingValue( ECamSettingItemDynamicVideoScene ) );
       
  1376      switch ( scene )
       
  1377          {
       
  1378          case ECamSceneAuto:
       
  1379          case ECamSceneNormal:
       
  1380              {
       
  1381              SetIconL(
       
  1382                  button,
       
  1383                  iconFileName,
       
  1384                  EMbmCameraappQgn_indi_cam4_mode_auto,
       
  1385                  EMbmCameraappQgn_indi_cam4_mode_auto_mask,
       
  1386                  skinInstance,
       
  1387                  KAknsIIDQgnIndiCam4ModeAuto );
       
  1388              break;
       
  1389              }
       
  1390          case ECamSceneNight:
       
  1391              {
       
  1392              SetIconL(
       
  1393                  button,
       
  1394                  iconFileName,
       
  1395                  EMbmCameraappQgn_indi_cam4_mode_night,
       
  1396                  EMbmCameraappQgn_indi_cam4_mode_night_mask,
       
  1397                  skinInstance,
       
  1398                  KAknsIIDQgnIndiCam4ModeNight );
       
  1399              break;
       
  1400              }
       
  1401          case ECamSceneLowLight: 
       
  1402              {
       
  1403              SetIconL(
       
  1404                  button,
       
  1405                  iconFileName,
       
  1406                  EMbmCameraappQgn_indi_cam4_wb_tungsten,
       
  1407                  EMbmCameraappQgn_indi_cam4_wb_tungsten_mask,
       
  1408                  skinInstance,
       
  1409                  KAknsIIDQgnIndiCam4WbTungsten );
       
  1410              break;
       
  1411              }
       
  1412          default:
       
  1413              {
       
  1414              //Do Nothing
       
  1415              }
       
  1416              break;
       
  1417          }
       
  1418      }
       
  1419 
       
  1420  // ---------------------------------------------------------------------------
       
  1421  // CCamVideoPreCaptureView::UpdateVideoColorToneIconsL()
       
  1422  // ---------------------------------------------------------------------------
       
  1423  //
       
  1424 void CCamVideoPreCaptureView::UpdateVideoColorToneIconsL()
       
  1425     {
       
  1426     CAknButton* button = ToolbarButtonById(ECamCmdCaptureSetupColourFilterVideo);
       
  1427     if(!button)
       
  1428         return;
       
  1429     if ( !iController.UiConfigManagerPtr()->IsColorToneFeatureSupported() )
       
  1430         {
       
  1431         HideButton(ECamCmdCaptureSetupColourFilterVideo);
       
  1432         return;
       
  1433         }
       
  1434     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
  1435     TFileName iconFileName;
       
  1436     CamUtility::ResourceFileName( iconFileName );
       
  1437 
       
  1438     TCamColourFilterId color = static_cast< TCamColourFilterId > 
       
  1439         ( iController.IntegerSettingValue( ECamSettingItemDynamicVideoColourFilter ) );
       
  1440         
       
  1441     switch ( color )
       
  1442         {
       
  1443         case ECamColourFilterColour:
       
  1444             {
       
  1445             SetIconL(
       
  1446                 button,
       
  1447                 iconFileName,
       
  1448                 EMbmCameraappQgn_indi_cam4_colour_normal,
       
  1449                 EMbmCameraappQgn_indi_cam4_colour_normal_mask,
       
  1450                 skinInstance,
       
  1451                 KAknsIIDQgnIndiCam4ColourNormal );
       
  1452             break;
       
  1453             }
       
  1454         case ECamColourFilterBlackAndWhite:
       
  1455             {
       
  1456             SetIconL(
       
  1457                 button,
       
  1458                 iconFileName,
       
  1459                 EMbmCameraappQgn_indi_cam4_colour_bw,
       
  1460                 EMbmCameraappQgn_indi_cam4_colour_bw_mask,
       
  1461                 skinInstance,
       
  1462                 KAknsIIDQgnIndiCam4ColourBw );
       
  1463             break;
       
  1464             }
       
  1465         case ECamColourFilterSepia:
       
  1466             {
       
  1467             SetIconL(
       
  1468                 button,
       
  1469                 iconFileName,
       
  1470                 EMbmCameraappQgn_indi_cam4_colour_sepia,
       
  1471                 EMbmCameraappQgn_indi_cam4_colour_sepia_mask,
       
  1472                 skinInstance,
       
  1473                 KAknsIIDQgnIndiCam4ColourSepia );
       
  1474             break;
       
  1475             }
       
  1476         case ECamColourFilterNegative:
       
  1477             {
       
  1478             SetIconL(
       
  1479                 button,
       
  1480                 iconFileName,
       
  1481                 EMbmCameraappQgn_indi_cam4_colour_negative,
       
  1482                 EMbmCameraappQgn_indi_cam4_colour_negative_mask,
       
  1483                 skinInstance,
       
  1484                 KAknsIIDQgnIndiCam4ColourNegative );
       
  1485             break;
       
  1486             }
       
  1487         case ECamColourFilterVivid:
       
  1488             {
       
  1489             SetIconL(
       
  1490                 button,
       
  1491                 iconFileName,
       
  1492                 EMbmCameraappQgn_indi_cam4_colour_vivid,
       
  1493                 EMbmCameraappQgn_indi_cam4_colour_vivid_mask,
       
  1494                 skinInstance,
       
  1495                 KAknsIIDQgnIndiCam4ColourVivid );
       
  1496             break;
       
  1497             }
       
  1498         default:
       
  1499             break;
       
  1500         }
       
  1501     }
       
  1502 
       
  1503 // ---------------------------------------------------------------------------
       
  1504 // CCamVideoPreCaptureView::UpdateVideoWhitebalanceIconsL()
       
  1505 // ---------------------------------------------------------------------------
       
  1506 //
       
  1507  void CCamVideoPreCaptureView::UpdateVideoWhitebalanceIconsL()
       
  1508      {
       
  1509      CAknButton* button = ToolbarButtonById(ECamCmdCaptureSetupWhiteBalanceVideo);
       
  1510      if(!button)
       
  1511          return;
       
  1512      MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
  1513      TFileName iconFileName;
       
  1514      CamUtility::ResourceFileName( iconFileName );
       
  1515      if ( !iController.UiConfigManagerPtr()->IsWhiteBalanceFeatureSupported() )
       
  1516          {
       
  1517          HideButton( ECamCmdCaptureSetupWhiteBalanceVideo);
       
  1518          return;
       
  1519          }
       
  1520      TCamWhiteBalanceId wb = static_cast< TCamWhiteBalanceId > 
       
  1521          ( iController.IntegerSettingValue( ECamSettingItemDynamicVideoWhiteBalance ) );
       
  1522          
       
  1523      switch ( wb )
       
  1524          {
       
  1525          case ECamWhiteBalanceAWB:
       
  1526              {
       
  1527              SetIconL(
       
  1528                  button,
       
  1529                  iconFileName,
       
  1530                  EMbmCameraappQgn_indi_cam4_wb_auto,
       
  1531                  EMbmCameraappQgn_indi_cam4_wb_auto_mask,
       
  1532                  skinInstance,
       
  1533                  KAknsIIDQgnIndiCam4WbAuto );
       
  1534              break;
       
  1535              }
       
  1536          case ECamWhiteBalanceDaylight:
       
  1537              {
       
  1538              SetIconL(
       
  1539                  button,
       
  1540                  iconFileName,
       
  1541                  EMbmCameraappQgn_indi_cam4_wb_sunny,
       
  1542                  EMbmCameraappQgn_indi_cam4_wb_sunny_mask,
       
  1543                  skinInstance,
       
  1544                  KAknsIIDQgnIndiCam4WbSunny );
       
  1545              break;
       
  1546              }
       
  1547          case ECamWhiteBalanceCloudy:
       
  1548              {
       
  1549              SetIconL(
       
  1550                  button,
       
  1551                  iconFileName,
       
  1552                  EMbmCameraappQgn_indi_cam4_wb_cloudy,
       
  1553                  EMbmCameraappQgn_indi_cam4_wb_cloudy_mask,
       
  1554                  skinInstance,
       
  1555                  KAknsIIDQgnIndiCam4WbCloudy );
       
  1556              break;
       
  1557              }
       
  1558          case ECamWhiteBalanceTungsten:
       
  1559              {
       
  1560              SetIconL(
       
  1561                  button,
       
  1562                  iconFileName,
       
  1563                  EMbmCameraappQgn_indi_cam4_wb_tungsten,
       
  1564                  EMbmCameraappQgn_indi_cam4_wb_tungsten_mask,
       
  1565                  skinInstance,
       
  1566                  KAknsIIDQgnIndiCam4WbTungsten );
       
  1567              break;
       
  1568              }
       
  1569          case ECamWhiteBalanceFlourescent:
       
  1570              {
       
  1571              SetIconL(
       
  1572                  button,
       
  1573                  iconFileName,
       
  1574                  EMbmCameraappQgn_indi_cam4_wb_fluorecent,
       
  1575                  EMbmCameraappQgn_indi_cam4_wb_fluorecent_mask,
       
  1576                  skinInstance,
       
  1577                  KAknsIIDQgnIndiCam4WbFluorecent );
       
  1578              break;
       
  1579              }
       
  1580          default:
       
  1581              break;
       
  1582          }
       
  1583      }
       
  1584 
       
  1585 
       
  1586 //  End of File