camerauis/cameraapp/generic/inc/CamViewBase.h
changeset 19 d9aefe59d544
parent 3 8b2d6d0384b0
child 21 fa6d9f75d6a6
child 28 3075d9b614e6
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
     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:  Base class for all camera views*
       
    15 */
       
    16 
       
    17 
       
    18 #ifndef CAMVIEWBASE_H
       
    19 #define CAMVIEWBASE_H
       
    20 
       
    21 // ===========================================================================
       
    22 //  INCLUDES
       
    23 
       
    24 #include "CamAppUiBase.h"
       
    25 #include "CamCommandHandlerAo.h"
       
    26 #include <aknview.h>
       
    27 
       
    28 // ===========================================================================
       
    29 // FORWARD DECLARATIONS
       
    30 class CCamAppController;
       
    31 class CCamContainerBase;
       
    32 class CCamStandbyContainer;
       
    33 class CCamWaitDialog;
       
    34 
       
    35 
       
    36 // ===========================================================================
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 *  Base class for all camera views
       
    41 *
       
    42 *  @since 2.8
       
    43 */
       
    44 class CCamViewBase : public CAknView
       
    45     {
       
    46     public:  // Constructors and destructor
       
    47         
       
    48         /**
       
    49         * Destructor.
       
    50         * @since 2.8
       
    51         */
       
    52         virtual ~CCamViewBase();
       
    53 
       
    54     public: // New functions
       
    55         
       
    56         virtual void HandleAppEvent( const TCamAppEvent& aEvent );
       
    57 
       
    58      	/**
       
    59         * Update the softkeys for the current situation.
       
    60         * @since 2.8
       
    61         */
       
    62         virtual void UpdateCbaL();  
       
    63         
       
    64         /**
       
    65         * Blank the softkeys on the cba
       
    66         * @since 3.0
       
    67         */
       
    68         virtual void BlankSoftkeysL();  
       
    69 
       
    70         /**
       
    71         * Switch from current mode to standby mode
       
    72         * @since 2.8
       
    73         * @param aViewId the current view id
       
    74         * @param aError associated error code
       
    75         */
       
    76         virtual void SwitchToStandbyModeL( TCamAppViewIds aViewId, TInt aError );
       
    77 
       
    78         /**
       
    79         * Exit standby mode
       
    80         * @since 2.8
       
    81         */
       
    82         void ExitStandbyModeL();
       
    83         
       
    84         /**
       
    85         * Exit all modes.
       
    86         * Has empty default implementation which can be overriden
       
    87         * if needed in inherited classes. Atleast user scene setup view does this.
       
    88         * Called e.g. when entering standby mode to be able to enter normal
       
    89         * VF mode again when exiting standby.
       
    90         */
       
    91         virtual void ExitAllModesL();
       
    92 
       
    93         /**
       
    94         * Handle change of focus to another application
       
    95         * This only handles another application coming to the foreground when
       
    96         * the camera application is already in the background behind an eikon
       
    97         * server window
       
    98         * @since 2.8
       
    99         */
       
   100         virtual void HandleFocusLossL();
       
   101         
       
   102         /**
       
   103         * Handle change of mode
       
   104         * @since 3.0
       
   105         */
       
   106         virtual void PrepareForModeChange();
       
   107 
       
   108         /**
       
   109         * Called to identify the help context for this view
       
   110         * @since 2.8
       
   111         * @param aContext Help context object to populate with control context
       
   112         * information
       
   113         */
       
   114         virtual void GetHelpContext(TCoeHelpContext& aContext) const;
       
   115 
       
   116         /**
       
   117         * Returns the currently used container for this view
       
   118         * @since 2.8
       
   119         * @return   The currently used container
       
   120         * information
       
   121         */
       
   122         CCamContainerBase* Container();
       
   123 
       
   124         /**
       
   125         * Sets the softkeys to the specified Resource ID
       
   126         * @since 3.0
       
   127         * @param aResource ID of the softkey resource to use
       
   128         */
       
   129         virtual void SetSoftKeysL(TInt aResource);
       
   130         
       
   131         /**
       
   132         * Blanks the softkeys for the Courtesy UI Off state. 
       
   133         * @since 3.0
       
   134         */
       
   135         void SetCourtesySoftKeysL();
       
   136         
       
   137         /**
       
   138         * Returns the softkeys to their previous state after UI has been turned back on
       
   139         * @since 3.0
       
   140         */
       
   141         void UnsetCourtesySoftKeysL();
       
   142     
       
   143         /**
       
   144          * Returns whether the view is in standby mode
       
   145          * @return Whether the view is in standby mode
       
   146          */
       
   147         TBool IsInStandbyMode();
       
   148 
       
   149         /**
       
   150         * Requests that the camera application redraws the supplied active palette area
       
   151         * @since 3.0
       
   152         * @param aArea the area to redraw
       
   153         */
       
   154         void RedrawAPArea(const TRect& aArea);
       
   155 
       
   156 
       
   157         /**
       
   158         * Return a pointer to view specific CBA (or applications CBA if
       
   159         * there is no view specific CBA defined).
       
   160         * @since S60 v5.0
       
   161         * @return Pointer to CEikButtonGroupContainer. Ownership not
       
   162         *         transferred
       
   163         */
       
   164         CEikButtonGroupContainer* ViewCba();
       
   165         
       
   166         /**
       
   167          * Updates toolbar icons.
       
   168          * 
       
   169          */
       
   170         virtual void UpdateToolbarIconsL();
       
   171 
       
   172     public: // Functions from base classes
       
   173 
       
   174         /**
       
   175         * From CAknView Handle commands
       
   176         * @since 2.8
       
   177         * @param aCommand command to be handled
       
   178         */
       
   179         void HandleCommandL( TInt aCommand );
       
   180 
       
   181         /**
       
   182         * From CAknView Handles the foreground/background event
       
   183         * @since 2.8
       
   184         * @param aForeground ETrue if this view is on foreground, else EFalse.
       
   185         */
       
   186         void HandleForegroundEventL( TBool aForeground );
       
   187         
       
   188         /**
       
   189         * Active object for handling toolbar commands
       
   190         * @since S60 v.5.0
       
   191         */
       
   192         void HandleCommandAoL( TInt aCommand );  
       
   193 
       
   194     protected:  // Functions from base classes
       
   195 
       
   196         /**
       
   197         * From CAknView.
       
   198         * @since 2.8
       
   199         * @param aPostvViewId the ID for previous view we are switching from
       
   200         * @param aCustomMessageId the Uid for message passed to this view
       
   201         * @param aCustomMessage descriptor containing data content for view specific message
       
   202         */
       
   203         void DoActivateL( const TVwsViewId& aPostvViewId, TUid aCustomMessageId,
       
   204                                                     const TDesC8& aCustomMessage );
       
   205 
       
   206         /**
       
   207         * From CAknView.
       
   208         * @since 2.8
       
   209         */
       
   210         void DoDeactivate();
       
   211         
       
   212     protected:  // New functions
       
   213 
       
   214         /**
       
   215         * C++ default constructor.
       
   216         * @since 2.8
       
   217         * @param aController Reference to either the application controller base class or test base class
       
   218         */
       
   219         CCamViewBase( CCamAppController& aController );
       
   220 
       
   221         /**
       
   222         * Create the container associated with this view.
       
   223         * @since 2.8
       
   224         */
       
   225         virtual void CreateContainerL() = 0;
       
   226 
       
   227         /**
       
   228         * Set the view's title text
       
   229         * @since 2.8
       
   230         */
       
   231         virtual void SetTitlePaneTextL() = 0;       
       
   232 
       
   233         /**
       
   234         * Show rename query and rename file.
       
   235         * Switch orientation if required. Calls DoQueryRenameL()
       
   236         * @since 2.8
       
   237         * @param aMode The current mode.
       
   238         */
       
   239         void QueryRenameL( TCamCameraMode aMode );
       
   240         
       
   241         /**
       
   242         * Show rename query and rename file.
       
   243         * @since 2.8
       
   244         * @param aMode The current mode.
       
   245         */
       
   246         void DoQueryRenameL( TCamCameraMode aMode );
       
   247 
       
   248         /**
       
   249         * Show an overwrite confirmation query. This is used
       
   250         * when trying to overwrite a file using rename.
       
   251         * @since 2.8
       
   252         * @param aFilename The name of the file that trying to overwrite.
       
   253         * @return ETrue if the user has confirmed the overwrite.
       
   254         */
       
   255         TBool ShowOverwriteConfirmationQueryL( 
       
   256             const TDesC& aFilename );
       
   257 
       
   258         /**
       
   259         * Show rename query.
       
   260         * @since 2.8
       
   261         * @param aFilename The current name of the file that renaming.
       
   262         * @param aMode The current capture mode.
       
   263         * @return ETrue if the user has entered a name. Or EFalse, if 
       
   264         *         user has cancelled the rename.
       
   265         */
       
   266         TBool ShowRenameQueryL( TDes& aFilename, TCamCameraMode aMode );
       
   267 
       
   268         /**
       
   269         * Check if renaming to the given name is valid.
       
   270         * @since 2.8
       
   271         * @param aFilename The new name to check.
       
   272         * @return ETrue if the name is valid.
       
   273         */
       
   274         virtual TBool IsNewNameValidL( const TDesC& aFilename );
       
   275 
       
   276         /**
       
   277         * Renames the current capture array file.
       
   278         * @since 2.8
       
   279         * @param aNewName The new name for the current file.
       
   280         * @param aMode The current capture mode.
       
   281         * @return ETrue if the name has been renamed succesfully.
       
   282         */
       
   283         TBool RenameCurrentFileL( const TDesC& aNewName, TCamCameraMode aMode );
       
   284 
       
   285         /**
       
   286         * Returns whether the view is a precapture view or not
       
   287         * @since 3.0
       
   288         * @returns ETrue if view is precapture
       
   289         */
       
   290         virtual TBool IsPreCapture();
       
   291 
       
   292         /**
       
   293         * Increment the camera user count.
       
   294         * This method ensures that view only increments the counter by one.
       
   295         */        
       
   296         void IncrementCameraUsers();
       
   297         
       
   298         /**
       
   299         * Decrement the camera user count.
       
   300         * If count goes to zero, camera is released.
       
   301         * This method ensures, that decrement call is only forwarded to
       
   302         * controller, if this view has earlier incremented the count.
       
   303         */
       
   304         void DecrementCameraUsers();
       
   305         
       
   306         /**
       
   307         * Is this view using camera, i.e. has IncrementCameraUsers been called,
       
   308         * but DecrementCameraUsers not.
       
   309         */
       
   310         TBool IsCameraUser() const;
       
   311         
       
   312 public:
       
   313         /**
       
   314         * Returns whether the view is a postcapture view or not
       
   315         * @since 3.0
       
   316         * @returns ETrue if view is postcapture
       
   317         */
       
   318         virtual TBool IsPostCapture();
       
   319 private:
       
   320 
       
   321         /**
       
   322         * Returns whether the view is a burst capture postcapture view or not
       
   323         * @since 3.0
       
   324         * @returns ETrue if view is burst post capture postcapture
       
   325         */
       
   326         virtual TBool IsBurstPostCapture();
       
   327 
       
   328         /**
       
   329          * Sets the iStandbyModeActive flag
       
   330          * @param aActive What to set iStandbyModeActive to
       
   331          */
       
   332         void SetStandbyModeActive(TBool aActive);
       
   333 
       
   334     protected:  // Data
       
   335         
       
   336         // Base class for Camera application controller
       
   337         CCamAppController& iController; 
       
   338  
       
   339         // The container for the view's controls
       
   340         CCamContainerBase* iContainer; // owned
       
   341 
       
   342         // Specifies whether the application is embedded or not.
       
   343         TBool iEmbedded;
       
   344 
       
   345         // Resource Id for the view menu bar 
       
   346         TInt iPreviousMenuResourceId;
       
   347 
       
   348         // set to ETrue when in standby mode
       
   349         TBool iStandbyModeActive;
       
   350 
       
   351         // error code associated with standby mode
       
   352         //TInt iStandbyError;
       
   353 
       
   354         // standby mode container
       
   355         CCamStandbyContainer* iStandbyContainer;
       
   356         
       
   357     private: // data
       
   358 
       
   359         // whether or not the view registered an interest in resources
       
   360         // when it came to the foreground
       
   361         TBool iIncEngineCount;
       
   362 
       
   363 
       
   364         // Stores the current and previous resources used for setting the CBA
       
   365         // Allows one level of "undo", currently used by the courtesy UI.
       
   366         TInt iCurrentCbaResource;
       
   367         TInt iPreviousCbaResource;
       
   368         TBool iCourtesySoftkeys;
       
   369         
       
   370         // own.
       
   371         CCamCommandHandlerAo* iCommandHandlerAo;        
       
   372         
       
   373     };
       
   374 
       
   375 #endif      // CAMVIEWBASE_H   
       
   376             
       
   377 // ===========================================================================
       
   378 // End of File