videocollection/hgmyvideos/inc/vcxhgmyvideosvideolist.h
changeset 0 96612d01cf9f
child 15 8f0df5c82986
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 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 the License "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:      Class for providing video list.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VCXHGMYVIDEOSVIDEOLIST_H
       
    21 #define VCXHGMYVIDEOSVIDEOLIST_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <coemain.h>
       
    25 #include <e32cmn.h>
       
    26 #include <vcxmyvideosdefs.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CMPXMedia;
       
    30 class CMPXMediaArray;
       
    31 class CVcxHgMyVideosVideoListItem;
       
    32 class TMPXItemId;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  * Class for providing video list.
       
    38  * 
       
    39  * @lib vcxhgmyvideos.lib
       
    40  */
       
    41 NONSHARABLE_CLASS( CVcxHgMyVideosVideoList ) :
       
    42         public CBase
       
    43     {
       
    44     public: // Constructing and destructing.
       
    45 
       
    46         /**
       
    47          * Two-phased constructor.
       
    48          * 
       
    49          * @return New object.
       
    50          */
       
    51         static CVcxHgMyVideosVideoList* NewL();
       
    52 
       
    53         /**
       
    54          * Two-phased constructor.
       
    55          * 
       
    56          * @return New object. 
       
    57          */
       
    58         static CVcxHgMyVideosVideoList* NewLC();
       
    59 
       
    60         /**
       
    61          * Destructor.
       
    62          */
       
    63         virtual ~CVcxHgMyVideosVideoList();
       
    64 
       
    65     public: // Data changes.
       
    66         
       
    67         /**
       
    68          * Removes all items from the video list.
       
    69          */
       
    70         void RemoveVideoList();
       
    71         
       
    72         /**
       
    73          * Replaces video list with new one.
       
    74          * 
       
    75          * @param aVideoList Reference to new video list.
       
    76          */
       
    77         void ReplaceVideoListL( CMPXMediaArray& aVideoList );
       
    78                 
       
    79     public: // Data fetching and status information.
       
    80                
       
    81         /**
       
    82          * Returns count of video items.
       
    83          * 
       
    84          * @return Count of items.
       
    85          */        
       
    86         TInt VideoCount();
       
    87 
       
    88         /**
       
    89          * Gets video's download state based on list index.
       
    90          * 
       
    91          * @param aIndex Index to video list.
       
    92          * @return Video's download state as TVcxMyVideosDownloadState structure.
       
    93          */
       
    94         TVcxMyVideosDownloadState VideoDownloadState( TInt aIndex );
       
    95         
       
    96 		/**
       
    97 		 * Returns a list of item indexes which downloading
       
    98 		 * state is different than EVcxMyVideosDlStateNone.
       
    99 		 * 
       
   100 		 * @return List of item indexes.
       
   101 		 */
       
   102 		void GetOngoingDownloads( RArray<TInt>& aDownloads );
       
   103 		
       
   104         /**
       
   105          * Removes MPX Media object from video array.
       
   106          * 
       
   107          * @param aMpxItemId MPX Item Id.
       
   108          * @return Removed index number if succeeded, otherwise KErrNotFound.
       
   109          */
       
   110         TInt RemoveVideo( TMPXItemId aMpxItemId );
       
   111         
       
   112         /**
       
   113          * Resorts the video list. The list can be sorted by date, 
       
   114 		 * size or name.
       
   115          *
       
   116          * @param aSortingOrder Sorting order used.
       
   117          */
       
   118         void ResortVideoListL( const TVcxMyVideosSortingOrder& aSortingOrder );
       
   119         
       
   120         /**
       
   121          * Adds video to video list to the correct position, 
       
   122          * according to sorting order. Ownership of video 
       
   123          * is transferred to video list.
       
   124          *
       
   125          * @param aVideo Video to add.
       
   126          * @param aSortingOrder Sorting order used.
       
   127          */
       
   128         void AddToCorrectPlaceL( CMPXMedia* aVideo,
       
   129                 TVcxMyVideosSortingOrder aSortingOrder );
       
   130         
       
   131         /**
       
   132          * Returns MPX Media object based on index.
       
   133          * 
       
   134          * @param aIndex Index to video list.
       
   135          * @return MPX Media object or NULL.
       
   136          */
       
   137         CMPXMedia* MPXMedia( TInt aIndex );
       
   138         
       
   139         /**
       
   140          * Returns MPX Media object based on MPX Item Id.
       
   141          * 
       
   142          * @pararm aMpxItemId MPX Item Id.
       
   143          * @return MPX Media object or NULL.
       
   144          */
       
   145         CMPXMedia* MPXMediaByMPXItemId( TMPXItemId aMpxItemId );
       
   146         
       
   147         /**
       
   148          * Returns correct list index based on MPX Item Id.
       
   149          * 
       
   150          * @param aMpxItemId MPX Item Id.
       
   151          * @return List index.
       
   152          */
       
   153         TInt IndexByMPXItemId( TMPXItemId aMpxItemId );
       
   154         
       
   155         /**
       
   156          * Translates array index to MPX item id by reading the value from array.
       
   157          *
       
   158          * @param aArrayIndex Index in array.
       
   159          * @return MPX item id
       
   160          */
       
   161         TMPXItemId ArrayIndexToMpxItemIdL( TInt aArrayIndex );
       
   162         
       
   163         /**
       
   164          * Returns MPX Media object based on URI.
       
   165          * 
       
   166          * @param aUri Video's URI.
       
   167          * @return MPX Media object or NULL.
       
   168          */        
       
   169         CMPXMedia* MPXMediaByUri( const TDesC& aUri );
       
   170 
       
   171     private:
       
   172 
       
   173         /**
       
   174          * Constructor.
       
   175          */
       
   176         CVcxHgMyVideosVideoList();
       
   177                 
       
   178     private:
       
   179 
       
   180         /**
       
   181          * Array of videos.
       
   182          * Own.
       
   183          */
       
   184         RPointerArray<CVcxHgMyVideosVideoListItem> iVideoList;
       
   185     };
       
   186 
       
   187 #endif // VCXHGMYVIDEOSVIDEOLIST_H