camerauis/cameraapp/generic/inc/CamNaviProgressBarModel.h
branchRCL_3
changeset 54 bac7acad7cb3
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 recording progress bar 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 #ifndef CAMNAVIPROGRESSBARMODEL_H
       
    30 #define CAMNAVIPROGRESSBARMODEL_H
       
    31 
       
    32 // INCLUDES
       
    33 #include <bldvariant.hrh>
       
    34  
       
    35 #include <coecntrl.h>
       
    36 #include <AknUtils.h>
       
    37 #include "CamAppController.h"
       
    38 #include "CamSettings.hrh"
       
    39 #include "CamResourceLoader.h"
       
    40 #include "CamAppUiBase.h"
       
    41 #include "CamObservable.h"
       
    42 #include "CamObserver.h"
       
    43 #include "mcamcameraobserver.h"
       
    44 
       
    45 class CCamObserverHandler;
       
    46 class CCamTextItem;
       
    47 
       
    48 // CONSTANTS
       
    49 const TInt KMaxRecordTimeTextLength = 40;
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 class MAknsSkinInstance;
       
    53 class CCamDecorator;
       
    54 
       
    55 // CLASS DECLARATION
       
    56 
       
    57 /**
       
    58 * Control for displaying recording time info in navi pane.
       
    59 * @since 2.8
       
    60 */
       
    61 class CCamNaviProgressBarModel : public CBase,
       
    62                                  public MCamCameraObserver,
       
    63                                  public MCamControllerObserver,
       
    64                                  public MCamResourceLoader,
       
    65                                  public MCamObservable,
       
    66                                  public MCamObserver
       
    67   {
       
    68   public: // Constructors and destructor
       
    69 
       
    70     /**
       
    71     * Static factory construction function
       
    72     * @since 2.8
       
    73     * @param aController Reference to CCamAppController
       
    74     * @return pointer to constructed instance of CCamNaviProgressBarModel
       
    75     */
       
    76     static CCamNaviProgressBarModel* NewL( CCamAppController& aController );
       
    77 
       
    78     /**
       
    79     * Destructor.
       
    80     */
       
    81     virtual ~CCamNaviProgressBarModel();
       
    82 
       
    83   // -------------------------------------------------------
       
    84   // From MCamCameraObserver
       
    85   public:
       
    86 
       
    87     virtual void  HandleCameraEventL( TInt              aStatus, 
       
    88                                       TCamCameraEventId aEventId, 
       
    89                                       TAny*             aEventData = NULL );
       
    90 
       
    91   // -------------------------------------------------------
       
    92   public:
       
    93 
       
    94     /**
       
    95     * Draw Navi-progress bar
       
    96     * @since 3.0
       
    97     * @param aGc Handle to Window graphics context
       
    98     * @param aControl Pointer to the Control
       
    99     */
       
   100     void DrawProgressBar( CBitmapContext& aGc, const CCoeControl* aControl ) const;
       
   101     
       
   102     /**
       
   103     * Sets a new extent to render into
       
   104     * @param aExtent New extent
       
   105     */
       
   106     void SetExtentL( const TRect& aExtent );
       
   107     
       
   108     /**
       
   109     * Returns the rect used for progress bar and 
       
   110     * elapsed/remaining videotime
       
   111     */
       
   112     TRect ProgPaneRect();
       
   113         
       
   114   protected:
       
   115 
       
   116     /**
       
   117     * C++ constructor.
       
   118     * @since 2.8
       
   119     * @param aController Reference to CCamAppController
       
   120     */
       
   121     CCamNaviProgressBarModel( CCamAppController& aController );
       
   122     
       
   123     /**
       
   124     * Symbian OS 2nd phase constructor.
       
   125     * @since 2.8
       
   126     */
       
   127     void ConstructL();
       
   128     
       
   129   private: // Functions from base classes
       
   130 
       
   131     /**
       
   132     * From CCoeControl Draw the view
       
   133     * @since 3.0
       
   134     * @param aGc Handle to Window graphics context
       
   135     * @param aControl Pointer to the control
       
   136     */
       
   137     virtual void DrawProgBar( CBitmapContext& aGc, const CCoeControl* aControl ) const;
       
   138     
       
   139     
       
   140     /**
       
   141     * From MCamControllerObserver
       
   142     * Handle an event from CCamAppController.
       
   143     * @since 2.8
       
   144     * @param aEvent the type of event
       
   145     * @param aError error code
       
   146     */
       
   147     virtual void HandleControllerEventL( TCamControllerEvent aEvent,
       
   148                                          TInt                aError );
       
   149 
       
   150   public:  // From MCamResourceLoader
       
   151 
       
   152     /**
       
   153     * From MCamResourceLoader
       
   154     * @since 3.0
       
   155     */
       
   156     void LoadResourceDataL();
       
   157     
       
   158     /**
       
   159     * From MCamResourceLoader
       
   160     * @since 3.0
       
   161     */
       
   162     void UnloadResourceData();
       
   163     
       
   164     /**
       
   165     * From MCamResourceLoader
       
   166     * @since 3.0
       
   167     */
       
   168     void ReloadResourceDataL();
       
   169 
       
   170   public: // From MCamObservable
       
   171 
       
   172     /**
       
   173     * From MCamObservable
       
   174     * @param aObserver Observer to register
       
   175     * @since 3.0
       
   176     */
       
   177     void RegisterObserverL(MCamObserver* aObserver);
       
   178     
       
   179     /**
       
   180     * From MCamObservable
       
   181     * @param aObserver Observer to deregister
       
   182     * @since 3.0
       
   183     */
       
   184     void DeregisterObserver(MCamObserver* aObserver);
       
   185     
       
   186     /**
       
   187     * From MCamObservable
       
   188     * @param aEvent Event code to broadcast
       
   189     * @since 3.0
       
   190     */
       
   191     void BroadcastEvent(TCamObserverEvent aEvent);
       
   192 
       
   193   public: // From MCamObserver
       
   194 
       
   195     /**
       
   196     * From MCamObserver
       
   197     * @param aEvent The event code
       
   198     * @since 3.0
       
   199     */
       
   200     virtual void HandleObservedEvent(TCamObserverEvent aEvent);
       
   201 
       
   202   private: // New functions
       
   203     
       
   204     /**
       
   205     * Formats the elapsed/remaining record times
       
   206     * @since 2.8
       
   207     */
       
   208     void FormatTimeL();
       
   209     
       
   210     /**
       
   211     * Draws the elapsed record time to the navi pane 
       
   212     * @since 2.8
       
   213     */
       
   214     void DrawElapsedTimeText( CBitmapContext& aGc ) const;
       
   215     
       
   216     /**
       
   217     * Draws the remaining record time to the navi pane 
       
   218     * @since 2.8
       
   219     */
       
   220     void DrawRemainingTimeText( CBitmapContext&    aGc, 
       
   221                                 MAknsSkinInstance* aSkin ) const;
       
   222 
       
   223     /**
       
   224     * Draws the progress bar in the navi pane
       
   225     */
       
   226     void DrawProgressBar( CBitmapContext& aGc ) const;
       
   227 
       
   228     /**
       
   229     * Callback for the minute-minder flash timer
       
   230     */
       
   231     static TInt FlashCallBack( TAny* aAny );
       
   232     
       
   233     /**
       
   234     * Read nontouch layout for primary camera
       
   235     */
       
   236     void NonTouchLayoutL();
       
   237     
       
   238     /**
       
   239     * Read nontouch layout for secondary camera
       
   240     */    
       
   241     void NonTouchLayoutSecondaryL();
       
   242 
       
   243     /**
       
   244     * Read touch layout
       
   245     */    
       
   246     void TouchLayoutL();
       
   247 
       
   248   protected: //data
       
   249     
       
   250     CCamAppController& iController; 
       
   251     
       
   252     TTimeIntervalMicroSeconds iRecordTimeElapsed;
       
   253     TTimeIntervalMicroSeconds iRecordTimeRemaining;
       
   254     
       
   255     TBuf<KMaxRecordTimeTextLength> iElapsedTimeText;
       
   256     TBuf<KMaxRecordTimeTextLength> iRemainingTimeText;
       
   257     
       
   258     // Rectangle for drawing the elapsed time text to.
       
   259     TAknLayoutText iElapsedTimeTextLayout; 
       
   260     TAknLayoutText iRemainingTimeTextLayout; 
       
   261 
       
   262     TRect iProgPaneRect;
       
   263     
       
   264     // own
       
   265     CCamTextItem* iElapsedTimeTextItem;
       
   266 
       
   267     // own
       
   268     CCamTextItem* iRemainingTimeTextItem;
       
   269     
       
   270     CFbsBitmap* iPhoneIcon;
       
   271     CFbsBitmap* iPhoneIconMask;
       
   272     CFbsBitmap* iMMCIcon;
       
   273     CFbsBitmap* iMMCIconMask;
       
   274     CFbsBitmap* iMassStorageIcon;
       
   275     CFbsBitmap* iMassStorageIconMask;
       
   276 
       
   277     /**
       
   278     * Progress bar graphic.
       
   279     * 
       
   280     * Own.
       
   281     */
       
   282     CFbsBitmap* iProgressBarBitmap;
       
   283 
       
   284     /**
       
   285     * Mask for progress bar graphic.
       
   286     * 
       
   287     * Own.
       
   288     */
       
   289     CFbsBitmap* iProgressBarMask;
       
   290 
       
   291     /**
       
   292     * Background for progress bar area.
       
   293     * 
       
   294     * Own.
       
   295     */
       
   296     CFbsBitmap* iProgressBarFrame;
       
   297 
       
   298     TCamMediaStorage iStorageLocation;
       
   299     
       
   300     // Resource string used to format the time text
       
   301     HBufC* iTimeFormat;
       
   302     
       
   303     TAknLayoutRect iProgressIconRect;
       
   304     TAknLayoutRect iProgressBarRect;
       
   305     
       
   306     // Layout information for the video storage icon.
       
   307     TAknLayoutRect iVidStorageIconRect;
       
   308     
       
   309     TCamOrientation iCamOrientation;
       
   310         
       
   311     CCamDecorator* iDecorator;
       
   312         
       
   313     // Rect to draw into
       
   314     TRect iExtent;
       
   315     
       
   316     // Handles observers
       
   317     CCamObserverHandler* iObserverHandler;
       
   318 
       
   319     // Timer for the flashing of the elapsed time every minute
       
   320     CPeriodic* iFlashingTimer;
       
   321 
       
   322     // When true, the elapsed time isn't drawn
       
   323     TBool iFlash;
       
   324   };
       
   325 
       
   326 #endif // CAMNAVIPROGRESSBARMODEL_H
       
   327 
       
   328 // End of File