camerauis/cameraapp/generic/src/CamAppui.cpp
branchRCL_3
changeset 11 792dfc98fb3b
parent 7 dbec5787fa68
child 12 8c55c525d5d7
equal deleted inserted replaced
7:dbec5787fa68 11:792dfc98fb3b
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    50 #include <hal.h>
    50 #include <hal.h>
    51 #include <hal_data.h>
    51 #include <hal_data.h>
    52 #include <oommonitorsession.h>
    52 #include <oommonitorsession.h>
    53 #include <driveinfo.h>
    53 #include <driveinfo.h>
    54 #include <pathinfo.h>
    54 #include <pathinfo.h>
    55 #include <accmonitor.h>
    55 #include <AccMonitor.h>
    56 
    56 
    57 #ifndef __WINSCW__
    57 #ifndef __WINSCW__
    58 //#include <SFIUtilsAppInterface.h>
    58 //#include <SFIUtilsAppInterface.h>
    59 #endif
    59 #endif
    60 
    60 
   378       {
   378       {
   379       // Without lens cover support, always start to primary camera
   379       // Without lens cover support, always start to primary camera
   380       CamUtility::GetPsiInt( ECamPsiPrimaryCameraOrientation, orientation );
   380       CamUtility::GetPsiInt( ECamPsiPrimaryCameraOrientation, orientation );
   381       }
   381       }
   382 
   382 
   383   // Finish engine construction    
       
   384   if( uiOrientationOverride )
       
   385     {
       
   386     iController.CompleteConstructionL();
       
   387     }
       
   388 
       
   389   if ( orientation == ( TInt ) EAppUiOrientationLandscape )
   383   if ( orientation == ( TInt ) EAppUiOrientationLandscape )
   390     {
   384     {
   391     PRINT( _L("Camera <> orientation is landscape ") )
   385     PRINT( _L("Camera <> orientation is landscape ") )
   392     iCamOrientation = (ECamHandLeft == iSoftkeyPosition ) 
   386     iCamOrientation = (ECamHandLeft == iSoftkeyPosition ) 
   393                     ? ECamOrientationCamcorderLeft 
   387                     ? ECamOrientationCamcorderLeft 
   394                     : ECamOrientationCamcorder;
   388                     : ECamOrientationCamcorder;
   395     if( uiOrientationOverride )
   389 
   396       {
       
   397       //set orientation to CCamera	
       
   398       iController.SetCameraOrientationModeL( iLandscapeScreenMode );
       
   399       // and complete the cameracontroller construction
       
   400       iController.CompleteCameraConstructionL();
       
   401       }
       
   402     PRINT( _L("Camera <> Calling BaseConstructL") )
   390     PRINT( _L("Camera <> Calling BaseConstructL") )
   403     OstTrace0( CAMERAAPP_PERFORMANCE, CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 1" ); //CCORAPP_APP_BASE_CONSTRUCT_START
   391     OstTrace0( CAMERAAPP_PERFORMANCE, CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 1" ); //CCORAPP_APP_BASE_CONSTRUCT_START
   404     BaseConstructL( EAppOrientationLandscape | EAknEnableSkin | EAknEnableMSK | 
   392     BaseConstructL( EAppOrientationLandscape | EAknEnableSkin | EAknEnableMSK | 
   405                     ENonStandardResourceFile | EAknSingleClickCompatible );
   393                     ENonStandardResourceFile | EAknSingleClickCompatible );
   406     OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 0" );    //CCORAPP_APP_BASE_CONSTRUCT_END
   394     OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 0" );    //CCORAPP_APP_BASE_CONSTRUCT_END
   407     PRINT( _L("Camera <> BaseConstructL Complete") )
   395     PRINT( _L("Camera <> BaseConstructL Complete") )
       
   396                             
       
   397     if( uiOrientationOverride )
       
   398       {
       
   399       // Finish engine construction
       
   400       iController.CompleteConstructionL();  
       
   401       //set orientation to CCamera	
       
   402       iController.SetCameraOrientationModeL( iLandscapeScreenMode );
       
   403       // and complete the cameracontroller construction
       
   404       iController.CompleteCameraConstructionL();
       
   405       }
   408     }
   406     }
   409   else
   407   else
   410     {
   408     {
   411     PRINT( _L("Camera <> orientation is portrait") )
   409     PRINT( _L("Camera <> orientation is portrait") )
   412     iCamOrientation = ECamOrientationPortrait;
   410     iCamOrientation = ECamOrientationPortrait;
   413     if( uiOrientationOverride )
   411     
   414       {
       
   415       //set orientation to CCamera	
       
   416       iController.SetCameraOrientationModeL( iPortraitScreenMode );
       
   417       // and complete the cameracontroller construction
       
   418       iController.CompleteCameraConstructionL();
       
   419       }     
       
   420     PRINT( _L("Camera <> Calling BaseConstructL") )
   412     PRINT( _L("Camera <> Calling BaseConstructL") )
   421     OstTrace0( CAMERAAPP_PERFORMANCE, DUP4_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 1" );
   413     OstTrace0( CAMERAAPP_PERFORMANCE, DUP4_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 1" );
   422     BaseConstructL( EAppOrientationPortrait | EAknEnableSkin | EAknEnableMSK | 
   414     BaseConstructL( EAppOrientationPortrait | EAknEnableSkin | EAknEnableMSK | 
   423                     ENonStandardResourceFile );  
   415                     ENonStandardResourceFile );  
   424     OstTrace0( CAMERAAPP_PERFORMANCE, DUP5_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 0" );
   416     OstTrace0( CAMERAAPP_PERFORMANCE, DUP5_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 0" );
   425     PRINT( _L("Camera <> BaseConstructL Complete") )
   417     PRINT( _L("Camera <> BaseConstructL Complete") )
       
   418     
       
   419     if( uiOrientationOverride )
       
   420       {
       
   421       // Finish engine construction
       
   422       iController.CompleteConstructionL();  
       
   423       //set orientation to CCamera	
       
   424       iController.SetCameraOrientationModeL( iPortraitScreenMode );
       
   425       // and complete the cameracontroller construction
       
   426       iController.CompleteCameraConstructionL();
       
   427       }     
   426     }
   428     }
   427 
   429 
   428     PERF_EVENT_END_L2( EPerfEventAvkonUIConstruction );
   430     PERF_EVENT_END_L2( EPerfEventAvkonUIConstruction );
   429 
   431 
   430 #if !defined (__WINSCW__)
   432 #if !defined (__WINSCW__)
  2383                                     R_CAM_VIDEO_PRECAPTURE_TOOLBAR_LANDSCAPE );
  2385                                     R_CAM_VIDEO_PRECAPTURE_TOOLBAR_LANDSCAPE );
  2384                 // Add toolbar observer. Needed in first boot to secondary
  2386                 // Add toolbar observer. Needed in first boot to secondary
  2385                 SetPreCaptureMode( ECamPreCapViewfinder ); 
  2387                 SetPreCaptureMode( ECamPreCapViewfinder ); 
  2386                 }
  2388                 }
  2387             iFirstBoot = EFalse;
  2389             iFirstBoot = EFalse;
  2388             iView->HandleCommandL( ECamCmdPopUpMenuZoom );
  2390             // Do not show zoom pane when toolbar extension is visible
       
  2391             if ( iController.IsTouchScreenSupported() )
       
  2392                 {
       
  2393                 CAknToolbar* toolbar = CurrentFixedToolbar();
       
  2394                 if ( toolbar )
       
  2395                     {
       
  2396                     CAknToolbarExtension* toolbarextension =
       
  2397                     toolbar->ToolbarExtension();
       
  2398                     if ( toolbarextension && !toolbarextension->IsShown() )
       
  2399                         {
       
  2400                         iView->HandleCommandL( ECamCmdPopUpMenuZoom );
       
  2401                         }
       
  2402                     }
       
  2403                 }
  2389             }
  2404             }
  2390         //Remaining recording time counter update needed when recording has stopped and
  2405         //Remaining recording time counter update needed when recording has stopped and
  2391         //show last captured video setting is off.
  2406         //show last captured video setting is off.
  2392         if( iNaviPaneCounterControl && !ShowPostCaptureView() && iMode == ECamControllerVideo )
  2407         if( iNaviPaneCounterControl && !ShowPostCaptureView() && iMode == ECamControllerVideo )
  2393             {
  2408             {
  2537                     PRINT( _L( "Camera <> ECamEventMediaFileChanged, notify shutdown" ) )
  2552                     PRINT( _L( "Camera <> ECamEventMediaFileChanged, notify shutdown" ) )
  2538                     HandleControllerEventL( ECamEventExitRequested, KErrNone );
  2553                     HandleControllerEventL( ECamEventExitRequested, KErrNone );
  2539                     }
  2554                     }
  2540                 }
  2555                 }
  2541             }
  2556             }
  2542  
       
  2543       if ( iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsLocationSupported() )
       
  2544           {
       
  2545           // If record location setting is on, stop location trail
       
  2546           if ( ECamViewStatePreCapture != iViewState && ECamLocationOn == iController.IntegerSettingValue( ECamSettingItemRecLocation ) )
       
  2547           	  {
       
  2548           	  PRINT( _L("Camera: Gallery notified and non pre-capture view, stop location trail") )
       
  2549           	  iController.StopLocationTrail();
       
  2550           	  }
       
  2551           else
       
  2552           	  {
       
  2553               PRINT1( _L("Camera: location trail not in use or view state (%d) is precapture"), iViewState )
       
  2554           	  }
       
  2555           }
       
  2556 
       
  2557         break;
  2557         break;
  2558         }
  2558         }
  2559     // -----------------------------------------------------
  2559     // -----------------------------------------------------
  2560     case ECamEventCameraChanged:
  2560     case ECamEventCameraChanged:
  2561         {
  2561         {
  3350           if ( iController.UiConfigManagerPtr()
  3350           if ( iController.UiConfigManagerPtr()
  3351                && iController.UiConfigManagerPtr()->IsOrientationSensorSupported() )
  3351                && iController.UiConfigManagerPtr()->IsOrientationSensorSupported() )
  3352           // Shut down the Sensor API object.
  3352           // Shut down the Sensor API object.
  3353           iController.UpdateSensorApiL(EFalse);
  3353           iController.UpdateSensorApiL(EFalse);
  3354 
  3354 
  3355           if ( iController.UiConfigManagerPtr() && 
       
  3356                iController.UiConfigManagerPtr()->IsLocationSupported() )
       
  3357               {
       
  3358         	  // If record location setting is on, stop location trail when losing focus
       
  3359         	  if ( AppInBackground( EFalse ) )
       
  3360         	      {
       
  3361         	      PRINT( _L("Camera: CCamAppUi::HandleWsEventL focus lost, stop location trail") )
       
  3362         	      iController.StopLocationTrail();
       
  3363         	      }
       
  3364               }
       
  3365 
       
  3366     #if !defined (__WINSCW__)
  3355     #if !defined (__WINSCW__)
  3367           // relinquish capture keys
  3356           // relinquish capture keys
  3368           UnRegisterCaptureKeys();    
  3357           UnRegisterCaptureKeys();    
  3369           
  3358           
  3370           RArray <TInt> halfCaptureKeys;
  3359           RArray <TInt> halfCaptureKeys;
  8143             {
  8132             {
  8144             // Check that iMode matches iTargetMode and that the corresponding
  8133             // Check that iMode matches iTargetMode and that the corresponding
  8145             // view is active.
  8134             // view is active.
  8146             if ( iMode == iTargetMode &&
  8135             if ( iMode == iTargetMode &&
  8147                 ( ( iMode == ECamControllerVideo && iView == iVideoCaptureView ) ||
  8136                 ( ( iMode == ECamControllerVideo && iView == iVideoCaptureView ) ||
  8148                   ( iMode == ECamControllerImage && iView == iStillCaptureView ) ) )
  8137                   ( iMode == ECamControllerImage && iView == iStillCaptureView ) ) &&
       
  8138                 ( iPreCaptureMode != ECamPreCapCaptureSetup ) && 
       
  8139                 ( iPreCaptureMode != ECamPreCapGenericSetting ) && 
       
  8140                 ( iPreCaptureMode != ECamPreCapSceneSetting ) )
  8149                 {
  8141                 {
  8150                 fixedToolbar->SetToolbarVisibility( ETrue );
  8142                 fixedToolbar->SetToolbarVisibility( ETrue );
  8151                 }
  8143                 }
  8152             else
  8144             else
  8153                 {
  8145                 {