camerauis/cameraapp/generic/src/CamAppController.cpp
branchRCL_3
changeset 17 8f559c47d7fd
parent 16 53c8aa5d97a3
child 19 e32fcfe0045f
equal deleted inserted replaced
16:53c8aa5d97a3 17:8f559c47d7fd
    78 
    78 
    79 #include "CamVideoQualityLevel.h"
    79 #include "CamVideoQualityLevel.h"
    80 #include "CamCallStateAo.h"    
    80 #include "CamCallStateAo.h"    
    81 #include "CamPropertyWatcher.h"
    81 #include "CamPropertyWatcher.h"
    82 #include <avkondomainpskeys.h>
    82 #include <avkondomainpskeys.h>
       
    83 #include <ProfileEngineInternalPSKeys.h>
       
    84 #include <ProfileEnginePrivatePSKeys.h>
    83 
    85 
    84 #ifndef __WINSCW__
    86 #ifndef __WINSCW__
    85   #include "rlocationtrail.h"
    87   #include "rlocationtrail.h"
    86   #include "locationtrailpskeys.h"
    88   #include "locationtrailpskeys.h"
    87 #endif
    89 #endif
   106 
   108 
   107 #include "camvideotime.h"
   109 #include "camvideotime.h"
   108 #include "CamGSInterface.h"
   110 #include "CamGSInterface.h"
   109 #include "CameraUiConfigManager.h"
   111 #include "CameraUiConfigManager.h"
   110 #include "camsnapshotrotator.h"
   112 #include "camsnapshotrotator.h"
       
   113 #include "CamVideoPreCaptureView.h"
       
   114 
   111 #include <bitmaptransforms.h> 
   115 #include <bitmaptransforms.h> 
   112 
   116 
   113 #ifdef _DEBUG
   117 #ifdef _DEBUG
   114 #ifdef _AO_TRACKING
   118 #ifdef _AO_TRACKING
   115 struct CFakeActiveScheduler : public CActiveScheduler {
   119 struct CFakeActiveScheduler : public CActiveScheduler {
   493     {
   497     {
   494     iKeyLockStatusWatcher->Cancel();
   498     iKeyLockStatusWatcher->Cancel();
   495     delete iKeyLockStatusWatcher;
   499     delete iKeyLockStatusWatcher;
   496     }
   500     }
   497   
   501   
       
   502   if ( iProfileStatusWatcher )
       
   503       {
       
   504       iProfileStatusWatcher->Cancel();
       
   505       delete iProfileStatusWatcher;
       
   506       }
       
   507   
   498   if ( iConfigManager  && iConfigManager->IsPublishZoomStateSupported() )
   508   if ( iConfigManager  && iConfigManager->IsPublishZoomStateSupported() )
   499       {
   509       {
   500       TRAP_IGNORE ( PublishZoomStateL( EFalse ) );
   510       TRAP_IGNORE ( PublishZoomStateL( EFalse ) );
   501       delete iContextFwClient;      
   511       delete iContextFwClient;      
   502       }
   512       }
   596       {
   606       {
   597       delete iRotatorAo;
   607       delete iRotatorAo;
   598       }
   608       }
   599 
   609 
   600   delete iSnapShotRotator;
   610   delete iSnapShotRotator;
       
   611   
       
   612   if( iTvAccessoryMonitor )
       
   613       {
       
   614       delete iTvAccessoryMonitor;
       
   615       iTvAccessoryMonitor = NULL;
       
   616       }
       
   617   
   601   PRINT( _L("Camera <= ~CCamAppController") );
   618   PRINT( _L("Camera <= ~CCamAppController") );
   602   }
   619   }
   603 
   620 
   604 
   621 
   605 // ---------------------------------------------------------------------------
   622 // ---------------------------------------------------------------------------
  1075     if( iInfo.iOperation != aNewOperation 
  1092     if( iInfo.iOperation != aNewOperation 
  1076      || aError           != KErrNone ) 
  1093      || aError           != KErrNone ) 
  1077       {      
  1094       {      
  1078       iInfo.iOperation = aNewOperation;
  1095       iInfo.iOperation = aNewOperation;
  1079       NotifyControllerObservers( ECamEventOperationStateChanged, aError );
  1096       NotifyControllerObservers( ECamEventOperationStateChanged, aError );
       
  1097       if( aNewOperation == ECamStandby )
       
  1098           {
       
  1099           ClearSequenceBusyFlag( &iBusyFlags );
       
  1100           TCamControllerInfo& info = const_cast<TCamControllerInfo&>( iCameraController->ControllerInfo() );
       
  1101           ClearFlags( info.iBusy , ECamBusySequence );
       
  1102           }
  1080       }
  1103       }
  1081 
  1104 
  1082   PRINT( _L("Camera <= CCamAppController::SetOperation") );
  1105   PRINT( _L("Camera <= CCamAppController::SetOperation") );
  1083   }
  1106   }
  1084 
  1107 
  1221             iInfo.iOperation == ECamPausing      ||
  1244             iInfo.iOperation == ECamPausing      ||
  1222             iInfo.iOperation == ECamPaused       ||
  1245             iInfo.iOperation == ECamPaused       ||
  1223             iInfo.iOperation == ECamResuming     ||
  1246             iInfo.iOperation == ECamResuming     ||
  1224             iInfo.iOperation == ECamCompleting )
  1247             iInfo.iOperation == ECamCompleting )
  1225             {    
  1248             {    
  1226             iVideoTimeRemaining = iCameraController->RemainingVideoRecordingTime();  
  1249             iVideoTimeRemaining = RemainingVideoRecordingTime();  
  1227             }
  1250             }
  1228         else 
  1251         else 
  1229             {
  1252             {
  1230             PRINT( _L("Camera <> CCamAppController::RecordTimeRemaining - video mode not yet initialized" ));
  1253             PRINT( _L("Camera <> CCamAppController::RecordTimeRemaining - video mode not yet initialized" ));
  1231             TRAPD( err, iVideoTimeRemaining = CalculateVideoTimeRemainingL() );
  1254             TRAPD( err, iVideoTimeRemaining = CalculateVideoTimeRemainingL() );
  1234                 iVideoTimeRemaining = 0;
  1257                 iVideoTimeRemaining = 0;
  1235                 }
  1258                 }
  1236             }
  1259             }
  1237         }
  1260         }
  1238    if ( ECamControllerVideo == CurrentMode() &&
  1261    if ( ECamControllerVideo == CurrentMode() &&
       
  1262             iInfo.iOperation == ECamNoOperation && 
  1239    	    ECamMediaStorageCard == IntegerSettingValue( ECamSettingItemVideoMediaStorage ) &&
  1263    	    ECamMediaStorageCard == IntegerSettingValue( ECamSettingItemVideoMediaStorage ) &&
  1240    	    appUi->IsMemoryFullOrUnavailable( ECamMediaStorageCard ) )
  1264    	    appUi->IsMemoryFullOrUnavailable( ECamMediaStorageCard ) )
  1241         {
  1265         {
  1242         iVideoTimeRemaining =  0; 
  1266         iVideoTimeRemaining =  0; 
  1243         }
  1267         }
  1720        // Sequence capture is not in progress as capture failed 
  1744        // Sequence capture is not in progress as capture failed 
  1721        iSequenceCaptureInProgress = EFalse; 
  1745        iSequenceCaptureInProgress = EFalse; 
  1722        }
  1746        }
  1723 
  1747 
  1724     PRINT1( _L("Camera <> Tried to start capture, status:%d"), capture ); 
  1748     PRINT1( _L("Camera <> Tried to start capture, status:%d"), capture ); 
  1725     if ( capture )
       
  1726       {
       
  1727       if( ECamActiveCameraPrimary == iInfo.iActiveCamera
       
  1728           && iConfigManager && iConfigManager->IsCaptureToneDelaySupported() )
       
  1729         {
       
  1730         // first cancel to make sure
       
  1731         iCaptureToneDelayTimer->Cancel();
       
  1732         // delay playing of capture tone
       
  1733         iCaptureToneDelayTimer->StartTimer();
       
  1734         }
       
  1735       else
       
  1736         {
       
  1737         // Play capture sound
       
  1738         PlaySound( CaptureToneId(), EFalse );
       
  1739         }
       
  1740       }
       
  1741     }
  1749     }
  1742   // -------------------------------------------------------
  1750   // -------------------------------------------------------
  1743   // Not ready for a capture
  1751   // Not ready for a capture
  1744   else
  1752   else
  1745     {
  1753     {
  1862 //
  1870 //
  1863 void CCamAppController::StartVideoRecordingL()
  1871 void CCamAppController::StartVideoRecordingL()
  1864   {
  1872   {
  1865   PRINT( _L("Camera => CCamAppController::StartVideoRecordingL") );    
  1873   PRINT( _L("Camera => CCamAppController::StartVideoRecordingL") );    
  1866   __ASSERT_DEBUG( iCameraController, CamPanic( ECamPanicInvalidState ) );
  1874   __ASSERT_DEBUG( iCameraController, CamPanic( ECamPanicInvalidState ) );
  1867   if( ECamControllerVideo == iInfo.iMode )
  1875   if ( ECamControllerVideo == iInfo.iMode )
  1868     {
  1876       {
  1869     if( !iVideoRequested
  1877       CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );  
  1870      &&  ECamNoOperation == iInfo.iOperation )
  1878       if ( IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) &&
  1871       {
  1879                IsHdmiCableConnected() )
  1872       iVideoRequested = ETrue;     
  1880           {
       
  1881           appUi->HandleHdmiEventL( ECamHdmiCableConnectedBeforeRecording );
       
  1882           return;
       
  1883           }
       
  1884       if ( !iVideoRequested
       
  1885               &&  ECamNoOperation == iInfo.iOperation )
       
  1886           {
       
  1887           iVideoRequested = ETrue;     
  1873       if( !iSilentProfile || iShutterSndAlwaysOn  )
  1888       if( !iSilentProfile || iShutterSndAlwaysOn  )
  1874         	{
  1889           {
  1875         	// Load (and play) the start video sound	
  1890           // Load (and play) the start video sound	
  1876         	PlaySound( ECamVideoStartSoundId , ETrue );  
  1891           PlaySound( ECamVideoStartSoundId , ETrue );  
  1877         	}   
  1892           }   
  1878   
  1893   
  1879       // initialise the array accessing values
  1894           // initialise the array accessing values
  1880       iArrayUsageCount   = KVideoArrayUsers;
  1895           iArrayUsageCount   = KVideoArrayUsers;
  1881       iCurrentImageIndex = 0;
  1896           iCurrentImageIndex = 0;
  1882   
  1897   
  1883       if( ECamMediaStorageCard == 
  1898           if ( ECamMediaStorageCard == 
  1884               IntegerSettingValue( ECamSettingItemVideoMediaStorage ) )
  1899                    IntegerSettingValue( ECamSettingItemVideoMediaStorage ) )
  1885         {
  1900               {
  1886         TRAPD( err, ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone ) );
  1901               TRAPD( err, ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone ) );
  1887         if ( err )
  1902               if ( err )
       
  1903                   {
       
  1904                   PRINT( _L("Camera <> invalid MMC") );        
       
  1905                   NotifyControllerObservers( ECamEventInvalidMemoryCard );
       
  1906   
       
  1907                   // If we have got here, we can't access MMC. Switch to phone memory
       
  1908                   TRAP_IGNORE( ForceUsePhoneMemoryL() ); //with multiple drive support, 
       
  1909                                                          //this actually uses the internal mass memory
       
  1910                   // Ignore for now, let fail when recording.
       
  1911                   TRAP_IGNORE( ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone, ETrue ) );
       
  1912                   }
       
  1913               }
       
  1914           else
       
  1915               {
       
  1916               // Ignore for now, let fail when recording.
       
  1917               TRAP_IGNORE( ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone ) );
       
  1918               }
       
  1919 
       
  1920           if( iSilentProfile && !iShutterSndAlwaysOn )
       
  1921               {
       
  1922               PlaySoundComplete();
       
  1923               }
       
  1924           // Remember where are we recording
       
  1925           iInitialVideoStorageLocation = static_cast<TCamMediaStorage>( 
       
  1926                IntegerSettingValue( ECamSettingItemVideoMediaStorage ) );
       
  1927           }
       
  1928       else
  1888           {
  1929           {
  1889           PRINT( _L("Camera <> invalid MMC") );        
  1930           // Video already requested or other operation busy.
  1890           NotifyControllerObservers( ECamEventInvalidMemoryCard );
  1931           // Request ignored.
  1891   
       
  1892           // If we have got here, we can't access MMC. Switch to phone memory
       
  1893           TRAP_IGNORE( ForceUsePhoneMemoryL() ); //with multiple drive support, 
       
  1894                                                  //this actually uses the internal mass memory
       
  1895           // Ignore for now, let fail when recording.
       
  1896           TRAP_IGNORE( ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone, ETrue ) );
       
  1897           }
  1932           }
  1898         }
  1933       }
  1899       else
       
  1900         {
       
  1901         // Ignore for now, let fail when recording.
       
  1902         TRAP_IGNORE( ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone ) );
       
  1903         }
       
  1904 
       
  1905         if( iSilentProfile && !iShutterSndAlwaysOn )
       
  1906         	{
       
  1907         	PlaySoundComplete();
       
  1908         	}
       
  1909       // Remember where are we recording
       
  1910       iInitialVideoStorageLocation = static_cast<TCamMediaStorage>( 
       
  1911                     IntegerSettingValue( ECamSettingItemVideoMediaStorage ) );
       
  1912       }
       
  1913     else
       
  1914       {
       
  1915       // Video already requested or other operation busy.
       
  1916       // Request ignored.
       
  1917       }
       
  1918     }
       
  1919   // Note: The code to actually START video recording has been moved
  1934   // Note: The code to actually START video recording has been moved
  1920   // to the PlaySoundComplete function so as to only start when
  1935   // to the PlaySoundComplete function so as to only start when
  1921   // sound playback has completed.
  1936   // sound playback has completed.
  1922   }
  1937   }
  1923 
  1938 
  2229   if( !iNoBurstCancel 
  2244   if( !iNoBurstCancel 
  2230    && ECamNoOperation != CurrentOperation()
  2245    && ECamNoOperation != CurrentOperation()
  2231    && ECamCompleting  != CurrentOperation() )
  2246    && ECamCompleting  != CurrentOperation() )
  2232     {  
  2247     {  
  2233     // If we are currently focused, cancel autofocus
  2248     // If we are currently focused, cancel autofocus
  2234     if ( IsViewFinding() && CurrentOperation() != ECamCapturing ) // Cannot do AF operations if VF not on. AF is anyway cancelled on VF start event.
  2249     if ( IsViewFinding() && CurrentOperation() != ECamCapturing &&  // Cannot do AF operations if VF not on. AF is anyway cancelled on VF start event.
       
  2250         iCurrentAFRequest != ECamRequestCancelAutofocus ) // Don't cancel twice
  2235       {
  2251       {
  2236       if( ECamFocusing == CurrentOperation() )
  2252       if( ECamFocusing == CurrentOperation() )
  2237         {
  2253         {
  2238         CancelAFNow();
  2254         CancelAFNow();
  2239         if ( IsTouchScreenSupported() )
  2255         if ( IsTouchScreenSupported() )
  2492 #ifdef _DEBUG
  2508 #ifdef _DEBUG
  2493     PRINT ( _L("Camera <> ======================================") );
  2509     PRINT ( _L("Camera <> ======================================") );
  2494     PRINT ( _L("Camera <> Photo quality index:                  ") );
  2510     PRINT ( _L("Camera <> Photo quality index:                  ") );
  2495     PRINT1( _L("Camera <> Before loading 2nd cam settings: %d   "), IntegerSettingValue( ECamSettingItemPhotoQuality ) );
  2511     PRINT1( _L("Camera <> Before loading 2nd cam settings: %d   "), IntegerSettingValue( ECamSettingItemPhotoQuality ) );
  2496 #endif
  2512 #endif
       
  2513     
       
  2514     // Scene mode is forced to Automatic while secondary camera is in use.
       
  2515     iSceneModeForcedBySecondaryCamera = ETrue;
  2497 
  2516 
  2498     LoadSecondaryCameraSettingsL();
  2517     LoadSecondaryCameraSettingsL();
  2499   
  2518   
  2500 #ifdef _DEBUG
  2519 #ifdef _DEBUG
  2501     PRINT1( _L("Camera <> After loading 2nd cam settings:  %d   "), IntegerSettingValue( ECamSettingItemPhotoQuality ) );
  2520     PRINT1( _L("Camera <> After loading 2nd cam settings:  %d   "), IntegerSettingValue( ECamSettingItemPhotoQuality ) );
  2521 
  2540 
  2522     if ( CameraSwitchQueued() != ESwitchSecondaryOrientation )
  2541     if ( CameraSwitchQueued() != ESwitchSecondaryOrientation )
  2523         {
  2542         {
  2524         PRINT( _L("Camera <> switch to 1st cam") )
  2543         PRINT( _L("Camera <> switch to 1st cam") )
  2525         targetCamera = ECamActiveCameraPrimary;
  2544         targetCamera = ECamActiveCameraPrimary;
       
  2545         
       
  2546         // Primary camera will use its previously selected scene mode after camera switch.
       
  2547         iSceneModeForcedBySecondaryCamera = EFalse;
  2526         }
  2548         }
  2527     else
  2549     else
  2528         {
  2550         {
  2529         PRINT( _L("Camera <> change 2nd camera mode") )
  2551         PRINT( _L("Camera <> change 2nd camera mode") )
  2530         targetCamera = ECamActiveCameraSecondary;
  2552         targetCamera = ECamActiveCameraSecondary;
  3406       PRINT( _L("Camera => ECamSettingItemFaceTracking") );
  3428       PRINT( _L("Camera => ECamSettingItemFaceTracking") );
  3407       TCamCameraSettingId cameraId( 
  3429       TCamCameraSettingId cameraId( 
  3408         CCamSettingConversion::Map2CameraControllerSettingId( aSettingItem ) );
  3430         CCamSettingConversion::Map2CameraControllerSettingId( aSettingItem ) );
  3409       iCameraController->DirectSettingsChangeL( cameraId );
  3431       iCameraController->DirectSettingsChangeL( cameraId );
  3410       NotifyControllerObservers( ECamEventFaceTrackingStateChanged );
  3432       NotifyControllerObservers( ECamEventFaceTrackingStateChanged );
       
  3433       
       
  3434       // If Face tracking was turned off by user (not forced off by a scene mode)
       
  3435       // update iPreviousFaceTrack to the current state as we are not going to
       
  3436       // reset to the previous state automatically at any point.
       
  3437       TCamSceneId scene = static_cast< TCamSceneId > 
       
  3438           ( IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) );
       
  3439       
       
  3440       if ( scene != ECamSceneMacro &&
       
  3441            scene != ECamSceneScenery &&
       
  3442            scene != ECamSceneSports && 
       
  3443            !iSceneModeForcedBySecondaryCamera )
       
  3444           {
       
  3445           PRINT1( _L("Camera MK: Changing face tracking state -> update iPreviousFaceTrack to %d"), aSettingValue );
       
  3446           iSettingsModel->SetPreviousFaceTrack( static_cast<TCamSettingsOnOff>( aSettingValue ) );
       
  3447           }
       
  3448       
  3411       break;
  3449       break;
  3412       }  
  3450       }  
  3413     case ECamSettingItemDynamicVideoFlash:  
  3451     case ECamSettingItemDynamicVideoFlash:  
  3414       {
  3452       {
  3415       PRINT( _L("Camera => ECamSettingItemDynamicVideoFlash") );
  3453       PRINT( _L("Camera => ECamSettingItemDynamicVideoFlash") );
  4494           iInfo.iOperation == ECamPausing      ||
  4532           iInfo.iOperation == ECamPausing      ||
  4495           iInfo.iOperation == ECamPaused       ||
  4533           iInfo.iOperation == ECamPaused       ||
  4496           iInfo.iOperation == ECamResuming     ||
  4534           iInfo.iOperation == ECamResuming     ||
  4497           iInfo.iOperation == ECamCompleting )
  4535           iInfo.iOperation == ECamCompleting )
  4498         {          
  4536         {          
  4499         iVideoTimeRemaining = iCameraController->RemainingVideoRecordingTime();  
  4537         iVideoTimeRemaining = RemainingVideoRecordingTime();  
  4500         }
  4538         }
  4501       else 
  4539       else 
  4502         {
  4540         {
  4503         PRINT( _L("Camera <> CCamAppController::SetPathnamesToNewStorageL - video mode not yet initialized" ));
  4541         PRINT( _L("Camera <> CCamAppController::SetPathnamesToNewStorageL - video mode not yet initialized" ));
  4504         TRAPD( err, iVideoTimeRemaining = CalculateVideoTimeRemainingL() );
  4542         TRAPD( err, iVideoTimeRemaining = CalculateVideoTimeRemainingL() );
  4722   : iBusyFlags( EBusyNone )
  4760   : iBusyFlags( EBusyNone )
  4723   , iDiskCriticalLevel   ( KErrNotFound )
  4761   , iDiskCriticalLevel   ( KErrNotFound )
  4724   , iRamDiskCriticalLevel( KErrNotFound )
  4762   , iRamDiskCriticalLevel( KErrNotFound )
  4725   , iImageOrientation( ECamOrientation0 )
  4763   , iImageOrientation( ECamOrientation0 )
  4726   , iLastImageOrientation( ECamOrientation0 )
  4764   , iLastImageOrientation( ECamOrientation0 )
       
  4765   , iPendingHdmiEvent( ECamHdmiNoEvent )
  4727   {
  4766   {
  4728   }
  4767   }
  4729 
  4768 
  4730 // ---------------------------------------------------------------------------
  4769 // ---------------------------------------------------------------------------
  4731 // CCamAppController::ConstructL
  4770 // CCamAppController::ConstructL
  4823                                                           KPSUidAvkonDomain,
  4862                                                           KPSUidAvkonDomain,
  4824                                                           KAknKeyguardStatus );
  4863                                                           KAknKeyguardStatus );
  4825       // request notifications about key lock status
  4864       // request notifications about key lock status
  4826       iKeyLockStatusWatcher->Subscribe();     
  4865       iKeyLockStatusWatcher->Subscribe();     
  4827       }
  4866       }
       
  4867   
       
  4868   iProfileStatusWatcher = CCamPropertyWatcher::NewL( *this,
       
  4869                                                      KPSUidProfileEngine,
       
  4870                                                      KProEngActiveProfileChanged );
       
  4871   // request notifications about profile status
       
  4872   iProfileStatusWatcher->Subscribe();    
       
  4873   IsProfileSilent();
       
  4874   
  4828   // read central repository value indicating whether camera shutter sound
  4875   // read central repository value indicating whether camera shutter sound
  4829   // should be played always or depending on the current profile setting
  4876   // should be played always or depending on the current profile setting
  4830   CRepository* cr = CRepository::NewLC( KCRUidCamcorderFeatures );
  4877   CRepository* cr = CRepository::NewLC( KCRUidCamcorderFeatures );
  4831   TInt value;
  4878   TInt value;
  4832   TInt err;
  4879   TInt err;
  4885 
  4932 
  4886   CamUtility::GetPsiInt( ECamPsiMaxBurstCapture, iLongSequenceLimit );
  4933   CamUtility::GetPsiInt( ECamPsiMaxBurstCapture, iLongSequenceLimit );
  4887 
  4934 
  4888   User::LeaveIfError( iFs.Connect() ); 
  4935   User::LeaveIfError( iFs.Connect() ); 
  4889   iDriveChangeNotifier = CCamDriveChangeNotifier::NewL( iFs, *this ); 
  4936   iDriveChangeNotifier = CCamDriveChangeNotifier::NewL( iFs, *this ); 
  4890 
  4937   
       
  4938   iTvAccessoryMonitor = CCamTvAccessoryMonitor::NewL( this );
       
  4939   iTvAccessoryMonitor->StartListeningL();
       
  4940   
  4891   PRINT( _L("Camera <= CCamAppController::ConstructL"));
  4941   PRINT( _L("Camera <= CCamAppController::ConstructL"));
  4892   }
  4942   }
  4893 
  4943 
  4894 
  4944 
  4895 
  4945 
  7906                    PRINT( _L("Camera HandleSlideOpenedL => Exit Standby view") );
  7956                    PRINT( _L("Camera HandleSlideOpenedL => Exit Standby view") );
  7907                    view->HandleCommandL( ECamCmdExitStandby );
  7957                    view->HandleCommandL( ECamCmdExitStandby );
  7908                   }
  7958                   }
  7909               }
  7959               }
  7910           }
  7960           }
  7911 
  7961       
       
  7962       if ( aCategory == KPSUidProfileEngine && aKey == KProEngActiveProfileChanged )
       
  7963           {
       
  7964           PRINT( _L("Camera <> aCategory == KCRUidProfileEngine && aKey == KProEngActiveWarningTones") );
       
  7965           IsProfileSilent();
       
  7966           }
  7912 
  7967 
  7913 #endif // !( defined(__WINS__) || defined(__WINSCW__        
  7968 #endif // !( defined(__WINS__) || defined(__WINSCW__        
  7914 
  7969 
  7915   PRINT( _L("Camera <= CCamAppController::HandlePropertyChangedL"))
  7970   PRINT( _L("Camera <= CCamAppController::HandlePropertyChangedL"))
  7916 
  7971 
  8338 // tones setting to determine whether silent or not
  8393 // tones setting to determine whether silent or not
  8339 // ---------------------------------------------------------------------------
  8394 // ---------------------------------------------------------------------------
  8340 //  
  8395 //  
  8341 TBool CCamAppController::IsProfileSilent()
  8396 TBool CCamAppController::IsProfileSilent()
  8342     {
  8397     {
  8343     TRAPD( ignore, iSilentProfile = IsProfileSilentL() );
  8398     if ( !iShutterSndAlwaysOn )
  8344     if ( ignore )
  8399         {
  8345         {
  8400         TRAPD( ignore, iSilentProfile = IsProfileSilentL() );
  8346         }
  8401         if ( ignore )
  8347     return iSilentProfile;
  8402             {
       
  8403             // If reading the warning tone (= camera tones) value fails
       
  8404             // we set tones off by default
       
  8405             iSilentProfile = ETrue;
       
  8406             }
       
  8407         return iSilentProfile;
       
  8408         }
       
  8409     else
       
  8410         {
       
  8411         return EFalse;
       
  8412         }
  8348     }
  8413     }
  8349 
  8414 
  8350 
  8415 
  8351 // ---------------------------------------------------------------------------
  8416 // ---------------------------------------------------------------------------
  8352 // CCamAppController::IsProfileSilentL
  8417 // CCamAppController::IsProfileSilentL
  8354 // tones setting to determine whether silent or not
  8419 // tones setting to determine whether silent or not
  8355 // ---------------------------------------------------------------------------
  8420 // ---------------------------------------------------------------------------
  8356 //  
  8421 //  
  8357 TBool CCamAppController::IsProfileSilentL()
  8422 TBool CCamAppController::IsProfileSilentL()
  8358     {
  8423     {
  8359     // get current keypad volume as indication of whether
  8424     // If camera tones have been set off from settings, return true here 
       
  8425     if ( iSettingsModel->IntegerSettingValue( ECamSettingItemPhotoCaptureTone )
       
  8426                 == ECamSettToneOff )
       
  8427         {
       
  8428         return ETrue;
       
  8429         }
       
  8430     
       
  8431     // Get current keypad volume as an indication of whether
  8360     // or not we have a silent profile
  8432     // or not we have a silent profile
  8361     CRepository* cr = CRepository::NewLC( KCRUidProfileEngine );
  8433     CRepository* cr = CRepository::NewLC( KCRUidProfileEngine );
  8362     TInt value;
  8434     TInt value;
  8363     User::LeaveIfError( cr->Get( KProEngActiveWarningTones, value ) );
  8435     User::LeaveIfError( cr->Get( KProEngActiveWarningTones, value ) );
       
  8436     PRINT1(_L("Camera <> CCamAppController::IsProfileSilentL() value = %d"), value)
  8364     CleanupStack::PopAndDestroy( cr );
  8437     CleanupStack::PopAndDestroy( cr );
  8365     
  8438     
  8366     //In case the phone variant allows turning camera tones off,
       
  8367     // first check if that is the case here.
       
  8368     if ( iSettingsModel->IntegerSettingValue( ECamSettingItemPhotoCaptureTone )
       
  8369             == ECamSettToneOff )
       
  8370         {
       
  8371         return ETrue;
       
  8372         }
       
  8373 
       
  8374     return ( value == 0 );
  8439     return ( value == 0 );
  8375     }
  8440     }
  8376 
  8441 
  8377 
  8442 
  8378 // ---------------------------------------------------------------------------
  8443 // ---------------------------------------------------------------------------
  9157             {
  9222             {
  9158             // sequence canceled, no need to event further
  9223             // sequence canceled, no need to event further
  9159             return;
  9224             return;
  9160             }
  9225             }
  9161       break;
  9226       break;
  9162       }  
  9227       }
       
  9228     //Image capture event  
       
  9229     case ECamCameraEventImageCaptureEvent:
       
  9230       {
       
  9231       PlaySound( CaptureToneId(), EFalse );
       
  9232       }
       
  9233       break;  
  9163     default:
  9234     default:
  9164       break;
  9235       break;
  9165     }
  9236     }
  9166 
  9237 
  9167 
  9238 
 10769                       {
 10840                       {
 10770                       SwitchToStandbyL( ECamErrMemoryCardNotInserted );
 10841                       SwitchToStandbyL( ECamErrMemoryCardNotInserted );
 10771                       }
 10842                       }
 10772                   }
 10843                   }
 10773               }
 10844               }
 10774           else if ( aType == EDriveUSBMassStorageModeOn )
 10845           else if ( aType == EDriveUSBMassStorageModeOn &&
       
 10846                   appUi->IsRecoverableStatus() )
 10775               {
 10847               {
 10776               SwitchToStandbyL(ECamErrMassStorageMode);
 10848               SwitchToStandbyL(ECamErrMassStorageMode);
 10777 
       
 10778               }
 10849               }
 10779           else if ( aType == EDriveUSBMassStorageModeOff )
 10850           else if ( aType == EDriveUSBMassStorageModeOff &&
       
 10851                   !appUi->IsRecoverableStatus() )
 10780               {
 10852               {
 10781               SwitchToStandbyL( KErrNone );
 10853               SwitchToStandbyL( KErrNone );
 10782               }
 10854               }
 10783         }
 10855         }
 10784     
 10856     
 11361         NotifyControllerObservers( ECamEventSnapshotRotated );    
 11433         NotifyControllerObservers( ECamEventSnapshotRotated );    
 11362         }
 11434         }
 11363     PRINT( _L( "Camera <= CCamAppController::SnapshotRotationComplete" ) );    
 11435     PRINT( _L( "Camera <= CCamAppController::SnapshotRotationComplete" ) );    
 11364     }
 11436     }
 11365 
 11437 
 11366  
 11438 // ---------------------------------------------------------------------------
       
 11439 // CCamAppController::HandleTvAccessoryConnectedL
       
 11440 // 
       
 11441 // ---------------------------------------------------------------------------
       
 11442 //
       
 11443 void CCamAppController::HandleTvAccessoryConnectedL()
       
 11444     {
       
 11445     PRINT(_L("Camera => CCamAppController::HandleTvAccessoryConnectedL "));
       
 11446     if( IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) 
       
 11447             && IsHdmiCableConnected() )
       
 11448         {
       
 11449         if( ECamCapturing == iInfo.iOperation || 
       
 11450             ECamPaused == iInfo.iOperation )
       
 11451             {
       
 11452             CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
       
 11453             iHdmiCableConnectedDuringRecording = ETrue;
       
 11454             TVwsViewId activeView;
       
 11455             if ( appUi->GetActiveViewId( activeView ) == KErrNone )
       
 11456               {
       
 11457               if( ECamViewIdVideoPreCapture == activeView.iViewUid.iUid  )
       
 11458                   {
       
 11459                   CCamVideoPreCaptureView* view = static_cast<CCamVideoPreCaptureView*>( appUi->View( activeView.iViewUid ) );
       
 11460                   view->HandleCommandL( ECamCmdStop );
       
 11461                   }
       
 11462               }
       
 11463             }
       
 11464         }
       
 11465     PRINT(_L("Camera <= CCamAppController::HandleTvAccessoryConnectedL "));
       
 11466     }
       
 11467 
       
 11468 // ---------------------------------------------------------------------------
       
 11469 // CCamAppController::HandleTvAccessoryConnectedL
       
 11470 // 
       
 11471 // ---------------------------------------------------------------------------
       
 11472 //
       
 11473 void CCamAppController::HandleTvAccessoryDisconnectedL()
       
 11474     {
       
 11475     
       
 11476     }
       
 11477 
       
 11478 // ---------------------------------------------------------------------------
       
 11479 // CCamAppController::IsHdmiCableConnected
       
 11480 // 
       
 11481 // ---------------------------------------------------------------------------
       
 11482 //
       
 11483 TBool CCamAppController::IsHdmiCableConnected()
       
 11484     {
       
 11485     return iTvAccessoryMonitor->IsHdmiCableConnected();
       
 11486     }
 11367 //  End of File  
 11487 //  End of File  
 11368 
 11488 
       
 11489 
       
 11490 // ---------------------------------------------------------------------------
       
 11491 // CCamAppController::RemainingVideoRecordingTime
       
 11492 // 
       
 11493 // ---------------------------------------------------------------------------
       
 11494 //
       
 11495 TTimeIntervalMicroSeconds CCamAppController::RemainingVideoRecordingTime()
       
 11496     {
       
 11497     return iCameraController->RemainingVideoRecordingTime();
       
 11498     }
       
 11499 
       
 11500 // ---------------------------------------------------------------------------
       
 11501 // CCamAppController::HandlePostHdmiConnectDuringRecordingEventL
       
 11502 // 
       
 11503 // ---------------------------------------------------------------------------
       
 11504 //
       
 11505 void CCamAppController::HandlePostHdmiConnectDuringRecordingEventL()
       
 11506     {
       
 11507     if( iHdmiCableConnectedDuringRecording == TBool(ETrue) )
       
 11508         {
       
 11509         iHdmiCableConnectedDuringRecording = EFalse;
       
 11510         CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
       
 11511         appUi->HandleHdmiEventL( ECamHdmiCableConnectedDuringRecording );
       
 11512         }  
       
 11513     }
       
 11514 
       
 11515 
       
 11516 // ---------------------------------------------------------------------------
       
 11517 // CCamAppController::SetPendingHdmiEvent
       
 11518 // 
       
 11519 // ---------------------------------------------------------------------------
       
 11520 //
       
 11521 void CCamAppController::SetPendingHdmiEvent( TCamHdmiEvent aPendingHdmiEvent )
       
 11522     {
       
 11523     iPendingHdmiEvent = aPendingHdmiEvent;
       
 11524     }
       
 11525 
       
 11526 
       
 11527 // ---------------------------------------------------------------------------
       
 11528 // CCamAppController::HandlePendingHdmiEvent
       
 11529 // 
       
 11530 // ---------------------------------------------------------------------------
       
 11531 //
       
 11532 void CCamAppController::HandlePendingHdmiEvent()
       
 11533     {
       
 11534     if( iPendingHdmiEvent != ECamHdmiNoEvent )
       
 11535         {
       
 11536         CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
       
 11537         appUi->HandleHdmiEventL( iPendingHdmiEvent );
       
 11538         iPendingHdmiEvent = ECamHdmiNoEvent;
       
 11539         }
       
 11540     }
       
 11541 
       
 11542     
       
 11543 // ---------------------------------------------------------------------------
       
 11544 // CCamAppController::HandleSecondaryCameraExit
       
 11545 // 
       
 11546 // Place here any extra things that need to be done when
       
 11547 // exiting camera app. in secondary camera mode
       
 11548 // ---------------------------------------------------------------------------
       
 11549 //
       
 11550 void CCamAppController::HandleSecondaryCameraExitL()
       
 11551     {
       
 11552     PRINT( _L( "Camera => CCamAppController::HandleSecondaryCameraExit" ) );          
       
 11553     
       
 11554     // Scene mode and face tracking issues --->
       
 11555     CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );  
       
 11556     // Do a switch to primary camera.
       
 11557     appUi->HandleCommandL( ECamCmdSwitchCamera );
       
 11558     // Set correct settings for primary camera.
       
 11559     SetDynamicSettingsToDefaults();
       
 11560     // Check if "User" scene mode should be on.
       
 11561     iSettingsModel->SetUserSceneDefault();
       
 11562     // PhotoSceneHasChangedL() needs to be called to 
       
 11563     // get also face tracking to the correct state.
       
 11564     iSettingsModel->PhotoSceneHasChangedL( IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) );
       
 11565     // StoreFaceTrackingValue() does nothing in 2ndary camera mode.
       
 11566     // (Because scene mode is forced to Auto while in 2ndary camera.)
       
 11567     // -> Always save face tracking state when exiting from 2ndary cam.
       
 11568     SetIntegerSettingValueL( ECamSettingItemFaceTracking, iSettingsModel->GetPreviousFaceTrack() );   
       
 11569     // <--- Scene mode and face tracking issues
       
 11570     
       
 11571     PRINT( _L( "Camera <= CCamAppController::HandleSecondaryCameraExit" ) );    
       
 11572     }    
       
 11573 
       
 11574 // ---------------------------------------------------------------------------
       
 11575 // CCamAppController::SceneModeForcedBySecondaryCamera
       
 11576 // 
       
 11577 // ---------------------------------------------------------------------------
       
 11578 //    
       
 11579 TBool CCamAppController::SceneModeForcedBySecondaryCamera()
       
 11580     {
       
 11581     return iSceneModeForcedBySecondaryCamera;
       
 11582     }
       
 11583 	
       
 11584 //  End of File  
       
 11585