photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenviewimp.h
branchRCL_3
changeset 26 5b3385a43d68
child 27 34937ec34dac
equal deleted inserted replaced
25:8e5f6eea9c9f 26:5b3385a43d68
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:    Implementation of Fullscreen view
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CGLXFULLSCREENIMP_C
       
    19 #define C_CGLXFULLSCREENIMP_C
       
    20 
       
    21 #include <alf/ialfwidgeteventhandler.h>
       
    22 #include <mglxuicommandhandler.h>
       
    23 #include <gesturehelper.h>
       
    24 #include <gestureobserver.h>
       
    25 #include <glximageviewermanager.h>
       
    26 #include <alf/alfcompositionutility.h>
       
    27 
       
    28 #include "glxfullscreenview.h"
       
    29 #include "glxfullscreenbindingsetfactory.h"
       
    30 #include "glxfullscreenview.hrh"
       
    31 #include "glxmmcnotifier.h"
       
    32 #include "glxtv.h"
       
    33 #include "mglxhdmidecoderobserver.h" //for MGlxHDMIDecoderObserver
       
    34 
       
    35 //Gesture Helper namespace 
       
    36 namespace GestureHelper
       
    37     {
       
    38     class CGestureHelper;
       
    39     }
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 class CAlfEnv;
       
    43 class CGlxMediaListMulModelProvider;
       
    44 class TGlxMulFullScreenBindingSetFactory;
       
    45 class CEikButtonGroupContainer;
       
    46 class CGlxActiveMediaListRegistry;
       
    47 class CGlxZoomControl;
       
    48 class CGlxSingleLineMetaPane;
       
    49 class CGlxCommandHandlerAiwShowMapHardKey;
       
    50 class CGlxDRMUtility;
       
    51 class CGlxHdmiController;
       
    52 class CGestureHelper;
       
    53 class TGlxMedia;
       
    54 class CGlxFullScreenBusyIcon;
       
    55 class CGlxNavigationalState;
       
    56 
       
    57 namespace Alf
       
    58 	{
       
    59    class IMulCoverFlowWidget;
       
    60    class IMulModel;
       
    61    class IMulSliderWidget;
       
    62    class IMulSliderModel;
       
    63 	}
       
    64 /*
       
    65  Defines the swipe direction
       
    66  */ 
       
    67 enum TSwipe
       
    68     {
       
    69         EForward,EBackward
       
    70     };
       
    71     
       
    72 NONSHARABLE_CLASS (CGlxFullScreenViewImp): public CGlxFullScreenView, 
       
    73                                             public IAlfWidgetEventHandler,
       
    74  											public MGlxUiCommandHandler,
       
    75 			                                public MStorageNotifierObserver,
       
    76 			                                public CAlfEffectObserver::MAlfEffectObserver,
       
    77 											public MGlxTvObserver,
       
    78 											public MGlxHDMIDecoderObserver
       
    79     {
       
    80 public:    
       
    81     /**
       
    82     * Two-phased constructor.`
       
    83     *
       
    84     * @return Pointer to newly created object.
       
    85     */
       
    86     static CGlxFullScreenViewImp* NewL(MGlxMediaListFactory* aMediaListFactory,
       
    87                                  const TFullScreenViewResourceIds& aResourceIds,
       
    88                                  TInt aViewUID,
       
    89                                  const TDesC& aTitle);
       
    90 
       
    91     /**
       
    92     * Two-phased constructor.
       
    93     *
       
    94     * @return Pointer to newly created object.
       
    95     */
       
    96     static CGlxFullScreenViewImp* NewLC(MGlxMediaListFactory* aMediaListFactory,
       
    97             const TFullScreenViewResourceIds& aResourceIds,TInt aViewUID, const TDesC& aTitle);
       
    98     
       
    99     /**
       
   100      * Destructor.
       
   101      */
       
   102     virtual ~CGlxFullScreenViewImp();
       
   103 
       
   104 public:// CGlxViewBase
       
   105     virtual TBool HandleViewCommandL(TInt aCommand);
       
   106 
       
   107     void HandleCommandL(TInt aCommandId, CAlfControl* aControl) ;
       
   108 
       
   109     void HandleResourceChangeL (TInt aType);   
       
   110 
       
   111 public:// CAknView
       
   112     void HandleForegroundEventL(TBool aForeground);
       
   113 
       
   114     TUid Id() const;
       
   115 
       
   116     void DoMLViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId,
       
   117         const TDesC8& aCustomMessage);
       
   118     void DoMLViewDeactivate();
       
   119     
       
   120       //Shows the exipry note/dialog for expired DRM files
       
   121       void ShowDrmExpiryNoteL();
       
   122       
       
   123 	  // Callback for periodic timer, static, 
       
   124 	  static TInt PeriodicCallback( TAny* aPtr );
       
   125 	  //nonstatic func called from periodic timer
       
   126 	  void CallPeriodicCallback();
       
   127 public:
       
   128     //From IAlfWidgetEventHandler
       
   129     bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const;
       
   130     
       
   131     AlfEventStatus offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent );
       
   132     
       
   133     void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData );
       
   134     
       
   135     AlfWidgetEventHandlerInitData* eventHandlerData();
       
   136     
       
   137     void setActiveStates( unsigned int aStates );
       
   138     
       
   139     IAlfInterfaceBase* makeInterface( const IfId& aType );
       
   140     
       
   141     AlfEventHandlerType eventHandlerType() ;
       
   142 
       
   143     AlfEventHandlerExecutionPhase eventExecutionPhase() ;
       
   144 	
       
   145 	//From MAlfEffectObserver
       
   146     void HandleEffectCallback(TInt aType, TInt aHandle, TInt aStatus);
       
   147 
       
   148 public:
       
   149     //From MGlxHDMIDecoderObserver
       
   150     /*
       
   151      * Handle completion notification of HDMI Image Decoder.
       
   152      */
       
   153     void HandleHDMIDecodingEventL(THdmiDecodingStatus aStatus);
       
   154 
       
   155 private:
       
   156     /*
       
   157      * Constructor 
       
   158      */
       
   159     CGlxFullScreenViewImp(const TFullScreenViewResourceIds& aResourceIds,TInt aViewUID);
       
   160 
       
   161     /*
       
   162      * By default Symbian 2nd phase constructor is private.
       
   163      */
       
   164     void ConstructL(MGlxMediaListFactory* aMediaListFactory,const TDesC& aTitle );
       
   165     
       
   166     /*
       
   167      *  Creates a coverflow widget
       
   168      */
       
   169     void CreateCoverflowWidgetL();
       
   170     
       
   171     /*
       
   172      *  Destroys Widgets, Coverflow and also calls DestroySliderWidget()
       
   173      */
       
   174      void DestroyWidgets();
       
   175      
       
   176     /*
       
   177      *  Destroys Slider widget
       
   178      */
       
   179      void DestroySliderWidget();
       
   180      
       
   181     /*
       
   182      * Activate zoomcontrol
       
   183      * @param:aTap: specifies whether zoom control is launched by tapping or by pressing volume keys
       
   184      */
       
   185     void ActivateZoomControlL(TZoomStartMode aStartMode, TPoint* aZoomFocus = NULL); 
       
   186     
       
   187     /*
       
   188      * DeActivate zoomcontrol
       
   189      */
       
   190     void DeactivateZoomControlL();
       
   191     
       
   192     /*
       
   193      * DeactivateFullScreen
       
   194      */
       
   195     void DeactivateFullScreen();
       
   196     
       
   197     /*
       
   198      * ActivateFullScreen
       
   199      */
       
   200     void ActivateFullScreenL();
       
   201     
       
   202     /*
       
   203     * Trun the UI on
       
   204     * @param aStartTimer:Incase of starting the zoom :we shouldn't be starting the timer.
       
   205     * else we  need to start the Ui timer to hide the screen furniture
       
   206     * so for the rest of the cases we need to have  aStartTimer = ETrue
       
   207     */
       
   208     void ShowUiL(TBool aStartTimer);
       
   209     
       
   210     /*
       
   211     * Hide the UI off
       
   212     * @param aHideSlider:When we start zooming using the slider widget,for continous zooming from the 
       
   213     * fullscreen view to zoom control, we need to have the slider visible so in this case we shouldnt 
       
   214     * be hiding the slider so pass EFalse,else case asliderstatus = ETrue
       
   215     */     
       
   216     void HideUi(TBool aHideSlider);
       
   217     
       
   218     /*
       
   219     * Sets the UI state
       
   220     */     
       
   221     void SetUiState (TUiState  aState);
       
   222     
       
   223     /*
       
   224     * returns the Ui state
       
   225     */     
       
   226     TUiState GetUiState();
       
   227     
       
   228     /*
       
   229     * Call back function for the CPeriodic
       
   230     */
       
   231     static TInt TimeOut(TAny* aSelf);
       
   232       
       
   233     /*
       
   234     * Calculates and returns the Initial Zoom factor
       
   235     */		
       
   236     TInt GetInitialZoomLevel();
       
   237     
       
   238     /*
       
   239     * Calls GetInitialZoomLevel() to get the Zoom Level and Sets the Value to the
       
   240     * Slider Level
       
   241     */
       
   242     void SetSliderToMin();
       
   243     
       
   244     /*
       
   245     * Creates and Initializes the slider model/widget
       
   246     */
       
   247     void CreateSliderWidgetL();
       
   248     
       
   249     /**
       
   250      * This function doesnt add any value, added to remove codescanner warnings
       
   251      */
       
   252     AlfEventStatus OfferEventL(const TAlfEvent& aEvent);
       
   253     /**
       
   254      * returns the swipe direction of coverflow
       
   255      */
       
   256     TSwipe GetSwipeDirection();
       
   257     /**
       
   258      * returns the index of item for which texture can be removed for cleanup
       
   259      * The index will be out the iterator offsets w.r.t focssed index.
       
   260      */
       
   261     TInt GetIndexToBeRemoved();
       
   262     /**
       
   263      * Remove the fullscreen texture.
       
   264      */
       
   265     void RemoveTexture();
       
   266   	/**
       
   267      * Consume DRM rights
       
   268      */  
       
   269     void ConsumeDRMRightsL(const TGlxMedia& aMedia);
       
   270     /**
       
   271      * Set the image to external display - HDMI
       
   272      */
       
   273     void SetItemToHDMIL();
       
   274     /**
       
   275      * handle MMC insertion
       
   276      */
       
   277     void HandleMMCInsertionL();
       
   278     /**
       
   279      * handle MMC removal
       
   280      */
       
   281     void HandleMMCRemovalL();
       
   282     
       
   283     /**
       
   284      * navigate to main list
       
   285      */
       
   286     void NavigateToMainListL();
       
   287 	
       
   288     /**
       
   289      * Disable/enable the fullscreen toolbar
       
   290      */
       
   291     void EnableFSToolbar(TBool aEnable);
       
   292     
       
   293 	/**
       
   294      * Create Image Viewer manager Instance
       
   295      */
       
   296     void CreateImageViewerInstanceL();
       
   297     
       
   298     /**
       
   299      * Delete Image Viewer manager Instance
       
   300      */
       
   301     void DeleteImageViewerInstance();
       
   302 	
       
   303 	/*
       
   304 	 * Get the HDMI cable insert/removal notification.
       
   305      */
       
   306 	void HandleTvStatusChangedL( TTvChangeType aChangeType );
       
   307 
       
   308     /**
       
   309      * Checks if the slider to be show for the focus index
       
   310      */
       
   311     TBool CheckIfSliderToBeShownL();
       
   312 
       
   313     /**
       
   314      * Update coverflow items after zoom/foreground event
       
   315      */
       
   316     void UpdateItems();
       
   317 
       
   318 private:
       
   319     /** Softkey resource id's */
       
   320     TFullScreenViewResourceIds iResourceIds; 
       
   321     // /** Avkon unique ViewId */ 
       
   322     TInt iViewUid;
       
   323 
       
   324     /** Alf environment (not owned) */
       
   325     CAlfEnv* iEnv;
       
   326 
       
   327     /// Active media list registry stores the pointer to the active media list
       
   328     /// Allows UPnP to know when list has changed
       
   329     CGlxActiveMediaListRegistry* iActiveMediaListRegistry;
       
   330 
       
   331     /** Data Provider */
       
   332     CGlxMediaListMulModelProvider* iMediaListMulModelProvider;
       
   333     TGlxMulFullScreenBindingSetFactory iFullScreenBindingSet;
       
   334 
       
   335     //creating instance of viewWidget
       
   336     IAlfViewWidget* iViewWidget;
       
   337     
       
   338     /** The 2D Coverflow Widget ( owned )*/
       
   339     IMulCoverFlowWidget* iCoverFlowWidget;
       
   340     IMulSliderWidget*   iSliderWidget;
       
   341     IMulSliderModel*    iSliderModel;
       
   342 
       
   343     //creating zoomcontrol
       
   344     CGlxZoomControl* iZoomControl;
       
   345     
       
   346     // Holds the state of the Ui in Fullscreen
       
   347     TUiState iUiState;
       
   348 
       
   349     // used to turn the Ui off,if the screen is inactive for 10 sec
       
   350     CPeriodic* iTimer;
       
   351     CEikButtonGroupContainer* iZoomButtonGroup;
       
   352 	CGlxCommandHandlerAiwShowMapHardKey* iShowOnMapHardKeyhandler;
       
   353     
       
   354     CGlxScreenFurniture* iScreenFurniture;
       
   355     CGlxHdmiController* iHdmiController;
       
   356 	    
       
   357     CGlxDRMUtility* iDrmUtility;
       
   358     CPeriodic* iPeriodic;
       
   359     CGlxFullScreenBusyIcon* iBusyIcon;
       
   360 	
       
   361     CGlxNavigationalState* iNaviState;
       
   362     
       
   363     GestureHelper::CGestureHelper* iGestureHelper;
       
   364     TBool   iMultiTouchGestureOngoing   ;
       
   365     
       
   366     // stores the initial zoom percentage
       
   367     TInt iInitialZoomRatio ;
       
   368     //Previous focused index
       
   369     TInt iOldFocusIndex;
       
   370     TBool iImgViewerMode;
       
   371 	CGlxMMCNotifier* iMMCNotifier;
       
   372 	TBool iMMCState;
       
   373 	TSize iScrnSize;   // ScrnSize
       
   374 	TSize iGridIconSize; // grid icon size
       
   375     TBool iIsDialogLaunched;
       
   376     TBool iIsMMCRemoved;
       
   377 	CAlfEffectObserver* iAlfEffectObs;
       
   378 	TInt iEffectHandle;
       
   379     // For image viewer, not own
       
   380     CGlxImageViewerManager* iImageViewerInstance;
       
   381 	CGlxTv*  iGlxTvOut;
       
   382 	TInt iHdmiWidth;
       
   383 	TInt iHdmiHeight;
       
   384     };
       
   385 
       
   386 #endif
       
   387