mpxplugins/viewplugins/inc/mpxupnpplaybackdialog.h
changeset 0 ff3acec5bc43
child 15 a1247965635c
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 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:  Music Player upnpplayback dialog declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MPXUPNPPLAYBACKDIALOG_H
       
    21 #define MPXUPNPPLAYBACKDIALOG_H
       
    22 
       
    23 
       
    24 //  INCLUDES
       
    25 #include <akntoolbarobserver.h>
       
    26 #include <AknDialog.h>
       
    27 #include <mpxcommonframeworkdefs.h>
       
    28 #include <mpxplaybackobserver.h>  //MMPXPlaybackObserver, MMPXPlaybackCallback
       
    29 #include <mpxcollectionobserver.h>
       
    30 #include "mpxlayoutswitchobserver.h"
       
    31 #include "mpxplaybackframeworkdefs.h" // TMPXPlaybackPlayerType
       
    32 #include <mpxmediakeyhandlerobserver.h>
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CMPXUPnPPlaybackDialogCustomControl;
       
    36 class MMPXPlaybackUtility;
       
    37 class CMPXAlbumArtUtil;
       
    38 class CMPXCommonUiHelper;
       
    39 class MMPXViewUtility;
       
    40 class CMPXCollectionPlaylist;
       
    41 class CMPXUPnPPlaybackDialogLayout;
       
    42 class MMPXPlayerManager;
       
    43 class MMPXCollectionUtility;
       
    44 class MMPXMediaKeyHandler;
       
    45 class CAknTitlePane;
       
    46 class CAknNavigationControlContainer;  // iNaviPane
       
    47 class CAknNavigationDecorator;         // iOrigNaviPane
       
    48 class CMPXMedia;
       
    49 class CMPXMediaArray;
       
    50 class CAknToolbar;
       
    51 class CAknButton;
       
    52 
       
    53 // CLASS DECLARATION
       
    54 
       
    55 /**
       
    56  *  CMPXUpnpPlaybackEditorDialog dialog class for UPnP Remote ->Local
       
    57  *  or Remote -> Remote playback
       
    58  */
       
    59 NONSHARABLE_CLASS( CMPXUPnPPlaybackDialog ) :  public CAknDialog,
       
    60                                                public MMPXPlaybackObserver,
       
    61                                                public MMPXPlaybackCallback,
       
    62                                                public MMPXLayoutSwitchObserver,
       
    63                                                public MMPXCollectionMediaObserver,
       
    64                                                public MMPXMediaKeyHandlerObserver,
       
    65                                                public MAknToolbarObserver
       
    66     {
       
    67 public:  // Constructors and destructor
       
    68 
       
    69     /**
       
    70      * Symbian OS two-phased constructor
       
    71      * @return MP UpnpPlayback Dialog.
       
    72      */
       
    73     IMPORT_C static CMPXUPnPPlaybackDialog* NewL();
       
    74 
       
    75     /**
       
    76      * Destructor.
       
    77      */
       
    78     IMPORT_C virtual ~CMPXUPnPPlaybackDialog();
       
    79 
       
    80     /**
       
    81      * Parameter passed in from viewframework
       
    82      *
       
    83      * @param aParam Parameter pass in from viewframework.
       
    84      */
       
    85     IMPORT_C void SetParamL( const TDesC* aParam );
       
    86 
       
    87 protected:
       
    88 
       
    89     /**
       
    90      * Updates playback view.
       
    91      */
       
    92     void UpdateViewL();
       
    93 
       
    94     /**
       
    95      * Updates track info field.
       
    96      *
       
    97      * @param aMedia Media's properties. If NULL, default info will
       
    98      *                    be shown.
       
    99      */
       
   100     void UpdateTrackInfoL(
       
   101         const CMPXMedia* aMedia );
       
   102 
       
   103     /**
       
   104      * Update current playback state.
       
   105      *
       
   106      * @param aPlaybackState Current playback state.
       
   107      */
       
   108     void UpdatePlaybackState(
       
   109         TMPXPlaybackState aPlaybackState );
       
   110 
       
   111     /**
       
   112      * Updates track's playback position.
       
   113      *
       
   114      * @param  aPos, New playback postions in seconds
       
   115      * @param  aDuration, Track duration in seconds
       
   116      */
       
   117     void UpdateTrackPlaybackPositionL(
       
   118         TInt aPos,
       
   119         TInt aDuration );
       
   120 
       
   121     /**
       
   122      * Updates track's album art.
       
   123      *
       
   124      * @param aMedia Media's properties. If NULL, default album art
       
   125      *                    will be shown.
       
   126      */
       
   127     void UpdateAlbumArtL(
       
   128         const CMPXMedia* aMedia );
       
   129 
       
   130     /**
       
   131      * Updates track position in playlist field.
       
   132      */
       
   133     void UpdateTrackPosInPlaylistL();
       
   134 
       
   135     /**
       
   136      * Updates download state label.
       
   137      */
       
   138     void UpdateDownloadStateLabelL();
       
   139 
       
   140     /**
       
   141      * Updates the title pane
       
   142      */
       
   143     void UpdateTitlePaneL();
       
   144 
       
   145     /**
       
   146      *  Handle playback message
       
   147      *
       
   148      *  @param aMessage playback message
       
   149      */
       
   150     void DoHandlePlaybackMessageL(
       
   151         const CMPXMessage& aMessage );
       
   152 
       
   153     /**
       
   154      *  Handle playback property
       
   155      *
       
   156      *  @param aProperty the property
       
   157      *  @param aValue the value of the property
       
   158      *  @param aError error code
       
   159      */
       
   160     void DoHandlePropertyL(
       
   161         TMPXPlaybackProperty aProperty,
       
   162         TInt aValue,
       
   163         TInt aError,
       
   164         TBool aInit = EFalse);
       
   165 
       
   166     /**
       
   167      *  Handle media properties.
       
   168      *
       
   169      *  @param aMedia media properties
       
   170      *  @param aError error code
       
   171      */
       
   172     void DoHandleMediaL( const CMPXMedia& aMedia,
       
   173                          TInt aError );
       
   174 
       
   175     /**
       
   176      *  Handle playback state changed.
       
   177      *
       
   178      *  @param aState New Playback state
       
   179      *  @param aData Extra data parameter, used for any extra information
       
   180      *               along with the state change message
       
   181      */
       
   182     void DoHandleStateChangedL(
       
   183         TMPXPlaybackState aState,
       
   184         TInt aData );
       
   185 
       
   186     /**
       
   187      * Displays error notes.
       
   188      *
       
   189      * @param aError Error ID to be handled.
       
   190      */
       
   191     void HandleErrorL( TInt aError );
       
   192 
       
   193     /**
       
   194      * Displays error note for when all tracks are invalid,
       
   195      * and goes back to collection list view
       
   196      */
       
   197     void HandleAllTracksInvalidL();
       
   198 
       
   199     /**
       
   200      * Checks whether or not to skip to next track on an error
       
   201      *
       
   202      * @param aCurrentIndex Current index
       
   203      */
       
   204     void SkipOnErrorL( TInt aCurrentIndex, TInt aCount );
       
   205 
       
   206 
       
   207     /**
       
   208      * Request for the media object
       
   209      * aDrm Flag whether or not to request all DRM info as well
       
   210      */
       
   211     void RequestMediaL( TBool aDrm=EFalse );
       
   212 
       
   213     /**
       
   214     * Prepare status pane for full-screen playback view.
       
   215     */
       
   216     void PrepareStatusPaneForPlaybackViewL();
       
   217 
       
   218     /**
       
   219     * Restore status pane to it's normal state.
       
   220     */
       
   221     void PrepareStatusPaneForExitingViewL();
       
   222 
       
   223 // from base class MMPXMediaKeyHandlerObserver
       
   224 
       
   225     /**
       
   226      * Handle media key commands.
       
   227      *
       
   228      * @since 5.0
       
   229      * @param aCommand Command to be handled.
       
   230      * @param aData data for the specific command
       
   231      */
       
   232     void HandleMediaKeyCommand(
       
   233         const TMPXPlaybackCommand aCommand,
       
   234         const TInt aData = KErrNotFound );
       
   235 
       
   236 private:
       
   237 
       
   238     /**
       
   239      * C++ default constructor.
       
   240      */
       
   241     CMPXUPnPPlaybackDialog();
       
   242 
       
   243     /**
       
   244      * By default Symbian 2nd phase constructor is private.
       
   245      */
       
   246     void ConstructL( TInt aResource );
       
   247 
       
   248 private:    // New functions
       
   249 
       
   250     /**
       
   251      * Find the components custom control.
       
   252      */
       
   253     CMPXUPnPPlaybackDialogCustomControl *GetUPnPPlaybackDialogCustomControl() const;
       
   254 
       
   255     /**
       
   256      * Handle media key commands.
       
   257      *
       
   258      * @param aCommand Media key commands. see mpxappui.hrh
       
   259      */
       
   260     void DoHandleMediaKeyCommandL( TMPXPlaybackCommand aCommand );
       
   261 
       
   262     /**
       
   263      * Control popup behaviour.
       
   264      *
       
   265      * @param aCommand Media key commands. see mpxappui.hrh
       
   266      * @param aValue Parameter for aCommand
       
   267      */
       
   268     void HandlePopupL( TMPXPlaybackCommand aCommand );
       
   269 
       
   270     /**
       
   271      * Backs up Status Pane.
       
   272      */
       
   273     void BackupPreviousStatusPaneL();
       
   274 
       
   275     /**
       
   276      * Restores Previous Status Pane.
       
   277      */
       
   278     void RestorePreviousStatusPaneL();
       
   279 
       
   280     /**
       
   281      * Shows a Not supported error note
       
   282      */
       
   283     void CommandNotSupportedL();
       
   284 
       
   285     /**
       
   286      * Exits the dialog when callback from CIdle
       
   287      */
       
   288     static TInt DelayedExit( TAny* aPtr );
       
   289 
       
   290 
       
   291 private: // Functions from base classes
       
   292 
       
   293     /**
       
   294      * Creates custom control for the dialog
       
   295      * @param aControlType control type
       
   296      */
       
   297     SEikControlInfo CreateCustomControlL( TInt aControlType );
       
   298 
       
   299     /**
       
   300      * Initialises the dialog's controls before the dialog is sized and layed out.
       
   301      */
       
   302     void PreLayoutDynInitL();
       
   303 
       
   304     /**
       
   305      * This function ALWAYS returns ETrue.
       
   306      * @param aButtonId button ID
       
   307      */
       
   308     TBool OkToExitL( TInt aButtonId );
       
   309 
       
   310     /**
       
   311      * Returns the number of component controls.
       
   312      */
       
   313     TInt CountComponentControls() const;
       
   314 
       
   315     /**
       
   316      * Returns the component control.
       
   317      * @param aIndex index of the component
       
   318      */
       
   319     CCoeControl* ComponentControl(TInt aIndex) const;
       
   320 
       
   321 // from base class MMPXPlaybackObserver
       
   322 
       
   323     /**
       
   324      * From MMPXPlaybackObserver
       
   325      * Handle playback message
       
   326      *
       
   327      * @param aMessage playback message
       
   328      * @param aErr system error code.
       
   329      */
       
   330     void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
       
   331 
       
   332 // from base class MMPXPlaybackCallback
       
   333 
       
   334     /**
       
   335      * From MMPXPlaybackCallback
       
   336      * Handle playback property
       
   337      *
       
   338      * @since 3.0
       
   339      * @param aProperty the property
       
   340      * @param aValue the value of the property
       
   341      * @param aError error code
       
   342      */
       
   343     void HandlePropertyL(
       
   344         TMPXPlaybackProperty aProperty,
       
   345         TInt aValue,
       
   346         TInt aError );
       
   347 
       
   348     /**
       
   349      * From MMPXPlaybackCallback
       
   350      * Method is called continously until aComplete=ETrue, signifying that
       
   351      * it is done and there will be no more callbacks
       
   352      * Only new items are passed each time
       
   353      *
       
   354      * @since 3.0
       
   355      * @param aPlayer UID of the subplayer
       
   356      * @param aSubPlayers a list of sub players
       
   357      * @param aComplete ETrue no more sub players. EFalse more subplayer
       
   358      *                  expected
       
   359      * @param aError error code
       
   360      */
       
   361     void HandleSubPlayerNamesL(
       
   362         TUid aPlayer,
       
   363         const MDesCArray* aSubPlayers,
       
   364         TBool aComplete,
       
   365         TInt aError );
       
   366 
       
   367     /**
       
   368      * From MMPXPlaybackCallback
       
   369      * Handle media properties
       
   370      *
       
   371      * @since 3.0
       
   372      * @param aMedia media
       
   373      * @param aError error code
       
   374      */
       
   375     void HandleMediaL(
       
   376         const CMPXMedia& aMedia,
       
   377         TInt aError );
       
   378 
       
   379 // from base class MMPXCollectionMediaObserver
       
   380     /**
       
   381     *  Handle extended media properties
       
   382     *
       
   383     *  @param aMedia media
       
   384     *  @param aError error code
       
   385     */
       
   386     void HandleCollectionMediaL(
       
   387         const CMPXMedia& aMedia,
       
   388         TInt aError);
       
   389 
       
   390 
       
   391 // from base class CAknView
       
   392 
       
   393     /**
       
   394      * From CAknView
       
   395      * Command handling function.
       
   396      *
       
   397      * @since 3.0
       
   398      * @param aCommand Command which is handled
       
   399      */
       
   400     void HandleCommandL( TInt aCommand );
       
   401 
       
   402     /**
       
   403      * From CAknView
       
   404      * Processes user commands.
       
   405      *
       
   406      * @since 3.0
       
   407      * @param aCommand ID of the command to respond to.
       
   408      */
       
   409     void ProcessCommandL( TInt aCommandId ) ;
       
   410 
       
   411     /**
       
   412      * From CAknView
       
   413      * Event handler for status pane size changes.
       
   414      *
       
   415      * @since 3.0
       
   416      */
       
   417     void HandleStatusPaneSizeChange();
       
   418 
       
   419 // from base class MEikMenuObserver
       
   420 
       
   421     /**
       
   422      * From MEikMenuObserver
       
   423      * Dynamically initialises a menu pane.
       
   424      *
       
   425      * @param aResourceId The ID of the menu pane.
       
   426      * @param aMenuPane The menu pane itself.
       
   427      */
       
   428     void DynInitMenuPaneL(
       
   429         TInt aResourceId,
       
   430         CEikMenuPane* aMenuPane );
       
   431 
       
   432 // from base class CoeControl
       
   433     /**
       
   434      * From CoeControl.
       
   435      * Handles a change to the control's resources.
       
   436      *
       
   437      * @param aType A message UID value.
       
   438      */
       
   439     void HandleResourceChange( TInt aType );
       
   440 
       
   441 // from base class MMPXLayoutSwitchObserver
       
   442 
       
   443     /**
       
   444      * From MMPXLayoutSwitchObserver
       
   445      * Callback function when layout is changed.
       
   446      *
       
   447      * @since S60 v3.0
       
   448      */
       
   449     void HandleLayoutChange();
       
   450 
       
   451 
       
   452     TKeyResponse OfferKeyEventL(
       
   453             const TKeyEvent& aKeyEvent,
       
   454             TEventCode aType );
       
   455 
       
   456 private:
       
   457 
       
   458     /**
       
   459      *  Sets the playback volume.
       
   460      *
       
   461      *  @param aVolume volume value.
       
   462      */
       
   463     void SetVolume( const TInt aVolume );
       
   464 
       
   465     /**
       
   466      *  Mutes the playback volume.
       
   467      */
       
   468     void MuteVolume();
       
   469 
       
   470     /**
       
   471      *  Unmutes the playback volume.
       
   472      */
       
   473     void UnMuteVolume();
       
   474     /**
       
   475      *  Update toolbar.
       
   476      */
       
   477     void UpdateToolbar();
       
   478     /**
       
   479      * From MAknToolbarObserver
       
   480      * Processes user commands.
       
   481      *
       
   482      * @since 5.0
       
   483      * @param aCommand ID of the command to respond to.
       
   484      */
       
   485     void OfferToolbarEventL( TInt aCommandId );
       
   486       
       
   487     /**
       
   488      * From MAknToolbarObserver
       
   489      * Used to change toolbar settings before it is made visible
       
   490      *
       
   491      * @since 5.0
       
   492      * @param aCommand ID of the command to respond to.
       
   493      */
       
   494     void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolBar );
       
   495 
       
   496 private:    // Data
       
   497 
       
   498     MMPXPlaybackUtility* iPlaybackUtility;  // not own
       
   499     CMPXAlbumArtUtil* iMPXUtility;   // own
       
   500     CMPXMedia* iMedia;  // own
       
   501 
       
   502     CMPXCommonUiHelper* iCommonUiHelper;    // own
       
   503 
       
   504     // View utility.
       
   505     MMPXViewUtility* iViewUtility;
       
   506 
       
   507     // Current playback states
       
   508     TInt iDuration; // in seconds
       
   509     TInt iPosition; // in seconds
       
   510     TMPXPlaybackState iPlaybackState;
       
   511     TInt iRandomMode;
       
   512     TInt iRepeatMode;
       
   513 
       
   514     TBool iEmbedded;
       
   515     TBool iSwitchingView;
       
   516     // Feature flag for set as ringtone
       
   517     TBool iChangeRTForAllProfiles;
       
   518 
       
   519     // Error code to be handled at a later time
       
   520     TInt iDelayedError;
       
   521 
       
   522     CMPXUPnPPlaybackDialogLayout* iPlaybackDialogLayout;    // owned
       
   523 
       
   524     RArray<TUid> iPlayersList;
       
   525     TMPXPlaybackPlayerType iCurrentPlayerType;
       
   526     MMPXCollectionUtility* iCollectionUtility;
       
   527 
       
   528     TInt iStartPlaybackIndex;
       
   529     TInt iLastSkipDirection;
       
   530     TBool iSkipping;
       
   531 
       
   532     // RemCon target for receiving media key events
       
   533     MMPXMediaKeyHandler* iMediaKeyHandler;  // owned
       
   534     TInt iResourceOffset;       // must be freed
       
   535     TInt iCommonPlaybackResourceOffset; // must be freed
       
   536     TInt iUpnpResourceOffset; // must be freed
       
   537     TRect iModRect; // MainPane rectangle
       
   538 
       
   539     // Backup and restore previous view title and navi pane
       
   540     TInt iPreviousLayoutId;
       
   541     CAknTitlePane* iTitlePane;             // Not owned
       
   542     HBufC* iOrigTitle;             // Original title text, owned
       
   543     CAknNavigationControlContainer* iNaviPane;              // Not owned
       
   544 
       
   545     TKeyEvent iLastKeyEvent;
       
   546     TEventCode iLastKeyType;
       
   547     HBufC* iSubPlayerName;
       
   548 
       
   549     CIdle* iDelayedEventExit; // Owned
       
   550 
       
   551     TBool iKeySoundDisabled;
       
   552 
       
   553     TInt iCurrentVolume;
       
   554 
       
   555     TInt iFMTXResourceOffset;   // must be freed
       
   556     CAknToolbar* iToolbar; // not owned
       
   557     
       
   558     CAknButton* iBtnPreviousItem; // not owned
       
   559     CAknButton* iBtnNextItem; // not owned
       
   560     CAknButton* iBtnPlayPause; // not owned
       
   561     TBool iSeekForward;
       
   562     };
       
   563 
       
   564 #endif      // MPXUPNPPLAYBACKDIALOG_H
       
   565 
       
   566 // End of File