upnpframework/upnpcommonui/inc/upnpbrowsedialog.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Header file for the UPnPSelectionDialog class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __UPNP_BROWSE_DIALOG_H__
       
    20 #define __UPNP_BROWSE_DIALOG_H__
       
    21 
       
    22 // INCLUDES
       
    23 // System
       
    24 #include <AknProgressDialog.h>
       
    25 
       
    26 // upnpframework / avcontroller api
       
    27 #include "upnpavbrowsingsessionobserver.h"
       
    28 #include "upnpavrenderingsessionobserver.h"
       
    29 
       
    30 // commonui internal
       
    31 #include "upnpdeviceobserver.h"
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CUPnPMusicAdapter;
       
    35 class CUPnPLocalPlayer;
       
    36 class CUPnPBrowseCacheItem;
       
    37 class CAknIconArray;
       
    38 class CUPnPCommonUI;
       
    39 class CUpnpImagePlayer;
       
    40 class CUPnPBrowsePlaylistFiller;
       
    41 class CUPnPPeriodic;
       
    42 
       
    43 /**
       
    44 * Browse dialog class of Common UI library
       
    45 */
       
    46 class CUPnPBrowseDialog : public CAknDialog,
       
    47                           public MUPnPAVBrowsingSessionObserver,
       
    48                           public MProgressDialogCallback,
       
    49                           public MUPnPDeviceObserver
       
    50                           
       
    51     {
       
    52 
       
    53     public:  // Constructors and destructor
       
    54 
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         */
       
    58         IMPORT_C static CUPnPBrowseDialog* NewL(
       
    59                                             TInt aMenuResource,
       
    60                                             MUPnPAVController& aAVControl,
       
    61                                             const CUpnpAVDevice& aDevice,
       
    62                                             CUPnPCommonUI& aCommonUI );
       
    63 
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         IMPORT_C virtual ~CUPnPBrowseDialog();
       
    68 
       
    69     public: // Methods from MUPnPAVBrowsingSessionObserver
       
    70 
       
    71         /**
       
    72          * Returns a browse result received from a Media Server.
       
    73          *         
       
    74          * @since Series 60 3.1
       
    75          * @param aBrowseResponse browse response xml document
       
    76          * @param aError system wide error code
       
    77          * @param aMatches number of returned items
       
    78          * @param aTotalCount total number of objects on container
       
    79          * @param aUpdateId update id number
       
    80          * @return None
       
    81          */
       
    82         void BrowseResponse(
       
    83                         const TDesC8& aBrowseResponse,
       
    84                         TInt aError,
       
    85                         TInt aMatches,
       
    86                         TInt aTotalCount,
       
    87                         const TDesC8& aUpdateId
       
    88                         );
       
    89 
       
    90         /**
       
    91          * Returns a search result received from a Media Server.
       
    92          *
       
    93          * @param aSearchResponse search response xml document
       
    94          * @param aError system wide error code
       
    95          * @param aMatches number of returned items
       
    96          * @param aTotalCount total number of resulted items
       
    97          * @param aUpdateId update id number
       
    98          * @return None
       
    99          */
       
   100         void SearchResponse( 
       
   101                         const TDesC8& /*aSearchResponse*/,
       
   102                          TInt /*aError*/,
       
   103                          TInt /*aMatches*/,
       
   104                          TInt /*aTotalCount*/,
       
   105                          const TDesC8& /*aUpdateId*/
       
   106                          ){};
       
   107 
       
   108         /**
       
   109          * Notifies that the create container operation is complete.
       
   110          *
       
   111          * @since Series 60 3.1
       
   112          * @param TInt, status information
       
   113          * @param aObjectId (const TDesC8&) object ID of the new container
       
   114          */
       
   115         void CreateContainerResponse( TInt /*aError*/,
       
   116                         const TDesC8& /*aObjectId = KNullDesC8*/ ){};
       
   117 
       
   118         /**
       
   119          * Notifies that the requested UPnP Object deletion is complete.
       
   120          *
       
   121          * @since Series 60 3.1
       
   122          * @param TInt, status information
       
   123          * @return None
       
   124          */
       
   125         void DeleteObjectResponse( TInt /*aError*/ ){};
       
   126 
       
   127          /**
       
   128          * Returns search capabilities of the requested Media Server.
       
   129          *
       
   130          * @since Series 60 3.1
       
   131          * @param TInt, status information
       
   132          * @param HBufC8&, the search capabilities string
       
   133          * @return None
       
   134          */
       
   135         void SearchCapabilitiesResponse( TInt /*aError*/,
       
   136             const TDesC8& /*aSearchCapabilities*/  ){};
       
   137         
       
   138         
       
   139         /**
       
   140          * Notifies that the Media Server we have a session with has
       
   141          * disappeared. Session is now unusable and must be closed. 
       
   142          *
       
   143          * @since Series 60 3.1
       
   144          * @param aReason reason code
       
   145          * @return None
       
   146          */ 
       
   147         void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason );
       
   148         
       
   149         /**
       
   150          * Notifies that the Local Media Server has been put on sharing state
       
   151          *
       
   152          * @since Series 60 3.1
       
   153          * @param aReason reason code
       
   154          * @return None
       
   155          */
       
   156         void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){};
       
   157         
       
   158    protected: // from CoeControl
       
   159    
       
   160         /**
       
   161         * Gets the control's help context. 
       
   162         * @param TCoeHelpContext, context of desired help
       
   163         * @return none
       
   164         */
       
   165         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   166    
       
   167     public: // From MProgressDialogCallback
       
   168 
       
   169         /**
       
   170          * Callback function for progress bar.
       
   171          *
       
   172          * @since Series 60 3.1
       
   173          * @param aButtonId, id of the button pressed
       
   174          * @return None
       
   175          */
       
   176         void DialogDismissedL( TInt aButtonId );
       
   177 
       
   178     public: // New functions
       
   179 
       
   180         /**
       
   181         * Sends the browse request to UPnP AV Controller. When result set
       
   182         * arrives, UPnP AV Controller will call the "BrowseResponse" call
       
   183         * back method.
       
   184         *
       
   185         * @param TInt index of the iBrowseArray object, if -1 is given,
       
   186         *             the root container will be browsed.
       
   187         * @return None
       
   188         */
       
   189         void SendBrowseRequestL( TInt aIndex );
       
   190 
       
   191         /**
       
   192          * Callback method for the iImageControlTimer.
       
   193          *
       
   194          * @since Series 60 3.1
       
   195          * @param aDlg current dialog which to be called
       
   196          * @return Tint
       
   197          */
       
   198         static TInt ImageControlTimerCallbackL(TAny* aDlg);
       
   199 
       
   200 
       
   201     protected:  // Functions from base classes
       
   202 
       
   203         /**
       
   204         * From CAknDialog, handles menu commands
       
   205         * @param aCommandId, command to be handled
       
   206         * @return none
       
   207         */
       
   208         void ProcessCommandL( TInt aCommandId );
       
   209 
       
   210         /**
       
   211         * From CAknDialog, handles key events.
       
   212         * @param TKeyEvent, Event to handled.
       
   213         * @param TEventCode, Type of the key event.
       
   214         * @return TKeyResponse, response code (EKeyWasConsumed, 
       
   215         *         EKeyWasNotConsumed).
       
   216         */
       
   217         TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent,
       
   218                                       TEventCode aType);
       
   219 
       
   220         /**
       
   221         * From CAknDialog, handles layout initialization
       
   222         */
       
   223         void PreLayoutDynInitL();
       
   224 
       
   225        /**
       
   226         * Menu observer interface. From MEikMenuObserver
       
   227         * @since Series 60 3.1
       
   228         * @param aResourceId resource ID identifying the menu pane to 
       
   229         * initialise.
       
   230         * @param aMenuPane The in-memory representation of the menu pane
       
   231         * @return none
       
   232         */
       
   233         void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane);
       
   234 
       
   235         /**
       
   236         * From CAknDialog, handles focus changes of the dialog
       
   237         * @param aButtonId, pressed button id
       
   238         * @return True if ready to close dialog, False otherwise
       
   239         */
       
   240         TBool OkToExitL( TInt aButtonId );
       
   241         
       
   242         /**
       
   243         * From CoeControl
       
   244         */
       
   245         void HandleResourceChange(TInt aType);
       
   246 
       
   247         
       
   248     public: // Methods from MUPnPDeviceObserver
       
   249     
       
   250         /**
       
   251          * Notifies that the target renderer disappeared
       
   252          *
       
   253          * @since Series 60 3.1
       
   254          * @param aError exit reason
       
   255          * @return None
       
   256          */
       
   257         void DeviceDisappeared( TInt aError );
       
   258         
       
   259     private:    // New Functions
       
   260 
       
   261         /**
       
   262         * Loads a possibly skinned icon and adds it to icon array
       
   263         * @since Series 60 3.1
       
   264         * @param CAknIconArray, array of icons
       
   265         * @param MAknsSkinInstance, skin instance
       
   266         * @param TDesC, reference to icon file
       
   267         * @param TAknsItemID, skinned icon id
       
   268         * @param TInt, bitmap id
       
   269         * @param TInt, bitmap mask id
       
   270         */
       
   271         void AppendIconToArrayL( CAknIconArray* aArray,
       
   272                                  MAknsSkinInstance* aSkin,
       
   273                                  const TDesC& aMbmFile,
       
   274                                  const TAknsItemID& aID,
       
   275                                  TInt aBitmapId,
       
   276                                  TInt aMaskId);
       
   277 
       
   278         /**
       
   279         * Marks one item
       
   280         * @since Series 60 3.1
       
   281         * @param aItemIndex (TInt) index of item that should be marked
       
   282         * @return None
       
   283         */
       
   284         void MarkItemL( TInt aItemIndex );
       
   285 
       
   286         /**
       
   287         * Unmarks one item
       
   288         * @since Series 60 3.1
       
   289         * @param aItemIndex (TInt) index of item that should be unmarked
       
   290         * @return None
       
   291         */
       
   292         void UnmarkItem( TInt aItemIndex );
       
   293 
       
   294         /**
       
   295         * Marks all items. Does not mark any containers.
       
   296         * @since Series 60 3.1
       
   297         * @return None
       
   298         */
       
   299         void MarkAllItemsL();
       
   300 
       
   301         /**
       
   302         * Unmarks all items
       
   303         * @since Series 60 3.1
       
   304         * @return None
       
   305         */
       
   306         void UnmarkAllItems();
       
   307 
       
   308         /**
       
   309         * Unmarks one item
       
   310         * @since Series 60 3.1
       
   311         * @param aItemIndex (TInt) index of item that should be unmarked
       
   312         * @return None
       
   313         */
       
   314         void UnMarkItemL( TInt aItemIndex );
       
   315 
       
   316         /**
       
   317         * Plays music file
       
   318         * @since Series 60 3.1
       
   319         * @param none
       
   320         * @return none
       
   321         */
       
   322         void PlayL(TBool aLocal);
       
   323 
       
   324         /**
       
   325         * Show image, video and music on external media renderer
       
   326         * @since Series 60 3.1
       
   327         * @param none
       
   328         * @return none
       
   329         */
       
   330         void ShowPlayExtL();
       
   331 
       
   332         /**
       
   333         * Displays wait note
       
   334         * @since Series 60 3.1
       
   335         * @param TInt, note resource
       
   336         */
       
   337         void DisplayWaitNoteL( TInt aResource );
       
   338 
       
   339 
       
   340         /**
       
   341         * Dismisses wait note
       
   342         * @since Series 60 3.2.3
       
   343         */
       
   344         void DismissWaitNoteL();
       
   345         
       
   346         /**
       
   347         * Called when target device responds to browse query
       
   348         * @since Series 60 3.1
       
   349         * @param TInt, query status
       
   350         * @param aTotalCount TInt total number of objects
       
   351         * @param RPointerArray&, returned item array
       
   352         * @return None
       
   353         */
       
   354         void BrowseResponseL( 
       
   355                     TInt aError,
       
   356                     TInt aTotalCount,
       
   357                     const RPointerArray<CUpnpObject>& aResultArray );
       
   358 
       
   359         
       
   360         
       
   361         
       
   362         /**
       
   363         * updates selected items array
       
   364         * @since Series 60 3.1
       
   365         * @param None
       
   366         * @return None
       
   367         */
       
   368         void SelectedArrayCheckL(void);
       
   369         
       
   370          /**
       
   371          * updates command button area
       
   372          * @since Series 60 3.23
       
   373          * @param aMark use for two states, item marked or no marked
       
   374          * @param aTempCounter is the number of the current item in the list.
       
   375          * @return None
       
   376          */
       
   377          void UpdateCommandButtonAreaL( TBool aMark, TInt aTempCounter );
       
   378 
       
   379          /**
       
   380          * updates command button area
       
   381          * @since Series 60 3.23
       
   382          * @param aMark use for two states, item marked or no marked
       
   383          * @param aTempCounter is the number of the current item in the list.
       
   384          * @return None
       
   385          */
       
   386          void UpdateCommandButtonArea( TBool aMark, TInt aTempCounter );
       
   387          
       
   388     private:
       
   389 
       
   390         /**
       
   391         * C++ default constructor.
       
   392         */
       
   393         CUPnPBrowseDialog( MUPnPAVController& aAVControl,
       
   394                            CUPnPCommonUI& aCommonUI,
       
   395                            const CUpnpAVDevice& aDevice );
       
   396 
       
   397         /**
       
   398         * By default Symbian 2nd phase constructor is private.
       
   399         */
       
   400         void ConstructL( TInt aMenuResource );
       
   401 
       
   402         /**
       
   403         * Loads listbox items
       
   404         * @since Series 60 3.1
       
   405         * @return none
       
   406         */
       
   407         void LoadListItemsL( void );
       
   408 
       
   409         /**
       
   410         * Delete old list items
       
   411         * @since Series 60 3.1
       
   412         * @return none
       
   413         */
       
   414         void DeleteListItemsL( void );
       
   415 
       
   416         /**
       
   417         * Clears dialog title
       
   418         * @since Series 60 3.1
       
   419         * @return none
       
   420         */
       
   421         void ClearTitleL();
       
   422 
       
   423         /**
       
   424         * Updates navi pane text
       
   425         * @since Series 60 3.1
       
   426         * @return none
       
   427         */
       
   428         void UpdateNaviPaneTextL();
       
   429 
       
   430         /**
       
   431          * Check if the container with the specified container Id exists
       
   432          * @since Series 60 3.1
       
   433          * @param aCheckContainerId the container Id to be checked
       
   434          * @return the found result
       
   435          */
       
   436         TInt CacheCheck( const TDesC8& aCheckContainerId );
       
   437         
       
   438         /**
       
   439          * Update the cache if any new container is found
       
   440          * @since Series 60 3.1
       
   441          * @param aContainerId the container Id to be checked
       
   442          * @param aNewItem check if the container is new or not
       
   443          * @return the found result
       
   444          */
       
   445         void CacheItemUpdateL( const TDesC8& aContainerId, TBool aNewItem );
       
   446         
       
   447         /**
       
   448          * Send dummy browse response
       
   449          * @since Series 60 3.1
       
   450          * @param aCacheIndex the index in the cache array
       
   451          *
       
   452          * @return none
       
   453          */
       
   454         void SendDummyBrowseResponseL( TInt aCacheIndex );
       
   455         
       
   456         /**
       
   457         * Starts ImageControl
       
   458         * @since Series 60 3.1
       
   459         * @param None
       
   460         * @return none
       
   461         */
       
   462         void StartImageControlL();
       
   463         
       
   464         /**
       
   465         * Stops ImageControl
       
   466         * @since Series 60 3.1
       
   467         * @param None
       
   468         * @return None
       
   469         */
       
   470         void StopImageControlL();
       
   471         
       
   472         /**
       
   473         * Updates softkeys 
       
   474         * @since Series 60 3.1
       
   475         * @param aResourceId (TInt) softkey resource
       
   476         * @return None
       
   477         */
       
   478         void UpdateSoftkeysL( TInt aResourceId );
       
   479         
       
   480         /**
       
   481         * Starts imageControl timer
       
   482         * @since Series 60 3.1
       
   483         * @param None
       
   484         * @return None
       
   485         */
       
   486         void StartImageControlTimer( void );
       
   487         
       
   488         /**
       
   489         * Shows current image
       
   490         * @since Series 60 3.1
       
   491         * @param aShowImage (TBool) shows current image and draws showing 
       
   492         *  icon
       
   493         * @return None
       
   494         */
       
   495         void ShowCurrentImageL( TBool aShowImage );
       
   496         
       
   497         /**
       
   498         * Shows current video
       
   499         * @since Series 60 3.1
       
   500         * @param none
       
   501         * @return none
       
   502         */
       
   503         void ShowVideoDialogExtL( );
       
   504         
       
   505         /**
       
   506         * Handel copy
       
   507         * @since Series 60 3.1
       
   508         * @param None
       
   509         *                     
       
   510         * @return none
       
   511         */
       
   512         void HandleCopyL();
       
   513         
       
   514         /**
       
   515         * Create a playlist filler representing current music selection
       
   516         * for starting music playback
       
   517         * @since Series 60 3.1
       
   518         * @param none
       
   519         *                     
       
   520         * @return CUPnPPlayListFiller filler instance
       
   521         */
       
   522         CUPnPPlayListFiller* CreateFillerLC();
       
   523          
       
   524         /**
       
   525          * Handle different errors returned from other dialogs
       
   526          * @since Series 60 3.1
       
   527          * @param exiting reason
       
   528          * @return none
       
   529          */
       
   530         void HandleErrorL( TInt aError ); 
       
   531         
       
   532         /**
       
   533         * Check if any audio item is marked
       
   534         * @since Series 60 3.1
       
   535         * @param None
       
   536         * @return ETrue if at least one audio item is marked
       
   537         */
       
   538         TBool IsAudioItemMarked( void );  
       
   539  
       
   540     private:    // Data
       
   541 
       
   542         //listbox
       
   543         CEikColumnListBox*          iListBox; //not owned
       
   544         //browse result array
       
   545         RPointerArray<CUpnpObject>  iResultArray; //item inside not owned
       
   546         //navi pane
       
   547         CAknNavigationDecorator*    iNaviDecorator; //owned
       
   548         // navi pane
       
   549         CAknNavigationControlContainer* iNaviPane; //not owned
       
   550         //AV controller
       
   551         MUPnPAVBrowsingSession*     iBrowseSession; //owned
       
   552         
       
   553         CUPnPCommonUI&              iCommonUI; //not owned
       
   554         
       
   555         MUPnPAVController&          iAVControl; //not owned
       
   556         //parent container
       
   557         RPointerArray<HBufC8>       iParentId;  //owned
       
   558         // parent name
       
   559         RPointerArray<HBufC8>       iParentName; //owned
       
   560         //common UI
       
   561            
       
   562         //wait dialog
       
   563         CAknWaitDialog*             iWaitNoteDialog; //owned    
       
   564         //temporary browse result array
       
   565         RPointerArray<CUpnpObject>  iTempArray; // items inside not owned
       
   566         //browse direction
       
   567         TInt                        iBrowseFlag;
       
   568         
       
   569         // stores selected item index
       
   570         TInt                        iSelectedItem;
       
   571         
       
   572         //exit timer
       
   573         TBool                       iFirstResultArray;
       
   574         TInt                        iCurrentItem;
       
   575         TBool                       iAllObjectsReceived;
       
   576 
       
   577         TInt                        iPrevHighlighteditem;
       
   578         TInt                        iUppermostItem;
       
   579         TInt                        iBrowseDirection;
       
   580         
       
   581         TBool                       iDummyBrowseResponse;
       
   582         HBufC8*                     iCurrentFolderId; //owned
       
   583         TBool                       iBrowseRequestSent;
       
   584 
       
   585         RPointerArray<CUPnPBrowseCacheItem>        iBrowseCacheItems; //owned
       
   586 
       
   587         CPeriodic*                  iPeriodic; //owned       
       
   588 
       
   589         //Array for selected items
       
   590         RPointerArray<CUpnpObject>  iSelectedItemsArray; //owned
       
   591         //Flag to tell if the image control view is active
       
   592         TBool                       iImageControlActive;        
       
   593         //ImageControl periodic timer
       
   594         CUPnPPeriodic*              iImageControlTimer; //owned
       
   595         
       
   596         CUpnpImagePlayer*           iImagePlayer; //owned
       
   597         
       
   598         CUPnPLocalPlayer*           iLocalPlayer; //owned
       
   599         
       
   600         CUpnpAVDevice*              iTargetDevice; //owned
       
   601         
       
   602         const CUpnpAVDevice&        iSourceDevice; //not owned
       
   603         
       
   604         // title pane
       
   605         CAknTitlePane*              iTitlePane; //not owned
       
   606         
       
   607         //Flag to tell if shift and Ok was pressed the same time
       
   608         TBool                       iShiftAndOkPressed;
       
   609         
       
   610         TInt                        iLastImageItemIndex;
       
   611         
       
   612         TInt                        iChildDialogOpen;
       
   613         
       
   614         //flag to either media server disappears or media renderer disappear
       
   615         TBool                       iMSDisappear;
       
   616         
       
   617         TInt                        iTotalCount;
       
   618         
       
   619         CUPnPCommonUI::TUPnPAction               iAction;
       
   620         
       
   621         TInt                        iCopyIndex;
       
   622         
       
   623         TBool                       iRoot;
       
   624         
       
   625         TBool                       iIsMusicItem;
       
   626         
       
   627         TBool                       iAllObjectsReceviedInOneBrowse;
       
   628         
       
   629         TInt                        iNumObjectReceviedInOnBrowse;
       
   630         
       
   631         /**
       
   632          * for music playing, this is to prevent user to pop up renderer
       
   633          * selection and select renderer multiple times
       
   634          */
       
   635         TBool                       iMusicPlay;
       
   636         
       
   637         TInt                        iError;
       
   638         
       
   639         // is PreLayoutDynInitL done. Used when exiting dialog
       
   640         TBool                       iDlgPreLayoutDone;
       
   641         
       
   642         // Flag to tell if the the Hash (#) key is Holding down
       
   643         TBool                       iHashKeyFlag;
       
   644         
       
   645         // Flag to tell if need repeat browse request to get all objects 
       
   646         // which an original browse request desired
       
   647         TBool iNeedRepeatRequest;
       
   648         
       
   649         // Flag to tell if the browse request is original browse request.
       
   650         TBool iOriginalBrowseRequest;
       
   651         
       
   652         // Current number of objects receved from original browse request
       
   653         TInt iCurrentRecevedObjectIndex;
       
   654         
       
   655         // Count of objects which an original browse request desired
       
   656         TInt iNeedRecevedObjectCount;
       
   657         
       
   658         // Server return count of objects in first browse request
       
   659         TInt iServerReturnObjectCount;
       
   660         
       
   661         // If wait note is cancel before the browse dialog is displayed,
       
   662         // set a value for leave.
       
   663         TInt iErrorForCancel;	
       
   664         
       
   665         // Flag to tell if the copying is onging, ETrue: Ongoing
       
   666         TBool                       iCopying;
       
   667         
       
   668         // Flag to tell if the application should be closed, ETrue: should be closed
       
   669         TBool                       iApplicationClose;
       
   670     };
       
   671 
       
   672 #endif // __UPNP_BROWSE_DIALOG_H__
       
   673 
       
   674 // End of file