mpxplugins/viewplugins/views/mainview/inc/mpxmainviewimp.h
changeset 0 ff3acec5bc43
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:  MPX main view implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CMPXMAINVIEWIMP_H
       
    21 #define C_CMPXMAINVIEWIMP_H
       
    22 
       
    23 
       
    24 // INCLUDES
       
    25 #include <eikspmod.h>
       
    26 #include <eikclb.h>
       
    27 #include <mpxplaybackobserver.h>
       
    28 #include <mpxcollectionobserver.h>
       
    29 #include "mpxwaitnotedefs.h"
       
    30 
       
    31 #include "mpxmainview.h"
       
    32 #include "mpxalbumartutilobserver.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CMPXMainViewContainer;
       
    36 class MMPXViewUtility;
       
    37 class MMPXPlaybackUtility;
       
    38 class MMPXCollectionUtility;
       
    39 class CMPXCommonUiHelper;
       
    40 class CMPXAlbumArtUtil;
       
    41 class CMPXCollectionPath;
       
    42 class CMPXMediaArray;
       
    43 class CAknQueryDialog;
       
    44 
       
    45 // CLASS DECLARATION
       
    46 
       
    47 /**
       
    48  *  MPX main view.
       
    49  *
       
    50  *  @lib mpxmainview.lib
       
    51  *  @since S60 v3.0
       
    52  */
       
    53 NONSHARABLE_CLASS( CMPXMainViewImp ) : public CMPXMainView,
       
    54                                        public MMPXCollectionObserver,
       
    55                                        public MMPXPlaybackObserver,
       
    56                                        public MMPXPlaybackCallback,
       
    57                                        public MEikListBoxObserver,
       
    58                                        public MMPXAlbumArtUtilObserver
       
    59     {
       
    60 public:
       
    61 
       
    62     /**
       
    63      * Two-phased constructor.
       
    64      *
       
    65      * @since 3.0
       
    66      * @return Pointer to newly created object.
       
    67      */
       
    68     static CMPXMainViewImp* NewL();
       
    69 
       
    70     /**
       
    71      * Two-phased constructor.
       
    72      *
       
    73      * @since 3.0
       
    74      * @return Pointer to newly created object.
       
    75      */
       
    76     static CMPXMainViewImp* NewLC();
       
    77 
       
    78     /**
       
    79      * Destructor.
       
    80      */
       
    81     virtual ~CMPXMainViewImp();
       
    82 
       
    83 public: // New Functions
       
    84 
       
    85     /**
       
    86     * Idle callback function
       
    87     */
       
    88     static TInt IdleCallback( TAny* ptr );
       
    89 
       
    90     /**
       
    91     * Idle processing function
       
    92     */
       
    93     void HandleIdleEventL();
       
    94 
       
    95 private:
       
    96 
       
    97     /**
       
    98      * C++ default constructor.
       
    99      */
       
   100     CMPXMainViewImp();
       
   101 
       
   102     /**
       
   103      * By default Symbian 2nd phase constructor is private.
       
   104      */
       
   105     void ConstructL();
       
   106 
       
   107     /**
       
   108      * Displays error notes.
       
   109      *
       
   110      * @param aError Error ID to be handled.
       
   111      */
       
   112     void HandleErrorL( TInt aError );
       
   113 
       
   114     /**
       
   115      * Function to display information notes
       
   116      *
       
   117      * @param aResourceId Resource ID of the text string.
       
   118      */
       
   119     void DisplayInfoNoteL( TInt aResourceId );
       
   120 
       
   121     /**
       
   122      * Function to display confirmation notes
       
   123      *
       
   124      * @param aResourceId Resource ID of the text string.
       
   125      */
       
   126     void DisplayConfirmionNoteL( TInt aResourceId );
       
   127 
       
   128 // From MMPXCollectionObserver
       
   129 
       
   130     /**
       
   131      * From MMPXCollectionObserver
       
   132      * Handle collection message.
       
   133      *
       
   134      * @param aMessage Collection message
       
   135      * @param aErr system error code.
       
   136      */
       
   137     void HandleCollectionMessage(
       
   138         CMPXMessage* aMessage, TInt aError );
       
   139 
       
   140     /**
       
   141      *  From MMPXCollectionObserver
       
   142      *  Handles the collection entries being opened. Typically called
       
   143      *  when client has Open()'d a folder
       
   144      *
       
   145      *  @param aEntries collection entries opened
       
   146      *  @param aIndex focused entry
       
   147      *  @param aComplete ETrue no more entries. EFalse more entries
       
   148      *                   expected
       
   149      *  @param aError error code
       
   150      */
       
   151     void HandleOpenL(
       
   152         const CMPXMedia& aEntries,
       
   153         TInt aIndex,
       
   154         TBool aComplete,
       
   155         TInt aError );
       
   156 
       
   157     /**
       
   158      *  From MMPXCollectionObserver
       
   159      *  Handles the collection entries being opened. Typically called
       
   160      *  when client has Open()'d an item. Client typically responds by
       
   161      *  'playing' the item
       
   162      *
       
   163      *  @param aPlaylist collection path to item
       
   164      *  @param aError error code
       
   165      */
       
   166     void HandleOpenL(
       
   167         const CMPXCollectionPlaylist& aPlaylist,
       
   168         TInt aError );
       
   169 
       
   170     /**
       
   171      *
       
   172      *  From MMPXCollectionObserver
       
   173      *  Handle media properties
       
   174      *  Notes: The client is responsible for delete the object of aProperties
       
   175      *
       
   176      *  @param aMedia media
       
   177      *  @param aError error code
       
   178      */
       
   179     void HandleCollectionMediaL(
       
   180         const CMPXMedia& aMedia,
       
   181         TInt aError );
       
   182 
       
   183 // from base class MMPXPlaybackObserver
       
   184 
       
   185     /**
       
   186      * From MMPXPlaybackObserver
       
   187      * Handle playback message
       
   188      *
       
   189      * @param aMessage playback message
       
   190      * @param aErr system error code.
       
   191      */
       
   192     void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
       
   193 
       
   194 // from base class MMPXPlaybackCallback
       
   195 
       
   196     /**
       
   197      * From MMPXPlaybackCallback
       
   198      * Handle playback property
       
   199      *
       
   200      * @param aProperty the property
       
   201      * @param aValue the value of the property
       
   202      * @param aError error code
       
   203      */
       
   204     void HandlePropertyL(
       
   205         TMPXPlaybackProperty aProperty,
       
   206         TInt aValue,
       
   207         TInt aError );
       
   208 
       
   209     /**
       
   210      * From MMPXPlaybackCallback
       
   211      * Method is called continously until aComplete=ETrue, signifying that
       
   212      * it is done and there will be no more callbacks
       
   213      * Only new items are passed each time
       
   214      *
       
   215      * @param aPlayer UID of the subplayer
       
   216      * @param aSubPlayers a list of sub players
       
   217      * @param aComplete ETrue no more sub players. EFalse more subplayer
       
   218      *                  expected
       
   219      * @param aError error code
       
   220      */
       
   221     void HandleSubPlayerNamesL(
       
   222         TUid aPlayer,
       
   223         const MDesCArray* aSubPlayers,
       
   224         TBool aComplete,
       
   225         TInt aError );
       
   226 
       
   227     /**
       
   228      * From MMPXPlaybackCallback
       
   229      * Handle media properties
       
   230      * Notes: The client is responsible for delete the object of aMedia
       
   231      *
       
   232      * @since 3.0
       
   233      * @param aMedia media
       
   234      * @param aError error code
       
   235      */
       
   236     void HandleMediaL(
       
   237         const CMPXMedia& aMedia,
       
   238         TInt aError );
       
   239 
       
   240 // from base class CAknView
       
   241 
       
   242     /**
       
   243      * From CAknView
       
   244      * Returns views id.
       
   245      *
       
   246      * @since 3.0
       
   247      * @return Views Uid
       
   248      */
       
   249     TUid Id() const;
       
   250 
       
   251     /**
       
   252      * From CAknView
       
   253      * Command handling function.
       
   254      *
       
   255      * @since 3.0
       
   256      * @param aCommand Command which is handled
       
   257      */
       
   258     void HandleCommandL( TInt aCommand );
       
   259 
       
   260     /**
       
   261      * From CAknView
       
   262      * Handles a view activation.
       
   263      *
       
   264      * @param aPrevViewId Specifies the view previously active.
       
   265      * @param aCustomMessageId Specifies the message type.
       
   266      * @param aCustomMessage The activation message.
       
   267      */
       
   268     void DoActivateL(
       
   269         const TVwsViewId& aPrevViewId,
       
   270         TUid aCustomMessageId,
       
   271         const TDesC8& aCustomMessage );
       
   272 
       
   273     /**
       
   274      * From CAknView
       
   275      * View deactivation function.
       
   276      */
       
   277     void DoDeactivate();
       
   278 
       
   279     /**
       
   280      * From CAknView
       
   281      * Foreground event handling function.
       
   282      *
       
   283      * @param aForeground Indicates the required focus state of the control.
       
   284      */
       
   285     void HandleForegroundEventL( TBool aForeground );
       
   286 
       
   287 // from base class MEikMenuObserver
       
   288 
       
   289     /**
       
   290      * From MEikMenuObserver
       
   291      * Dynamically initialises a menu pane.
       
   292      *
       
   293      * @param aResourceId The ID of the menu pane.
       
   294      * @param aMenuPane The menu pane itself.
       
   295      */
       
   296     void DynInitMenuPaneL(
       
   297         TInt aResourceId,
       
   298         CEikMenuPane* aMenuPane );
       
   299 
       
   300 // from MEikListBoxObserver
       
   301 
       
   302     /**
       
   303      * Handles listbox events.
       
   304      *
       
   305      * @param aListBox Listbox where the event occurred.
       
   306      * @param aEventType Event type.
       
   307      */
       
   308      void HandleListBoxEventL(
       
   309         CEikListBox* aListBox,
       
   310         TListBoxEvent aEventType );
       
   311 
       
   312 // from MMPXAlbumArtUtilObserver
       
   313 
       
   314     /**
       
   315      * From MMPXAlbumArtUtilObserver.
       
   316      * Notify that extraction of album art started.
       
   317      */
       
   318     void ExtractAlbumArtStarted();
       
   319 
       
   320     /**
       
   321      * From MMPXAlbumArtUtilObserver.
       
   322      * Album art is extracted from file and ready to use.
       
   323      *
       
   324      * @param aBitmap a converted image. Ownership is transferred.
       
   325      * @param aErr error code
       
   326      */
       
   327     void ExtractAlbumArtCompleted(
       
   328         CFbsBitmap* aBitmap,
       
   329         TInt aErr );
       
   330 
       
   331 // New function
       
   332 
       
   333     /**
       
   334      *  Handle playback message
       
   335      *
       
   336      *  @param aMessage playback message
       
   337      */
       
   338     void DoHandlePlaybackMessageL(
       
   339         const CMPXMessage& aMessage );
       
   340 
       
   341     /**
       
   342      *  Handle playback property
       
   343      *
       
   344      *  @param aProperty the property
       
   345      *  @param aValue the value of the property
       
   346      *  @param aError error code
       
   347      */
       
   348     void DoHandlePropertyL(
       
   349         TMPXPlaybackProperty aProperty,
       
   350         TInt aValue,
       
   351         TInt aError );
       
   352 
       
   353     /**
       
   354      * Handle collection message
       
   355      *
       
   356      * @param aMessage collection message
       
   357      */
       
   358     void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
       
   359 
       
   360     /**
       
   361      *  Handle media properties.
       
   362      *  Notes: The client is responsible for delete the object of aMedia
       
   363      *
       
   364      *  @param aMedia media properties
       
   365      *  @param aError error code
       
   366      */
       
   367     void DoHandleMediaL(
       
   368         const CMPXMedia& aMedia,
       
   369         TInt aError );
       
   370 
       
   371     /**
       
   372      *  Handle playback state changed.
       
   373      *
       
   374      *  @param aState New Playback state
       
   375      */
       
   376     void DoHandleStateChangedL(
       
   377         TMPXPlaybackState aState );
       
   378 
       
   379     /**
       
   380      * Updates list box
       
   381      *
       
   382      * @param aEntries collection entries opened
       
   383      * @param aIndex focused entry
       
   384      */
       
   385     void UpdateListBoxL(
       
   386         const CMPXMedia& aEntries,
       
   387         TInt aIndex );
       
   388 
       
   389     /**
       
   390     * Update the total item count text
       
   391     * @param aMedia, media object containing the information
       
   392     */
       
   393     void UpdateItemCountTotalL( const CMPXMedia& aMedia );
       
   394 
       
   395     /**
       
   396      * Updates playback view status
       
   397      *
       
   398      */
       
   399     void UpdatePlaybackViewStatusL();
       
   400 
       
   401     /**
       
   402      * Start either the refresh or scanning note
       
   403      */
       
   404     void StartWaitNoteL( TWaitNoteType aNoteType );
       
   405 
       
   406     /**
       
   407      * Close the waitnote dialog
       
   408      * @param aSkipCheckIfActive - flags if the method should check if waitnote
       
   409      *                             is the current view
       
   410      */
       
   411     void CloseWaitNoteL(TBool aSkipCheckIfActive = EFalse);
       
   412 
       
   413     /**
       
   414      * Handle a broadcast message event
       
   415      * from the collection framework
       
   416      * @arg aEvent, event to handle
       
   417      */
       
   418     void DoHandleBroadcastMsgL( TInt aEvent );
       
   419 
       
   420     /**
       
   421      * Handle a corrupt message sent from the collection server
       
   422      */
       
   423     void DoHandleCorruptMsgL();
       
   424 
       
   425     /**
       
   426     * Starts the MediaL() calls to update plugin info
       
   427     */
       
   428     void UpdatePluginInfo();
       
   429 
       
   430     /**
       
   431     * Send resynchronize collection command to specific collection(s)
       
   432     */
       
   433     void ResynchronizeCollectionL();
       
   434 
       
   435     /**
       
   436     * Calls MediaL to retrieve item details
       
   437     */
       
   438     void DoRetrieveDetailsL(TBool aSkipAttribute = EFalse);
       
   439 
       
   440     /**
       
   441      * Album art is extracted from file and ready to use.
       
   442      *
       
   443      * @param aBitmap a converted image. Ownership is transferred.
       
   444      * @param aErr error code
       
   445      */
       
   446     void DoExtractAlbumArtCompletedL( CFbsBitmap* aBitmap,
       
   447                                      TInt aErr );
       
   448 
       
   449     /**
       
   450     * Sets the default focus
       
   451     * Sets a KMPXCommandIdCollectionSelect command with
       
   452     * selection index of 0
       
   453     */
       
   454     void DoSetDefaultFocusL();
       
   455 
       
   456 private:    // Data
       
   457 
       
   458     CMPXMainViewContainer*      iContainer;  // own
       
   459     MMPXPlaybackUtility*        iPlaybackUtility;
       
   460     MMPXViewUtility*            iViewUtility;
       
   461     MMPXCollectionUtility*      iCollectionUtility;
       
   462     CMPXAlbumArtUtil*           iMPXUtility;
       
   463     CMPXCommonUiHelper*         iCommonUiHelper;
       
   464     TInt                        iResourceOffset;       // must be freed
       
   465     TBool                       iColInitialized;
       
   466 
       
   467     // Incremental update to listbox
       
   468     CMPXCollectionPath*         iCurPath;
       
   469     CMPXMediaArray*             iMediaArray;
       
   470     TInt                        iCurPlugin;
       
   471     TBool                       iInitDBNeeded;
       
   472     TBool                       iInitDBCorrupted;
       
   473     TBool                       iDelayedUsbRefresh;
       
   474     TBool                       iOutOfDisk;
       
   475 
       
   476     // playback view status
       
   477     HBufC*                      iTitle;
       
   478     TInt                        iDuration;
       
   479     TInt                        iPosition;
       
   480     TInt                        iPlaybackState;
       
   481     TInt                        iAlbumArtIndex;
       
   482 
       
   483     // Handlng system events
       
   484     CAknQueryDialog*            iQueryDialog;  // not owned, only for dismissal
       
   485     TInt                        iCurSystemEvent;
       
   486 
       
   487     TBool                       iShowPlaybackIndicator;
       
   488     TBool                       iRefreshingCollection;
       
   489     TBool                       iExitOptionHidden;
       
   490     TBool                       iDelayPluginInfoUpdate;
       
   491     TInt                        iCurPlPlayPosition;
       
   492     TInt                        iCurPlTotalCount;
       
   493     CIdle*                      iIdle;
       
   494     TBool                       iDiskDismountDuringFormat;
       
   495     TBool                       iPathCorrupted;
       
   496     };
       
   497 
       
   498 #endif  // C_CMPXMAINVIEWIMP_H
       
   499 
       
   500 // End of File