camerauis/cameraapp/generic/src/CamAppui.cpp
branchRCL_3
changeset 67 756ad29ed18e
parent 62 f0c0788c4de2
equal deleted inserted replaced
62:f0c0788c4de2 67:756ad29ed18e
    61 #include <musresourceproperties.h>
    61 #include <musresourceproperties.h>
    62 #include <cameraplatpskeys.h>
    62 #include <cameraplatpskeys.h>
    63 
    63 
    64 #include <AknCommonDialogsDynMem.h>
    64 #include <AknCommonDialogsDynMem.h>
    65 #include <CAknMemorySelectionDialogMultiDrive.h>
    65 #include <CAknMemorySelectionDialogMultiDrive.h>
    66 #include <aknmessagequerydialog.h>
       
    67 
    66 
    68 #include "CameraappPrivateCRKeys.h"
    67 #include "CameraappPrivateCRKeys.h"
    69 #include "CamAppUi.h"
    68 #include "CamAppUi.h"
    70 #include "CamUtility.h"
    69 #include "CamUtility.h"
    71 #include "CamAppController.h"
    70 #include "CamAppController.h"
   145                                    | ECamCameraEventClassImage
   144                                    | ECamCameraEventClassImage
   146                                    | ECamCameraEventClassVideo
   145                                    | ECamCameraEventClassVideo
   147                                    | ECamCameraEventClassVfControl
   146                                    | ECamCameraEventClassVfControl
   148                                    | ECamCameraEventClassSsControl
   147                                    | ECamCameraEventClassSsControl
   149                                    | ECamCameraEventClassSettings );
   148                                    | ECamCameraEventClassSettings );
   150 /**
   149 
   151  * class CCamFtuDisplay
       
   152  * This class is used to give a notification to Camera First Time User regarding the 
       
   153  * geotagging of captured images or videos.
       
   154  */
       
   155 
       
   156 class CCamFtuDisplay : public CAsyncOneShot 
       
   157     {
       
   158 public:
       
   159     /**
       
   160      * CCamFtuDisplay
       
   161      * Default Constructor
       
   162      */
       
   163     CCamFtuDisplay( CCamAppUi * aCamAppUi )
       
   164     : CAsyncOneShot( CActive::EPriorityLow), iCamAppUi(aCamAppUi)
       
   165             {
       
   166             }
       
   167     enum TEnableCamFtu
       
   168         {
       
   169         ECamFtuEnable = 0,
       
   170         ECamFtuDisable
       
   171         };
       
   172     
       
   173 protected:
       
   174     /**
       
   175      * RunL
       
   176      * Callback method
       
   177      */
       
   178     void RunL()
       
   179         {
       
   180         iCamAppUi->CamFtuDisplayL();
       
   181         }
       
   182 private:
       
   183     /**
       
   184      * iCamAppUi
       
   185      * An instance of the CCamAppUi
       
   186      */
       
   187     CCamAppUi* iCamAppUi;
       
   188     };
       
   189 
   150 
   190 
   151 
   191 // ===========================================================================
   152 // ===========================================================================
   192 // Member functions
   153 // Member functions
   193 
   154 
   288     delete iScreenClearer;
   249     delete iScreenClearer;
   289     delete iVolumeKeyObserver;
   250     delete iVolumeKeyObserver;
   290 
   251 
   291     delete iCollectionManager;
   252     delete iCollectionManager;
   292     iCollectionManager = NULL;
   253     iCollectionManager = NULL;
   293 
       
   294     if( iCamFtuDisplay )
       
   295         {
       
   296         delete iCamFtuDisplay;
       
   297         iCamFtuDisplay = NULL;
       
   298         }
       
   299 
   254 
   300     PRINT( _L("Camera <= ~CCamAppUi" ))
   255     PRINT( _L("Camera <= ~CCamAppUi" ))
   301     }
   256     }
   302 
   257 
   303 // -----------------------------------------------------------------------------
   258 // -----------------------------------------------------------------------------
   332   iDSASupported = iController.UiConfigManagerPtr()->IsDSAViewFinderSupported();
   287   iDSASupported = iController.UiConfigManagerPtr()->IsDSAViewFinderSupported();
   333   
   288   
   334   TBool uiOrientationOverride = iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported();
   289   TBool uiOrientationOverride = iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported();
   335   
   290   
   336   // Get the screenmode values used for setting  the orientation
   291   // Get the screenmode values used for setting  the orientation
   337   
   292   RArray<TInt> screenModeValues;
   338   if ( uiOrientationOverride )
   293   if ( uiOrientationOverride )
   339       {
   294       {
   340       RArray<TInt> screenModeValues;
       
   341       CleanupClosePushL( screenModeValues );
       
   342       iController.UiConfigManagerPtr()->SupportedScreenModesL( screenModeValues );
   295       iController.UiConfigManagerPtr()->SupportedScreenModesL( screenModeValues );
   343       iLandscapeScreenMode = screenModeValues[0];
   296       iLandscapeScreenMode = screenModeValues[0];
   344       iPortraitScreenMode = screenModeValues[1];
   297       iPortraitScreenMode = screenModeValues[1];
   345       CleanupStack::PopAndDestroy( &screenModeValues );
       
   346       }
   298       }
   347   
   299   
   348   // The embedded views are set after ConstructL completes
   300   // The embedded views are set after ConstructL completes
   349   // but the value is only of interest if the app is embedded
   301   // but the value is only of interest if the app is embedded
   350   iEmbeddedViewSet = !IsEmbedded();
   302   iEmbeddedViewSet = !IsEmbedded();
   708   // TRAP errors so camera starts up even if startup animation fails
   660   // TRAP errors so camera starts up even if startup animation fails
   709   TRAP_IGNORE(iStartupLogoController = CCamStartupLogoController::NewL(EStartupLogoVisible));
   661   TRAP_IGNORE(iStartupLogoController = CCamStartupLogoController::NewL(EStartupLogoVisible));
   710 
   662 
   711   PRINT( _L("Camera <= CCamAppUi::ConstructL") )
   663   PRINT( _L("Camera <= CCamAppUi::ConstructL") )
   712   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 0" );
   664   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 0" );
   713    
   665   }
   714   //  To get FTU flag value
       
   715 
       
   716     TInt ftuValue=0;
       
   717     TInt retErr=0;
       
   718     retErr=iRepository->Get( KCamCrFtuMessageFlag, ftuValue );
       
   719    
       
   720     if( !IsEmbedded() && ftuValue == CCamFtuDisplay::ECamFtuEnable 
       
   721 	        && retErr==KErrNone )
       
   722         {
       
   723         iCamFtuDisplay = new (ELeave)CCamFtuDisplay(this);
       
   724         iCamFtuDisplay->Call();
       
   725         }
       
   726     }
       
   727     
   666     
   728 
   667 
   729 
   668 
   730 // -----------------------------------------------------------------------------
   669 // -----------------------------------------------------------------------------
   731 // IsInternalView
   670 // IsInternalView
   753     }
   692     }
   754 
   693 
   755   PRINT1( _L("Camera <= CCamAppUi::IsInternalView, return %d"), internal );
   694   PRINT1( _L("Camera <= CCamAppUi::IsInternalView, return %d"), internal );
   756   return internal;
   695   return internal;
   757   }
   696   }
   758 // -----------------------------------------------------------------------------
   697 
   759 // CCamAppUi:: HyperlinkCallback
   698 
   760 // Call back method for the hyper link text 
   699  
   761 // -----------------------------------------------------------------------------
       
   762 //
       
   763 TInt CCamAppUi:: HyperlinkCallback(TAny* aAny)
       
   764     {
       
   765     (static_cast<CCamAppUi*>(aAny))->OpenSettingView();
       
   766     return EFalse;
       
   767     }
       
   768 // -----------------------------------------------------------------------------
       
   769 // CCamAppUi::OpenSettingView
       
   770 // Non static public method , to launch the settings view
       
   771 // -----------------------------------------------------------------------------
       
   772 //
       
   773 void CCamAppUi::OpenSettingView()
       
   774     {
       
   775     TRAP_IGNORE( HandleCommandL( ECamCmdSettings ) );
       
   776     }
       
   777 // -----------------------------------------------------------------------------
       
   778 // CCamAppUi::CamFtuDisplayL()
       
   779 // TO Display FTU message for first time camera launched
       
   780 // -----------------------------------------------------------------------------
       
   781 //
       
   782 void CCamAppUi::CamFtuDisplayL()
       
   783     {    
       
   784 
       
   785 	iController.SetIntegerSettingValueL( ECamSettingItemRecLocation, ECamLocationOn );
       
   786 
       
   787     CAknMessageQueryDialog* dlg =
       
   788     new (ELeave) CAknMessageQueryDialog();
       
   789     dlg->PrepareLC( R_FTU_MESSAGE_DIALOG );
       
   790     HBufC* msg = iEikonEnv->AllocReadResourceLC( R_FTU_MESSAGE_DIALOG_TEXT );
       
   791     HBufC* hyperLinkMsg = iEikonEnv->AllocReadResourceLC(
       
   792             R_FTU_MESSAGE_HYPERLINK_TEXT );
       
   793    
       
   794     TInt len = msg->Length() 
       
   795             + hyperLinkMsg->Length() 
       
   796             + KOpeningLinkTag().Length() 
       
   797             + KClosingLinkTag().Length();
       
   798     
       
   799     HBufC* displayMsg = HBufC::NewLC( len );
       
   800     _LIT(KMsgFormat, "%S%S%S%S");
       
   801     displayMsg->Des().Format(KMsgFormat, 
       
   802             msg, 
       
   803             &KOpeningLinkTag(),
       
   804             hyperLinkMsg,
       
   805             &KClosingLinkTag());
       
   806 
       
   807     dlg->SetMessageTextL( *displayMsg );
       
   808     CleanupStack::PopAndDestroy(3); //msg, hyperLinkMsg, displayMsg
       
   809     
       
   810     TCallBack callback( HyperlinkCallback, this );
       
   811 
       
   812     dlg->SetLink( callback );
       
   813 
       
   814     dlg->RunLD();
       
   815 
       
   816     iRepository->Set( KCamCrFtuMessageFlag, CCamFtuDisplay::ECamFtuDisable );
       
   817 
       
   818 	//Read the location record value in case its changed by hyperlink
       
   819 
       
   820 	TInt value = 0;
       
   821 	iRepository->Get( KCamCrPhotoStoreLocation, value );
       
   822 	iController.SetIntegerSettingValueL( ECamSettingItemRecLocation, value );
       
   823 	
       
   824     } 
       
   825 // -----------------------------------------------------------------------------
   700 // -----------------------------------------------------------------------------
   826 // CCamAppUi::IsConstructionComplete
   701 // CCamAppUi::IsConstructionComplete
   827 // Returns whether or not all construction has completed
   702 // Returns whether or not all construction has completed
   828 // -----------------------------------------------------------------------------
   703 // -----------------------------------------------------------------------------
   829 //    
   704 //    
  1016         {
   891         {
  1017         // stop the timer and remove the indicator from the side pane
   892         // stop the timer and remove the indicator from the side pane
  1018         iSelfTimer->Cancel();
   893         iSelfTimer->Cancel();
  1019 
   894 
  1020         // In capture setup mode, toolbar and indicators are not visible
   895         // In capture setup mode, toolbar and indicators are not visible
  1021         // They will be updated when returning to precap, similarily to
   896         // They will be updated when returning to precap, similar to
  1022         // when setting the self timer mode above
   897         // when setting the self timer mode above.
  1023         // during changing from still pre-capture view to video pre-capture view, no need 
   898         // Also, during transition from still pre-capture view to video 
  1024         // to show toolbar of still image. It will display toolbar of video when entering video pre-capture  
   899         // pre-capture view, there's no need to show toolbar of still image. 
  1025 
   900         // It will display toolbar of video when entering video pre-capture.
  1026         if( ( iPreCaptureMode != ECamPreCapCaptureSetup && 
   901         if ( iPreCaptureMode != ECamPreCapCaptureSetup && 
  1027               iPreCaptureMode != ECamPreCapSceneSetting ) &&                           
   902              iPreCaptureMode != ECamPreCapSceneSetting )
  1028             !( IsViewFinderInTransit() && 
       
  1029                 iMode == ECamControllerImage &&
       
  1030                 iTargetMode == ECamControllerVideo ) )    
       
  1031             {
   903             {
  1032             // Re-show the active palette
   904             // Re-show the active palette
  1033             iActivePaletteHandler->UpdateActivePaletteL();
   905             iActivePaletteHandler->UpdateActivePaletteL();
  1034             iPreventActivePaletteDisplay = EFalse;
   906             iPreventActivePaletteDisplay = EFalse;
  1035             SetActivePaletteVisibility( ETrue );
   907             SetActivePaletteVisibility( ETrue );
  1043                     }
   915                     }
  1044                 }
   916                 }
  1045             // Cancel any active focusing operation
   917             // Cancel any active focusing operation
  1046             // this won't cancel if capture has already been requested
   918             // this won't cancel if capture has already been requested
  1047             iController.CancelFocusAndCapture();
   919             iController.CancelFocusAndCapture();
  1048                 
   920 
  1049             iStillCaptureView->UpdateToolbarIconsL();
   921             iStillCaptureView->UpdateToolbarIconsL();
  1050             
   922             
  1051             // Raise precapture UI and restart courtesy UI timer,
   923             // Raise precapture UI and restart courtesy UI timer,
  1052             // if hide icons is enabled.
   924             // if hide icons is enabled.
  1053             RaisePreCaptureCourtesyUI(EFalse);        
   925             RaisePreCaptureCourtesyUI(EFalse);        
  1054             }        
   926             }
  1055         
   927         
  1056         UpdateCba();
   928         UpdateCba();
  1057         CCamViewBase* precapView = static_cast<CCamViewBase*>( iView );              
   929         }
  1058         if( precapView && 
       
  1059             IsViewFinderInTransit() && 
       
  1060             iMode == ECamControllerImage &&
       
  1061             iTargetMode == ECamControllerVideo )
       
  1062           {
       
  1063           precapView->ViewCba()->DrawNow();       
       
  1064           }
       
  1065         }    
       
  1066     }
   930     }
  1067 
   931 
  1068 // -----------------------------------------------------------------------------
   932 // -----------------------------------------------------------------------------
  1069 // CCamAppUi::SelfTimerEnabled
   933 // CCamAppUi::SelfTimerEnabled
  1070 // Returns current self-timer state
   934 // Returns current self-timer state
  1612             
  1476             
  1613         iPreventActivePaletteDisplay = ETrue;
  1477         iPreventActivePaletteDisplay = ETrue;
  1614         SetActivePaletteVisibility( EFalse );           
  1478         SetActivePaletteVisibility( EFalse );           
  1615            
  1479            
  1616         // Update CBA
  1480         // Update CBA
  1617         if ( iSelfTimer && iSelfTimer->IsActive() )
  1481         UpdateCba();
  1618             {
       
  1619             UpdateCba();
       
  1620             }
       
  1621         }
  1482         }
  1622       }
  1483       }
  1623       break;
  1484       break;
  1624     // -----------------------------------------------------
  1485     // -----------------------------------------------------
  1625     case ECamCmdSelfTimerCancel:
  1486     case ECamCmdSelfTimerCancel:
  3892         {
  3753         {
  3893         CCamGSInterface* plugin = CCamGSInterface::NewL( KCamGSPluginUid );
  3754         CCamGSInterface* plugin = CCamGSInterface::NewL( KCamGSPluginUid );
  3894         CleanupStack::PushL( plugin );
  3755         CleanupStack::PushL( plugin );
  3895         AddViewL( plugin ); // Transfer ownership to AppUi
  3756         AddViewL( plugin ); // Transfer ownership to AppUi
  3896         CleanupStack::Pop( plugin );
  3757         CleanupStack::Pop( plugin );
  3897         iController.SetSettingsPlugin( plugin->iDtor_ID_Key );
       
  3898         iPlugin = plugin;        
  3758         iPlugin = plugin;        
  3899         }
  3759         }
  3900       break;
  3760       break;
  3901       }
  3761       }
  3902     // -----------------------------------------------------
  3762     // -----------------------------------------------------
  4089       }
  3949       }
  4090     else if( iViewState == ECamViewStateBurstThumbnail )
  3950     else if( iViewState == ECamViewStateBurstThumbnail )
  4091       {
  3951       {
  4092       iController.ReleaseArray( ETrue );    
  3952       iController.ReleaseArray( ETrue );    
  4093       }
  3953       }
  4094     if ( iPreCaptureMode != ECamPreCapTimeLapseSlider && !IsEmbedded() )
  3954     if ( iPreCaptureMode != ECamPreCapTimeLapseSlider )
  4095       {
  3955       {
  4096       iPreCaptureMode = ECamPreCapViewfinder;
  3956       iPreCaptureMode = ECamPreCapViewfinder;
  4097       }       
  3957       }       
  4098     }
  3958     }
  4099 
  3959 
  5178             if ( iController.IsProcessingCapture() )
  5038             if ( iController.IsProcessingCapture() )
  5179                 {
  5039                 {
  5180                 PRINT( _L("Camera <= CCamAppUi::StartCaptureL - already processing - ignored capture key") );
  5040                 PRINT( _L("Camera <= CCamAppUi::StartCaptureL - already processing - ignored capture key") );
  5181                 return EKeyWasNotConsumed;
  5041                 return EKeyWasNotConsumed;
  5182                 }
  5042                 }
  5183 
  5043             else if( iController.ActiveCamera() == ECamActiveCameraSecondary &&
       
  5044                     iController.IsRotationActive() )
       
  5045                 {
       
  5046                 PRINT( _L("Camera <= CCamAppUi::StartCaptureL - rotation in processing - ignored capture key") );
       
  5047                 return EKeyWasNotConsumed;                
       
  5048                 }
  5184             // Start capture
  5049             // Start capture
  5185             iController.Capture();
  5050             iController.Capture();
  5186 
  5051 
  5187             // Ensure softkeys are correct for sequence
  5052             // Ensure softkeys are correct for sequence
  5188             if ( IsBurstEnabled() )            
  5053             if ( IsBurstEnabled() )            
  5491     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_INTERNALEXITL, "e_CCamAppUi_InternalExitL 1" );
  5356     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_INTERNALEXITL, "e_CCamAppUi_InternalExitL 1" );
  5492     
  5357     
  5493     PRINT( _L("Camera => CCamAppUi::InternalExitL") );
  5358     PRINT( _L("Camera => CCamAppUi::InternalExitL") );
  5494 
  5359 
  5495     iController.StoreFaceTrackingValue(); // store the current FT setting
  5360     iController.StoreFaceTrackingValue(); // store the current FT setting
  5496 
       
  5497     if ( iMode == ECamControllerVideo ) 
       
  5498         {
       
  5499         // Prevent flickering when returning to default Still image mode
       
  5500         CCamViewBase* precapView = static_cast<CCamViewBase*>( iView ); 
       
  5501     	__ASSERT_DEBUG( precapView, CamPanic( ECamPanicNullPointer ));
       
  5502         precapView->ViewCba()->MakeVisible( EFalse );
       
  5503         } 
       
  5504 	
  5361 	
  5505     if ( iController.UiConfigManagerPtr() && 
  5362     if ( iController.UiConfigManagerPtr() && 
  5506          iController.UiConfigManagerPtr()->IsLocationSupported() )
  5363          iController.UiConfigManagerPtr()->IsLocationSupported() )
  5507         {
  5364         {
  5508         // If record location setting is on, stop location trail
  5365         // If record location setting is on, stop location trail
  7878         SetActivePaletteVisibility( EFalse );
  7735         SetActivePaletteVisibility( EFalse );
  7879         }
  7736         }
  7880 
  7737 
  7881     if ( iViewState != ECamViewStateUserSceneSetup )
  7738     if ( iViewState != ECamViewStateUserSceneSetup )
  7882         {
  7739         {
  7883 	    if ( AknLayoutUtils::PenEnabled() ) 
  7740 	    if ( CamUtility::IsNhdDevice() ) 
  7884 	        {
  7741 	        {
  7885 	        StatusPane()->MakeVisible( aMode == ECamPreCapStandby || 
  7742 	        StatusPane()->MakeVisible( aMode == ECamPreCapStandby || 
  7886 	                                   IsSecondCameraEnabled() && 
  7743 	                                   IsSecondCameraEnabled() && 
  7887 	                                   !IsQwerty2ndCamera() ||
  7744 	                                   !IsQwerty2ndCamera() ||
  7888 	                                   SettingsLaunchedFromCamera() ); 
  7745 	                                   SettingsLaunchedFromCamera() );