mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgplaylisthelper.h
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Collection playlist helper
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMPXCOLLECTIONVIEWHGPLAYLISTHELPER_H
       
    20 #define CMPXCOLLECTIONVIEWHGPLAYLISTHELPER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <mpxcollectionobserver.h>
       
    25 #include <mpxplaybackobserver.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CMPXAppUi;
       
    31 class CMPXCollectionPath;
       
    32 class MMPXCollectionUtility;
       
    33 class MMPXPlaybackUtility;
       
    34 class MMPXCollectionUiHelper;
       
    35 class CMPXCollectionOpenUtility;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 /**
       
    39  * Saves/restores current playback path.
       
    40  *
       
    41  *  @lib mpxcommoncontainer.dll
       
    42  */
       
    43 NONSHARABLE_CLASS(CMPXCollectionViewHgPlaylistHelper) : public CBase,
       
    44                         public MMPXCollectionObserver,
       
    45                         public MMPXPlaybackObserver
       
    46     {
       
    47     public: // Constructors and destructor
       
    48 
       
    49         /**
       
    50          * Two-phased constructor.
       
    51          *
       
    52          * @since 3.1
       
    53          * @param aPlaybackUtility Playback utility to use.
       
    54          * @param aCollectionUiHelper UI helper to use
       
    55          * @return Pointer to newly created object.
       
    56          */
       
    57         static CMPXCollectionViewHgPlaylistHelper * NewL(MMPXPlaybackUtility* aPlaybackUtility,
       
    58                                       MMPXCollectionUiHelper* aCollectionUiHelper);
       
    59 
       
    60         /**
       
    61          * Two-phased constructor.
       
    62          *
       
    63          * @since 3.1
       
    64          * @param aPlaybackUtility Playback utility to use.
       
    65          * @param aCollectionUiHelper UI helper to use
       
    66          * @return Pointer to newly created object.
       
    67          */
       
    68         static CMPXCollectionViewHgPlaylistHelper * NewLC(MMPXPlaybackUtility* aPlaybackUtility,
       
    69                                        MMPXCollectionUiHelper* aCollectionUiHelper);
       
    70 
       
    71         /**
       
    72          * Destructor.
       
    73          */
       
    74         virtual ~CMPXCollectionViewHgPlaylistHelper();
       
    75 
       
    76     public: // New funtions
       
    77 
       
    78         /**
       
    79          *  Loads current collection path
       
    80          */
       
    81         void LoadPathL();
       
    82 
       
    83         /**
       
    84          * Loads the default collection path
       
    85          * @param some delay to load the path (in ms)
       
    86          */
       
    87         void LoadDefaultPathL( TInt aDelay = 0 );
       
    88 
       
    89         /**
       
    90          * Return if the default playlist has been initialized
       
    91          *
       
    92          * @return ETrue if the path has been initialized, EFalse otherwise;
       
    93          */
       
    94         TBool Initialized();
       
    95 
       
    96         /**
       
    97          * Return if the playlist is currently initializing
       
    98          *
       
    99          * @return ETrue it's currently initializing, EFalse otherwise;
       
   100          */
       
   101         TBool IsInitializing();
       
   102 
       
   103         /**
       
   104          * Set the initialized state
       
   105          *
       
   106          * @param aInit The current state of initialization.
       
   107          */
       
   108         void SetInitialized( TBool aInit );
       
   109 
       
   110         /**
       
   111          * Cancels the initialize operation
       
   112          */
       
   113         void CancelInit();
       
   114 
       
   115         /**
       
   116          *  Initialize default playlist
       
   117          */
       
   118         void InitPlaylistL(TBool aEnableShuffle);
       
   119 
       
   120         /**
       
   121          *  Initialize playlist with path
       
   122          */
       
   123         void InitPlaylistL(CMPXCollectionPath& aPath, TBool aEnableShuffle);
       
   124 
       
   125     private:
       
   126 
       
   127         /**
       
   128          * C++ Constructor
       
   129          *
       
   130          * @param aPlaybackUtility Playback utility to use.
       
   131          * @param aCollectionUiHelper collection ui helper to use
       
   132          */
       
   133         CMPXCollectionViewHgPlaylistHelper (MMPXPlaybackUtility* aPlaybackUtility,
       
   134                          MMPXCollectionUiHelper* aCollectionUiHelper);
       
   135 
       
   136         /**
       
   137          * By default Symbian 2nd phase constructor is private.
       
   138          */
       
   139         void ConstructL();
       
   140 
       
   141     // from base class MMPXCollectionObserver
       
   142 
       
   143         /**
       
   144          * From MMPXCollectionObserver
       
   145          * Handle media properties.
       
   146          *
       
   147          * @since 3.1
       
   148          * @param aMedia  media properties.
       
   149          * @param aError Error code.
       
   150          */
       
   151         void HandleCollectionMediaL(
       
   152             const CMPXMedia& aMedia,
       
   153             TInt aError );
       
   154 
       
   155         /**
       
   156          * From MMPXCollectionObserver
       
   157          * Handle collection message.
       
   158          *
       
   159          * @since 3.1
       
   160          * @param aMessage Collection message
       
   161          * @param aErr system error code.
       
   162          */
       
   163         void HandleCollectionMessage(
       
   164             CMPXMessage* aMessage, TInt aError );
       
   165 
       
   166         /**
       
   167          * From MMPXCollectionObserver
       
   168          * Handles the collection entries being opened.
       
   169          *
       
   170          * @since 3.1
       
   171          * @param aEntries Collection entries opened.
       
   172          * @param aIndex Focused entry.
       
   173          * @param aComplete ETrue no more entries. EFalse more entries
       
   174          *                  expected.
       
   175          * @param aError Error code.
       
   176          */
       
   177         void HandleOpenL(
       
   178             const CMPXMedia& aEntries,
       
   179             TInt aIndex,
       
   180             TBool aComplete,
       
   181             TInt aError );
       
   182 
       
   183         /**
       
   184          * From MMPXCollectionObserver
       
   185          * Handles the item being opened.
       
   186          *
       
   187          * @since 3.1
       
   188          * @param aPlaylist Collection playlist, owner ship is transfered.
       
   189          * @param aError Error code.
       
   190          */
       
   191         void HandleOpenL(
       
   192             const CMPXCollectionPlaylist& aPlaylist,
       
   193             TInt aError );
       
   194 
       
   195         /**
       
   196          * From MMPXPlaybackObserver
       
   197          * Handle playback message
       
   198          *
       
   199          * @param aMessage playback message
       
   200          * @param aErr system error code.
       
   201          */
       
   202         void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
       
   203 
       
   204     private:  // New functions
       
   205 
       
   206         /**
       
   207          * Initialize playback engine with the path provided
       
   208          *
       
   209          * @param aPath The collection path to initialize playback engine with.
       
   210          */
       
   211         void InitPlaybackEngineL( CMPXCollectionPath& aPath );
       
   212 
       
   213         /**
       
   214          * Handle playback message
       
   215          *
       
   216          * @param aMessage playback message
       
   217          */
       
   218         void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
       
   219 
       
   220         /**
       
   221          * Handle collection message
       
   222          *
       
   223          * @param aMessage collection message
       
   224          */
       
   225         void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
       
   226 
       
   227         /**
       
   228         * Start the incremental open operation at a particular index
       
   229         * @param aPath path to open
       
   230         * @param aIndex index to start reading from
       
   231         * @param aDelay delay to start the operation (in ms)
       
   232         */
       
   233         void DoIncrementalOpenL( CMPXCollectionPath& aPath, TInt aIndex,
       
   234                                  TInt aDelay = 0 );
       
   235 
       
   236     private:
       
   237 
       
   238         MMPXCollectionUtility* iCollectionUtility; 	  // owned
       
   239         MMPXPlaybackUtility* iPlaybackUtility;  	  // not owned
       
   240         MMPXCollectionUiHelper* iCollectionUiHelper;  // not owned
       
   241         CMPXCollectionOpenUtility* iIncOpenUtil;	  // owned
       
   242 
       
   243         TBool iPathInitialized;
       
   244         TBool iIsInitializing;
       
   245         TBool iInitCanceled;
       
   246         TBool iDefaultPath;      	// Are we initializing the default path?
       
   247         TMPXItemId iSelectionId; 	// Item we want to play
       
   248         TInt  iSelectionIndex; 		// Index we are restoring to
       
   249         TBool iLoadSavedPath;    	// Load a saved path or load a default path?
       
   250         TBool iUSBOngoing;       	// is usb ongoing
       
   251         TUid iRootPathId;
       
   252 		TBool iEnableShuffle;		// enable shuffle play
       
   253     };
       
   254 
       
   255 #endif // CMPXCOLLECTIONVIEWHGPLAYLISTHELPER_H
       
   256 
       
   257 // End of File
       
   258