camerauis/cameraapp/generic/src/CamAppController.cpp
changeset 1 f5ec9446e5bf
parent 0 1ddebce53859
child 3 8b2d6d0384b0
equal deleted inserted replaced
0:1ddebce53859 1:f5ec9446e5bf
    30 #include <hal_data.h>
    30 #include <hal_data.h>
    31 #include <pathinfo.h>
    31 #include <pathinfo.h>
    32 #include <barsread.h>
    32 #include <barsread.h>
    33 #include <AknUtils.h>
    33 #include <AknUtils.h>
    34 #include <akntoolbar.h>
    34 #include <akntoolbar.h>
    35 #include <ProductVariant.hrh>
       
    36 #include <centralrepository.h>
    35 #include <centralrepository.h>
    37 
    36 
    38 #include <ctsydomainpskeys.h>
    37 #include <ctsydomainpskeys.h>
    39 #include <ProfileEngineSDKCRKeys.h>
    38 #include <ProfileEngineSDKCRKeys.h>
    40 #include <sysutildomaincrkeys.h>
    39 #include <sysutildomaincrkeys.h>
   103 #include <cfcontextquery.h>
   102 #include <cfcontextquery.h>
   104 
   103 
   105 #include "camvideotime.h"
   104 #include "camvideotime.h"
   106 #include "CamGSInterface.h"
   105 #include "CamGSInterface.h"
   107 #include "CameraUiConfigManager.h"
   106 #include "CameraUiConfigManager.h"
       
   107 #include "camsnapshotrotator.h"
   108 #include <bitmaptransforms.h> 
   108 #include <bitmaptransforms.h> 
   109 
   109 
   110 #ifdef _DEBUG
   110 #ifdef _DEBUG
   111 #ifdef _AO_TRACKING
   111 #ifdef _AO_TRACKING
   112 struct CFakeActiveScheduler : public CActiveScheduler {
   112 struct CFakeActiveScheduler : public CActiveScheduler {
   591   
   591   
   592   if( iRotatorAo )
   592   if( iRotatorAo )
   593       {
   593       {
   594       delete iRotatorAo;
   594       delete iRotatorAo;
   595       }
   595       }
       
   596 
       
   597   delete iSnapShotRotator;
   596   PRINT( _L("Camera <= ~CCamAppController") );
   598   PRINT( _L("Camera <= ~CCamAppController") );
   597   }
   599   }
   598 
   600 
   599 
   601 
   600 // ---------------------------------------------------------------------------
   602 // ---------------------------------------------------------------------------
  2260 CCamAppController::SnapshotImage() const
  2262 CCamAppController::SnapshotImage() const
  2261   {
  2263   {
  2262   PRINT ( _L("Camera => CCamAppController::SnapshotImage") ); 
  2264   PRINT ( _L("Camera => CCamAppController::SnapshotImage") ); 
  2263   PRINT1( _L("Camera <> CCamAppController::SnapshotImage .. current image index: %d"), iCurrentImageIndex ); 
  2265   PRINT1( _L("Camera <> CCamAppController::SnapshotImage .. current image index: %d"), iCurrentImageIndex ); 
  2264   PRINT1( _L("Camera => CCamAppController::SnapshotImage .. saved current image: %d"), SavedCurrentImage() ); 
  2266   PRINT1( _L("Camera => CCamAppController::SnapshotImage .. saved current image: %d"), SavedCurrentImage() ); 
       
  2267 
       
  2268   if ( iSnapShotRotator->IsActive() )
       
  2269     {
       
  2270     // Avoid flickering. Do not show original snapshot, if it needs to be rotated
       
  2271     PRINT( _L("Camera <= CCamAppController::SnapshotImage - return null") );
       
  2272     return NULL;
       
  2273     }
  2265 
  2274 
  2266   //Sometime burst capture array includes more than one image in single capture mode, 
  2275   //Sometime burst capture array includes more than one image in single capture mode, 
  2267   //so just display the latest image here.
  2276   //so just display the latest image here.
  2268   CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); 
  2277   CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); 
  2269   if ( BurstCaptureArray()->Count() > 1 && !appUi->IsBurstEnabled() )
  2278   if ( BurstCaptureArray()->Count() > 1 && !appUi->IsBurstEnabled() )
  4729   iIdleTimer             = CCamTimer::NewL( KIdleTimeout, 
  4738   iIdleTimer             = CCamTimer::NewL( KIdleTimeout, 
  4730                                             TCallBack( CCamAppController::IdleTimeoutL, this ) );
  4739                                             TCallBack( CCamAppController::IdleTimeoutL, this ) );
  4731   iImageSaveActive       = CCamImageSaveActive::NewL( *this , *this );        
  4740   iImageSaveActive       = CCamImageSaveActive::NewL( *this , *this );        
  4732   iCaptureArray          = CCamBurstCaptureArray::NewL( *iImageSaveActive );
  4741   iCaptureArray          = CCamBurstCaptureArray::NewL( *iImageSaveActive );
  4733   iRotationArray         = CCamBurstCaptureArray::NewL( *iImageSaveActive );
  4742   iRotationArray         = CCamBurstCaptureArray::NewL( *iImageSaveActive );
       
  4743   iSnapShotRotator       = CCamSnapShotRotator::NewL( *this );
  4734   iSequenceFilenameArray = new( ELeave ) CDesCArraySeg( KTimelapseArrayGranularity );
  4744   iSequenceFilenameArray = new( ELeave ) CDesCArraySeg( KTimelapseArrayGranularity );
  4735   iSoundPlayer           = CCamAudioPlayerController::NewL( *this, *this );
  4745   iSoundPlayer           = CCamAudioPlayerController::NewL( *this, *this );
  4736 
  4746 
  4737   if ( iConfigManager && iConfigManager->IsLensCoverSupported() )
  4747   if ( iConfigManager && iConfigManager->IsLensCoverSupported() )
  4738        {
  4748        {
  6180   else
  6190   else
  6181     {
  6191     {
  6182     PRINT( _L("Camera <> CCamAppController: status in KErrNone..") );
  6192     PRINT( _L("Camera <> CCamAppController: status in KErrNone..") );
  6183     __ASSERT_ALWAYS( aBitmap, CamPanic( ECamPanicNullPointer ) );
  6193     __ASSERT_ALWAYS( aBitmap, CamPanic( ECamPanicNullPointer ) );
  6184 
  6194 
  6185           
  6195     if( iInfo.iActiveCamera == ECamActiveCameraSecondary &&
       
  6196         iCaptureOrientation == ECamOrientation90 &&
       
  6197         ECamSettOn == iSettingsModel->IntegerSettingValue( ECamSettingItemImageRotation ) &&
       
  6198         ECamSettOn == IntegerSettingValue( ECamSettingItemShowCapturedPhoto ) )
       
  6199         {
       
  6200         PRINT( _L( "Camera <> Rotate portrait secondary camera snapshot image 180 degrees" ) )
       
  6201         TRAP_IGNORE( iSnapShotRotator->RotateL( aBitmap ) );
       
  6202         }
       
  6203      
  6186     CopySnapshotIfNeeded( *aBitmap, aStatus );
  6204     CopySnapshotIfNeeded( *aBitmap, aStatus );
  6187      
  6205      
  6188     // Removed filename reservation when snapshot arrives.
  6206     // Removed filename reservation when snapshot arrives.
  6189     // From now on, it's always done in HandleImageCaptureEvent,
  6207     // From now on, it's always done in HandleImageCaptureEvent,
  6190     // even if snapshot comes first.
  6208     // even if snapshot comes first.
  6324           }
  6342           }
  6325         PRINT1( _L("Camera <> CCamAppController::HandleImageCaptureEventL array count:%d"), BurstCaptureArray()->Count() );  
  6343         PRINT1( _L("Camera <> CCamAppController::HandleImageCaptureEventL array count:%d"), BurstCaptureArray()->Count() );  
  6326         // check if snapshot bitmap needs to be rotated before creating a thumbnail from it
  6344         // check if snapshot bitmap needs to be rotated before creating a thumbnail from it
  6327         TBool rotate( ECamSettOn == iSettingsModel->IntegerSettingValue( ECamSettingItemImageRotation ) &&
  6345         TBool rotate( ECamSettOn == iSettingsModel->IntegerSettingValue( ECamSettingItemImageRotation ) &&
  6328                       ECamSettOn == IntegerSettingValue( ECamSettingItemShowCapturedPhoto ) &&
  6346                       ECamSettOn == IntegerSettingValue( ECamSettingItemShowCapturedPhoto ) &&
  6329                       iCaptureOrientation != ECamOrientation0 &&
  6347                       iCaptureOrientation != ECamOrientation0 );
  6330                       iInfo.iActiveCamera == ECamActiveCameraPrimary );
  6348 
  6331         if ( ECamImageCaptureBurst != iInfo.iImageMode )
  6349         if ( ECamImageCaptureBurst != iInfo.iImageMode )
  6332           {
  6350           {
  6333           //create thumbnail or rotate first if needed
  6351           //create thumbnail or rotate first if needed
  6334           if ( iConfigManager && iConfigManager->IsThumbnailManagerAPISupported() )
  6352           if ( iConfigManager && iConfigManager->IsThumbnailManagerAPISupported() )
  6335               {
  6353               {
  7335 void CCamAppController::LoadSecondaryCameraSettingsL()
  7353 void CCamAppController::LoadSecondaryCameraSettingsL()
  7336   {
  7354   {
  7337   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPCONTROLLER_LOADSECONDARYCAMERASETTINGSL, "e_CCamAppController_LoadSecondaryCameraSettingsL 1" );
  7355   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPCONTROLLER_LOADSECONDARYCAMERASETTINGSL, "e_CCamAppController_LoadSecondaryCameraSettingsL 1" );
  7338   PRINT( _L("Camera => CCamAppController::LoadSecondaryCameraSettingsL" ))
  7356   PRINT( _L("Camera => CCamAppController::LoadSecondaryCameraSettingsL" ))
  7339   iSettingsModel->StorePrimaryCameraSettingsL();
  7357   iSettingsModel->StorePrimaryCameraSettingsL();
       
  7358   iSettingsModel->StoreUserSceneSettingsL();
  7340 
  7359 
  7341   PRINT( _L("Camera <> CCamAppController::LoadSecondaryCameraSettingsL B" ))
  7360   PRINT( _L("Camera <> CCamAppController::LoadSecondaryCameraSettingsL B" ))
  7342   
  7361   
  7343   SetIntegerSettingValueL( ECamSettingItemPhotoQuality, 
  7362   SetIntegerSettingValueL( ECamSettingItemPhotoQuality, 
  7344                            iConfiguration->SecondaryCameraImageQuality() );
  7363                            iConfiguration->SecondaryCameraImageQuality() );
  7503     {
  7522     {
  7504     PRINT( _L("Camera => CCamAppController::SetImageOrientationL") );
  7523     PRINT( _L("Camera => CCamAppController::SetImageOrientationL") );
  7505     if( iConfigManager && iConfigManager->IsOrientationSensorSupported()
  7524     if( iConfigManager && iConfigManager->IsOrientationSensorSupported()
  7506     		&& iCameraController )
  7525     		&& iCameraController )
  7507         {
  7526         {
  7508         if ( ECamActiveCameraPrimary == iInfo.iActiveCamera )
  7527         // Camera controller asks for the current orientation through
  7509             {
  7528         // our ImageOrientation(). Value for that was updated in 
  7510             // Camera controller asks for the current orientation through
  7529         // DataReceived() callback.
  7511             // our ImageOrientation(). Value for that was updated in 
  7530         iCameraController->DirectSettingsChangeL( ECameraSettingOrientation );
  7512             // DataReceived() callback.
       
  7513             iCameraController->DirectSettingsChangeL( ECameraSettingOrientation );
       
  7514             }
       
  7515         else
       
  7516             {
       
  7517             // No action in secondary camera.
       
  7518             }
       
  7519         }
  7531         }
  7520     PRINT( _L("Camera <= CCamAppController::SetImageOrientationL"))   
  7532     PRINT( _L("Camera <= CCamAppController::SetImageOrientationL"))   
  7521     }
  7533     }
  7522 
  7534 
  7523 
  7535 
 10898 //  
 10910 //  
 10899 TBool CCamAppController::VideoInitNeeded()
 10911 TBool CCamAppController::VideoInitNeeded()
 10900     {
 10912     {
 10901     return iVideoInitNeeded;  
 10913     return iVideoInitNeeded;  
 10902     }
 10914     }
 10903         
 10915     
       
 10916 // ---------------------------------------------------------------------------
       
 10917 // StoreUserSceneSettingsL
       
 10918 // Stores the UserScene settings
       
 10919 // ---------------------------------------------------------------------------
       
 10920 //  
       
 10921 void CCamAppController::StoreUserSceneSettingsL()
       
 10922     {
       
 10923     iSettingsModel->StoreUserSceneSettingsL();	    
       
 10924     }      
 10904 //  End of File  
 10925 //  End of File