mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewimp.cpp
branchRCL_3
changeset 66 1f1dad4af8f8
parent 53 3de6c4cf6b67
equal deleted inserted replaced
60:bdd9da0d70fe 66:1f1dad4af8f8
   111 #include <akntranseffect.h>
   111 #include <akntranseffect.h>
   112 
   112 
   113 // CONSTANTS
   113 // CONSTANTS
   114 const TInt KMPXOneSecInMilliSecs( 1000 );
   114 const TInt KMPXOneSecInMilliSecs( 1000 );
   115 const TUid KMPXEqualizerViewImplementationId = { 0x101FFC77 };
   115 const TUid KMPXEqualizerViewImplementationId = { 0x101FFC77 };
   116 const TUid KMPXMetadataEditorDialogImplementationId  = { 0x101FFC83 };
       
   117 const TInt KMPXPostponeForHandleDelayedError( 1000000 ); // 1S
   116 const TInt KMPXPostponeForHandleDelayedError( 1000000 ); // 1S
   118 const TInt KMPXPlaybackViewWindowBackground = -1;
   117 const TInt KMPXPlaybackViewWindowBackground = -1;
   119 const TInt KMPXDelayForTNRequest( 3000000 ); // 3S
   118 const TInt KMPXDelayForTNRequest( 3000000 ); // 3S
   120 
   119 
   121 // for freqency display in the format of "XXX.XX"
   120 // for freqency display in the format of "XXX.XX"
  1631 
  1630 
  1632     // Reset flag after error handling is done.
  1631     // Reset flag after error handling is done.
  1633     MPX_DEBUG1("CMPXPlaybackViewImp::HandleErrorL()");
  1632     MPX_DEBUG1("CMPXPlaybackViewImp::HandleErrorL()");
  1634     MPX_DEBUG1("    > Reset New Item Opened Flag");
  1633     MPX_DEBUG1("    > Reset New Item Opened Flag");
  1635     iNewItemOpened = EFalse;
  1634     iNewItemOpened = EFalse;
  1636     iErrorOccured = EFalse;
  1635 
  1637     MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleErrorL: Exiting");
  1636     MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleErrorL: Exiting");
  1638     }
  1637     }
  1639 
  1638 
  1640 // ---------------------------------------------------------------------------
  1639 // ---------------------------------------------------------------------------
  1641 // Displays error note for when all tracks are invalid,
  1640 // Displays error note for when all tracks are invalid,
  1980         {
  1979         {
  1981         TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
  1980         TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
  1982         }
  1981         }
  1983     else if ( aError != KErrNone && iLastPBViewActivated )
  1982     else if ( aError != KErrNone && iLastPBViewActivated )
  1984         {
  1983         {
  1985         iErrorOccured = ETrue;
       
  1986         TRAP_IGNORE( DoHandleErrorPlaybackMessageL( aError ) );
  1984         TRAP_IGNORE( DoHandleErrorPlaybackMessageL( aError ) );
  1987         }
  1985         }
  1988     MPX_DEBUG2("<--CMPXCommonPlaybackViewImp::HandlePlaybackMessage(): aError = %d", aError);
  1986     MPX_DEBUG2("<--CMPXCommonPlaybackViewImp::HandlePlaybackMessage(): aError = %d", aError);
  1989     }
  1987     }
  1990 
  1988 
  2172             // Status pane has to be modified before view gets deactivated
  2170             // Status pane has to be modified before view gets deactivated
  2173             break;
  2171             break;
  2174             }
  2172             }
  2175         case EMPXPbvCmdSongDetails:
  2173         case EMPXPbvCmdSongDetails:
  2176             {
  2174             {
  2177             if( !iErrorOccured )
  2175             LaunchFileDetailsDialogL();
  2178                 {
       
  2179                 LaunchFileDetailsDialogL();
       
  2180                 }
       
  2181             
       
  2182             break;
  2176             break;
  2183             }
  2177             }
  2184         case EMPXPbvCmdPlay:
  2178         case EMPXPbvCmdPlay:
  2185             {
  2179             {
  2186             if ( iEmbedded )
  2180             if ( iEmbedded )
  2721                                 iMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
  2715                                 iMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
  2722                             if ( id != cacheId )
  2716                             if ( id != cacheId )
  2723                                 {
  2717                                 {
  2724                                 MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL requesting media" );
  2718                                 MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL requesting media" );
  2725                                 RequestMediaL();
  2719                                 RequestMediaL();
       
  2720                                 UpdateTitlePaneL();
  2726                                 }
  2721                                 }
  2727                             }
  2722                             }
  2728                         }
  2723                         }
  2729                     }
  2724                     }
  2730 
  2725 
  2764 
  2759 
  2765     switch ( aResourceId )
  2760     switch ( aResourceId )
  2766         {
  2761         {
  2767         case R_MPX_PLAYBACK_VIEW_MENU:
  2762         case R_MPX_PLAYBACK_VIEW_MENU:
  2768             {
  2763             {
  2769             if( iErrorOccured ) 
       
  2770                 {
       
  2771                 MPX_DEBUG2( "iErrorOccured %d" , iErrorOccured);
       
  2772                 aMenuPane->SetItemDimmed( EMPXPbvCmdSongDetails, ETrue );
       
  2773                 }
       
  2774             
       
  2775             if ( iIsffButtonPressed )
  2764             if ( iIsffButtonPressed )
  2776                 {
  2765                 {
  2777                 iIsffButtonPressed = EFalse;
  2766                 iIsffButtonPressed = EFalse;
  2778                 iContainer->RestoreButtons( iPlaybackState );
  2767                 iContainer->RestoreButtons( iPlaybackState );
  2779                 iPlaybackUtility->CommandL( EPbCmdStopSeeking );
  2768                 iPlaybackUtility->CommandL( EPbCmdStopSeeking );
  3017 
  3006 
  3018             // only switch to flat if current view is not equalizer
  3007             // only switch to flat if current view is not equalizer
  3019             // since it'll mess up equilizer's screen
  3008             // since it'll mess up equilizer's screen
  3020             if ( StatusPane()->CurrentLayoutResId() !=
  3009             if ( StatusPane()->CurrentLayoutResId() !=
  3021                  R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT &&
  3010                  R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT &&
  3022                  activeView != KMPXEqualizerViewImplementationId && 
  3011                  activeView != KMPXEqualizerViewImplementationId )
  3023 				 activeView != KMPXMetadataEditorDialogImplementationId )
       
  3024                 {
  3012                 {
  3025                 TRAP_IGNORE(
  3013                 TRAP_IGNORE(
  3026                     StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ));
  3014                     StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ));
  3027                 }
  3015                 }
  3028             }
  3016             }
  3077     const TUid& aCurrentViewType,
  3065     const TUid& aCurrentViewType,
  3078     const TUid& /*aPreviousViewType*/ )
  3066     const TUid& /*aPreviousViewType*/ )
  3079     {
  3067     {
  3080     MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleViewActivation VF" );
  3068     MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleViewActivation VF" );
  3081     iPBViewToBeActivated = ( KMPXPluginTypePlaybackUid == aCurrentViewType.iUid );
  3069     iPBViewToBeActivated = ( KMPXPluginTypePlaybackUid == aCurrentViewType.iUid );
  3082 	if(iPBViewToBeActivated)
       
  3083 		{
       
  3084 		HandleLayoutChange();
       
  3085 		}
       
  3086     MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleViewActivation iPBViewToBeActivated %d", iPBViewToBeActivated );
  3070     MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleViewActivation iPBViewToBeActivated %d", iPBViewToBeActivated );
  3087     }
  3071     }
  3088 // ---------------------------------------------------------------------------
  3072 // ---------------------------------------------------------------------------
  3089 // From MMPXViewActivationObserver
  3073 // From MMPXViewActivationObserver
  3090 // ---------------------------------------------------------------------------
  3074 // ---------------------------------------------------------------------------
  3940                     if ( playlist->Count() > 0 )
  3924                     if ( playlist->Count() > 0 )
  3941                         {
  3925                         {
  3942                         if( pausePlayControl )
  3926                         if( pausePlayControl )
  3943                         	{
  3927                         	{
  3944 	                        TMPXPlaybackState state = iPlaybackUtility->StateL();
  3928 	                        TMPXPlaybackState state = iPlaybackUtility->StateL();
  3945 	                        if ( state == EPbStatePlaying )
  3929 	                        if ((state == EPbStateInitialising) || (state == EPbStatePlaying))
  3946 	                           {
  3930 	                           {
  3947 	                           pausePlayControl->SetCurrentState(0, ETrue);
  3931 	                           pausePlayControl->SetCurrentState(0, ETrue);
  3948 	                           }
  3932 	                           }
  3949 	                        //get EPbStateInitialising when skipping to next, ignore it to remove play/pause key flicker 
  3933 	                        else
  3950 	                        //It is showing the state that was previously shown when EPbStateInitializing
       
  3951 	                        else if ( state != EPbStateInitialising )
       
  3952 	                           {
  3934 	                           {
  3953 	                           pausePlayControl->SetCurrentState(1, ETrue);
  3935 	                           pausePlayControl->SetCurrentState(1, ETrue);
  3954 	                           }
  3936 	                           }
  3955                         	}
  3937                         	}
  3956 
  3938