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