videocollection/hgmyvideos/inc/vcxhgmyvideosmodel.h
changeset 0 96612d01cf9f
child 8 ce5ada96ab30
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:      Common model class for component.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VCXHGMYVIDEOSMODEL_H
       
    21 #define VCXHGMYVIDEOSMODEL_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <coemain.h>
       
    25 #include <vcxmyvideosdefs.h>
       
    26 #include <MediatorEventProvider.h>
       
    27 #include <thumbnailmanager.h>
       
    28 #include <thumbnailmanagerobserver.h>
       
    29 #include <videoplayercustommessage.h>
       
    30 
       
    31 #include "CIptvDriveMonitor.h"
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 
       
    35 class CVcxHgMyVideosCollectionClient;
       
    36 class CVcxHgMyVideosDownloadClient;
       
    37 class CRepository;
       
    38 class CIptvLastWatchedApi;
       
    39 class CIptvLastWatchedData;
       
    40 
       
    41 
       
    42 // CONSTANTS
       
    43 
       
    44 const TInt KVcxHgMyVideosCategoryControlGroupId(500);
       
    45 const TInt KVcxHgMyVideosVideoControlGroupId(600);
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 /**
       
    50  * Common model class for component.
       
    51  *
       
    52  * @lib vcxhgmyvideos.lib
       
    53  */
       
    54 NONSHARABLE_CLASS( CVcxHgMyVideosModel ) : public CBase,
       
    55                                            public MThumbnailManagerObserver,
       
    56                                            public MIptvDriveMonitorObserver
       
    57     {
       
    58     public:
       
    59         
       
    60         /**
       
    61          * Application / view states.
       
    62          */
       
    63         enum TVcxMyVideosAppState
       
    64             {
       
    65             EVcxMyVideosAppStateUnknown = 0,
       
    66             EVcxMyVideosAppStateCategoryBusy,
       
    67             EVcxMyVideosAppStateCategoryIdle,
       
    68             EVcxMyVideosAppStateVideoBusy,
       
    69             EVcxMyVideosAppStateVideoIdle,
       
    70             EVcxMyVideosAppStatePlayer
       
    71             };
       
    72         
       
    73         /**
       
    74          * Screen resolutions.
       
    75          */
       
    76         enum TVcxScreenResolution
       
    77             {
       
    78             EVcxScreenResolutionUnknown = 0,
       
    79             EVcxScreenResolutionQVGA,
       
    80             EVcxScreenResolutionQHD,
       
    81             EVcxScreenResolutionVGA
       
    82             };        
       
    83         
       
    84     public: // Constructors and destructor
       
    85 
       
    86         /**
       
    87          * Two-phased constructor.
       
    88          *
       
    89          * @return New object.
       
    90          */
       
    91         static CVcxHgMyVideosModel* NewL();
       
    92 
       
    93         /**
       
    94          * Two-phased constructor.
       
    95          *
       
    96          * @return New object.
       
    97          */
       
    98         static CVcxHgMyVideosModel* NewLC();
       
    99 
       
   100         /**
       
   101          * Destructor.
       
   102          */
       
   103         virtual ~CVcxHgMyVideosModel();
       
   104 
       
   105     public:
       
   106         
       
   107         /**
       
   108          * Returns true if device has touch support.
       
   109          * 
       
   110          * @return ETrue if device supports touch.
       
   111          */
       
   112         TBool TouchSupport();
       
   113         
       
   114         /**
       
   115          * Returns current screen resolution (QVGA,QHD,VGA).
       
   116          * 
       
   117          * @param aCoeEnv Pointer to Coe Env.
       
   118          * @return Screen resolution.
       
   119          */
       
   120         TVcxScreenResolution GetScreenResolution( CCoeEnv* aCoeEnv );
       
   121 
       
   122         /**
       
   123          * Returns MPX Collection Client.
       
   124          *
       
   125          * @return Reference to Collection client.
       
   126          */
       
   127         CVcxHgMyVideosCollectionClient& CollectionClient();
       
   128         
       
   129         /**
       
   130          * Returns Download client.
       
   131          *
       
   132          * @return Reference to Download client.
       
   133          */
       
   134         CVcxHgMyVideosDownloadClient& DownloadClient();
       
   135         
       
   136         /**
       
   137          * Returns reference to component's File Server session.
       
   138          * 
       
   139          * @return Reference to File Server session.
       
   140          */
       
   141         RFs& FileServerSessionL();
       
   142         
       
   143         /**
       
   144          * Returns reference to component's drive monitor.
       
   145          * 
       
   146          * @return Reference to drive monitor.
       
   147          */
       
   148         CIptvDriveMonitor& DriveMonitorL();
       
   149 
       
   150         /**
       
   151          * Sets application state.
       
   152          *
       
   153          * @param aAppState New application state.
       
   154          */
       
   155         void SetAppState( TVcxMyVideosAppState aAppState );
       
   156         
       
   157         /**
       
   158          * Gets application state.
       
   159          *
       
   160          * @return Application state.
       
   161          */
       
   162         TVcxMyVideosAppState AppState();
       
   163 
       
   164         /**
       
   165          * Returns previous application state.
       
   166          *
       
   167          * @return Previous application state.
       
   168          */
       
   169         TVcxMyVideosAppState PreviousAppState();
       
   170 
       
   171         /**
       
   172          * Sets video list sort order (to CenRep).
       
   173          * 
       
   174          * @param aSortOrder New video list sort order.
       
   175          */
       
   176         void SetVideolistSortOrderL( TVcxMyVideosSortingOrder aSortOrder );
       
   177 
       
   178         /**
       
   179          * Gets video list sort order (from CenRep).
       
   180          * 
       
   181          * @return Video list sort order.
       
   182          */
       
   183         TVcxMyVideosSortingOrder VideolistSortOrderL();
       
   184 
       
   185         /**
       
   186          * Should be called when playback of video is stopping. Updates last
       
   187          * play point of video to 'Last Watched' dat-file.
       
   188          */
       
   189         void UpdateLastWatchedPlayPositionL( TUint32 aLastVideoPlayPoint );
       
   190         
       
   191         /**
       
   192          * Cancels the download completed soft notification.
       
   193          */
       
   194         void ResetDownloadNotification();
       
   195         
       
   196         /**
       
   197          * Should be called when playback of video is starting. Updates 'Last
       
   198          * Watched' information to Matrix and dat-file.
       
   199          * 
       
   200          * @param aVideoInfo Information about played video.
       
   201          * @param aMpxId1 MPX ID 1 of the played video.
       
   202          * @param aAgeProfile Age profile of the video for parental control.
       
   203          */
       
   204         void SetVideoAsLastWatchedL( TVideoPlayerCustomMessage& aVideoInfo, 
       
   205                                      TInt aMpxId1,
       
   206                                      TUint32 aAgeProfile );
       
   207 
       
   208         /**
       
   209          * Reads information about 'Last Watched' video clip from dat-file.
       
   210          * 
       
   211          * @param aVideoInfo On return, information about last played video.
       
   212          * @param aMpxId1 On return, MPX Item Id 1.
       
   213          * @param aAgeProfile On return, the age profile of the video for 
       
   214          *      parental control
       
   215          */
       
   216         void GetLastWatchedDataL( TVideoPlayerCustomMessage& aVideoInfo, 
       
   217                                   TUint32& aMpxId1,
       
   218                                   TUint32& aAgeProfile );
       
   219         
       
   220     public: // From MThumbnailManagerObserver
       
   221         
       
   222         /**
       
   223          * Preview thumbnail generation or loading is complete.
       
   224          *
       
   225          * @param aThumbnail An object representing the resulting thumbnail.
       
   226          * @param aId Request ID for the operation
       
   227          */
       
   228         void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId );
       
   229     
       
   230         /**
       
   231          * Final thumbnail bitmap generation or loading is complete.
       
   232          *
       
   233          * @param aError Error code.
       
   234          * @param aThumbnail An object representing the resulting thumbnail.
       
   235          * @param aId Request ID for the operation.
       
   236          */
       
   237         void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId );
       
   238     
       
   239     public: // from MIptvDriveMonitorObserver
       
   240         
       
   241         /**
       
   242         * Empty handler for drive monitor events.
       
   243         *
       
   244         * @aEvent  The Event.
       
   245         */
       
   246         void HandleDriveMonitorEvent( TIptvDriveMonitorEvent& aEvent );
       
   247         
       
   248     private: // Constructors
       
   249 
       
   250         /**
       
   251          * Default C++ constructor. 
       
   252          */
       
   253         CVcxHgMyVideosModel();
       
   254 
       
   255         /**
       
   256          * Symbian 2nd phase constructor.
       
   257          */
       
   258         void ConstructL();
       
   259 
       
   260         /**
       
   261          * If needed creates, and returns pointer to Last Watched API.
       
   262          * 
       
   263          * @return Pointer to Last Watched API.
       
   264          */
       
   265         CIptvLastWatchedApi* LastWatchedApiL();
       
   266         
       
   267         /**
       
   268          * If needed creates, and returns pointer to Last Watched Data.
       
   269          * 
       
   270          * @return Pointer to Last Watched Data.
       
   271          */
       
   272         CIptvLastWatchedData* LastWatchedDataL();
       
   273 
       
   274         /**
       
   275          * Copies data from one Video Player Custom message to another.
       
   276          * 
       
   277          * @param aSource Source object.
       
   278          * @param aTarget Target object.
       
   279          */
       
   280         void CopyVideoPlayerCustomMessageL( TVideoPlayerCustomMessage& aSource,
       
   281                                             TVideoPlayerCustomMessage& aTarget );
       
   282         
       
   283         /**
       
   284          * If needed creates, and returns pointer to Video Player Custom Message.
       
   285          * 
       
   286          * @return Pointer to Video Player Custom Message.
       
   287          */        
       
   288          TVideoPlayerCustomMessage* VideoPlayerCustomMessageL();       
       
   289         
       
   290         /**
       
   291          * Handles ThumbnailReady() call.
       
   292          *
       
   293          * @param aError Error code.
       
   294          * @param aThumbnail An object representing the resulting thumbnail.
       
   295          * @param aId Request ID for the operation.
       
   296          */        
       
   297         void HandleThumbnailReadyL( TInt aError,
       
   298                                     MThumbnailData& aThumbnail,
       
   299                                     TThumbnailRequestId aId );        
       
   300         /**
       
   301          * If needed creates, and returns pointer to Thumbnail Manager.
       
   302          *
       
   303          * @return Pointer to Thumbnail Manager.
       
   304          */
       
   305         CThumbnailManager* ThumbnailManagerL();
       
   306         
       
   307     private:
       
   308 
       
   309         /**
       
   310          * Client class for My Videos MPX Collection.
       
   311          * Own.
       
   312          */
       
   313         CVcxHgMyVideosCollectionClient* iCollection;
       
   314 
       
   315         /**
       
   316          * Application state.
       
   317          */
       
   318         TVcxMyVideosAppState iAppState;
       
   319         
       
   320         /**
       
   321          * Previous application state.
       
   322          */
       
   323         TVcxMyVideosAppState iPreviousAppState;        
       
   324         
       
   325         /**
       
   326          * Internal flag for storing touch support information.
       
   327          */
       
   328         TBool iTouchSupport;
       
   329         
       
   330         /**
       
   331          * Component's File Server session.
       
   332          * Own.
       
   333          */
       
   334         RFs iFsSession;
       
   335         
       
   336         /**
       
   337          * Component's drive monitor.
       
   338          * Own.
       
   339          */
       
   340         CIptvDriveMonitor* iDriveMonitor;
       
   341         
       
   342         /**
       
   343          * Session to MPX Collection CenRep.
       
   344          * Own.
       
   345          */
       
   346         CRepository* iCollectionCenRep;
       
   347         
       
   348         /**
       
   349          * Pointer to 'Last Watched' API.
       
   350          * Own.
       
   351          */
       
   352         CIptvLastWatchedApi* iLastWatchedApi;
       
   353         
       
   354         /**
       
   355          * Pointer to 'Last Watched' data object.
       
   356          * Own.
       
   357          */
       
   358         CIptvLastWatchedData* iLastWatchedData;
       
   359 
       
   360         /**
       
   361          * Pointer to Video Player custom message.
       
   362          * Own.
       
   363          */
       
   364         TVideoPlayerCustomMessage* iVideoPlayerCustomMessage;
       
   365         
       
   366         /**
       
   367          * S60 Thumbnail Manager.
       
   368          * Own.
       
   369          */
       
   370         CThumbnailManager* iTnManager;
       
   371         
       
   372         /**
       
   373          * Request ID of ongoing thumbnail request, or KErrNotFound.
       
   374          */
       
   375         TThumbnailRequestId iTnRequestId;
       
   376 
       
   377         /**
       
   378          * Pointer to Mediator Event class.
       
   379          * Own.
       
   380          */        
       
   381         CMediatorEventProvider* iMediatorEventProvider;
       
   382     
       
   383         /**
       
   384          * Video list sort order.
       
   385          */
       
   386         TVcxMyVideosSortingOrder iSortOrder;
       
   387     };
       
   388 
       
   389 #endif // VCXHGMYVIDEOSMODEL_H