videocollection/hgmyvideos/inc/vcxhgmyvideosvideolistimpl.h
branchRCL_3
changeset 23 befca0ec475f
equal deleted inserted replaced
22:839377eedc2b 23:befca0ec475f
       
     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:      Implementation of UI functionality for video list.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VCXHGMYVIDEOSVIDEOLISTIMPL_H
       
    21 #define VCXHGMYVIDEOSVIDEOLISTIMPL_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <e32cmn.h>
       
    25 #include <ganes/HgSelectionObserverIface.h>
       
    26 #include <ganes/HgMarkingObserverIface.h>
       
    27 #include <AknProgressDialog.h>
       
    28 #include <upnpcommandobserver.h>
       
    29 #include "vcxhgmyvideoslistbase.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CVcxHgMyVideosVideoModelHandler;
       
    33 class TViaPlayerCustomMessage;
       
    34 class CAknWaitDialog;
       
    35 class CVcxHgMyVideosVideoCopier;
       
    36 class CVcxHgMyVideosUPnPInterface;
       
    37 class CHgScroller;
       
    38 class CSendUi;
       
    39 class CDRMHelper;
       
    40 #ifdef RD_VIDEO_AS_RINGING_TONE
       
    41 class CHgMyVideosAiwMenuHandler;
       
    42 #endif
       
    43 
       
    44 namespace DRM
       
    45     {
       
    46     class CDrmUtility;
       
    47     }
       
    48 
       
    49 // CLASS DECLARATION
       
    50 
       
    51 /**
       
    52  * Implementation of UI functionality for video list.
       
    53  * 
       
    54  * @lib vcxhgmyvideos.lib
       
    55  */
       
    56 NONSHARABLE_CLASS( CVcxHgMyVideosVideoListImpl ) : public CVcxHgMyVideosListBase,
       
    57                                                    public MProgressDialogCallback,
       
    58                                                    public MUpnpCommandObserver,
       
    59                                                    public MHgSelectionObserver,
       
    60                                                    public MHgMarkingObserver
       
    61     {
       
    62     public:
       
    63 
       
    64         /**
       
    65          * Two-phased constructor.
       
    66          *
       
    67          * @param aModel Component model
       
    68          * @param aView Component view
       
    69          * @param aScroller Hg list control 
       
    70     
       
    71          * @return Pointer to newly created instance
       
    72          */
       
    73         static CVcxHgMyVideosVideoListImpl* NewL(
       
    74             CVcxHgMyVideosModel& aModel,
       
    75             CVcxHgMyVideosMainView& aView,
       
    76             CHgScroller& aScroller );
       
    77 
       
    78         /**
       
    79          * Two-phased constructor.
       
    80          *
       
    81          * @param aModel Component model 
       
    82          * @param aView Component view
       
    83          * @param aScroller Hg list control
       
    84          *
       
    85          * @return Pointer to newly created instance
       
    86          */
       
    87         static CVcxHgMyVideosVideoListImpl* NewLC( 
       
    88              CVcxHgMyVideosModel& aModel,
       
    89              CVcxHgMyVideosMainView& aView,
       
    90              CHgScroller& aScroller );
       
    91     
       
    92         /**
       
    93         * Destructor.
       
    94         */
       
    95         virtual ~CVcxHgMyVideosVideoListImpl();
       
    96     
       
    97         /**
       
    98          * Activate.
       
    99          * 
       
   100          * @param aIndex Index of video list to activate.
       
   101          */
       
   102         void DoListActivateL( TInt aIndex );
       
   103     
       
   104         /**
       
   105          * Deactivate
       
   106          */
       
   107         void DoListDeactivate();
       
   108 
       
   109         /**
       
   110          * Returns reference to the video model.
       
   111          * 
       
   112          * @return Reference to video model.
       
   113          */
       
   114         CVcxHgMyVideosVideoModelHandler& VideoModel();
       
   115         
       
   116         /**
       
   117          * Returns reference to the uPnP interface
       
   118          * 
       
   119          * @return Reference to uPnP interface
       
   120          */
       
   121         CVcxHgMyVideosUPnPInterface& UPnPInterface();
       
   122 
       
   123         /**
       
   124          * Gets list highlight.
       
   125          * 
       
   126          * @return Highlight.
       
   127          */
       
   128         TInt Highlight();
       
   129 
       
   130         /**
       
   131          * Returns the index(es) of video(s) that are operation targets.
       
   132          * 
       
   133          * @param aOperationTargets On return, index(es) of the video(s).
       
   134          */
       
   135         void GetOperationTargetIndexesL( RArray<TInt>& aOperationTargets );        
       
   136 
       
   137         /**
       
   138          * Starts playback of currently focused video.
       
   139          */
       
   140         void PlayCurrentVideoL();
       
   141                         
       
   142         /**
       
   143          * Deletes currently selected video(s).
       
   144          */
       
   145         void DeleteVideosL();
       
   146 
       
   147         /**
       
   148          * Plays currently selected video.
       
   149          */
       
   150         void PlayVideoL();
       
   151         
       
   152         /**
       
   153          * Handles sort command to list.
       
   154          * 
       
   155          * @param aSortCommand Sort command.
       
   156          */
       
   157         void HandleSortCommandL( TInt aSortCommand );
       
   158         
       
   159         /**
       
   160          * Checks the UI and list status and returns information to show
       
   161          * correct mark-menu items.
       
   162          * 
       
   163          * @param aShowMarkSubmenu On return, ETrue if mark sub-menu can be shown.
       
   164          * @param showStartMarking On return, ETrue if start marking menu item can be shown.
       
   165          * @param showEndMarking On return, ETrue if stop marking menu item can be shown.
       
   166          * @param aShowMarkAll On return, ETrue if mark all menu item can be shown.
       
   167          * @param aShowUnmarkAll On return, ETrue if unmark all menu item can be shown.
       
   168          */
       
   169         void ShowMarkMenuItemsL( 
       
   170                  TBool& aShowMarkSubmenu, TBool& showStartMarking, TBool& showEndMarking, 
       
   171                  TBool& aShowMarkAll, TBool& aShowUnmarkAll );
       
   172 
       
   173         /**
       
   174          * Handles mark command to list.
       
   175          * 
       
   176          * @param aMarkCommand Mark command.
       
   177          */
       
   178         void HandleMarkCommandL( TInt aMarkCommand );
       
   179         
       
   180         /**
       
   181          * Handles move and copy commands to list.
       
   182          * 
       
   183          * @param aCopy ETrue if copy command was given. EFalse if move.
       
   184          */
       
   185         void HandleMoveOrCopyCommandL( TBool aCopy );
       
   186         
       
   187         /**
       
   188          * Set empty list text for list control. 
       
   189          */
       
   190         void SetEmptyListTextL();        
       
   191 
       
   192         /**
       
   193          * Set title text for view.
       
   194          * 
       
   195          * @param aIndex Index of active video list.
       
   196          */
       
   197         void SetTitleTextL( TInt aIndex );
       
   198 
       
   199         /**
       
   200          * Handles dynamic initialisation of menu items specific to video list.
       
   201          * 
       
   202          * @param aResourceId Resource ID of menu to be activated.
       
   203          * @param aMenuPane Pointer to menu pane.
       
   204          */
       
   205         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   206         
       
   207         /**
       
   208          * Returns correct MSK resource Id based on current state of video list.
       
   209          *
       
   210          * @return MSK resource Id.
       
   211          */
       
   212         TInt GetMskResourceL();
       
   213         
       
   214         /**
       
   215          * Called by video model when video deletion is completed.
       
   216          * 
       
   217          * @param aFailedCount Count of items that could not be deleted.
       
   218          * @param aFailedName Name of video where deletion failed, if there was only one.
       
   219          */
       
   220         void VideoDeletionCompletedL( TInt aFailedCount, const TDesC& aFailedName );
       
   221         
       
   222         /**
       
   223          * Called by video model when move or copy command is completed.
       
   224          * 
       
   225          * @param aFailedCount Count of items that could not be moved/copied.
       
   226          * @param aFailedName Name of video where move/copy failed, if there was only one.
       
   227          */
       
   228         void VideoMoveOrCopyCompletedL( TInt aFailedCount, const TDesC& aFailedName );
       
   229         
       
   230         /**
       
   231          * Displays note about resume starting from beginning.
       
   232          */
       
   233         void ShowResumeStartsFromBeginningNoteL();
       
   234         
       
   235         /**
       
   236          * Begins multimarking mode.
       
   237          */
       
   238         void StartMarkingMode();
       
   239         
       
   240         /**
       
   241          * Ends multimarking mode.
       
   242          */
       
   243         void EndMarkingMode();
       
   244         
       
   245         /**
       
   246          * Send video using SendUI
       
   247          */
       
   248         void HandleSendL();
       
   249 
       
   250 #ifdef RD_VIDEO_AS_RINGING_TONE        
       
   251         /**
       
   252          * Handles command if aCommand is an Aiw command
       
   253          * 
       
   254          * @param aCommand Menu command ID
       
   255          */
       
   256         void TryHandleAiwCommandL( TInt aCommand );
       
   257 #endif
       
   258         
       
   259         /**
       
   260          * Checks if we are at marking mode and returns
       
   261          * corresponding value.
       
   262 		 *
       
   263 		 * @return ETrue if in marking mode else EFalse.
       
   264          *  
       
   265          */
       
   266         TBool IsMarking();
       
   267         
       
   268     public: // From MProgressDialogCallback
       
   269 
       
   270         /**
       
   271          * Called when (delete) wait dialog is dismissed.
       
   272          *
       
   273          * @aButtonId Button with which dialog was dismissed.
       
   274          */     
       
   275         void DialogDismissedL( TInt aButtonId ); 
       
   276     
       
   277     public: // From MHgSelectionObserver
       
   278             
       
   279         /**
       
   280          * Handle selection.
       
   281          * 
       
   282          * @param aIndex Selected item index.
       
   283          */
       
   284         void HandleSelectL( TInt aIndex );
       
   285             
       
   286         /**
       
   287          * Handle opening.
       
   288          * 
       
   289          * @param aIndex Opened item index.
       
   290          */
       
   291         void HandleOpenL( TInt aIndex );
       
   292     
       
   293     public: // From MHgMarkingObserver
       
   294         
       
   295         /**
       
   296          * Handle marking.
       
   297          * 
       
   298          * @param aIndex Selected item index.
       
   299          * @param aMarked ETrue if item marked, EFalse if item is unmarked.
       
   300          */
       
   301         void HandleMarkingL( TInt aIndex, TBool aMarked ); 
       
   302         
       
   303     public:
       
   304         
       
   305        /**
       
   306         * Handles async reposnses from CVcxHgMyVideosuPnPInterface::ShowVideo
       
   307         * In case we receive KErrNone or value below it (error), video playback 
       
   308         * has been ended due error or succesfully. 
       
   309         * 
       
   310         * Status might also be positive, which refers some undocumented additional
       
   311         * information. According to UPnP documentation, those status values should 
       
   312         * be ignored. 
       
   313         * 
       
   314         * @param aStatusCode  statuscode from the CVcxHgMyVideosUPnPInterface
       
   315         */
       
   316        void CommandComplete( TInt aStatusCode );
       
   317         
       
   318     protected:    
       
   319         
       
   320         /**
       
   321          * Default constructor
       
   322          *
       
   323          * @param aModel Component model
       
   324          * @param aView Component view
       
   325          * @param aScroller Hg list control
       
   326          */
       
   327         CVcxHgMyVideosVideoListImpl( CVcxHgMyVideosModel& iModel,
       
   328                                      CVcxHgMyVideosMainView& aView,
       
   329                                      CHgScroller& aScroller );
       
   330 
       
   331         /**
       
   332          * 2nd phase constructor.
       
   333          */
       
   334         void ConstructL();
       
   335 
       
   336         /**
       
   337          * Confirms video deletion from user.
       
   338          * 
       
   339          * @param aTargetCount Count of deletion targets.
       
   340          * @param aTargetName Name of deletion target, if there is only one.
       
   341          * @return ETrue if user confirmed deletion.
       
   342          */
       
   343         TBool ConfirmDeleteVideosL( TInt aTargetCount, const TDesC& aTargetName );
       
   344 
       
   345         /**
       
   346          * Opens the deletion wait note.
       
   347          */
       
   348         void OpenDeleteWaitNoteL();
       
   349 
       
   350         /**
       
   351          * Closes the deletion wait note.
       
   352          */
       
   353         void CloseDeleteWaitNote();
       
   354         
       
   355         /**
       
   356          * Fetch SendUI messaging configuration from CenRep
       
   357          * 
       
   358          * @return Messaging configuration from CenRep
       
   359          */
       
   360         TInt MessagingConfL();
       
   361 
       
   362         /**
       
   363          * Returns pointer to instance of CSendUi
       
   364          * 
       
   365          * @return Pointer to CSendUi
       
   366          */
       
   367         CSendUi* SendUiL();
       
   368 
       
   369 #ifdef RD_VIDEO_AS_RINGING_TONE
       
   370         /**
       
   371          * Returns pointer to instance of CHgMyVideosAiwMenuHandler.
       
   372          * First call creates handler and attaches AIW menu.
       
   373          * 
       
   374          * @return Pointer to CHgMyVideosAiwMenuHandler
       
   375          */
       
   376         CHgMyVideosAiwMenuHandler* AiwMenuHandlerL();
       
   377 #endif
       
   378 
       
   379         /**
       
   380          * OperationTargetsToMpxIdsL
       
   381          * Translates the target ui indexes to mpx ids. Needed for targeting 
       
   382          * list items if list may change while the requested operation is ongoing.
       
   383          *
       
   384          * @param operationTargetIndexes IN: Ui idexes of the target items
       
   385          * @param operationTargetIds OUT: Mpx ids of the target items
       
   386          */
       
   387         void OperationTargetsToMpxIdsL( RArray<TInt>& operationTargetIndexes,  
       
   388                                         RArray<TInt>& operationTargetIds );
       
   389 
       
   390         /**
       
   391          * Add "Send" menu item to menu.
       
   392          *
       
   393          * @param aMenuPane Add the menu item to this menu pane
       
   394          */
       
   395         void AddSendItemToMenuPaneL( CEikMenuPane* aMenuPane );
       
   396 
       
   397         /**
       
   398          * Handles dynamic initialisation of Move, Copy and Delete menu items
       
   399          *
       
   400          * @param aMenuPane Pointer to menu pane.
       
   401          * @param aItemsMarked If true, also add to Options menu. If false, only add to context menu.
       
   402          */
       
   403         void DynInitMenuPaneFileOperationsL(
       
   404                 CEikMenuPane* aMenuPane,
       
   405                 TBool aItemsMarked );
       
   406 
       
   407     protected:
       
   408     
       
   409         /**
       
   410          * Video model handler.
       
   411          * Own.
       
   412          */
       
   413         CVcxHgMyVideosVideoModelHandler* iVideoModel;    
       
   414         
       
   415         /**
       
   416          * Delete wait dialog.
       
   417          * Own.
       
   418          */
       
   419         CAknWaitDialog* iDeleteWaitDialog;
       
   420         
       
   421         /**
       
   422          * Class for handling copying and moving of videos.
       
   423          * Own.
       
   424          */
       
   425         CVcxHgMyVideosVideoCopier* iVideoCopier; 
       
   426         
       
   427         /**
       
   428          * UPnP handler interface
       
   429          * Own.
       
   430          */
       
   431         CVcxHgMyVideosUPnPInterface* iUPnP;
       
   432 
       
   433         /**
       
   434          * SendUI
       
   435          * Own
       
   436          */
       
   437         CSendUi* iSendUi;
       
   438 
       
   439 #ifdef RD_VIDEO_AS_RINGING_TONE
       
   440         /** 
       
   441          * Aiw Menu Handler
       
   442          * Own
       
   443          */
       
   444         CHgMyVideosAiwMenuHandler* iAiwMenuHandler;
       
   445 #endif
       
   446 
       
   447     };
       
   448 
       
   449 #endif // VCXHGMYVIDEOSVIDEOLISTIMPL_H