501 { |
501 { |
502 MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateViewL" ); |
502 MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateViewL" ); |
503 |
503 |
504 if ( iContainer && !iSwitchingView ) |
504 if ( iContainer && !iSwitchingView ) |
505 { |
505 { |
506 UpdatePlaybackState( iPlaybackState ); |
506 UpdatePlaybackStateL( iPlaybackState ); |
507 UpdateTrackInfoL( iMedia ); |
507 UpdateTrackInfoL( iMedia ); |
508 UpdateTrackPlaybackPositionL( iPosition, iDuration ); |
508 UpdateTrackPlaybackPositionL( iPosition, iDuration ); |
509 UpdateTrackPosInPlaylistL(); |
509 UpdateTrackPosInPlaylistL(); |
510 UpdateAlbumArtL( iMedia ); |
510 UpdateAlbumArtL( iMedia ); |
511 UpdateDownloadStateLabelL(); |
511 UpdateDownloadStateLabelL(); |
613 |
613 |
614 // --------------------------------------------------------------------------- |
614 // --------------------------------------------------------------------------- |
615 // Update current playback state. |
615 // Update current playback state. |
616 // --------------------------------------------------------------------------- |
616 // --------------------------------------------------------------------------- |
617 // |
617 // |
618 EXPORT_C void CMPXCommonPlaybackViewImp::UpdatePlaybackState( |
618 EXPORT_C void CMPXCommonPlaybackViewImp::UpdatePlaybackStateL( |
619 TMPXPlaybackState aPlaybackState ) |
619 TMPXPlaybackState aPlaybackState ) |
620 { |
620 { |
621 MPX_DEBUG2("CMPXCommonPlaybackViewImp::UpdatePlaybackState(%d): Entering", aPlaybackState); |
621 MPX_DEBUG2("CMPXCommonPlaybackViewImp::UpdatePlaybackState(%d): Entering", aPlaybackState); |
622 |
622 |
623 if ( iContainer && !iSwitchingView ) |
623 if ( iContainer && !iSwitchingView ) |
1352 TMPXPlaybackState aState, |
1352 TMPXPlaybackState aState, |
1353 TInt aData ) |
1353 TInt aData ) |
1354 { |
1354 { |
1355 MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandleStateChangedL" ); |
1355 MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandleStateChangedL" ); |
1356 MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandleStateChangedL %d", aState ); |
1356 MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandleStateChangedL %d", aState ); |
1357 UpdatePlaybackState( aState ); |
1357 UpdatePlaybackStateL( aState ); |
1358 |
1358 |
1359 switch ( aState ) |
1359 switch ( aState ) |
1360 { |
1360 { |
1361 case EPbStateStopped: |
1361 case EPbStateStopped: |
1362 case EPbStateNotInitialised: |
1362 case EPbStateNotInitialised: |
1495 case KErrCAPendingRights: |
1495 case KErrCAPendingRights: |
1496 case KErrCASizeNotDetermined: |
1496 case KErrCASizeNotDetermined: |
1497 case KErrCANewFileHandleRequired: |
1497 case KErrCANewFileHandleRequired: |
1498 case KErrPermissionDenied: |
1498 case KErrPermissionDenied: |
1499 { |
1499 { |
|
1500 if (aError == KErrCANoPermission || |
|
1501 aError == KErrCANoRights) |
|
1502 { |
|
1503 iCommonUiHelper->HandleErrorL( KMPXErrorExpiredRights, iMedia ); |
|
1504 } |
1500 TBool skip(ETrue); |
1505 TBool skip(ETrue); |
1501 |
1506 |
1502 if ( iMedia ) |
1507 if ( iMedia ) |
1503 { |
1508 { |
1504 if ( iMedia->IsSupported( KMPXMediaDrmType ) ) |
1509 if ( iMedia->IsSupported( KMPXMediaDrmType ) ) |
1652 { |
1657 { |
1653 MPX_DEBUG1("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: Entering"); |
1658 MPX_DEBUG1("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: Entering"); |
1654 MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: iDatabaseNotReady (%d)", iDatabaseNotReady); |
1659 MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: iDatabaseNotReady (%d)", iDatabaseNotReady); |
1655 |
1660 |
1656 iPlaybackUtility->CommandL( EPbCmdStop ); |
1661 iPlaybackUtility->CommandL( EPbCmdStop ); |
1657 UpdatePlaybackState( EPbStateStopped ); |
1662 UpdatePlaybackStateL( EPbStateStopped ); |
1658 |
1663 |
1659 TInt mpxWindowGroupId = CEikonEnv::Static()->RootWin().Identifier(); |
1664 TInt mpxWindowGroupId = CEikonEnv::Static()->RootWin().Identifier(); |
1660 |
1665 |
1661 // Usb event happened. |
1666 // Usb event happened. |
1662 if (iDatabaseNotReady) |
1667 if (iDatabaseNotReady) |
2589 MPX_DEBUG2("CMPXCommonPlaybackViewImp::DoActivateL(): state = %d", iPlaybackState); |
2594 MPX_DEBUG2("CMPXCommonPlaybackViewImp::DoActivateL(): state = %d", iPlaybackState); |
2590 if ( iPlaybackState == EPbStateInitialising ) |
2595 if ( iPlaybackState == EPbStateInitialising ) |
2591 { |
2596 { |
2592 delete iMedia; |
2597 delete iMedia; |
2593 iMedia = NULL; |
2598 iMedia = NULL; |
2594 UpdatePlaybackState( iPlaybackState ); |
2599 UpdatePlaybackStateL( iPlaybackState ); |
2595 UpdateTrackInfoL( iMedia ); |
2600 UpdateTrackInfoL( iMedia ); |
2596 } |
2601 } |
2597 else |
2602 else |
2598 { |
2603 { |
2599 // reset iNewItemOpened when Playback view is activated when state is |
2604 // reset iNewItemOpened when Playback view is activated when state is |
2615 { |
2620 { |
2616 CleanupStack::PushL( playlist ); |
2621 CleanupStack::PushL( playlist ); |
2617 if ( playlist->Count() > 0 ) |
2622 if ( playlist->Count() > 0 ) |
2618 { |
2623 { |
2619 RequestMediaL(); |
2624 RequestMediaL(); |
2620 UpdatePlaybackState( iPlaybackState ); |
2625 UpdatePlaybackStateL( iPlaybackState ); |
2621 } |
2626 } |
2622 else |
2627 else |
2623 { |
2628 { |
2624 // playlist count is 0, no tracks |
2629 // playlist count is 0, no tracks |
2625 iPlaybackState = EPbStateNotInitialised; |
2630 iPlaybackState = EPbStateNotInitialised; |
2860 aMenuPane->SetItemDimmed( |
2865 aMenuPane->SetItemDimmed( |
2861 EAknCmdHelp, |
2866 EAknCmdHelp, |
2862 ETrue ); |
2867 ETrue ); |
2863 } |
2868 } |
2864 |
2869 |
|
2870 // Check if HDMI cable is connected |
|
2871 TBool isHDMIConnected = iTvOutConfig->HdmiCableConnected(); |
|
2872 aMenuPane->SetItemDimmed( EMPXPbvCmdOpenMusicSettings, isHDMIConnected ); |
|
2873 aMenuPane->SetItemDimmed( EMPXPbvCmdEqualizer, isHDMIConnected ); |
|
2874 |
2865 // Check if FM Transmitter is supported |
2875 // Check if FM Transmitter is supported |
2866 if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) ) |
2876 if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) || isHDMIConnected ) |
2867 { |
2877 { |
2868 aMenuPane->SetItemDimmed( |
2878 aMenuPane->SetItemDimmed( |
2869 EMPXPbvCmdFMTransmitter, |
2879 EMPXPbvCmdFMTransmitter, |
2870 ETrue ); |
2880 ETrue ); |
2871 } |
2881 } |
2872 |
2882 |
2873 |
2883 |
2874 if ( iUpnpFrameworkSupport ) |
2884 if ( iUpnpFrameworkSupport ) |
2875 { |
2885 { |
2876 if ( !iMedia || !IsUpnpVisible() ) |
2886 if ( !iMedia || !IsUpnpVisibleL() ) |
2877 { |
2887 { |
2878 GetCurrentPlayerDetails(); |
2888 GetCurrentPlayerDetails(); |
2879 if ( iCurrentPlayerType == EPbLocal ) |
2889 if ( iCurrentPlayerType == EPbLocal ) |
2880 { |
2890 { |
2881 aMenuPane->SetItemDimmed( |
2891 aMenuPane->SetItemDimmed( |
3132 // ----------------------------------------------------------------------------- |
3141 // ----------------------------------------------------------------------------- |
3133 // CMPXCommonPlaybackViewImp::IsUpnpVisible |
3142 // CMPXCommonPlaybackViewImp::IsUpnpVisible |
3134 // Taken from Gallery upnp support implementation |
3143 // Taken from Gallery upnp support implementation |
3135 // ----------------------------------------------------------------------------- |
3144 // ----------------------------------------------------------------------------- |
3136 // |
3145 // |
3137 EXPORT_C TBool CMPXCommonPlaybackViewImp::IsUpnpVisible() |
3146 EXPORT_C TBool CMPXCommonPlaybackViewImp::IsUpnpVisibleL() |
3138 { |
3147 { |
3139 MPX_FUNC( "CMPXCommonPlaybackViewImp::IsUpnpVisible" ); |
3148 MPX_FUNC( "CMPXCommonPlaybackViewImp::IsUpnpVisible" ); |
3140 TBool returnValue = EFalse; |
3149 TBool returnValue = EFalse; |
3141 |
3150 |
3142 #ifdef UPNP_INCLUDED |
3151 #ifdef UPNP_INCLUDED |
3540 // ----------------------------------------------------------------------------- |
3549 // ----------------------------------------------------------------------------- |
3541 // |
3550 // |
3542 EXPORT_C TBool CMPXCommonPlaybackViewImp::IsCommandSupportedL() |
3551 EXPORT_C TBool CMPXCommonPlaybackViewImp::IsCommandSupportedL() |
3543 { |
3552 { |
3544 TBool forwardCommand = ETrue; |
3553 TBool forwardCommand = ETrue; |
3545 if ( iUpnpFrameworkSupport && IsUpnpVisible() ) |
3554 if ( iUpnpFrameworkSupport && IsUpnpVisibleL() ) |
3546 { |
3555 { |
3547 // retrieve iCurrentPlayerType info |
3556 // retrieve iCurrentPlayerType info |
3548 GetCurrentPlayerDetails(); |
3557 GetCurrentPlayerDetails(); |
3549 |
3558 |
3550 if ( iCurrentPlayerType != EPbLocal) |
3559 if ( iCurrentPlayerType != EPbLocal) |
3906 |
3915 |
3907 // --------------------------------------------------------------------------- |
3916 // --------------------------------------------------------------------------- |
3908 // Updates the middle toolbar button |
3917 // Updates the middle toolbar button |
3909 // --------------------------------------------------------------------------- |
3918 // --------------------------------------------------------------------------- |
3910 // |
3919 // |
3911 EXPORT_C void CMPXCommonPlaybackViewImp::UpdateToolbar() |
3920 EXPORT_C void CMPXCommonPlaybackViewImp::UpdateToolbarL() |
3912 { |
3921 { |
3913 MPX_FUNC("CMPXCommonPlaybackViewImp::UpdateToolbar"); |
3922 MPX_FUNC("CMPXCommonPlaybackViewImp::UpdateToolbarL"); |
3914 |
3923 |
3915 if ( AknLayoutUtils::PenEnabled() ) |
3924 if ( AknLayoutUtils::PenEnabled() ) |
3916 { |
3925 { |
3917 if ( Toolbar() ) |
3926 if ( Toolbar() ) |
3918 { |
3927 { |
3985 // Callback function of timer to handle delayed error |
3994 // Callback function of timer to handle delayed error |
3986 // ---------------------------------------------------------------------------- |
3995 // ---------------------------------------------------------------------------- |
3987 // |
3996 // |
3988 TInt CMPXCommonPlaybackViewImp::HandleDelayedError( TAny* aPtr ) |
3997 TInt CMPXCommonPlaybackViewImp::HandleDelayedError( TAny* aPtr ) |
3989 { |
3998 { |
|
3999 TInt ret( KErrNone ); |
3990 CMPXCommonPlaybackViewImp* pv = reinterpret_cast<CMPXCommonPlaybackViewImp*>( aPtr ); |
4000 CMPXCommonPlaybackViewImp* pv = reinterpret_cast<CMPXCommonPlaybackViewImp*>( aPtr ); |
3991 pv->iDelayedErrorTimer->Cancel(); |
4001 pv->iDelayedErrorTimer->Cancel(); |
3992 |
|
3993 // compare index |
4002 // compare index |
3994 if ( pv->iPlaybackUtility ) |
4003 if ( pv->iPlaybackUtility ) |
3995 { |
4004 { |
3996 MMPXSource* source( pv->iPlaybackUtility->Source() ); |
4005 MMPXSource* source( pv->iPlaybackUtility->Source() ); |
3997 if ( source ) |
4006 if ( source ) |
3998 { |
4007 { |
3999 CMPXCollectionPlaylist* pl( source->PlaylistL() ); |
4008 CMPXCollectionPlaylist* pl( NULL ); |
4000 if ( pl ) |
4009 MPX_TRAP( ret, pl = source->PlaylistL() ); |
4001 { |
4010 if( ret != KErrNone ) |
4002 CleanupStack::PushL( pl ); |
4011 { |
4003 if ( pv->iErrIndex == pl->Index() ) |
4012 return ret; |
4004 { |
4013 } |
4005 pv->HandleErrorL( pv->iLastDelayedErr ); |
4014 |
4006 } |
4015 if ( pv->iErrIndex == pl->Index() ) |
4007 CleanupStack::PopAndDestroy( pl ); |
4016 { |
4008 } |
4017 MPX_TRAP( ret, pv->HandleErrorL( pv->iLastDelayedErr ) ); |
|
4018 } |
|
4019 |
|
4020 delete pl; |
|
4021 pl = NULL; |
|
4022 |
4009 } |
4023 } |
4010 } |
4024 } |
4011 |
4025 |
4012 return KErrNone; |
4026 return ret; |
4013 } |
4027 } |
4014 |
4028 |
4015 // --------------------------------------------------------------------------- |
4029 // --------------------------------------------------------------------------- |
4016 // Updates track's album art. |
4030 // Updates track's album art. |
4017 // --------------------------------------------------------------------------- |
4031 // --------------------------------------------------------------------------- |