camerauis/cameraapp/generic/src/CamAppui.cpp
branchRCL_3
changeset 22 f54ad444594d
parent 21 289bbfdb6627
equal deleted inserted replaced
21:289bbfdb6627 22:f54ad444594d
    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>
    66 
    67 
    67 #include "CameraappPrivateCRKeys.h"
    68 #include "CameraappPrivateCRKeys.h"
    68 #include "CamAppUi.h"
    69 #include "CamAppUi.h"
    69 #include "CamUtility.h"
    70 #include "CamUtility.h"
    70 #include "CamAppController.h"
    71 #include "CamAppController.h"
   144                                    | ECamCameraEventClassImage
   145                                    | ECamCameraEventClassImage
   145                                    | ECamCameraEventClassVideo
   146                                    | ECamCameraEventClassVideo
   146                                    | ECamCameraEventClassVfControl
   147                                    | ECamCameraEventClassVfControl
   147                                    | ECamCameraEventClassSsControl
   148                                    | ECamCameraEventClassSsControl
   148                                    | ECamCameraEventClassSettings );
   149                                    | ECamCameraEventClassSettings );
   149 
   150 /**
       
   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     };
   150 
   189 
   151 
   190 
   152 // ===========================================================================
   191 // ===========================================================================
   153 // Member functions
   192 // Member functions
   154 
   193 
   249     delete iScreenClearer;
   288     delete iScreenClearer;
   250     delete iVolumeKeyObserver;
   289     delete iVolumeKeyObserver;
   251 
   290 
   252     delete iCollectionManager;
   291     delete iCollectionManager;
   253     iCollectionManager = NULL;
   292     iCollectionManager = NULL;
       
   293 
       
   294     if( iCamFtuDisplay )
       
   295         {
       
   296         delete iCamFtuDisplay;
       
   297         iCamFtuDisplay = NULL;
       
   298         }
   254 
   299 
   255     PRINT( _L("Camera <= ~CCamAppUi" ))
   300     PRINT( _L("Camera <= ~CCamAppUi" ))
   256     }
   301     }
   257 
   302 
   258 // -----------------------------------------------------------------------------
   303 // -----------------------------------------------------------------------------
   660   // TRAP errors so camera starts up even if startup animation fails
   705   // TRAP errors so camera starts up even if startup animation fails
   661   TRAP_IGNORE(iStartupLogoController = CCamStartupLogoController::NewL(EStartupLogoVisible));
   706   TRAP_IGNORE(iStartupLogoController = CCamStartupLogoController::NewL(EStartupLogoVisible));
   662 
   707 
   663   PRINT( _L("Camera <= CCamAppUi::ConstructL") )
   708   PRINT( _L("Camera <= CCamAppUi::ConstructL") )
   664   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 0" );
   709   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 0" );
   665   }
   710    
       
   711   //  To get FTU flag value
       
   712 
       
   713     TInt ftuValue=0;
       
   714     TInt retErr=0;
       
   715     retErr=iRepository->Get( KCamCrFtuMessageFlag, ftuValue );
       
   716    
       
   717     if( !IsEmbedded() && ftuValue == CCamFtuDisplay::ECamFtuEnable 
       
   718 	        && retErr==KErrNone )
       
   719         {
       
   720         iCamFtuDisplay = new (ELeave)CCamFtuDisplay(this);
       
   721         iCamFtuDisplay->Call();
       
   722         }
       
   723     }
   666     
   724     
   667 
   725 
   668 
   726 
   669 // -----------------------------------------------------------------------------
   727 // -----------------------------------------------------------------------------
   670 // IsInternalView
   728 // IsInternalView
   692     }
   750     }
   693 
   751 
   694   PRINT1( _L("Camera <= CCamAppUi::IsInternalView, return %d"), internal );
   752   PRINT1( _L("Camera <= CCamAppUi::IsInternalView, return %d"), internal );
   695   return internal;
   753   return internal;
   696   }
   754   }
   697 
   755 // -----------------------------------------------------------------------------
   698 
   756 // CCamAppUi:: HyperlinkCallback
   699  
   757 // Call back method for the hyper link text 
       
   758 // -----------------------------------------------------------------------------
       
   759 //
       
   760 TInt CCamAppUi:: HyperlinkCallback(TAny* aAny)
       
   761     {
       
   762     (static_cast<CCamAppUi*>(aAny))->OpenSettingView();
       
   763     return EFalse;
       
   764     }
       
   765 // -----------------------------------------------------------------------------
       
   766 // CCamAppUi::OpenSettingView
       
   767 // Non static public method , to launch the settings view
       
   768 // -----------------------------------------------------------------------------
       
   769 //
       
   770 void CCamAppUi::OpenSettingView()
       
   771     {
       
   772     TRAP_IGNORE( HandleCommandL( ECamCmdSettings ) );
       
   773     }
       
   774 // -----------------------------------------------------------------------------
       
   775 // CCamAppUi::CamFtuDisplayL()
       
   776 // TO Display FTU message for first time camera launched
       
   777 // -----------------------------------------------------------------------------
       
   778 //
       
   779 void CCamAppUi::CamFtuDisplayL()
       
   780     {    
       
   781 
       
   782 	iController.SetIntegerSettingValueL( ECamSettingItemRecLocation, ECamLocationOn );
       
   783 
       
   784     CAknMessageQueryDialog* dlg =
       
   785     new (ELeave) CAknMessageQueryDialog();
       
   786     dlg->PrepareLC( R_FTU_MESSAGE_DIALOG );
       
   787     HBufC* msg = iEikonEnv->AllocReadResourceLC( R_FTU_MESSAGE_DIALOG_TEXT );
       
   788     HBufC* hyperLinkMsg = iEikonEnv->AllocReadResourceLC(
       
   789             R_FTU_MESSAGE_HYPERLINK_TEXT );
       
   790    
       
   791     TInt len = msg->Length() 
       
   792             + hyperLinkMsg->Length() 
       
   793             + KOpeningLinkTag().Length() 
       
   794             + KClosingLinkTag().Length();
       
   795     
       
   796     HBufC* displayMsg = HBufC::NewLC( len );
       
   797     _LIT(KMsgFormat, "%S%S%S%S");
       
   798     displayMsg->Des().Format(KMsgFormat, 
       
   799             msg, 
       
   800             &KOpeningLinkTag(),
       
   801             hyperLinkMsg,
       
   802             &KClosingLinkTag());
       
   803 
       
   804     dlg->SetMessageTextL( *displayMsg );
       
   805     CleanupStack::PopAndDestroy(3); //msg, hyperLinkMsg, displayMsg
       
   806     
       
   807     TCallBack callback( HyperlinkCallback, this );
       
   808 
       
   809     dlg->SetLink( callback );
       
   810 
       
   811     dlg->RunLD();
       
   812 
       
   813     iRepository->Set( KCamCrFtuMessageFlag, CCamFtuDisplay::ECamFtuDisable );
       
   814 
       
   815 	//Read the location record value in case its changed by hyperlink
       
   816 
       
   817 	TInt value = 0;
       
   818 	iRepository->Get( KCamCrPhotoStoreLocation, value );
       
   819 	iController.SetIntegerSettingValueL( ECamSettingItemRecLocation, value );
       
   820 	
       
   821     } 
   700 // -----------------------------------------------------------------------------
   822 // -----------------------------------------------------------------------------
   701 // CCamAppUi::IsConstructionComplete
   823 // CCamAppUi::IsConstructionComplete
   702 // Returns whether or not all construction has completed
   824 // Returns whether or not all construction has completed
   703 // -----------------------------------------------------------------------------
   825 // -----------------------------------------------------------------------------
   704 //    
   826 //    
   893         iSelfTimer->Cancel();
  1015         iSelfTimer->Cancel();
   894 
  1016 
   895         // In capture setup mode, toolbar and indicators are not visible
  1017         // In capture setup mode, toolbar and indicators are not visible
   896         // They will be updated when returning to precap, similarily to
  1018         // They will be updated when returning to precap, similarily to
   897         // when setting the self timer mode above
  1019         // when setting the self timer mode above
   898         if( iPreCaptureMode != ECamPreCapCaptureSetup )
  1020         // during changing from still pre-capture view to video pre-capture view, no need 
       
  1021         // to show toolbar of still image. It will display toolbar of video when entering video pre-capture  
       
  1022 
       
  1023         if( ( iPreCaptureMode != ECamPreCapCaptureSetup && 
       
  1024               iPreCaptureMode != ECamPreCapSceneSetting ) &&                           
       
  1025             !( IsViewFinderInTransit() && 
       
  1026                 iMode == ECamControllerImage &&
       
  1027                 iTargetMode == ECamControllerVideo ) )    
   899             {
  1028             {
   900             // Re-show the active palette
  1029             // Re-show the active palette
   901             iActivePaletteHandler->UpdateActivePaletteL();
  1030             iActivePaletteHandler->UpdateActivePaletteL();
   902             iPreventActivePaletteDisplay = EFalse;
  1031             iPreventActivePaletteDisplay = EFalse;
   903             SetActivePaletteVisibility( ETrue );
  1032             SetActivePaletteVisibility( ETrue );
   920             // if hide icons is enabled.
  1049             // if hide icons is enabled.
   921             RaisePreCaptureCourtesyUI(EFalse);        
  1050             RaisePreCaptureCourtesyUI(EFalse);        
   922             }        
  1051             }        
   923         
  1052         
   924         UpdateCba();
  1053         UpdateCba();
       
  1054         CCamViewBase* precapView = static_cast<CCamViewBase*>( iView );              
       
  1055         if( precapView && 
       
  1056             IsViewFinderInTransit() && 
       
  1057             iMode == ECamControllerImage &&
       
  1058             iTargetMode == ECamControllerVideo )
       
  1059           {
       
  1060           precapView->ViewCba()->DrawNow();       
       
  1061           }
   925         }    
  1062         }    
   926     }
  1063     }
   927 
  1064 
   928 // -----------------------------------------------------------------------------
  1065 // -----------------------------------------------------------------------------
   929 // CCamAppUi::SelfTimerEnabled
  1066 // CCamAppUi::SelfTimerEnabled
  1472             
  1609             
  1473         iPreventActivePaletteDisplay = ETrue;
  1610         iPreventActivePaletteDisplay = ETrue;
  1474         SetActivePaletteVisibility( EFalse );           
  1611         SetActivePaletteVisibility( EFalse );           
  1475            
  1612            
  1476         // Update CBA
  1613         // Update CBA
  1477         UpdateCba();
  1614         if ( iSelfTimer && iSelfTimer->IsActive() )
       
  1615             {
       
  1616             UpdateCba();
       
  1617             }
  1478         }
  1618         }
  1479       }
  1619       }
  1480       break;
  1620       break;
  1481     // -----------------------------------------------------
  1621     // -----------------------------------------------------
  1482     case ECamCmdSelfTimerCancel:
  1622     case ECamCmdSelfTimerCancel:
  2004             else if ( !iFirstVFStart )
  2144             else if ( !iFirstVFStart )
  2005                 {
  2145                 {
  2006                 iController.TryAFRequest( ECamRequestCancelAutofocus );
  2146                 iController.TryAFRequest( ECamRequestCancelAutofocus );
  2007                 }
  2147                 }
  2008             }
  2148             }
       
  2149         }
       
  2150      else
       
  2151         {
       
  2152         SetToolbarVisibility();
  2009         }
  2153         }
  2010       iFirstVFStart = EFalse;
  2154       iFirstVFStart = EFalse;
  2011       
  2155       
  2012       PRINT( _L( "Camera <> CCamAppUi::HandleCameraEventL updating CBA") );
  2156       PRINT( _L( "Camera <> CCamAppUi::HandleCameraEventL updating CBA") );
  2013       UpdateCba();
  2157       UpdateCba();
  3941       }
  4085       }
  3942     else if( iViewState == ECamViewStateBurstThumbnail )
  4086     else if( iViewState == ECamViewStateBurstThumbnail )
  3943       {
  4087       {
  3944       iController.ReleaseArray( ETrue );    
  4088       iController.ReleaseArray( ETrue );    
  3945       }
  4089       }
  3946     if ( iPreCaptureMode != ECamPreCapTimeLapseSlider )
  4090     if ( iPreCaptureMode != ECamPreCapTimeLapseSlider && !IsEmbedded() )
  3947       {
  4091       {
  3948       iPreCaptureMode = ECamPreCapViewfinder;
  4092       iPreCaptureMode = ECamPreCapViewfinder;
  3949       }       
  4093       }       
  3950     }
  4094     }
  3951 
  4095