camerauis/cameraapp/generic/inc/CamNaviCounterModel.h
branchRCL_3
changeset 54 bac7acad7cb3
parent 0 1ddebce53859
child 57 2c87b2808fd7
equal deleted inserted replaced
53:61bc0f252b2b 54:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Control for displaying remaining images in navi pane.
       
    15 *
       
    16 *  Copyright © 2007 Nokia.  All rights reserved.
       
    17 *  This material, including documentation and any related computer
       
    18 *  programs, is protected by copyright controlled by Nokia.  All
       
    19 *  rights are reserved.  Copying, including reproducing, storing,
       
    20 *  adapting or translating, any or all of this material requires the
       
    21 *  prior written consent of Nokia.  This material also contains
       
    22 *  confidential information which may not be disclosed to others
       
    23 *  without the prior written consent of Nokia.
       
    24 
       
    25 *
       
    26 *
       
    27 */
       
    28 
       
    29 
       
    30 #ifndef CAMNAVICOUNTERMODEL_H
       
    31 #define CAMNAVICOUNTERMODEL_H
       
    32 
       
    33 // INCLUDES
       
    34 #include <bldvariant.hrh>
       
    35 #include <coecntrl.h>
       
    36 #include <AknUtils.h>
       
    37 #include "CamAppController.h"
       
    38 #include "CamSettings.hrh"
       
    39 #include "CamResourceLoader.h"
       
    40 #include "CamObservable.h"
       
    41 #include "CamObserverHandler.h"
       
    42 
       
    43 #include "CamSelfTimerObserver.h"
       
    44 
       
    45 #include "CamBurstModeObserver.h"
       
    46 
       
    47 #include "CamAppUiBase.h"
       
    48 
       
    49 // CONSTANTS
       
    50 const TInt KMaxTextLength = 40;
       
    51 
       
    52 // FORWARD DECLARATIONS
       
    53 class MAknsSkinInstance;
       
    54 class CCamDecorator;
       
    55 class CCamTextItem;
       
    56 class CAknNavigationDecorator;
       
    57 class CFbsBitmap;
       
    58 // CLASS DECLARATION
       
    59 
       
    60 
       
    61 /**
       
    62 * Control for displaying recording time info in navi pane.
       
    63 * @since 2.8
       
    64 */
       
    65 class CCamNaviCounterModel : public CBase,
       
    66                                 public MCamControllerObserver,
       
    67                                 public MCamObservable,
       
    68                                 public MCamResourceLoader, 
       
    69                                 public MCamSelfTimerObserver,
       
    70                                 public MCamBurstModeObserver
       
    71 
       
    72     {
       
    73     public: // Constructors and destructor
       
    74 		/**
       
    75 		*	Static factory construction function
       
    76         *   @since 2.8
       
    77 		*	@param aController Reference to CCamAppController
       
    78 		*	@return pointer to constructed instance of CCamNaviCounterModel
       
    79 		*/
       
    80 		static CCamNaviCounterModel* NewL( CCamAppController& aController );
       
    81 
       
    82         /**
       
    83         * Destructor.
       
    84         */
       
    85         ~CCamNaviCounterModel();
       
    86 
       
    87     private: // New functions
       
    88         /**
       
    89         * Update remaining image counter
       
    90         * @since 2.8
       
    91         */
       
    92         void UpdateCounter();
       
    93 
       
    94         /**
       
    95         * Update remaining time till next timelapse capture
       
    96         * @since 3.0
       
    97         */
       
    98         void UpdateTimeLapseCountdownL();
       
    99         
       
   100         /**
       
   101         * Update captured and remaining image count during burst and timelapse capture
       
   102         * @since 3.0
       
   103         */
       
   104         void UpdateSequenceImageCount();
       
   105 
       
   106         /**
       
   107         * Update remaining record time
       
   108         * @since 2.8
       
   109         */
       
   110         void UpdateRecordTimeAvailableL();
       
   111 
       
   112     public: // From MCamResourceLoader
       
   113         /**
       
   114         * From MCamResourceLoader
       
   115         * @since 3.0
       
   116         */
       
   117         void LoadResourceDataL();
       
   118 
       
   119         /**
       
   120         * From MCamResourceLoader
       
   121         * @since 3.0
       
   122         */
       
   123         void UnloadResourceData();
       
   124 
       
   125         /**
       
   126         * From MCamResourceLoader
       
   127         * @since 3.0
       
   128         */
       
   129         void ReloadResourceDataL();
       
   130     
       
   131     public: // From MCamObservable
       
   132         /**
       
   133         * From MCamObservable
       
   134         * @param aObserver Observer to register
       
   135         * @since 3.0
       
   136         */
       
   137         void RegisterObserverL(MCamObserver* aObserver);
       
   138 
       
   139         /**
       
   140         * From MCamObservable
       
   141         * @param aObserver Observer to deregister
       
   142         * @since 3.0
       
   143         */
       
   144         void DeregisterObserver(MCamObserver* aObserver);
       
   145 
       
   146         /**
       
   147         * From MCamObservable
       
   148         * @param aEvent Event code to broadcast
       
   149         * @since 3.0
       
   150         */
       
   151         void BroadcastEvent(TCamObserverEvent aEvent);
       
   152     
       
   153     public: // New functions
       
   154         /*
       
   155         * Draws counter and storage icon in the navi pane.
       
   156         */
       
   157         void CreateNaviBitmapsL( TBool aFlag = ETrue );
       
   158         
       
   159         /**
       
   160         * Set capture mode (defines which counter to use)
       
   161         * @since 2.8
       
   162         * @param aCaptureMode Specifies the current capture mode in use
       
   163         */
       
   164         void SetCaptureModeL( TCamCameraMode       aCaptureMode,
       
   165                               TCamImageCaptureMode aImageMode    );
       
   166         
       
   167         /**
       
   168         * Draw the storage icon
       
   169         * @since 2.8
       
   170         * @param aGc The graphics context to use
       
   171         */                     
       
   172         void DrawStorageIcon( CBitmapContext& aGc ) const;
       
   173 
       
   174         /**
       
   175         * Draw the video file type icon
       
   176         * @since 2.8
       
   177         * @param aGc The graphics context to use
       
   178         */                     
       
   179         void DrawVideoFileTypeIndicator( CBitmapContext& aGc ) const;
       
   180                
       
   181         /**
       
   182         * Force update of navi-pane (i.e after dismissal of MMC removed error note)
       
   183         * @since 2.8
       
   184         */
       
   185         void ForceNaviPaneUpdate();
       
   186 
       
   187         /**
       
   188         * Sets a new extent to render into
       
   189         * @param aExtent New extent
       
   190         */
       
   191         void SetExtentL( TRect aExtent );
       
   192         
       
   193     public: // Functions from base class MCamSelfTimerObserver
       
   194         /**
       
   195         * Handle an event from CCamSelfTimer.
       
   196         * @since 2.8
       
   197         * @param aEvent the self timer event
       
   198         * @param aCountDown self timer countdown duration
       
   199         */
       
   200         void HandleSelfTimerEvent( TCamSelfTimerEvent aEvent, 
       
   201             TInt aCountDown );
       
   202 
       
   203     public: // Functions from base class MCamBurstModeObserver
       
   204         /**
       
   205         * Handle sequence state change
       
   206         * @since 2.8
       
   207         * @param aActive ETrue if sequence now active, else EFalse
       
   208         */
       
   209         void BurstModeActiveL( TBool aActive, TBool aStillModeActive );
       
   210 
       
   211         /**
       
   212         * Draw the counter to the bitmap used in the navi pane
       
   213         * @since 3.0
       
   214         * @param aBmpGc The graphics context for the bitmap
       
   215         * @param aBmpMaskGc The graphics context for the bitmap mask
       
   216         */
       
   217 	    void DrawCounterToBitmaps( CFbsBitGc& aBmpGc, CFbsBitGc& aBmpMaskGc ) const;	
       
   218 
       
   219 		/**
       
   220 		* Draw Navi-Counter
       
   221 		* @since 3.0
       
   222 		* @param aGc Handle to graphics context
       
   223 		* @param aControl Pointer to the control
       
   224 		*/
       
   225 		void DrawNaviCtr( CBitmapContext& aGc, const CCoeControl* aControl ) const;
       
   226 
       
   227 	protected:
       
   228 		/**
       
   229         * C++ constructor.
       
   230         * @since 2.8
       
   231         * @param aController Reference to CCamAppController
       
   232         */
       
   233         CCamNaviCounterModel( CCamAppController& aController );
       
   234         
       
   235         /**
       
   236         * Symbian OS 2nd phase constructor.
       
   237         * @since 2.8
       
   238         */
       
   239         void ConstructL();
       
   240 
       
   241     private: // Functions from base classes
       
   242 
       
   243         /**
       
   244         * Draw the navi-counter
       
   245         * @since 3.0
       
   246         * @param aGc Handle to graphics context
       
   247         * @param aControl Pointer to the control
       
   248         */
       
   249         void DrawCounter( CBitmapContext& aGc, const CCoeControl* aControl ) const;
       
   250         
       
   251         /**
       
   252         * Draw the storage icon to the bitmap used in the navi pane
       
   253         * @since 3.0
       
   254         * @param aBmpGc The graphics context for the bitmap
       
   255         * @param aBmpMaskGc The graphics context for the bitmap mask
       
   256         */
       
   257         void DrawStorageIconToBitmap( CFbsBitGc& aBmpGc, CFbsBitGc& aBmpMaskGc  ) const;
       
   258 
       
   259         /**
       
   260         * Draw the text 
       
   261         * @since 2.8
       
   262         * @param aSkin the current skin
       
   263         * @param aText A Reference to the text
       
   264         */
       
   265         void DrawText(       MAknsSkinInstance* aSkin, 
       
   266                        const TDesC&             aText, 
       
   267                              CBitmapContext&    aGc   ) const;
       
   268 
       
   269         /**
       
   270         * Draw the countdown text (timelapse mode)
       
   271         * @since 3.0
       
   272         * @param aSkin the current skin
       
   273         * @param aGc the graphics context
       
   274         */                       
       
   275         void DrawTimeLapseCountdown( MAknsSkinInstance* aSkin,
       
   276                                      CBitmapContext&    aGc   ) const;  
       
   277                                      
       
   278         /**
       
   279         * Draw the captured and remaining image text (timelapse and burst mode)
       
   280         * @since 3.0
       
   281         * @param aSkin the current skin
       
   282         * @param aGc the graphics context
       
   283         */  
       
   284         void DrawSequenceImageText( MAknsSkinInstance* aSkin,
       
   285                                     CBitmapContext&    aGc   ) const;    
       
   286              
       
   287         /**
       
   288         * Draw the count of captured images (timelapse mode - postcapture)
       
   289         * @since 3.0
       
   290         * @param aSkin the current skin
       
   291         * @param aGc the graphics context
       
   292         */                                       
       
   293         void DrawImagesCapturedTextL( MAknsSkinInstance* aSkin,
       
   294                                       CBitmapContext&    aGc   ) const;  
       
   295 
       
   296         /**
       
   297         * Draw the current file size
       
   298         * @since 3.0
       
   299         * @param aSkin the current skin
       
   300         */
       
   301         void DrawCurrentFileSizeL( MAknsSkinInstance* aSkin, 
       
   302                                    CBitmapContext&    aGc   ) const;
       
   303 
       
   304         /**
       
   305         * Construct the member variables for selftimer icon
       
   306         * in the navi-pane
       
   307         * @since 2.8
       
   308         * @param aResname The resource file name
       
   309         */
       
   310         void ConstructNaviSelfTimerL( TPtrC& aResname );
       
   311         
       
   312         /**
       
   313         * Draw the selftimer icon and text
       
   314         * @since 2.8
       
   315         * @param aGc The graphics context to use
       
   316         * @param aSkin The current skin
       
   317         */        
       
   318         void DrawNaviSelfTimer( CBitmapContext&    aGc, 
       
   319                                 MAknsSkinInstance* aSkin ) const;           
       
   320 
       
   321         /**
       
   322         * Construct the member variables for sequence icon 
       
   323         * in the navi-pane
       
   324         * @since 2.8
       
   325         * @param aResname The resource file name
       
   326         */
       
   327         void ConstructNaviSequenceL( TPtrC& aResname );
       
   328 
       
   329         /**
       
   330         * Draw the sequence icon
       
   331         * @since 2.8
       
   332         * @param aGc The graphics context to use
       
   333         */                
       
   334         void DrawNaviSequence( CBitmapContext& aGc ) const;
       
   335 
       
   336 #ifdef PRODUCT_SUPPORTS_NAVIPANE_GENERIC_SETUP_INDICATOR
       
   337         /**
       
   338         * Construct the member variables for general setup icon 
       
   339         * in the navi-pane
       
   340         * @since 2.8
       
   341         * @param aResname The resource file name
       
   342         */
       
   343         void ConstructNaviGenericSetupL( TPtrC& aResname );
       
   344         
       
   345         /**
       
   346         * Draw the generic setup icon 
       
   347         * @since 2.8
       
   348         * @param aGc The graphics context to use
       
   349         */                
       
   350         void DrawNaviGenericSetup( CBitmapContext& aGc ) const;
       
   351 #endif // PRODUCT_SUPPORTS_NAVIPANE_GENERIC_SETUP_INDICATOR
       
   352 
       
   353         /**
       
   354         * Construct the member variables for audio mute icon 
       
   355         * in the navi-pane
       
   356         * @since 2.8
       
   357         * @param aResname The resource file name
       
   358         */
       
   359         void ConstructNaviAudioMuteL( TPtrC& aResname );
       
   360         
       
   361         /**
       
   362         * Draw the audio mute icon 
       
   363         * @since 2.8
       
   364         * @param aGc The graphics context to use
       
   365         */                
       
   366         void DrawNaviAudioMute( CBitmapContext& aGc ) const;
       
   367 
       
   368 
       
   369 #ifdef PRODUCT_SUPPORTS_NAVIPANE_MODE_SUBTITLE
       
   370         /**
       
   371         * Construct the member variables for mode subtitle 
       
   372         * in the navi-pane
       
   373         * @since 2.8
       
   374         * @param aResname The resource file name
       
   375         */
       
   376         void ConstructNaviModeSubtitleL( TPtrC& aResname );
       
   377         
       
   378         /**
       
   379         * Draw the mode subtitle icon and text
       
   380         * @since 2.8
       
   381         * @param aGc The graphics context to use
       
   382         * @param aSkin The current skin
       
   383         */                
       
   384         void DrawNaviModeSubtitle( CBitmapContext& aGc, MAknsSkinInstance* aSkin ) const;
       
   385 #endif // PRODUCT_SUPPORTS_NAVIPANE_MODE_SUBTITLE
       
   386 
       
   387         /**
       
   388         * From MCamControllerObserver
       
   389         * Handle an event from CCamAppController.
       
   390         * @since 2.8
       
   391         * @param aEvent the type of event
       
   392         * @param aError error code
       
   393         */
       
   394         void HandleControllerEventL( TCamControllerEvent aEvent,
       
   395                                     TInt aError );
       
   396         
       
   397         /**
       
   398         * Read nontouch layout for primary camera
       
   399         */
       
   400         void NonTouchLayoutL();
       
   401         
       
   402         /**
       
   403         * Read nontouch layout for primary camera
       
   404         */
       
   405         void NonTouchLayoutSecondaryL();
       
   406 
       
   407         /**
       
   408         * Read touch layout
       
   409         */
       
   410         void TouchLayoutL(); 
       
   411 
       
   412     protected: //data
       
   413        TInt iOriginalValueForEachBurst;  
       
   414        TBool iCounterNeedUpdate;  
       
   415         CCamAppController& iController; // camera app controller
       
   416 
       
   417         // text array - used to store remaining images as text
       
   418         TBuf<KMaxTextLength> iCounterText;
       
   419         
       
   420         // string used to store remaining time till next 
       
   421         // timelapse capture 
       
   422         HBufC* iCountDownText;
       
   423         
       
   424         // text array - used to store captured and remaining image
       
   425         // count in timelapse and burst modes
       
   426         TBuf<KMaxTextLength> iSequenceImageText;
       
   427 
       
   428         // text array - used to store remaining record time as text
       
   429         TBuf<KMaxTextLength> iRemainingTimeText;
       
   430 
       
   431         // Layout information for drawing the counter text.
       
   432         TAknLayoutText iPhotoTextLayout;
       
   433         TAknLayoutText iVideoTextLayout;
       
   434 
       
   435         // own
       
   436         CCamTextItem* iPhotoTextItem;
       
   437 
       
   438         // own
       
   439         CCamTextItem* iVideoTextItem;
       
   440 
       
   441         // Text items for drawing timelapse and burst text.
       
   442         // own
       
   443         CCamTextItem* iSequenceImageTextItem;
       
   444 
       
   445         // own
       
   446         CCamTextItem* iSequenceCapturedTextItem;
       
   447 
       
   448         // own
       
   449         CCamTextItem* iTimeLapseCountdownTextItem;
       
   450 
       
   451 #ifdef PRODUCT_SUPPORTS_NAVIPANE_FILENAME        
       
   452         // Layout information for drawing the current filename text.
       
   453         TAknLayoutText iPhotoNameLayout;
       
   454         TAknLayoutText iVideoNameLayout;
       
   455 #endif // PRODUCT_SUPPORTS_NAVIPANE_FILENAME    
       
   456 
       
   457         // current capture mode info
       
   458         TCamCameraMode       iMode;
       
   459         TCamImageCaptureMode iImageMode;
       
   460 
       
   461         // storage location bitmaps
       
   462         CFbsBitmap* iPhoneIcon;
       
   463         CFbsBitmap* iPhoneIconMask;
       
   464         CFbsBitmap* iMMCIcon;
       
   465         CFbsBitmap* iMMCIconMask;
       
   466         CFbsBitmap* iMassStorageIcon;
       
   467         CFbsBitmap* iMassStorageIconMask;
       
   468         
       
   469         CFbsBitmap* iMpeg4Icon;
       
   470         CFbsBitmap* iMpeg4IconMask;
       
   471         CFbsBitmap* i3GPIcon;
       
   472         CFbsBitmap* i3GPIconMask;
       
   473 
       
   474         // current storage location (phone or card)
       
   475         TCamMediaStorage iStorageLocation;
       
   476 
       
   477         // set to ETrue when engine has initialised video recorder
       
   478         TBool iVideoInitialised;
       
   479 
       
   480         // Layout information for the video storage icon (in postcapture state).
       
   481         TAknLayoutRect iVidPostStorageIconRect;
       
   482         
       
   483         // Layout information for the video storage icon (in precapture state).
       
   484         TAknLayoutRect iVidPreStorageIconRect;
       
   485         
       
   486         // Layout information for the image storage icon.
       
   487         TAknLayoutRect iImgStorageIconRect;
       
   488 
       
   489         // Layout information for the video file type icon.
       
   490         TAknLayoutRect iVideoFileTypeIconRect;
       
   491                 
       
   492         // Layout information for drawing the self timer icon.
       
   493         TAknLayoutRect iSelfTimerIconRect;
       
   494 
       
   495         // Self timer bitmaps.
       
   496         CFbsBitmap* iSelfTimerIcon;
       
   497         CFbsBitmap* iSelfTimerMask;
       
   498 
       
   499         // Specifies whether the self timer should be drawn or not.
       
   500         TBool iDrawSelfTimer;
       
   501 
       
   502         // Layout information for drawing the self timer text.
       
   503         TAknLayoutText iSelfTimerTextLayout;
       
   504 
       
   505         // text array - used to store self timer countdown as text
       
   506         TBuf<KMaxTextLength> iSelfTimerText;
       
   507 
       
   508 #ifdef PRODUCT_SUPPORTS_NAVIPANE_SEQUENCE
       
   509         // Specifies whether the sequence should be drawn or not.
       
   510         TBool iDrawSequence;        
       
   511 #endif // PRODUCT_SUPPORTS_NAVIPANE_SEQUENCE
       
   512 
       
   513         // Layout information for drawing the sequence icon.
       
   514         TAknLayoutRect iSequenceIconRect;
       
   515 
       
   516         // Sequence bitmap and mask
       
   517         CFbsBitmap* iSequenceIcon;
       
   518         CFbsBitmap* iSequenceMask;
       
   519 
       
   520 #ifdef PRODUCT_SUPPORTS_NAVIPANE_GENERIC_SETUP_INDICATOR
       
   521         // Layout information for drawing the generic setup icon.
       
   522         TAknLayoutRect iGenericIconRect;
       
   523 
       
   524         // Generic setup bitmap and mask
       
   525         CFbsBitmap* iGenericIcon;
       
   526         CFbsBitmap* iGenericMask;
       
   527 #endif // PRODUCT_SUPPORTS_NAVIPANE_GENERIC_SETUP_INDICATOR
       
   528 
       
   529         // Layout information for drawing the audio mute icon.
       
   530         TAknLayoutRect iAudioMuteIconRect;
       
   531 
       
   532         // Audio mute bitmap and mask
       
   533         CFbsBitmap* iAudioMuteIcon;
       
   534         CFbsBitmap* iAudioMuteMask;
       
   535 
       
   536 #ifdef PRODUCT_SUPPORTS_NAVIPANE_MODE_SUBTITLE   
       
   537         // Layout information for the subtitles text
       
   538         TAknLayoutText iSubtitlePhotoTextLayout;
       
   539         TAknLayoutText iSubtitleVideoTextLayout;
       
   540 
       
   541         // Text strings for photo/video subtitles
       
   542         HBufC16* iSubtitlePhotoText;
       
   543         HBufC16* iSubtitleVideoText;                
       
   544 
       
   545         // Layout information for the subtitle icons (video and photo mode)
       
   546         TAknLayoutRect iSubtitlePhotoRect;
       
   547         TAknLayoutRect iSubtitleVideoRect;                
       
   548 
       
   549         // Photo and video mode bitmaps and masks
       
   550         CFbsBitmap* iSubtitlePhotoIcon;
       
   551         CFbsBitmap* iSubtitlePhotoMask;
       
   552         CFbsBitmap* iSubtitleVideoIcon;
       
   553         CFbsBitmap* iSubtitleVideoMask;        
       
   554 #endif // PRODUCT_SUPPORTS_NAVIPANE_MODE_SUBTITLE
       
   555 
       
   556         // Layout information for Photo size text
       
   557         TAknLayoutText iPhotoSizeLayout;
       
   558 
       
   559         // Layout information for Video size text
       
   560         TAknLayoutText iVideoSizeLayout;
       
   561         
       
   562         // Resource string used to format the time text
       
   563         HBufC* iTimeFormat;
       
   564 
       
   565         // set to ETrue if burst (sequence) mode enabled
       
   566         TBool iBurstActive;
       
   567         
       
   568         // Current orientation
       
   569         TCamOrientation iCamOrientation;
       
   570         
       
   571         // Decorators for various layouts
       
   572         CCamDecorator* iPhotoPrecapDecorator;
       
   573         CCamDecorator* iVideoPrecapDecorator;
       
   574         CCamDecorator* iSequenceInCaptureDecorator;
       
   575         CCamDecorator* iPhotoPostcapDecorator;
       
   576         CCamDecorator* iVideoPostcapDecorator;
       
   577         CCamDecorator* iTimeLapsePostCaptureDecorator;
       
   578         
       
   579         // Where the counter should be drawn
       
   580         TRect iExtent;
       
   581         
       
   582         // To help handle the observers
       
   583         CCamObserverHandler* iObserverHandler;
       
   584         
       
   585         TBool iLocationIconVisible;
       
   586         
       
   587         // Used to display items in the navi pane
       
   588         CAknNavigationDecorator* iNaviDec;        
       
   589         CFbsBitmap* iNaviBitmap;
       
   590         CFbsBitmap* iNaviBitmapMask;
       
   591     };
       
   592 
       
   593 #endif // CAMNAVICOUNTERMODEL_H
       
   594 
       
   595 // End of File