camerauis/cameraapp/generic/src/CamContainerBase.cpp
branchRCL_3
changeset 54 bac7acad7cb3
child 57 2c87b2808fd7
equal deleted inserted replaced
53:61bc0f252b2b 54:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Base class for all camera application containers*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <eikmenub.h>
       
    21 #include <aknview.h>
       
    22 #include <avkon.hrh>
       
    23 #include <AknsFrameBackgroundControlContext.h>
       
    24 #include <AknsDrawUtils.h>
       
    25 #include <AknUtils.h>
       
    26 // System includes for changing the orientation.
       
    27 #include <eikenv.h>
       
    28 #include <eikappui.h>
       
    29 
       
    30 #include <activepalette2ui.h>
       
    31 #include <cameraapp.rsg>
       
    32 #include <vgacamsettings.rsg>
       
    33 #include <aknlayoutscalable_apps.cdl.h>
       
    34 #include <layoutmetadata.cdl.h>
       
    35 #include <StringLoader.h>
       
    36 
       
    37 #include "CamContainerBase.h"
       
    38 #include "CamAppController.h"
       
    39 #include "CamLogger.h"
       
    40 #include "CamUtility.h"
       
    41 #include "CamAppUi.h"
       
    42 #include "CamNaviCounterControl.h"
       
    43 #include "CamNaviProgressBarControl.h"
       
    44 #include "CamZoomPane.h"
       
    45 #include "camactivepalettehandler.h"
       
    46 #include "CameraUiConfigManager.h"
       
    47 #include "CamViewBase.h"
       
    48 #include "cambackupcontainer.h"
       
    49 
       
    50   static const TInt KCamBurstCounterLength = 2;
       
    51   _LIT(KCamBurstCounterFormat, "%02d");
       
    52 
       
    53 // ================= STATIC MEMBER VARIABLES ================
       
    54 	
       
    55 MActivePalette2UI* CCamContainerBase::iActivePalette = NULL;
       
    56 
       
    57 // ================= MEMBER FUNCTIONS =======================
       
    58 
       
    59 // Destructor
       
    60 CCamContainerBase::~CCamContainerBase()
       
    61   {
       
    62   PRINT( _L("Camera => ~CCamContainerBase") );
       
    63   delete iBgContext;
       
    64 
       
    65 
       
    66   iPrimaryZoomInKeys.Close();
       
    67   iPrimaryZoomOutKeys.Close();
       
    68   iSecondaryZoomInKeys.Close();
       
    69   iSecondaryZoomOutKeys.Close();
       
    70   
       
    71   iPrimaryCameraCaptureKeys.Close();
       
    72   iSecondaryCameraCaptureKeys.Close();
       
    73   
       
    74   iPrimaryCameraAFKeys.Close();
       
    75 
       
    76   delete iProcessingText;
       
    77     delete iBurstProcessingText;
       
    78   if(iBackupContainer)
       
    79       {
       
    80       delete iBackupContainer;
       
    81       iBackupContainer = NULL;
       
    82       }
       
    83   
       
    84   PRINT( _L("Camera <= ~CCamContainerBase") );
       
    85   }
       
    86   
       
    87 // ---------------------------------------------------------------------------
       
    88 // CCamContainerBase::CCamContainerBase
       
    89 // C++ constructor
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 CCamContainerBase::CCamContainerBase( CCamAppController& aController,
       
    93                                       CAknView&          aView       )
       
    94   : iView( aView ), 
       
    95     iController( aController )
       
    96   {
       
    97   }
       
    98 
       
    99 // ---------------------------------------------------------
       
   100 // CCamContainerBase::BaseConstructL
       
   101 // Symbian OS 2nd phase constructor
       
   102 // ---------------------------------------------------------
       
   103 //
       
   104 void CCamContainerBase::BaseConstructL( const TRect& aRect )
       
   105   {
       
   106   CreateWindowL();
       
   107   Window().SetBackgroundColor( KRgbBlack );
       
   108   SetRect( aRect );
       
   109   EnableDragEvents(); 
       
   110 
       
   111   CCamAppUiBase* appUi =  static_cast<CCamAppUiBase*>( iEikonEnv->EikAppUi() );
       
   112   iCamOrientation = appUi->CamOrientation();
       
   113 
       
   114   // set up the skin background context
       
   115   CreateBackgroundContextL();
       
   116   
       
   117   iBackupContainer = CCamBackupContainer::NewL(iController,iView,*this);
       
   118   
       
   119   // zoom keys
       
   120   iPrimaryZoomInKeys.Reset();
       
   121   iPrimaryZoomOutKeys.Reset();
       
   122   iSecondaryZoomInKeys.Reset();
       
   123   iSecondaryZoomOutKeys.Reset();
       
   124   
       
   125   // capture keys
       
   126   iPrimaryCameraCaptureKeys.Reset();
       
   127   iSecondaryCameraCaptureKeys.Reset();
       
   128   
       
   129   // AF keys
       
   130   iPrimaryCameraAFKeys.Reset();
       
   131   
       
   132   if ( iController.UiConfigManagerPtr() )
       
   133       {
       
   134       // Reading the zoom keys for primary and secondary camera
       
   135       iController.UiConfigManagerPtr()->
       
   136           SupportedPrimaryCameraZoomInKeysL( iPrimaryZoomInKeys );
       
   137       iController.UiConfigManagerPtr()->
       
   138                 SupportedPrimaryCameraZoomOutKeysL( iPrimaryZoomOutKeys );
       
   139       
       
   140       // secondary camera zoom-in/out keys
       
   141       iController.UiConfigManagerPtr()->
       
   142                 SupportedSecondaryCameraZoomInKeysL( iSecondaryZoomInKeys );
       
   143       iController.UiConfigManagerPtr()->
       
   144                 SupportedSecondaryCameraZoomOutKeysL( iSecondaryZoomOutKeys );
       
   145       
       
   146       // Reading the capture keys for primary and secondary camera
       
   147       iController.UiConfigManagerPtr()->
       
   148                 SupportedPrimaryCameraCaptureKeyL( iPrimaryCameraCaptureKeys );
       
   149       
       
   150       iController.UiConfigManagerPtr()->
       
   151                       SupportedSecondaryCameraCaptureKeyL( iSecondaryCameraCaptureKeys );
       
   152       
       
   153       // Reading AF or half capture key press  Keys
       
   154       iController.UiConfigManagerPtr()->SupportedPrimaryCameraAutoFocusKeyL(
       
   155                                                        iPrimaryCameraAFKeys );
       
   156       }
       
   157   if ( iPrimaryZoomInKeys.Count() <= 0 || iPrimaryZoomOutKeys.Count() <= 0 ||
       
   158        iSecondaryZoomInKeys.Count() <= 0 || iSecondaryZoomOutKeys.Count() <= 0 ||
       
   159        iPrimaryCameraCaptureKeys.Count() <= 0 || iSecondaryCameraCaptureKeys.Count() <= 0 ||       
       
   160        iPrimaryCameraAFKeys.Count() <= 0
       
   161       )
       
   162       {
       
   163       // Leave here, if there are no configured items so that we dont panic 
       
   164       //in any container classes derived from this base class
       
   165       User::Leave( KErrNotSupported );
       
   166       }
       
   167     }
       
   168     
       
   169 
       
   170 // ---------------------------------------------------------
       
   171 // CCamContainerBase::IsCaptureKeyL
       
   172 // Whether or not this key is considered to be a capture key
       
   173 // in the current context
       
   174 // ---------------------------------------------------------
       
   175 //
       
   176 TBool CCamContainerBase::IsCaptureKeyL( const TKeyEvent& aKeyEvent,
       
   177                                        TEventCode aType ) 
       
   178   {
       
   179   PRINT1( _L( "Camera => CCamContainerBase::IsCaptureKey event type (%d)" ),  aType ); 
       
   180   
       
   181   // Find out if this key is a capture key
       
   182   TBool isCaptureKey( EFalse) ;
       
   183   
       
   184   // Repeat events are not classed as capture keys
       
   185   if ( aKeyEvent.iRepeats != 0 )
       
   186     {
       
   187     PRINT( _L( "IsCaptureKey returning false (repeat)" ) );
       
   188     return isCaptureKey;
       
   189     }
       
   190   
       
   191   CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
       
   192   if ( appUi && appUi->AppInBackground( ETrue ) )
       
   193       {
       
   194       PRINT( _L("IsCaptureKey returning false (AppInBackground() = true") );
       
   195       return isCaptureKey;
       
   196       }
       
   197   
       
   198   if ( ECamActiveCameraPrimary == iController.ActiveCamera() )
       
   199       {
       
   200       isCaptureKey = IsPrimaryCameraCaptureKey( aKeyEvent );
       
   201       }
       
   202   else // secondary camera
       
   203       {
       
   204       isCaptureKey = IsSecondaryCameraCaptureKey( aKeyEvent );
       
   205       }  
       
   206 
       
   207   // Each product defines which key/s are treated as capture keys.
       
   208   // Different keys can be mapped for each active camera.
       
   209   // Look for capture event or key up event (note that capture
       
   210   // event is on the EEventKey for navi-key select press)
       
   211   if ( isCaptureKey )
       
   212       {
       
   213       if ( aType == EEventKeyDown || aType == EEventKey || aType == EEventKeyUp || aType == EEventKeyUp )
       
   214         {
       
   215         if ( isCaptureKey &&
       
   216              ( iController.UiConfigManagerPtr()->IsKeyLockWatcherSupported() && iController.IsKeyLockOn() ) )
       
   217             {
       
   218             isCaptureKey = !iController.IsKeyLockOn();
       
   219             }
       
   220         }
       
   221       else
       
   222         {
       
   223         // key types doesnt match so dont consider as capture key press.
       
   224         isCaptureKey = EFalse;
       
   225         }  
       
   226       }
       
   227   PRINT1( _L( "IsCaptureKey returning %d" ), isCaptureKey );
       
   228   return isCaptureKey;
       
   229   }
       
   230 
       
   231 // ---------------------------------------------------------
       
   232 // CCamContainerBase::IsShutterKeyL
       
   233 // Whether or not this key is considered to be a shutter key
       
   234 // in the current context
       
   235 // ---------------------------------------------------------
       
   236 //
       
   237 TBool CCamContainerBase::IsShutterKeyL( const TKeyEvent& aKeyEvent, TEventCode /* aType */ )
       
   238     {
       
   239     PRINT1( _L( "Camera => CCamContainerBase::IsShutterKeyL scancode (%d)" ),  aKeyEvent.iScanCode ); 
       
   240 
       
   241     if ( iController.UiConfigManagerPtr()
       
   242         && iController.UiConfigManagerPtr()->IsAutoFocusSupported() )
       
   243         {
       
   244 #ifndef __WINS__
       
   245         if ( aKeyEvent.iScanCode == iPrimaryCameraAFKeys[0] )
       
   246 #else
       
   247         if ( aKeyEvent.iScanCode == EProductKeyCaptureHalf )
       
   248 #endif 
       
   249             {
       
   250             return ETrue;
       
   251             }
       
   252         }
       
   253     return EFalse;
       
   254     }
       
   255 
       
   256 
       
   257 //
       
   258 // CCamZoomPane::CheckForZoomKey
       
   259 //
       
   260 TBool CCamContainerBase::CheckForZoomKey( const TKeyEvent& aKeyEvent )
       
   261     {
       
   262     return CheckInZoomKeyArray( aKeyEvent );
       
   263     }
       
   264 
       
   265 
       
   266 //
       
   267 //
       
   268 //
       
   269 TBool CCamContainerBase::CheckInZoomKeyArray( const TKeyEvent& aKeyEvent )
       
   270     {
       
   271     TCamActiveCamera camera = iController.ActiveCamera();
       
   272     TBool zoomKeyFound ( EFalse );
       
   273 
       
   274     if ( camera == ECamActiveCameraPrimary )
       
   275         {
       
   276         zoomKeyFound = ( KErrNotFound != 
       
   277                          iPrimaryZoomInKeys.Find( aKeyEvent.iScanCode ) );
       
   278         if ( !zoomKeyFound )
       
   279             {
       
   280             // Its not zoom-in key, check if its zoom out key
       
   281             zoomKeyFound = ( KErrNotFound != 
       
   282                              iPrimaryZoomOutKeys.Find( aKeyEvent.iScanCode ) );
       
   283             }
       
   284         }
       
   285     else if ( camera == ECamActiveCameraSecondary )
       
   286         {
       
   287         zoomKeyFound = ( KErrNotFound != 
       
   288                          iSecondaryZoomInKeys.Find( aKeyEvent.iScanCode ) );
       
   289         if ( !zoomKeyFound )
       
   290             {
       
   291             // Its not zoom-in key, check if its zoom out key
       
   292             zoomKeyFound = ( KErrNotFound != 
       
   293                              iSecondaryZoomOutKeys.Find( aKeyEvent.iScanCode ) );
       
   294             }        
       
   295         }
       
   296     else
       
   297         {
       
   298         // when we reach here, it means we have no zoom keys set, we return back.
       
   299         }
       
   300     return zoomKeyFound;
       
   301     }
       
   302 
       
   303 
       
   304 // ---------------------------------------------------------
       
   305 // CCamContainerBase::IsZoomKeyL
       
   306 // Whether or not this key is considered to be a shutter key
       
   307 // in the current context
       
   308 // ---------------------------------------------------------
       
   309 //
       
   310 TBool CCamContainerBase::IsZoomKeyL( const TKeyEvent& aKeyEvent,
       
   311                                         TEventCode aType ) 
       
   312     {
       
   313     PRINT1( _L( "Camera => CCamContainerBase::IsZoomKeyL event type (%d)" ),  aType );  
       
   314 
       
   315     CCamZoomPane* zoom = static_cast<CCamAppUiBase*>( iEikonEnv->EikAppUi() )->ZoomPane();    	
       
   316     
       
   317     // 
       
   318     if( !ZoomAvailable() )
       
   319     	{
       
   320     	return EFalse;
       
   321     	}
       
   322   	
       
   323   	PRINT( _L( "Camera => CCamContainerBase::IsZoomKeyL " ) );  
       
   324 
       
   325     // It's a possible zoom key if it's an up OR down event, OR
       
   326     // if it's a key event AND we're currently zooming 
       
   327     if ( aType == EEventKeyUp || aType == EEventKeyDown || aType == EEventUser ||
       
   328          ( aType == EEventKey && 
       
   329            zoom &&
       
   330            zoom->IsCurrentlyZooming() ) )
       
   331         {
       
   332         PRINT( _L( "Camera => CCamContainerBase::IsZoomKeyL A" ) )
       
   333         return CheckForZoomKey( aKeyEvent );
       
   334         }
       
   335 	     
       
   336 	PRINT( _L( "Camera => CCamContainerBase::IsZoomKeyL no" ) )
       
   337     return EFalse;
       
   338     }
       
   339 
       
   340 
       
   341 //
       
   342 // CCamContainerBase::ZoomAvailable()
       
   343 //
       
   344 TBool CCamContainerBase::ZoomAvailable()
       
   345 	{
       
   346 	PRINT( _L("Camera => CCamContainerBase::ZoomAvailable"))
       
   347 
       
   348 	// Ignore any zoom keys that come when either capturing a burst or still
       
   349   if ( iController.SequenceCaptureInProgress() 
       
   350     || ( ECamControllerImage == iController.CurrentMode()
       
   351       && ECamCapturing       == iController.CurrentOperation() ) 
       
   352     || ECamCompleting == iController.CurrentOperation()  )
       
   353     {
       
   354     PRINT( _L("Camera => CCamContainerBase::ZoomAvailable A false"))
       
   355     return EFalse;
       
   356     }
       
   357 	PRINT( _L("Camera => CCamContainerBase::ZoomAvailable yes"))
       
   358 	return ETrue;
       
   359 	}
       
   360 
       
   361 // ---------------------------------------------------------------------------
       
   362 // Window
       
   363 // ---------------------------------------------------------------------------
       
   364 //
       
   365 RWindow& 
       
   366 CCamContainerBase::Window() const
       
   367   {
       
   368   return CCoeControl::Window();
       
   369   }
       
   370 
       
   371 
       
   372 // ----------------------------------------------------
       
   373 // CCamContainerBase::OfferKeyEventL
       
   374 // Handles this application view's command keys. Forwards other
       
   375 // keys to child control(s).
       
   376 // ----------------------------------------------------
       
   377 //
       
   378 TKeyResponse 
       
   379 CCamContainerBase::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   380                                          TEventCode aType )
       
   381   {
       
   382   PRINT1( _L("Camera => CCamContainerBase::OfferKeyEventL scan code (%d)"), aKeyEvent.iScanCode )
       
   383   // if the cancel softkey is pressed
       
   384   if ( aKeyEvent.iScanCode == EStdKeyDevice1 )
       
   385     {        
       
   386     iView.HandleCommandL( EAknSoftkeyCancel );
       
   387     }
       
   388   // or if the select (OK) key is pressed
       
   389   //
       
   390   // (Note: intentionally ignoring repeat key presses here - this is a
       
   391   // work-around as the framework is passing navi-key select repeats
       
   392   // which we have to ignore)
       
   393   else if ( aType == EEventKey && 
       
   394             aKeyEvent.iCode == EKeyOK && 
       
   395             aKeyEvent.iRepeats == 0 )
       
   396     {
       
   397     iView.HandleCommandL( EAknSoftkeySelect );
       
   398     return EKeyWasConsumed; // indicate key press was processed
       
   399     }
       
   400     // stop video or sequence if get applications key press (short or long)
       
   401     // in touch also send key stops
       
   402   else if( aKeyEvent.iCode == EKeyApplication ||
       
   403          ( iController.IsTouchScreenSupported() && 
       
   404            aKeyEvent.iScanCode == EStdKeyYes ) ) 
       
   405   	{
       
   406     if ( ECamControllerVideo == iController.CurrentMode() )
       
   407       {
       
   408       TCamCaptureOperation operation = iController.CurrentOperation();
       
   409       if( ECamCapturing == operation
       
   410        || ECamPaused    == operation )
       
   411         {
       
   412         // Stop video 
       
   413         iController.StopVideoRecording();
       
   414         }
       
   415       }
       
   416     else if ( iController.SequenceCaptureInProgress() )
       
   417       {
       
   418       // Stop sequence capture
       
   419       iController.StopSequenceCaptureL();
       
   420       }
       
   421     else
       
   422     	{
       
   423     	// empty statement to remove Lint error, MISRA required rule 60
       
   424     	}
       
   425   	}
       
   426   else
       
   427     {
       
   428     // empty statement to remove Lint error, MISRA required rule 60
       
   429     }
       
   430 
       
   431   return EKeyWasNotConsumed;  // indicate key press was not processed
       
   432   }
       
   433 
       
   434 // ----------------------------------------------------
       
   435 // CCamContainerBase::HandleForegroundEventL
       
   436 // Called to notify of change of app fore/background state
       
   437 // ----------------------------------------------------
       
   438 //
       
   439 void CCamContainerBase::HandleForegroundEventL( TBool /*aForeground*/ )
       
   440     {
       
   441     }
       
   442 
       
   443 // ---------------------------------------------------------------------------
       
   444 // CCamContainerBase::MopSupplyObject
       
   445 // Gets an object whose type is encapsulated by the specified TTypeUid object
       
   446 // Supplies the skin context to child controls using the MObjectProvider chain
       
   447 // ---------------------------------------------------------------------------
       
   448 //
       
   449 TTypeUid::Ptr CCamContainerBase::MopSupplyObject( TTypeUid aId )
       
   450     {
       
   451     if ( aId.iUid == MAknsControlContext::ETypeId )
       
   452         {
       
   453         return MAknsControlContext::SupplyMopObject( aId, iBgContext );
       
   454         }
       
   455     return CCoeControl::MopSupplyObject( aId );
       
   456     }
       
   457 
       
   458 // ----------------------------------------------------
       
   459 // CCamContainerBase::HandleResourceChange
       
   460 // Change Client Rect and redraw when resolution changes
       
   461 // ----------------------------------------------------
       
   462 //
       
   463 void CCamContainerBase::HandleResourceChange( TInt aType )
       
   464     {
       
   465     PRINT( _L("Camera => CCamContainerBase::HandleResourceChange" ))
       
   466     
       
   467     CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->EikAppUi() );
       
   468     if ( KEikDynamicLayoutVariantSwitch == aType )
       
   469         {
       
   470 	    TCamOrientation orientation = appUi->CamOrientation();
       
   471 
       
   472         if( iCamOrientation != orientation )
       
   473             {
       
   474             iCamOrientation = orientation;
       
   475             if( orientation == ECamOrientationCamcorder || orientation == ECamOrientationCamcorderLeft )
       
   476                 {
       
   477                 PRINT( _L("Camera => CCamContainerBase::HandleResourceChange camcorder" ))
       
   478                 SetRect( appUi->ApplicationRect() );
       
   479                 }
       
   480             else
       
   481                 {
       
   482                 PRINT( _L("Camera => CCamContainerBase::HandleResourceChange not camcorder" ))
       
   483                 SetRect( appUi->ClientRect() );
       
   484                 }
       
   485             }
       
   486         }
       
   487             
       
   488     CCoeControl::HandleResourceChange( aType );
       
   489     if ( iController.IsTouchScreenSupported() ) 
       
   490         {
       
   491         // Update toolbar because HandleResourceChange might reload the default version
       
   492         // Only update toolbaricons if in precaptureview.
       
   493         if( appUi->CurrentViewState() != ECamViewStatePostCapture )
       
   494             {
       
   495             TRAP_IGNORE( static_cast<CCamViewBase&>( iView ).UpdateToolbarIconsL() );
       
   496             }
       
   497         }  
       
   498     }
       
   499 
       
   500 
       
   501 // virtual 
       
   502 void 
       
   503 CCamContainerBase::HandleAppEvent( const TCamAppEvent& /*aEvent*/ )
       
   504   {
       
   505   // No action
       
   506   }
       
   507 
       
   508 
       
   509 // ---------------------------------------------------------------------------
       
   510 // CCamContainerBase::SetPreviousViewId
       
   511 // Sets the ID of the previous view
       
   512 // ---------------------------------------------------------------------------
       
   513 //
       
   514 void CCamContainerBase::SetPreviousViewId( TCamAppViewIds aId )
       
   515     {
       
   516     iPrevViewId = aId;
       
   517     }
       
   518 
       
   519 
       
   520 // ---------------------------------------------------------
       
   521 // CCamContainerBase::SetupNaviPanesL
       
   522 // Set up navi-pane and progress bar if required
       
   523 // ---------------------------------------------------------
       
   524 //    
       
   525 void CCamContainerBase::SetupNaviPanesL( TCamActiveNaviPane aNaviPane )
       
   526 	{
       
   527 	PRINT( _L("Camera => CCamContainerBase::SetupNaviPanesL" ))
       
   528 	TRect rect( Rect() );
       
   529 	
       
   530 	if( aNaviPane == ECamPaneCounter )
       
   531 		{
       
   532         iNaviCounterControl = 
       
   533             static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() )->NaviCounterControl();
       
   534 	    iNaviCounterControl->SetMopParent( this );
       
   535 	    iNaviCounterControl->SetContainerWindowL( *this );  
       
   536 	    iNaviCounterControl->SetRect( Rect() );            
       
   537 	    iNaviCounterControl->MakeVisible( ETrue );
       
   538         if ( iNaviProgressBarControl )
       
   539             {
       
   540             iNaviProgressBarControl->MakeVisible( EFalse );
       
   541             }
       
   542 
       
   543 	    iPaneInUse = ECamPaneCounter;
       
   544 		}
       
   545 	else if( aNaviPane == ECamPaneProgress )
       
   546 		{
       
   547 		PRINT( _L("Camera => CCamContainerBase::SetupNaviPanesL progress" ))
       
   548         iNaviProgressBarControl = 
       
   549             static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() )->NaviProgressBarControl();
       
   550 	    iNaviProgressBarControl->SetMopParent( this );
       
   551 	    iNaviProgressBarControl->SetContainerWindowL( *this );            
       
   552 	    iNaviProgressBarControl->SetRect( Rect() );            
       
   553 	    iNaviProgressBarControl->MakeVisible( ETrue );    
       
   554         if ( iNaviCounterControl )
       
   555             {
       
   556             iNaviCounterControl->MakeVisible( EFalse );
       
   557             }
       
   558 
       
   559 	    iPaneInUse = ECamPaneProgress;
       
   560 		}
       
   561 	else
       
   562 		{
       
   563 		iPaneInUse = ECamPaneUndefined;
       
   564 		}
       
   565 	PRINT( _L("Camera <= CCamContainerBase::SetupNaviPanesL" ))
       
   566 	}
       
   567 
       
   568 // ---------------------------------------------------------------------------
       
   569 // CCamContainerBase::ShowZoomPaneWithTimer
       
   570 // Makes Zoom Pane visible for the period of the pane timer.
       
   571 // ---------------------------------------------------------------------------
       
   572 //
       
   573 void CCamContainerBase::ShowZoomPaneWithTimer()
       
   574     {
       
   575     // No implementation: only meaningful in pre-capture modes
       
   576     PRINT(_L("Camera => CCamContainerBase::ShowZoomPaneWithTimer() - No implementation!"));
       
   577     }
       
   578 
       
   579 // ---------------------------------------------------------------------------
       
   580 // CCamContainerBase::CreateActivePaletteL
       
   581 // Creates the Active Palette control
       
   582 // ---------------------------------------------------------------------------
       
   583 //
       
   584 void CCamContainerBase::CreateActivePaletteL()
       
   585     {
       
   586     CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
       
   587     appUi->APHandler()->CreateActivePaletteL( *this, this );
       
   588     iActivePalette = appUi->ActivePalette();
       
   589     }
       
   590 
       
   591 // ---------------------------------------------------------------------------
       
   592 // CCamContainerBase::DestroyActivePaletteL
       
   593 // Destroys the Active Palette control
       
   594 // ---------------------------------------------------------------------------
       
   595 //
       
   596 void CCamContainerBase::DestroyActivePalette()
       
   597     {
       
   598     CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
       
   599     appUi->APHandler()->DestroyActivePalette();
       
   600     iActivePalette = NULL;
       
   601     }
       
   602 
       
   603 // -----------------------------------------------------------------------------
       
   604 // CCamContainerBase::Redraw
       
   605 // -----------------------------------------------------------------------------
       
   606 void CCamContainerBase::Redraw(const TRect& /*aArea*/)
       
   607     {
       
   608     // Do nothing by default; may be overridden
       
   609     }
       
   610    	
       
   611 
       
   612 
       
   613 // -----------------------------------------------------------------------------
       
   614 // CCamContainerBase::PrepareProcessingTextL
       
   615 // -----------------------------------------------------------------------------
       
   616 //   
       
   617 void CCamContainerBase::PrepareProcessingTextL( TBool aStillMode )
       
   618     { 
       
   619     TAknLayoutRect vidProgressPane;
       
   620     
       
   621     TInt cba =  AknLayoutUtils::CbaLocation() == 
       
   622                 AknLayoutUtils::EAknCbaLocationLeft? 
       
   623                 AknLayoutUtils::EAknCbaLocationLeft : 0;
       
   624     
       
   625     if ( CamUtility::IsNhdDevice() )
       
   626         {
       
   627         vidProgressPane.LayoutRect( Rect(),
       
   628                 AknLayoutScalable_Apps::vid4_progress_pane( 
       
   629                 Layout_Meta_Data::IsLandscapeOrientation() ) );
       
   630                 
       
   631         iProcessingTextLayout.LayoutText( vidProgressPane.Rect(), 
       
   632                 AknLayoutScalable_Apps::vid4_progress_pane_t3());  
       
   633         }
       
   634     else
       
   635         {
       
   636         vidProgressPane.LayoutRect( Rect(), 
       
   637                 AknLayoutScalable_Apps::vid6_indi_pane( cba ) ); 
       
   638                 
       
   639         iProcessingTextLayout.LayoutText( vidProgressPane.Rect(), 
       
   640                 AknLayoutScalable_Apps::vid6_indi_pane_t4( 2 ));  
       
   641         }
       
   642         
       
   643     // Delete old text 
       
   644     if( iProcessingText )
       
   645         {
       
   646         delete iProcessingText;
       
   647         iProcessingText = NULL;  
       
   648         }
       
   649     if( aStillMode )
       
   650         {
       
   651         iProcessingText = StringLoader::LoadL( R_QTN_PROCESSING_IMAGE_TEXT );  
       
   652         }        
       
   653 /*        
       
   654     else
       
   655         {
       
   656         iProcessingText = StringLoader::LoadL( R_QTN_PROCESSING_VIDEO_TEXT );  
       
   657         }                    
       
   658 */        
       
   659     }
       
   660     
       
   661 // -----------------------------------------------------------------------------
       
   662 // CCamContainerBase::DismissProcessingTextL
       
   663 // -----------------------------------------------------------------------------
       
   664 //     
       
   665 void CCamContainerBase::DismissProcessingText()
       
   666     {
       
   667     delete iProcessingText;
       
   668     iProcessingText = NULL;
       
   669     }    
       
   670     
       
   671 // -----------------------------------------------------------------------------
       
   672 // CCamContainerBase::PrepareBurstProcessingTextL
       
   673 // -----------------------------------------------------------------------------
       
   674 //   
       
   675 void CCamContainerBase::PrepareBurstProcessingTextL()
       
   676     {
       
   677     PRINT( _L("Camera => CCamContainerBase::PrepareBurstProcessingTextL" ))	
       
   678     TAknLayoutRect vidProgressPane;  
       
   679     
       
   680     TInt cba =  AknLayoutUtils::CbaLocation() == 
       
   681                 AknLayoutUtils::EAknCbaLocationLeft? 
       
   682                 AknLayoutUtils::EAknCbaLocationLeft : 0;
       
   683     
       
   684     
       
   685     if ( CamUtility::IsNhdDevice() )
       
   686         {
       
   687         vidProgressPane.LayoutRect(
       
   688                 Rect(),
       
   689                 AknLayoutScalable_Apps::vid4_progress_pane( 
       
   690                         Layout_Meta_Data::IsLandscapeOrientation() ) );
       
   691 
       
   692         iBurstProcessingTextLayout.LayoutText( 
       
   693                 vidProgressPane.Rect(), 
       
   694                 AknLayoutScalable_Apps::vid4_progress_pane_t3() );  
       
   695         }
       
   696     else
       
   697         {
       
   698         
       
   699         vidProgressPane.LayoutRect(
       
   700                 Rect(),
       
   701                 AknLayoutScalable_Apps::vid6_indi_pane( cba ) );
       
   702                 
       
   703         iBurstProcessingTextLayout.LayoutText( 
       
   704                 vidProgressPane.Rect(), 
       
   705                 AknLayoutScalable_Apps::vid6_indi_pane_t4( 2 ) );
       
   706         
       
   707         }
       
   708     
       
   709     // Delete old text 
       
   710     if( iBurstProcessingText )
       
   711         {
       
   712         delete iBurstProcessingText;
       
   713         iBurstProcessingText = NULL;  
       
   714         }
       
   715     iBurstProcessingText = StringLoader::LoadL( 
       
   716                            R_QTN_PROCESSING_IMAGE_TEXT );
       
   717     PRINT( _L("Camera <= CCamContainerBase::PrepareBurstProcessingTextL" ))	                       
       
   718     }
       
   719  
       
   720 // -----------------------------------------------------------------------------
       
   721 // CCamContainerBase::UpdateBurstProcessingTextL
       
   722 // -----------------------------------------------------------------------------
       
   723 //   
       
   724 void CCamContainerBase::UpdateBurstProcessingTextL( TInt aHandled, TInt aTotal )
       
   725     {
       
   726     PRINT( _L("Camera => CCamContainerBase::UpdateBurstProcessingTextL" ))		
       
   727 
       
   728     // Delete old text 
       
   729     if( iBurstProcessingText )
       
   730         {
       
   731         delete iBurstProcessingText;
       
   732         iBurstProcessingText = NULL;  
       
   733         }
       
   734     CDesCArrayFlat* values 
       
   735     = new (ELeave) CDesCArrayFlat( 2 );
       
   736 
       
   737     CleanupStack::PushL( values );
       
   738     
       
   739     TBuf<KCamBurstCounterLength> handled;
       
   740     TBuf<KCamBurstCounterLength> total;
       
   741     handled.Format( KCamBurstCounterFormat, aHandled );
       
   742     total.Format( KCamBurstCounterFormat, aTotal );
       
   743     
       
   744     values->AppendL( handled );
       
   745     values->AppendL( total );
       
   746 
       
   747 #ifndef __WINS__
       
   748     iBurstProcessingText = StringLoader::LoadL( 
       
   749             R_QTN_PROCESSING_BURST_IMAGE_TEXT, *values );
       
   750 #endif
       
   751     
       
   752     CleanupStack::PopAndDestroy( values );                           
       
   753     PRINT( _L("Camera <= CCamContainerBase::UpdateBurstProcessingTextL" ))		                           
       
   754     }
       
   755     
       
   756 // -----------------------------------------------------------------------------
       
   757 // CCamContainerBase::DismissBurstProcessingText
       
   758 // -----------------------------------------------------------------------------
       
   759 //     
       
   760 void CCamContainerBase::DismissBurstProcessingText()
       
   761     {
       
   762     delete iBurstProcessingText;
       
   763     iBurstProcessingText = NULL;
       
   764     }    
       
   765         
       
   766 // ----------------------------------------------------
       
   767 // CCamContainerBase::CheckForFileName
       
   768 // 
       
   769 // ----------------------------------------------------
       
   770 //
       
   771 void CCamContainerBase::CheckForFileName( TBool aDoCheck )
       
   772     {
       
   773     }
       
   774 
       
   775 // -----------------------------------------------------------------------------
       
   776 // CCamContainerBase::CreateBackgroundContextL
       
   777 // -----------------------------------------------------------------------------
       
   778 //     
       
   779 void CCamContainerBase::CreateBackgroundContextL()
       
   780     {
       
   781     if( iCamOrientation == ECamOrientationCamcorder ||
       
   782         iCamOrientation == ECamOrientationCamcorderLeft )
       
   783         {
       
   784         iBgContext = CAknsBasicBackgroundControlContext::NewL( 
       
   785             KAknsIIDQsnBgScreen, Rect(), EFalse );
       
   786         }
       
   787     else
       
   788         {
       
   789         iBgContext = CAknsBasicBackgroundControlContext::NewL( 
       
   790             KAknsIIDQsnBgAreaMain, Rect(), EFalse );
       
   791         }
       
   792     }
       
   793 
       
   794 // -----------------------------------------------------------------------------
       
   795 // CCamContainerBase::ViewFinderFrameRect
       
   796 // -----------------------------------------------------------------------------
       
   797 //     
       
   798 TRect
       
   799 CCamContainerBase::ViewFinderFrameRect(TCamCameraMode aTargetMode) const   
       
   800     {
       
   801     PRINT( _L("Camera => CCamContainerBase::ViewFinderFrameRect") );
       
   802     const TCamAppViewIds viewId = static_cast<TCamAppViewIds>( iView.Id().iUid );
       
   803 
       
   804     TCamCameraMode cameraMode = (aTargetMode != ECamControllerIdle)
       
   805                                         ? aTargetMode
       
   806                                         : iController.CurrentMode();
       
   807     
       
   808     // In post capture view both target and current mode can be in idle mode, which
       
   809     // would cause the use of invalid viewfinder layouts
       
   810     if ( viewId == ECamViewIdVideoPostCapture && cameraMode == ECamControllerIdle )
       
   811         {
       
   812         cameraMode = ECamControllerVideo;
       
   813         }
       
   814     else if ( viewId == ECamViewIdStillPostCapture && cameraMode == ECamControllerIdle  )
       
   815         {
       
   816         cameraMode = ECamControllerImage;
       
   817         }
       
   818     
       
   819     const TInt resolution = (cameraMode == ECamControllerVideo)
       
   820                                 ? iController.GetCurrentVideoResolution()
       
   821                                 : iController.GetCurrentImageResolution();
       
   822 
       
   823     TRect rect = CamUtility::ViewfinderLayout( cameraMode, resolution );
       
   824     PRINT( _L("Camera <= CCamContainerBase::ViewFinderFrameRect") );
       
   825     return rect;
       
   826     }
       
   827 
       
   828 // -----------------------------------------------------------------------------
       
   829 // CCamContainerBase::IsPrimaryCameraCaptureKey
       
   830 // -----------------------------------------------------------------------------
       
   831 //     
       
   832 TBool CCamContainerBase::IsPrimaryCameraCaptureKey( const TKeyEvent& aKeyEvent ) const
       
   833     {
       
   834     TBool isCapturekey( KErrNotFound != iPrimaryCameraCaptureKeys.Find( aKeyEvent.iScanCode ) );
       
   835     CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
       
   836     if ( appUi 
       
   837          && ( !appUi->IsToolBarVisible() || !appUi->DrawPreCaptureCourtesyUI() )
       
   838          && ( aKeyEvent.iScanCode == EStdKeyDevice3
       
   839               || aKeyEvent.iScanCode == EStdKeyEnter
       
   840               || aKeyEvent.iScanCode == EStdKeyNkpEnter ) )
       
   841         {
       
   842         isCapturekey = ETrue;
       
   843         }
       
   844     return isCapturekey;
       
   845     }
       
   846 
       
   847 // -----------------------------------------------------------------------------
       
   848 // CCamContainerBase::IsSecondaryCameraCaptureKey
       
   849 // -----------------------------------------------------------------------------
       
   850 //     
       
   851 TBool CCamContainerBase::IsSecondaryCameraCaptureKey( const TKeyEvent& aKeyEvent ) const
       
   852     {
       
   853     TBool isCapturekey( KErrNotFound != iSecondaryCameraCaptureKeys.Find( aKeyEvent.iScanCode ) );
       
   854     CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
       
   855     if ( appUi 
       
   856          && !appUi->IsToolBarVisible()
       
   857          && ( aKeyEvent.iScanCode == EStdKeyDevice3
       
   858               || aKeyEvent.iScanCode == EStdKeyEnter
       
   859               || aKeyEvent.iScanCode == EStdKeyNkpEnter ))
       
   860         {
       
   861         isCapturekey = ETrue;
       
   862         }
       
   863     return isCapturekey;            
       
   864     }
       
   865 
       
   866 // -----------------------------------------------------------------------------
       
   867 // CCamContainerBase::CountComponentControls
       
   868 // -----------------------------------------------------------------------------
       
   869 //
       
   870 TInt CCamContainerBase::CountComponentControls() const
       
   871     {
       
   872     TInt index = 0;
       
   873     if(iBackupContainer)
       
   874         index++;
       
   875     return index;
       
   876     }
       
   877 
       
   878 // -----------------------------------------------------------------------------
       
   879 // CCamContainerBase::ComponentControl
       
   880 // -----------------------------------------------------------------------------
       
   881 //
       
   882 CCoeControl* CCamContainerBase::ComponentControl(TInt aIndex) const
       
   883     {
       
   884     CCoeControl* control = NULL;
       
   885      switch(aIndex)
       
   886          {
       
   887          case 0:
       
   888              {
       
   889              control = iBackupContainer;
       
   890              }
       
   891              break;
       
   892          default:
       
   893              break;
       
   894          }
       
   895     return control; 
       
   896     }
       
   897 
       
   898 // ---------------------------------------------------------
       
   899 // CCamCaptureSetupContainer::ReserveAndStartVF
       
   900 // ---------------------------------------------------------
       
   901 //
       
   902 void CCamContainerBase::ReserveAndStartVF()
       
   903     {
       
   904     PRINT ( _L("Camera => CCamContainerBase::ReserveAndStartVF") );
       
   905     TCamCameraMode mode = iController.CurrentMode();
       
   906     if(iController.IsAppUiAvailable())
       
   907         {
       
   908         TVwsViewId currentViewId;
       
   909         CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   910         appUi->GetActiveViewId( currentViewId );
       
   911         switch ( currentViewId.iViewUid.iUid )
       
   912             {
       
   913             case ECamViewIdPhotoUserSceneSetup:
       
   914             case ECamViewIdStillPreCapture:
       
   915                 {
       
   916                 mode = ECamControllerImage;
       
   917                 }
       
   918                 break;
       
   919             case ECamViewIdVideoPreCapture:
       
   920                 {
       
   921                 mode = ECamControllerVideo;
       
   922                 }
       
   923                 break;
       
   924             default:
       
   925                 {
       
   926                 //Assume imagemode if view cannot be determined.
       
   927                 if(mode==ECamControllerIdle)
       
   928                     {
       
   929                     mode = ECamControllerImage;                
       
   930                     }
       
   931                 }
       
   932                 break;
       
   933             }
       
   934         }
       
   935     //Don't reserve camera and start viewfinder if shutting down.
       
   936     if(mode!=ECamControllerShutdown)
       
   937         {
       
   938         iController.EnterViewfinderMode( mode );
       
   939         iController.StartIdleTimer();
       
   940         }
       
   941     PRINT ( _L("Camera <= CCamContainerBase::ReserveAndStartVF") );        
       
   942     }
       
   943 
       
   944 // End of File