photosgallery/slideshow/view/inc/shwslideshowview.h
branchRCL_3
changeset 60 5b3385a43d68
child 75 01504893d9cb
equal deleted inserted replaced
59:8e5f6eea9c9f 60:5b3385a43d68
       
     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:    Slideshow view implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_SHWSLIDESHOWVIEW_H
       
    20 #define C_SHWSLIDESHOWVIEW_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <glxviewbase.h>
       
    24 #include <mglxmedialistobserver.h>
       
    25 #include <AknProgressDialog.h>
       
    26 #include <AknWsEventObserver.h>
       
    27 #include <gestureobserver.h>
       
    28 #include <gesturehelper.h>
       
    29 #include "shwengineobserver.h"
       
    30 #include "shwmusicobserver.h"
       
    31 #include "shwconstants.h"
       
    32 #include "shwtickobserver.h"
       
    33 #include "shwgestureobserver.h"
       
    34 #include "gesturecontrol.h"
       
    35 #include "glxmmcnotifier.h"
       
    36 #include <mglxtvobserver.h>
       
    37 #include <glxtv.h>
       
    38 #include <mglxhdmidecoderobserver.h>
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class CAlfEnv;
       
    42 class CAlfDisplay;
       
    43 class CAlfDisplayCoeControl;
       
    44 class CAlfControlGroup;
       
    45 class CAlfSoftKeyControl;
       
    46 class CGlxUiUtility;
       
    47 class CGlxMediaListManager;
       
    48 class MGlxMediaList;
       
    49 class CShwSlideshowEngine;
       
    50 class CAknWaitDialog;
       
    51 class CShwSlideshowVolumeControl;
       
    52 class CShwSlideshowBackLightTimer;
       
    53 class CShwSlideShowPauseHandler;
       
    54 class CShwSlideShowKeyHandler;
       
    55 class CShwTelephoneHandler;
       
    56 class CMPXCollectionPath;
       
    57 class CEikButtonGroupContainer;
       
    58 class CShwGestureControl;
       
    59 class CShwTicker;
       
    60 class CShwMediaKeyUtility;
       
    61 class CGestureControl;
       
    62 class CGlxHdmiController;
       
    63 /**
       
    64  *  Slideshow view.
       
    65  *
       
    66  * @internal reviewed 07/06/2007 by Kimmo Hoikka  
       
    67  */
       
    68 NONSHARABLE_CLASS(CShwSlideshowView) : public CGlxViewBase,
       
    69                                        public MGlxMediaListObserver,
       
    70                                        public MShwEngineObserver,
       
    71                                        public MShwMusicObserver,
       
    72                                        public MProgressDialogCallback,
       
    73                                        public MShwTickObserver,
       
    74                                        public MShwGestureObserver,
       
    75                                        public MStorageNotifierObserver,
       
    76                                        public MGlxTvObserver,
       
    77 									   public MGlxHDMIDecoderObserver,
       
    78 									   public MAknWsEventObserver
       
    79     {
       
    80     public:
       
    81 
       
    82         /**
       
    83          * Two-phased constructor.
       
    84          *
       
    85          * @return Pointer to newly created object.
       
    86          */
       
    87         static CShwSlideshowView* NewLC();
       
    88 
       
    89         /**
       
    90          * Destructor.
       
    91          */
       
    92         ~CShwSlideshowView();
       
    93     
       
    94     public: // Callback functions
       
    95     	/**
       
    96     	 * Show the progress dialog
       
    97     	 * this needs to be public as it is a callback.
       
    98     	 * @return TInt, a non-zero value if it is intended to
       
    99          *      be called again, otherwise it should return zero.
       
   100     	 */
       
   101         TInt ShowProgressDialogL();
       
   102         
       
   103 
       
   104     	/**
       
   105     	 * Start the engine
       
   106     	 * this needs to be public as it is a callback.
       
   107     	 * @return TInt, a non-zero value if it is intended to
       
   108          *      be called again, otherwise it should return zero.
       
   109     	 */    
       
   110         TInt StartEngineL();
       
   111 
       
   112     	/**
       
   113     	 * Populate the media list
       
   114     	 * this needs to be public as it is a callback.
       
   115     	 * @return TInt, a non-zero value if it is intended to
       
   116          *      be called again, otherwise it should return zero.
       
   117     	 */    
       
   118         TInt PopulateListL();
       
   119 
       
   120     private:
       
   121    
       
   122         /**
       
   123          * C++ default constructor.
       
   124          */
       
   125         CShwSlideshowView();
       
   126 
       
   127         /**
       
   128          * 2nd phase constructor
       
   129          */
       
   130     	void ConstructL();
       
   131      
       
   132     private: // from base class CAknView
       
   133 
       
   134         /** 
       
   135          * @ref CAknView::Id
       
   136          */
       
   137         TUid Id() const;
       
   138 
       
   139         /** 
       
   140          * @ref CAknView::HandleForegroundEventL
       
   141          */
       
   142         void HandleForegroundEventL(TBool aForeground);
       
   143 
       
   144     public: // From MAknWsEventObserver
       
   145         void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
       
   146 
       
   147     public: // From CGlxViewBase
       
   148     	
       
   149     	/**
       
   150     	 * @ref CGlxViewBase::DoViewActivateL
       
   151     	 */	
       
   152         void DoViewActivateL( const TVwsViewId& aPrevViewId,
       
   153             TUid aCustomMessageId, const TDesC8& aCustomMessage );
       
   154     	/**
       
   155     	 * @ref CGlxViewBase::DoViewDeactivate
       
   156     	 */	
       
   157         void DoViewDeactivate();
       
   158 
       
   159    public://From MGlxHDMIDecoderObserver
       
   160 	   /**
       
   161 		* Handle notification of HDMI Image Decoder.
       
   162 		*/    
       
   163 	   void HandleHDMIDecodingEventL(THdmiDecodingStatus aStatus);
       
   164 
       
   165     private: // from MGlxMediaListObserver
       
   166 
       
   167     	/// @ref MGlxMediaListObserver::HandleItemAddedL
       
   168         void HandleItemAddedL( TInt aStartIndex,
       
   169         					   TInt aEndIndex,
       
   170         					   MGlxMediaList* aList );
       
   171     	/// @ref MGlxMediaListObserver::HandleMediaL
       
   172         void HandleMediaL( TInt aListIndex, MGlxMediaList* aList );
       
   173     	/// @ref MGlxMediaListObserver::HandleItemRemovedL
       
   174         void HandleItemRemovedL( TInt aStartIndex,
       
   175         						TInt aEndIndex,
       
   176         						MGlxMediaList* aList );
       
   177     	/// @ref MGlxMediaListObserver::HandleItemModifiedL
       
   178         void HandleItemModifiedL( const RArray<TInt>& aItemIndexes,
       
   179         						  MGlxMediaList* aList );
       
   180      	/// @ref MGlxMediaListObserver::HandleAttributesAvailableL
       
   181         void HandleAttributesAvailableL( TInt aItemIndex,
       
   182         								 const RArray<TMPXAttribute>& aAttributes,
       
   183         								 MGlxMediaList* aList );
       
   184      	/// @ref MGlxMediaListObserver::HandleFocusChangedL
       
   185         void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType,
       
   186         						 TInt aNewIndex,
       
   187         						 TInt aOldIndex,
       
   188         						 MGlxMediaList* aList );    
       
   189      	/// @ref MGlxMediaListObserver::HandleItemSelectedL
       
   190         void HandleItemSelectedL( TInt aIndex,
       
   191         						 TBool aSelected,
       
   192         						 MGlxMediaList* aList );    
       
   193     	/// @ref MGlxMediaListObserver::HandleMessageL
       
   194         void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList );
       
   195 	    
       
   196     	/// @ref MGlxMediaListObserver::HandlePopulatedL
       
   197     	void HandlePopulatedL( MGlxMediaList* aList );
       
   198 
       
   199     	// From MGlxTVObserver
       
   200     	virtual void HandleTvStatusChangedL ( TTvChangeType aChangeType );
       
   201     	
       
   202     	//form CAknView
       
   203 		void ProcessCommandL(TInt aCommandId);
       
   204     private: // From MShwEngineObserver
       
   205 
       
   206     	/**
       
   207     	 * @ref MShwEngineObserver::EngineStartedL
       
   208     	 */
       
   209     	void EngineStartedL();
       
   210     	
       
   211     	/**
       
   212     	 * @ref MShwEngineObserver::EnginePausedL
       
   213     	 */
       
   214     	void EnginePausedL();
       
   215     	
       
   216     	/**
       
   217     	 * @ref MShwEngineObserver::EngineResumedL
       
   218     	 */	
       
   219     	void EngineResumedL();
       
   220     	
       
   221     	/**
       
   222          * @ref MShwEngineObserver::EngineToggleUiStateL
       
   223          */ 
       
   224         void EngineToggleUiStateL();
       
   225         /**
       
   226          * @ref MShwEngineObserver::EngineLSKPressedL
       
   227          */ 
       
   228         void EngineLSKPressedL();
       
   229 
       
   230     	/**
       
   231     	 * @ref MShwEngineObserver::ErrorDuringSlideshowL
       
   232     	 */	
       
   233         void ErrorDuringSlideshowL();
       
   234 
       
   235     private: // from MShwMusicObserver
       
   236 
       
   237     	/**
       
   238     	 * @ref MShwMusicObserver::MusicOn
       
   239     	 */
       
   240         void MusicOnL();
       
   241     	
       
   242     	/**
       
   243     	 * @ref MShwMusicObserver::MusicOff
       
   244     	 */
       
   245         void MusicOff();
       
   246     	
       
   247     	/**
       
   248     	 * @ref MShwMusicObserver::MusicOn
       
   249     	 */
       
   250         void MusicVolumeL(TInt aCurrentVolume, TInt aMaxVolume);
       
   251 
       
   252     	/**
       
   253     	 * @ref MShwMusicObserver::ErrorWithTrackL
       
   254     	 */
       
   255         void ErrorWithTrackL( TInt aErrorCode );
       
   256 
       
   257     private: // from MProgressDialogCallback
       
   258 
       
   259         void DialogDismissedL( TInt aButtonId );
       
   260 
       
   261     private: // Helper functions
       
   262         
       
   263     	/**
       
   264     	 * Setup the screen furniture
       
   265     	 */
       
   266         void SetupScreenFurnitureL();
       
   267         
       
   268     	/**
       
   269     	 * Method that creates a local, ordered copy of the media list
       
   270     	 * @param aData from which to extract the play direction and the path
       
   271     	 */
       
   272         void GetPathAndPlaybackDirectionL( const TDesC8& aData );
       
   273         
       
   274     	/**
       
   275     	 * Helper function to set the focus in the filtered list, depending
       
   276     	 * on the selection or focus of the original list.
       
   277     	 */
       
   278         void SetListFocusL();
       
   279     	
       
   280     	/**
       
   281     	 * @ref MShwTickObserver::HandleTickL
       
   282     	 */
       
   283         void HandleTickL();
       
   284 
       
   285         /**
       
   286     	 * @ref MShwTickObserver::HandleTickCancelled
       
   287     	 */
       
   288         void HandleTickCancelled();
       
   289     	
       
   290     	/**
       
   291     	 * @ref MShwGestureObserver::HandleShwGestureEventL
       
   292     	 */
       
   293         void HandleShwGestureEventL(MShwGestureObserver::TShwGestureEventType aType);
       
   294 		
       
   295 		/**
       
   296 		 * Initializes the screen furniture for the slide show view
       
   297 		 */
       
   298         void InitializeShwFurnitureL();
       
   299 
       
   300         /**
       
   301     	 * Initializes the soft keys
       
   302     	 */
       
   303 		void InitializeCbaL();
       
   304 
       
   305 		/**
       
   306     	 * Hides the screen furniture
       
   307     	 */
       
   308 		void HideShwFurniture();
       
   309 
       
   310 		/**
       
   311     	 * Makes the screen furniture visible
       
   312     	 */
       
   313 		void ShowShwFurnitureL();
       
   314 
       
   315 		/**
       
   316     	 * Replaces an existing command set with a new one
       
   317     	 *@
       
   318     	 */
       
   319 		void ReplaceCommandSetL(TInt aNewComandId, TInt aOldCommandSet );
       
   320 
       
   321 		/**
       
   322          * returns the index of item for which texture can be removed for cleanup
       
   323          * The index will be out the iterator offsets w.r.t focssed index.
       
   324          */
       
   325         TInt GetIndexToBeRemoved();
       
   326 
       
   327         /**
       
   328          * Remove the fullscreen texture.
       
   329          */
       
   330         void RemoveTexture();
       
   331         
       
   332         /**
       
   333          * Set the current Item to HDMI.
       
   334          */
       
   335         void SetItemToHDMIL();
       
   336         /**
       
   337          * HandleMMCInsertionL.
       
   338          */
       
   339         void HandleMMCInsertionL();
       
   340         /**
       
   341          * HandleMMCRemovalL.
       
   342          */
       
   343         void HandleMMCRemovalL();
       
   344 		/**
       
   345 		 * Returns the index of the next item 
       
   346 		 * for which HDMI advance decoding will be done
       
   347 		 */
       
   348 		TInt GetNextIndex();
       
   349 		/**
       
   350          * Returns the application foreground status.
       
   351 		 * Foreground status is found using WindowsGroupID
       
   352 		 */
       
   353 		TBool IsAppInForegroundL();
       
   354 	public:
       
   355 	//to keep in track which of the command set is active/on top
       
   356 		enum TShwState
       
   357 			{
       
   358 			EShwPause = 1 ,
       
   359 			EShwPlay,
       
   360 			EShwExiting
       
   361 			};	
       
   362     private: // Data
       
   363 
       
   364         TInt iResourceOffset;
       
   365 
       
   366     	/**
       
   367          * HUIToolkit environment. 
       
   368          * not owned
       
   369          */
       
   370     	CAlfEnv* iEnv;	
       
   371 
       
   372     	CAlfDisplay* iDisplay;	// not owned
       
   373 
       
   374         /** Slideshow Engine */
       
   375         CShwSlideshowEngine* iEngine; // owned
       
   376        
       
   377         CAlfControlGroup* iVolumeControlGroup; // owned
       
   378 
       
   379         CAknWaitDialog*	iWaitDialog; // owned
       
   380 
       
   381         /// Own: Pause handler
       
   382         CShwSlideShowPauseHandler* iPauseHandler;
       
   383 
       
   384         /// Own: Key handler
       
   385         CShwSlideShowKeyHandler* iKeyHandler;
       
   386         
       
   387         CShwSlideshowVolumeControl* iVolumeControl; // owned
       
   388 
       
   389         TInt iCurrentVolume;// owned
       
   390 
       
   391         CShwSlideshowBackLightTimer* iBackLightTimer;	// owned
       
   392 
       
   393         // This flag is used to determine whether or not the slideshow
       
   394         // should resume when it returns to the foreground
       
   395         TBool iPauseOnForeground; // owned
       
   396 
       
   397         MGlxMediaList* iFilteredList;	// owned
       
   398         MGlxMediaList* iMediaList;		// owned
       
   399         /// Own: Flag to tell that input list is ready to be used
       
   400         TBool iInputListReady;
       
   401         /// Own: Flag to tell that play list is ready to be used
       
   402         TBool iPlayListReady;
       
   403 
       
   404         /// Own: asynch callback needed for engine start
       
   405         CAsyncCallBack* iAsyncCallBack;
       
   406 
       
   407         // handle interruptions from incoming telephone calls
       
   408         CShwTelephoneHandler* iTelephoneHandler;
       
   409 
       
   410         CMPXCollectionPath* iCollectionPath;            // owned
       
   411         NShwSlideshow::TPlayDirection iPlayDirection;   // owned
       
   412     	
       
   413         /// Own: The TV connection monitor
       
   414     	CGlxTv *  iTvConnection;
       
   415 		
       
   416         TBool iEngineStartFailed;
       
   417 
       
   418         /// Own: asynch callback needed for media list population
       
   419         CAsyncCallBack* iPopulateListCallBack;
       
   420 		CEikButtonGroupContainer* iShwCba;
       
   421 		
       
   422 		//Flag for event generated by MSK
       
   423 		TBool iMSKPressed;
       
   424 		
       
   425 		//Flag for event generated by LSK
       
   426 		TBool iLSKPressed;
       
   427 		
       
   428 	//to keep track of whether the furniture is visible or not
       
   429 	//and to toggle on tap	
       
   430 	enum TShwFurniture
       
   431 		{
       
   432 		EFurnitureVisible = 1,
       
   433 		EFurnitureHidden
       
   434 		};
       
   435 		
       
   436 	TShwState iShwState;
       
   437 	TShwFurniture iShwFurniture;	
       
   438 	CShwGestureControl* iShwGestureControl;
       
   439 	GestureHelper::CGestureControl* iGestureControl;
       
   440 	CAlfControlGroup* iGestureControlGroup;
       
   441 	CShwTicker* iTicker;
       
   442 	CShwMediaKeyUtility* iMediaKeyHandler;
       
   443 	CGlxHdmiController* iHdmiController;
       
   444 	TBool iHdmiActive;
       
   445 	CGlxMMCNotifier* iMMCNotifier;
       
   446 	TBool iMMCState;
       
   447 	TBool iIsForegrnd;
       
   448 	TSize iScrnSize;
       
   449 	TSize iGridIconSize;
       
   450 	//to check if slideshow is paused in BG 
       
   451 	//and after that we are bringing to foreground
       
   452 	TBool iPrevNotInBackground;
       
   453 
       
   454 	TInt iHdmiWidth;
       
   455     TInt iHdmiHeight;
       
   456     CAknWsEventMonitor* iAknEventMonitor;// not owned
       
   457     };
       
   458 
       
   459 #endif  // C_SHWSLIDESHOWVIEW_H
       
   460 
       
   461 // End of File