mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewimp.cpp
branchRCL_3
changeset 26 70a8526f03f2
parent 21 a1247965635c
child 28 56b11cf8addb
equal deleted inserted replaced
21:a1247965635c 26:70a8526f03f2
   160 _LIT(KMPXPnRealAudioMimeType, "audio/x-pn-realaudio");
   160 _LIT(KMPXPnRealAudioMimeType, "audio/x-pn-realaudio");
   161 _LIT(KMPXRealAudioMimeType, "audio/x-realaudio");
   161 _LIT(KMPXRealAudioMimeType, "audio/x-realaudio");
   162 _LIT(KMPXRnRealAudioMimeType, "audio/vnd.rn-realaudio");
   162 _LIT(KMPXRnRealAudioMimeType, "audio/vnd.rn-realaudio");
   163 #endif
   163 #endif
   164 
   164 
   165 #define THUMBNAIL_CENREP_UID 0x102830B0 // from thumbnailmanageruids.hrh
       
   166 const TUint32 KSizeAudioFullscreenWidth = 0x16;
       
   167 const TUint32 KSizeAudioFullscreenHeight = 0x17;
       
   168 
       
   169 // ======== MEMBER FUNCTIONS ========
   165 // ======== MEMBER FUNCTIONS ========
   170 
   166 
   171 
   167 
   172 // ---------------------------------------------------------------------------
   168 // ---------------------------------------------------------------------------
   173 // Symbian 2nd phase constructor can leave.
   169 // Symbian 2nd phase constructor can leave.
   210     iViewUtility->AddObserverL( this );
   206     iViewUtility->AddObserverL( this );
   211 
   207 
   212     TInt flags( 0 );
   208     TInt flags( 0 );
   213     CRepository* repository( CRepository::NewLC( KCRUidMPXMPFeatures ));
   209     CRepository* repository( CRepository::NewLC( KCRUidMPXMPFeatures ));
   214     User::LeaveIfError( repository->Get( KMPXMPLocalVariation, flags ));
   210     User::LeaveIfError( repository->Get( KMPXMPLocalVariation, flags ));
   215     CleanupStack::PopAndDestroy( repository );
       
   216     repository = NULL;
       
   217 
       
   218     repository = CRepository::NewLC( TUid::Uid(THUMBNAIL_CENREP_UID));
       
   219 
       
   220     TInt xSize( 0 );
       
   221     TInt ySize( 0 );
       
   222     User::LeaveIfError( repository->Get( KSizeAudioFullscreenWidth, xSize ));
       
   223     User::LeaveIfError( repository->Get( KSizeAudioFullscreenHeight, ySize ));
       
   224     iFullScreenImageSize.SetSize(xSize,ySize);
       
   225     CleanupStack::PopAndDestroy( repository );
   211     CleanupStack::PopAndDestroy( repository );
   226     repository = NULL;
   212     repository = NULL;
   227 
   213 
   228     iChangeRTForAllProfiles =
   214     iChangeRTForAllProfiles =
   229         static_cast<TBool>( flags & KMPXChangeRTForAll );
   215         static_cast<TBool>( flags & KMPXChangeRTForAll );
   755         if ( aMedia && aMedia->IsSupported(KMPXMediaGeneralUri))
   741         if ( aMedia && aMedia->IsSupported(KMPXMediaGeneralUri))
   756             {
   742             {
   757             const TDesC& album = aMedia->ValueText( KMPXMediaGeneralUri );
   743             const TDesC& album = aMedia->ValueText( KMPXMediaGeneralUri );
   758             if(!iOldUri || iOldUri->Compare(album)!= 0)
   744             if(!iOldUri || iOldUri->Compare(album)!= 0)
   759                 {
   745                 {
       
   746 				TRect albumArtRect( iLayout->IndicatorLayout( ClientRect(), EAlbumArtArea ));
   760                 // Request for pre-generated TN size
   747                 // Request for pre-generated TN size
   761                 MPX_TRAP( err,
   748                 MPX_TRAP( err,
   762                     iMPXUtility->ExtractAlbumArtL(
   749                     iMPXUtility->ExtractAlbumArtL(
   763                     *aMedia,
   750                     *aMedia,
   764                     *iContainer,
   751                     *iContainer,
   765                     iFullScreenImageSize ); );
   752                     albumArtRect.Size() ); );
   766 
   753 
   767                 // cancel timer
   754                 // cancel timer
   768                 if ( iTNRequestTimer->IsActive())
   755                 if ( iTNRequestTimer->IsActive())
   769                     {
   756                     {
   770                     iTNRequestTimer->Cancel();
   757                     iTNRequestTimer->Cancel();
   966                     // display frequecy as : XXX.XX Mhz
   953                     // display frequecy as : XXX.XX Mhz
   967                     TBuf<KMPXFMFreqWidth + 1> freqMHzStr;
   954                     TBuf<KMPXFMFreqWidth + 1> freqMHzStr;
   968                     TInt err = freqMHzStr.Num( freqMHz, realFormat );
   955                     TInt err = freqMHzStr.Num( freqMHz, realFormat );
   969                     if ( err > 0 )
   956                     if ( err > 0 )
   970                         {
   957                         {
       
   958                         AknTextUtils::LanguageSpecificNumberConversion( freqMHzStr );
   971                         HBufC* labelFormatText = StringLoader::LoadL(
   959                         HBufC* labelFormatText = StringLoader::LoadL(
   972                             R_MPX_FM_FREQUENCY_LABEL,
   960                             R_MPX_FM_FREQUENCY_LABEL,
   973                             freqMHzStr );
   961                             freqMHzStr );
   974 
   962 
   975                         // ownership transferred
   963                         // ownership transferred
  2564     iPlaybackUtility->PropertyL( *this, EPbPropertyRepeatMode );
  2552     iPlaybackUtility->PropertyL( *this, EPbPropertyRepeatMode );
  2565 
  2553 
  2566     // Set title
  2554     // Set title
  2567     // Ignore errors from updating title pane since if that is not
  2555     // Ignore errors from updating title pane since if that is not
  2568     // updated, still want to activate view
  2556     // updated, still want to activate view
  2569     TRAP_IGNORE(
  2557     TRAP_IGNORE( UpdateTitlePaneL() );
  2570         {
  2558 
  2571         UpdateTitlePaneL();
  2559     if ( !AknLayoutUtils::PenEnabled() )
  2572         CAknNavigationControlContainer* naviPane(
  2560         {
  2573             static_cast<CAknNavigationControlContainer*>
  2561         CEikButtonGroupContainer* cba = Cba();
  2574             ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ))));
  2562         if ( cba )
  2575         if ( naviPane )
  2563             {
  2576             {
       
  2577             naviPane->PushDefaultL();
       
  2578             }
       
  2579         } );
       
  2580 
       
  2581     CEikButtonGroupContainer* cba = Cba();
       
  2582     if ( cba )
       
  2583         {
       
  2584 
       
  2585 #ifdef __ENABLE_MSK
  2564 #ifdef __ENABLE_MSK
  2586         iCommonUiHelper->SetMiddleSoftKeyLabelL(
  2565             iCommonUiHelper->SetMiddleSoftKeyLabelL(
  2587             *cba,
  2566                 *cba,
  2588             R_TEXT_SOFTKEY_EMPTY,
  2567                 R_TEXT_SOFTKEY_EMPTY,
  2589             EAknSoftkeyForwardKeyEvent );
  2568                 EAknSoftkeyForwardKeyEvent );
  2590 #endif // __ENABLE_MSK
  2569 #endif // __ENABLE_MSK
       
  2570             }
  2591         }
  2571         }
  2592 
  2572 
  2593     iPlaybackState = iPlaybackUtility->StateL();
  2573     iPlaybackState = iPlaybackUtility->StateL();
  2594     MPX_DEBUG2("CMPXCommonPlaybackViewImp::DoActivateL(): state = %d", iPlaybackState);
  2574     MPX_DEBUG2("CMPXCommonPlaybackViewImp::DoActivateL(): state = %d", iPlaybackState);
  2595     if ( iPlaybackState == EPbStateInitialising )
  2575     if ( iPlaybackState == EPbStateInitialising )
  3037                     StatusPane()->SwitchLayoutL( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ));
  3017                     StatusPane()->SwitchLayoutL( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ));
  3038                 }
  3018                 }
  3039             }
  3019             }
  3040 
  3020 
  3041         iContainer->SetRect( ClientRect() );
  3021         iContainer->SetRect( ClientRect() );
  3042         delete iOldUri;
       
  3043         iOldUri = NULL;
       
  3044         // Update album art
       
  3045         TRAP_IGNORE( UpdateAlbumArtL( iMedia ));
       
  3046         TRAP_IGNORE( UpdateTrackInfoL( iMedia ));
       
  3047         iContainer->DrawDeferred();
  3022         iContainer->DrawDeferred();
  3048         }
  3023         }
  3049     }
  3024     }
  3050 
  3025 
  3051 // ---------------------------------------------------------------------------
  3026 // ---------------------------------------------------------------------------
  3876 //
  3851 //
  3877 EXPORT_C void CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL()
  3852 EXPORT_C void CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL()
  3878     {
  3853     {
  3879     MPX_FUNC("CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL");
  3854     MPX_FUNC("CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL");
  3880 
  3855 
  3881     if (iContainer)
  3856     if (iContainer && !AknLayoutUtils::PenEnabled() )
  3882             {
  3857             {
  3883         CEikButtonGroupContainer* cba = Cba();
  3858         CEikButtonGroupContainer* cba = Cba();
  3884         if (cba)
  3859         if (cba)
  3885             {
  3860             {
  3886             MMPXSource* s = iPlaybackUtility->Source();
  3861             MMPXSource* s = iPlaybackUtility->Source();
  3995 // ----------------------------------------------------------------------------
  3970 // ----------------------------------------------------------------------------
  3996 //
  3971 //
  3997 TInt CMPXCommonPlaybackViewImp::HandleDelayedError( TAny* aPtr )
  3972 TInt CMPXCommonPlaybackViewImp::HandleDelayedError( TAny* aPtr )
  3998     {
  3973     {
  3999 	TInt ret( KErrNone );
  3974 	TInt ret( KErrNone );
       
  3975 	TInt index( KErrNotFound );
  4000     CMPXCommonPlaybackViewImp* pv = reinterpret_cast<CMPXCommonPlaybackViewImp*>( aPtr );
  3976     CMPXCommonPlaybackViewImp* pv = reinterpret_cast<CMPXCommonPlaybackViewImp*>( aPtr );
  4001     pv->iDelayedErrorTimer->Cancel();
  3977     pv->iDelayedErrorTimer->Cancel();
  4002     // compare index
  3978     // compare index
  4003     if ( pv->iPlaybackUtility )
  3979     if ( pv->iPlaybackUtility )
  4004     	{
  3980     	{
  4009             MPX_TRAP( ret, pl = source->PlaylistL() );
  3985             MPX_TRAP( ret, pl = source->PlaylistL() );
  4010             if( ret != KErrNone )
  3986             if( ret != KErrNone )
  4011             	{
  3987             	{
  4012                 return ret;
  3988                 return ret;
  4013             	}
  3989             	}
  4014 
  3990             if ( pl )
  4015 			if ( pv->iErrIndex == pl->Index() )
  3991                 {
       
  3992                 index = pl->Index();  
       
  3993                 }  
       
  3994 			if ( pv->iErrIndex == index )
  4016 				{
  3995 				{
  4017 				MPX_TRAP( ret, pv->HandleErrorL( pv->iLastDelayedErr ) );
  3996 				MPX_TRAP( ret, pv->HandleErrorL( pv->iLastDelayedErr ) );
  4018 				}
  3997 				}
  4019 			
  3998 			
  4020 			delete pl;
  3999 			delete pl;
  4054                 // Request for custom TN size               
  4033                 // Request for custom TN size               
  4055                 MPX_TRAP( err,
  4034                 MPX_TRAP( err,
  4056                     pv->iMPXUtility->ExtractAlbumArtL(
  4035                     pv->iMPXUtility->ExtractAlbumArtL(
  4057                     *pv->iMedia,
  4036                     *pv->iMedia,
  4058                     *pv->iContainer,
  4037                     *pv->iContainer,
  4059                     albumArtRect.Size() ); );                
  4038                     albumArtRect.Size(),
       
  4039                     EFalse ); );
  4060                 }
  4040                 }
  4061             }
  4041             }
  4062 
  4042 
  4063         if ( KErrNone != err )
  4043         if ( KErrNone != err )
  4064             {
  4044             {