mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackplaylisthelper.h
branchRCL_3
changeset 19 0aa8cc770c8a
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #ifndef CMTPPLAYBACKPLAYLISTHELPER_H_
       
    22 #define CMTPPLAYBACKPLAYLISTHELPER_H_
       
    23 
       
    24 #include <mpxcollectionobserver.h>
       
    25 #include <mpxcollectionuihelperobserver.h>
       
    26 
       
    27 #include "mtpdebug.h"
       
    28 #include "cmtpplaybackparam.h"
       
    29 
       
    30 class MMPXCollectionUiHelper;
       
    31 class MMPXCollectionHelper;
       
    32 class MMPXCollectionUtility;
       
    33 
       
    34 class TMTPPbDataSuid;
       
    35 class CMTPPlaybackControlImpl;
       
    36 
       
    37 NONSHARABLE_CLASS( CMTPPlaybackPlaylistHelper ) : public CBase,
       
    38                                                   public MMPXCollectionObserver
       
    39     {
       
    40 public: // Constructors and destructor
       
    41 
       
    42     /**
       
    43      * Two-phased constructor.
       
    44      */
       
    45     static CMTPPlaybackPlaylistHelper* NewL( CMTPPlaybackControlImpl& aControlImpl );
       
    46 
       
    47     /**
       
    48      * Destructor.
       
    49      */
       
    50     virtual ~CMTPPlaybackPlaylistHelper();
       
    51     
       
    52 public:
       
    53     
       
    54     /**
       
    55      * Get playlist from collection server
       
    56      * @param aPlayObject, refer to TMTPPbDataSuid
       
    57      */
       
    58     void GetPlayListFromCollectionL( const TMTPPbDataSuid& aPlayObject );
       
    59     
       
    60     /**
       
    61      * Get playlist from collection server
       
    62      * @param aIndex, song index
       
    63      */
       
    64     void GetPlayListFromCollectionL( TInt aIndex );
       
    65     
       
    66     /**
       
    67      * Get suid from collection server
       
    68      * @param aPlaylist, current collection playlist
       
    69      */
       
    70     TMTPPbDataSuid GetMTPPBSuidFromCollectionL( 
       
    71             const CMPXCollectionPlaylist& aPlaylist );
       
    72     
       
    73     /**
       
    74      * Get category
       
    75      */
       
    76     TMTPPbCategory MTPPbCategory() const;
       
    77     
       
    78     /**
       
    79      * Get suid
       
    80      */
       
    81     TFileName MTPPbSuid() const;
       
    82     
       
    83 private:
       
    84     
       
    85     //from base class MMPXCollectionObserver  
       
    86     /** 
       
    87      *  Handle collection message
       
    88      * 
       
    89      *  @param aMsg collection message, ownership not transferred. 
       
    90      *         Please check aMsg is not NULL before using it. 
       
    91      *         If aErr is not KErrNone, plugin might still call back with more
       
    92      *         info in the aMsg.
       
    93      *  @param aErr system error code.
       
    94      */
       
    95     void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
       
    96     
       
    97     /**
       
    98      *  Handles the collection entries being opened. Typically called
       
    99      *  when client has Open()'d a folder.
       
   100      *
       
   101      *  @param aEntries collection entries opened
       
   102      *  @param aIndex focused entry
       
   103      *  @param aComplete ETrue no more entries. EFalse more entries
       
   104      *                   expected
       
   105      *  @param aError error code   
       
   106      */
       
   107     void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete,
       
   108               TInt aError );
       
   109     
       
   110     /**
       
   111      *  Handles the item being opened. Typically called
       
   112      *  when client has Open()'d an item. Client typically responds by
       
   113      *  'playing' the item via the playlist.
       
   114      *
       
   115      *  @param aPlaylist collection playlist
       
   116      *  @param aError error code
       
   117      */
       
   118     void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
       
   119     
       
   120     /**
       
   121      * From MMPXCollectionMediaObserver 
       
   122      * It handles MediaL event.
       
   123      *
       
   124      * @param aMedia object containing collection's informations
       
   125      * @param aError error code
       
   126      */
       
   127     void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
       
   128 
       
   129 private:
       
   130     
       
   131     /**
       
   132      * C++ default constructor.
       
   133      */
       
   134     CMTPPlaybackPlaylistHelper( CMTPPlaybackControlImpl& aControlImpl );
       
   135     
       
   136     /**
       
   137      * By default Symbian 2nd phase constructor is private.
       
   138      */
       
   139     void ConstructL();
       
   140     
       
   141 private:
       
   142     
       
   143     /**
       
   144      * Handle collection message
       
   145      */
       
   146     void DoHandleCollectionMessageL( const CMPXMessage& aMsg );
       
   147     
       
   148     /**
       
   149      * Handle OpenL
       
   150      */
       
   151     void DoHandleOpenL( const CMPXMedia& aEntries );
       
   152     
       
   153     /**
       
   154      * Open the root path of playlist
       
   155      */
       
   156     void OpenMusicPlayListPathL();
       
   157     
       
   158     /**
       
   159      * Open the root path of album
       
   160      */
       
   161     void OpenMusicAblumPathL();
       
   162     
       
   163     /**
       
   164      * Reset play source
       
   165      */
       
   166     void ResetPlaySource();
       
   167     
       
   168     /**
       
   169     *Update path index according to iPlayObject
       
   170     */
       
   171     void UpdatePlaylistPathIndexL( const CMPXMedia& aEntries );
       
   172     
       
   173     /**
       
   174     *Got the collectionHelperL
       
   175     */
       
   176     MMPXCollectionHelper* CollectionHelperL();
       
   177     
       
   178     /**
       
   179      * Map uri to ItemId
       
   180      */
       
   181     const TMPXItemId UriToItemIdL();
       
   182     
       
   183     /**
       
   184      * Map uri to ItemId
       
   185      */
       
   186     const TFileName ItemIdToUriL( const TMPXItemId& aId );
       
   187     
       
   188     /**
       
   189      * Find Album Songs
       
   190      */
       
   191     CMPXMedia* FindAlbumSongsL( const TMPXItemId& aAlbumId );
       
   192     
       
   193     /*
       
   194      * UpdatePathAndOpenL
       
   195      */
       
   196     void UpdateAlbumPathAndOpenL();
       
   197     
       
   198     /*
       
   199      * UpdatePathAndOpenL
       
   200      */
       
   201     void UpdatePathAndOpenL();
       
   202     
       
   203     /**
       
   204      *  Return instance of CMTPPlaybackControlImpl.
       
   205      *
       
   206      */
       
   207     CMTPPlaybackControlImpl& MTPPlaybackControlImpl();
       
   208     
       
   209 private:
       
   210     
       
   211     MMPXCollectionUiHelper*              iCollectionUiHelper;//Owned
       
   212     MMPXCollectionHelper*                iCollectionHelper;//Owned
       
   213     MMPXCollectionUtility*               iCollectionUtil;//Owned
       
   214     HBufC*                               iPlayObject;  //Owned
       
   215     
       
   216     CMTPPlaybackControlImpl&             iMTPPlaybackControl;// Not owned
       
   217     
       
   218     TMTPPbCategory                       iPlayCategory;
       
   219     TInt                                 iSongIndex;
       
   220     TInt                                 iPathIndex;
       
   221 
       
   222     /**
       
   223     FLOGGER debug trace member variable.
       
   224      */
       
   225     __FLOG_DECLARATION_MEMBER;
       
   226     };
       
   227 
       
   228 #endif /* CMTPPLAYBACKPLAYLISTHELPER_H_ */