mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewcontainer.cpp
branchRCL_3
changeset 53 3de6c4cf6b67
equal deleted inserted replaced
52:14979e23cb5e 53:3de6c4cf6b67
       
     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:  Implementation of Common Playback view's container.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <eiklabel.h>
       
    22 #include <eikimage.h>
       
    23 #include <eikprogi.h>
       
    24 #include <eikmenub.h>
       
    25 #include <eikappui.h>
       
    26 #include <eikenv.h>
       
    27 #include <aknview.h>
       
    28 #include <AknsUtils.h>
       
    29 #include <AknDef.h>
       
    30 #include <AknsConstants.h>
       
    31 #include <AknsSkinInstance.h>
       
    32 #include <AknsControlContext.h>
       
    33 #include <AknsDrawUtils.h>
       
    34 #include <AknsBasicBackgroundControlContext.h>
       
    35 #include <barsread.h>
       
    36 #include <centralrepository.h>
       
    37 #include <StringLoader.h>
       
    38 #include <fontids.hrh>
       
    39 #include <gulfont.h>
       
    40 #include <applayout.cdl.h>
       
    41 #include <AknIconArray.h>
       
    42 #include <AknIconUtils.h>
       
    43 #include <gulicon.h>
       
    44 #include <featmgr.h>
       
    45 #include <aknnotewrappers.h>
       
    46 
       
    47 #include <data_caging_path_literals.hrh>
       
    48 #include <aknlayoutscalable_apps.cdl.h>
       
    49 #include <layoutmetadata.cdl.h>
       
    50 #include <avkon.mbg>
       
    51 #include <mpxcommonplaybackview.rsg>
       
    52 #include <mpxcommonplaybackview.mbg>
       
    53 #include <mpxconstants.h>
       
    54 #include <mpxfmtx.rsg> // For FF_FMTX
       
    55 #include <mpxappui.hrh>
       
    56 #include <mpxinternalcrkeys.h>
       
    57 #include <touchfeedback.h>
       
    58 #include <akntranseffect.h>                 // For transition effects
       
    59 #include <gfxtranseffect/gfxtranseffect.h>  // For transition effects
       
    60 
       
    61 #include "mpxcommonplaybackviewcontainer.h"
       
    62 #include "mpxcommonplaybackviewlayout.h"
       
    63 #include "mpxcommonplaybackview.hrh"
       
    64 #include "mpxplaybackview.hlp.hrh"
       
    65 #include "mpxplaybackviewinfolabel.h"
       
    66 #include "mpxplaybackviewlayoutinterface.h"
       
    67 #include "mpxlayoutswitchobserver.h"
       
    68 #include "mpxcommonuihelper.h"
       
    69 #include "mpxbuttonmanager.h"
       
    70 #include "mpxlog.h"
       
    71 
       
    72 // CONSTANTS
       
    73 const TInt KLabelCount = ETextCount;
       
    74 const TInt KMPXMinSecSeparatorIndex = 2;
       
    75 
       
    76 _LIT(KMPXZeroDurationMark, "--");
       
    77 
       
    78 const TInt KOneHourInSeconds = 3600;
       
    79 const TInt KMPXTimeIndicatorLength = 16;
       
    80 
       
    81 // S60 softkey positions in CBA
       
    82 const TInt KMPXCbaLeftSoftkeyPos = 0;
       
    83 const TInt KMPXCbaRightSoftkeyPos = 2;
       
    84 
       
    85 // delay for actual seek operation
       
    86 const TInt KSeekDelay = 100000; // 0.1s
       
    87 
       
    88 const TInt KOneSecondInOneMilliSecond = 1000;
       
    89 // ======== MEMBER FUNCTIONS ========
       
    90 
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // Symbian 2nd phase constructor can leave.
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 EXPORT_C void CMPXCommonPlaybackViewContainer::ConstructL( const TRect& /*aRect*/ )
       
    97     {
       
    98     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::ConstructL() entering" );
       
    99 
       
   100     CreateWindowL();
       
   101 
       
   102     TAknWindowLineLayout screenLayout =
       
   103         AknLayout::screen();
       
   104     TRect screenRect = screenLayout.Rect();
       
   105 	iBackground = CAknsBasicBackgroundControlContext::NewL(
       
   106 			KAknsIIDQsnBgAreaMain, screenRect, EFalse );
       
   107 
       
   108 	iSeekTimer = CPeriodic::NewL( EPriorityLow );
       
   109 
       
   110     TInt flags( 0 );
       
   111     CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
       
   112     User::LeaveIfError( repository->Get( KMPXMPLocalVariation, flags ));
       
   113     delete repository;
       
   114     repository = NULL;
       
   115 
       
   116     iEnableMarquee = static_cast<TBool>( flags & KMPXMarqueeArtistName );
       
   117 
       
   118     iEnableButtons = static_cast<TBool>( flags & KMPXRockerMappingSupport );
       
   119 
       
   120 
       
   121     // Create labels
       
   122     CreateLabelsL();
       
   123     iLabels[ETextPlaylistCount]->MakeVisible( ETrue );
       
   124 
       
   125 	if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
       
   126 		{
       
   127     	// By default, FMTX label is displayed
       
   128     	iLabels[ETextFMFrequency]->MakeVisible( ETrue );
       
   129     	SetFMTXMode(ETrue);
       
   130 		}
       
   131 
       
   132     // Create icons
       
   133     CreateIconsL();
       
   134 
       
   135     // Create buttons if enabled
       
   136     if ( iEnableButtons )
       
   137         {
       
   138         TRect rockerParentRect;
       
   139         if ( iCurrentLayout.Width())
       
   140         {
       
   141             rockerParentRect = iCurrentLayout;
       
   142         }
       
   143         else
       
   144         {
       
   145             rockerParentRect = iCurrentLayout;
       
   146         }
       
   147 
       
   148         iButtonManager = CMPXButtonManager::NewL(
       
   149             this,
       
   150             iLayout,
       
   151             *this);
       
   152 
       
   153         iButtonManager->SetContainerWindowL( *this );
       
   154         iButtonManager->SetMopParent( this );
       
   155         iButtonManager->SetRect(rockerParentRect);
       
   156         }
       
   157 
       
   158      // Read time format strings from AVKON resource
       
   159     iMinSecFormatString = StringLoader::LoadL(
       
   160         R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO );
       
   161 
       
   162     iShortFormatString =
       
   163         StringLoader::LoadL( R_QTN_TIME_DURAT_SHORT_WITH_ZERO );
       
   164 
       
   165     iCommonUiHelper = CMPXCommonUiHelper::NewL();
       
   166 
       
   167     // Refresh the progress bar
       
   168     UpdateProgressBarGraphics();
       
   169 
       
   170     iMode = EUninitialized;
       
   171     // suppress download text per UI spec
       
   172     iLabels[ETextDownloadState]->MakeVisible( EFalse );
       
   173     iLabels[ETextArtist]->MakeVisible( EFalse );
       
   174     iLabels[ETextTrack]->MakeVisible( EFalse );
       
   175     iLabels[ETextElapsedTime]->MakeVisible( EFalse );
       
   176     iLabels[ETextRemainingTime]->MakeVisible( EFalse );
       
   177     iDisplayAlbumArt = EFalse;
       
   178     ActivateL();
       
   179 
       
   180     iTouchDown = EFalse;
       
   181     iActiveView = ETrue;
       
   182     iPrerollCompleted = EFalse;
       
   183 
       
   184     iLightStatus = CHWRMLight::ELightStatusUnknown;
       
   185     iIsForeground = EFalse ;
       
   186     iLight = CHWRMLight::NewL(this);
       
   187 
       
   188 	DrawableWindow()->SetPointerGrab( ETrue );
       
   189     EnableDragEvents();
       
   190 
       
   191     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::ConstructL() exiting" );
       
   192     }
       
   193 
       
   194 // ---------------------------------------------------------------------------
       
   195 // Destructor
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 EXPORT_C CMPXCommonPlaybackViewContainer::~CMPXCommonPlaybackViewContainer()
       
   199     {
       
   200     // Pointer events
       
   201     SetGloballyCapturing( EFalse );
       
   202     SetPointerCapture( EFalse );
       
   203 
       
   204     FreeIcons();
       
   205     delete iTrackAlbumArt;
       
   206 
       
   207     delete iBackground;
       
   208     iLabels.ResetAndDestroy();
       
   209     delete iMinSecFormatString;
       
   210     delete iShortFormatString;
       
   211     delete iCommonUiHelper;
       
   212 
       
   213     if ( iLight )
       
   214         {
       
   215         delete iLight;
       
   216         iLight = NULL;
       
   217         }
       
   218 
       
   219     delete iButtonManager;
       
   220 
       
   221    MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   222    if (feedback)
       
   223        {
       
   224        feedback->RemoveFeedbackForControl(this);
       
   225        }
       
   226 
       
   227     if ( iIdle )
       
   228         {
       
   229         iIdle->Cancel();
       
   230         delete iIdle;
       
   231         }
       
   232 
       
   233 	if ( iSeekTimer )
       
   234 		{
       
   235 		iSeekTimer->Cancel();
       
   236 		delete iSeekTimer;
       
   237 		}
       
   238     }
       
   239 
       
   240 // ---------------------------------------------------------------------------
       
   241 // Updates time indicators.
       
   242 // ---------------------------------------------------------------------------
       
   243 //
       
   244 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateTimeIndicatorsL(
       
   245     TInt aPlaybackPosInSeconds,
       
   246     TInt aTotalLengthInSeconds )
       
   247     {
       
   248     iTrackTotalLengthInSeconds = aTotalLengthInSeconds;
       
   249     if (!iTouchDown)
       
   250         {
       
   251         if( iDragProgressBar )
       
   252           {
       
   253           TInt expectPlaybackPos = iNewSongPosition / KOneSecondInOneMilliSecond;
       
   254           if( expectPlaybackPos == aPlaybackPosInSeconds )
       
   255               {
       
   256               iDragProgressBar = EFalse;
       
   257               }
       
   258           else
       
   259               {
       
   260               return;
       
   261               }
       
   262           }
       
   263     if ( aTotalLengthInSeconds == 0 )
       
   264         {
       
   265         TLocale locale;
       
   266         TBuf<KMPXTimeIndicatorLength> pos;
       
   267         TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
       
   268         pos = KMPXZeroDurationMark;
       
   269         pos.Append( separator );
       
   270         pos += KMPXZeroDurationMark;
       
   271 
       
   272         UpdateLabelL( ETextElapsedTime, pos );
       
   273         UpdateLabelL( ETextRemainingTime, pos );
       
   274         }
       
   275     else
       
   276         {
       
   277         CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode =
       
   278             CMPXCommonUiHelper::EMPXDuratAuto;
       
   279         if ( aTotalLengthInSeconds > KOneHourInSeconds )
       
   280             {
       
   281             durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
       
   282             }
       
   283 
       
   284         // Convert ellapsed time to texts
       
   285         HBufC* position = iCommonUiHelper->DisplayableDurationL(
       
   286             aPlaybackPosInSeconds,
       
   287             durationMode );
       
   288         CleanupStack::PushL( position );
       
   289 
       
   290         TInt remainingTime = aTotalLengthInSeconds - aPlaybackPosInSeconds;
       
   291         if ( remainingTime < 0 )
       
   292             {
       
   293             // Convert all negative value to zero
       
   294             remainingTime = 0;
       
   295             }
       
   296 
       
   297         // Convert remaining time to texts
       
   298         HBufC* remaining = iCommonUiHelper->DisplayableDurationL(
       
   299             remainingTime,
       
   300             durationMode );
       
   301         CleanupStack::PushL( remaining );
       
   302 
       
   303         UpdateLabelL( ETextElapsedTime, *position );
       
   304         UpdateLabelL( ETextRemainingTime, *remaining );
       
   305 
       
   306         CleanupStack::PopAndDestroy( remaining );
       
   307         CleanupStack::PopAndDestroy( position );
       
   308         }
       
   309 
       
   310     if ( ( iMode != EUninitialized )
       
   311          || ( iMode == EPlayMode || iMode == EPauseMode ) )
       
   312         {
       
   313         if ( aTotalLengthInSeconds )
       
   314             {
       
   315             TReal t = aTotalLengthInSeconds;
       
   316             iPlaybackRatio = aPlaybackPosInSeconds / t;
       
   317             }
       
   318         RefreshProgressBar();
       
   319         }
       
   320         }
       
   321     }
       
   322 
       
   323 // ---------------------------------------------------------------------------
       
   324 // Updates label
       
   325 // ---------------------------------------------------------------------------
       
   326 //
       
   327 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateLabelL(
       
   328     TMPXPbvTextIndicator aLabel,
       
   329     const TDesC& aText )
       
   330     {
       
   331     ASSERT( aLabel >= 0 && aLabel < iLabels.Count() );
       
   332     CMPXPlaybackViewInfoLabel* label = iLabels[aLabel];
       
   333     if(aLabel == ETextDownloadState)
       
   334         {
       
   335 		/*
       
   336         iSliderPaneRect = iLayout->IndicatorLayout( Rect(), ESliderPane );
       
   337         iLayout->LayoutLabel(
       
   338         iLabels[ETextDownloadState], iSliderPaneRect, ETextDownloadState );
       
   339 
       
   340         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   341         TRgb color = KRgbBlack;
       
   342 
       
   343         AknsUtils::GetCachedColor(
       
   344             skin,
       
   345             color,
       
   346             KAknsIIDQsnTextColors,
       
   347             EAknsCIQsnTextColorsCG50 );
       
   348 
       
   349         AknLayoutUtils::OverrideControlColorL(
       
   350             *iLabels[ETextDownloadState],
       
   351             EColorLabelText,
       
   352             color );
       
   353         */
       
   354         // suppress download text per UI spec.
       
   355         return;
       
   356         }
       
   357     if ( label )
       
   358         {
       
   359         TBool needRedraw = EFalse;
       
   360 
       
   361         if ( label->FullText() != aText )
       
   362             {
       
   363             needRedraw = ETrue;
       
   364             label->SetLabelTextL( aText);
       
   365             }
       
   366 
       
   367         if ( needRedraw && label->IsVisible() )
       
   368             {
       
   369             label->StartMarquee();
       
   370             label->DrawDeferred();
       
   371             }
       
   372         }
       
   373     }
       
   374 
       
   375 // ---------------------------------------------------------------------------
       
   376 // Sets main pane mode.
       
   377 // ---------------------------------------------------------------------------
       
   378 //
       
   379 EXPORT_C void CMPXCommonPlaybackViewContainer::SetMode( TMPXPbvPlaybackMode aMode )
       
   380     {
       
   381     iMode = aMode;
       
   382     iDisplayAlbumArt = ETrue;
       
   383 
       
   384     switch ( iMode )
       
   385         {
       
   386 	    case EUninitialized:
       
   387 	    	{
       
   388 	    	// Set label visibility
       
   389 	        //iLabels[ETextDownloadState]->MakeVisible( EFalse );
       
   390 	        iLabels[ETextArtist]->MakeVisible( ETrue );
       
   391 	        iLabels[ETextTrack]->MakeVisible( ETrue );
       
   392 	        //iLabels[ETextEmpty]->MakeVisible( EFalse );
       
   393 	        iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   394 	        iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   395         	break;
       
   396         	}
       
   397         case ENoTracksMode:
       
   398             {
       
   399             // Set label visibility
       
   400             //iLabels[ETextDownloadState]->MakeVisible( ETrue );
       
   401             iLabels[ETextArtist]->MakeVisible( EFalse );
       
   402             iLabels[ETextTrack]->MakeVisible( EFalse );
       
   403             //iLabels[ETextEmpty]->MakeVisible( ETrue );
       
   404             iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   405             iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   406             iDisplayAlbumArt = EFalse;
       
   407             break;
       
   408             }
       
   409         case EStopMode:
       
   410             {
       
   411             // Fixed the layout for Download label and time label are overlaped in position
       
   412             //iLabels[ETextDownloadState]->MakeVisible( EFalse );
       
   413             iLabels[ETextTrack]->MakeVisible( ETrue );
       
   414             iLabels[ETextArtist]->MakeVisible( ETrue );
       
   415             //iLabels[ETextEmpty]->MakeVisible( EFalse );
       
   416             iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   417             iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   418             break;
       
   419             }
       
   420         case EInitialising:
       
   421             {
       
   422             //iLabels[ETextDownloadState]->MakeVisible( ETrue );
       
   423             iLabels[ETextTrack]->MakeVisible( ETrue );
       
   424             iLabels[ETextArtist]->MakeVisible( ETrue );
       
   425             //iLabels[ETextEmpty]->MakeVisible( EFalse );
       
   426             iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   427             iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   428             break;
       
   429             }
       
   430         case EMediaKeySkipping:
       
   431             {
       
   432             //iLabels[ETextDownloadState]->MakeVisible( ETrue );
       
   433             iLabels[ETextTrack]->MakeVisible( ETrue );
       
   434             iLabels[ETextArtist]->MakeVisible( ETrue );
       
   435             //iLabels[ETextEmpty]->MakeVisible( EFalse );
       
   436             iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   437             iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   438             break;
       
   439             }
       
   440         case EInvalidMode:
       
   441             {
       
   442             //iLabels[ETextDownloadState]->MakeVisible( EFalse );
       
   443             iLabels[ETextTrack]->MakeVisible( EFalse );
       
   444             iLabels[ETextArtist]->MakeVisible( EFalse );
       
   445             //iLabels[ETextEmpty]->MakeVisible( EFalse );
       
   446             iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   447             iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   448 
       
   449             break;
       
   450             }
       
   451         case EBufferingMode:
       
   452             {
       
   453             // Set label visibility
       
   454             //iLabels[ETextDownloadState]->MakeVisible( EFalse );
       
   455             iLabels[ETextArtist]->MakeVisible( ETrue );
       
   456             iLabels[ETextTrack]->MakeVisible( ETrue );
       
   457             //iLabels[ETextEmpty]->MakeVisible( EFalse );
       
   458             iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   459             iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   460             break;
       
   461             }
       
   462         default:
       
   463             {
       
   464             // Set label visibility
       
   465             //iLabels[ETextDownloadState]->MakeVisible( EFalse );
       
   466             iLabels[ETextArtist]->MakeVisible( ETrue );
       
   467             iLabels[ETextTrack]->MakeVisible( ETrue );
       
   468             //iLabels[ETextEmpty]->MakeVisible( EFalse );
       
   469             iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   470             iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
       
   471             break;
       
   472             }
       
   473         }
       
   474 
       
   475     if ( iMode == EPlayMode )
       
   476         {
       
   477         iLabels[ETextArtist]->StartMarquee();
       
   478         iLabels[ETextTrack]->StartMarquee();
       
   479         }
       
   480     else
       
   481         {
       
   482         iLabels[ETextArtist]->StopMarquee();
       
   483         iLabels[ETextTrack]->StopMarquee();
       
   484         }
       
   485     DrawDeferred();
       
   486     }
       
   487 
       
   488 // ---------------------------------------------------------------------------
       
   489 // Set random mode.
       
   490 // ---------------------------------------------------------------------------
       
   491 //
       
   492 EXPORT_C void CMPXCommonPlaybackViewContainer::SetRandomMode( TBool aRandomMode )
       
   493     {
       
   494     iRandomMode = aRandomMode;
       
   495     Window().Invalidate( iRandomIconRect );
       
   496     }
       
   497 
       
   498 // ---------------------------------------------------------------------------
       
   499 // Set repeat mode.
       
   500 // ---------------------------------------------------------------------------
       
   501 //
       
   502 EXPORT_C void CMPXCommonPlaybackViewContainer::SetRepeatMode(
       
   503     TBool aRepeatAll,
       
   504     TBool aRepeatOne )
       
   505     {
       
   506     iRepeatAllMode = aRepeatAll;
       
   507     iRepeatOneMode = aRepeatOne;
       
   508     Window().Invalidate( iRepeatIconRect );
       
   509     }
       
   510 
       
   511 // ---------------------------------------------------------------------------
       
   512 // Set RealPlayer mode.
       
   513 // ---------------------------------------------------------------------------
       
   514 //
       
   515 EXPORT_C void CMPXCommonPlaybackViewContainer::SetRealAudioMode(
       
   516     TBool aRealAudioMode )
       
   517     {
       
   518 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
   519     iRealAudioMode = aRealAudioMode;
       
   520     Window().Invalidate( iRealIconRect );
       
   521 #else
       
   522     (void) aRealAudioMode;
       
   523     ASSERT( 0 );
       
   524 #endif
       
   525     }
       
   526 
       
   527 // -----------------------------------------------------------------------------
       
   528 // CMPXCommonPlaybackViewContainer::UpdateButtons
       
   529 // -----------------------------------------------------------------------------
       
   530 //
       
   531 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateButtons(
       
   532     TMPXPlaybackState aState )
       
   533     {
       
   534     if ( iEnableButtons )
       
   535         {
       
   536         iButtonManager->UpdateButtonStates( aState );
       
   537         DrawDeferred();
       
   538         }
       
   539     }
       
   540 
       
   541 // ---------------------------------------------------------------------------
       
   542 // Set layout for all elements and set sizes for icons.
       
   543 // ---------------------------------------------------------------------------
       
   544 //
       
   545 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateLayout()
       
   546     {
       
   547     MPX_FUNC( "CMPXCommonPlaybackViewContainer::UpdateLayout" );
       
   548     TRAP_IGNORE( DoUpdateLayoutL() );
       
   549     }
       
   550 
       
   551 // ---------------------------------------------------------------------------
       
   552 // Updates duration label.
       
   553 // ---------------------------------------------------------------------------
       
   554 //
       
   555 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateDurationLabelL(
       
   556     TInt aTotalLengthInSeconds )
       
   557     {
       
   558     HBufC* labelText( NULL );
       
   559     HBufC* duration( NULL );
       
   560 
       
   561     if ( aTotalLengthInSeconds == 0 )
       
   562         {
       
   563         TLocale locale;
       
   564         TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
       
   565 
       
   566         duration = HBufC::NewLC( KMPXTimeIndicatorLength );
       
   567         TPtr durationTPtr( duration->Des() );
       
   568 
       
   569         durationTPtr = KMPXZeroDurationMark;
       
   570         durationTPtr.Append( separator );
       
   571         durationTPtr += KMPXZeroDurationMark;
       
   572         }
       
   573     else
       
   574         {
       
   575         // Convert track duration to text
       
   576         duration = iCommonUiHelper->DisplayableDurationL(
       
   577             aTotalLengthInSeconds );
       
   578         CleanupStack::PushL( duration );
       
   579         }
       
   580 
       
   581     labelText = StringLoader::LoadLC(
       
   582         R_MPX_PBV_TRACK_DURATION_FORMAT,
       
   583         *duration );
       
   584 
       
   585     CleanupStack::PopAndDestroy( labelText );
       
   586     CleanupStack::PopAndDestroy( duration );
       
   587     }
       
   588 
       
   589 // ---------------------------------------------------------------------------
       
   590 // Force softkey label colors to what is specified in skin
       
   591 // for Music Player soft keys.
       
   592 // ---------------------------------------------------------------------------
       
   593 //
       
   594 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateSoftkeyColors()
       
   595     {
       
   596     CEikButtonGroupContainer* cbgc = CEikButtonGroupContainer::Current();
       
   597     MEikButtonGroup* bg = NULL;
       
   598     if ( cbgc )
       
   599         {
       
   600         bg = cbgc->ButtonGroup();
       
   601         }
       
   602 
       
   603     if ( bg )
       
   604         {
       
   605         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   606 
       
   607         TRgb color = KRgbBlack;
       
   608         CCoeControl* lsk = cbgc->ControlOrNull(
       
   609             bg->CommandId( KMPXCbaLeftSoftkeyPos ) );
       
   610         if ( lsk )
       
   611             {
       
   612             // Color is not updated if it not found from the skin
       
   613             if (!AknsUtils::GetCachedColor(
       
   614                 skin, color, KAknsIIDQsnTextColors,
       
   615                 EAknsCIQsnTextColorsCG47 ) )
       
   616                 {
       
   617                 TRAP_IGNORE(
       
   618                     AknLayoutUtils::OverrideControlColorL( *lsk,
       
   619                     EColorLabelText,
       
   620                     color ) );
       
   621                 }
       
   622             }
       
   623 
       
   624         CCoeControl* rsk = cbgc->ControlOrNull(
       
   625             bg->CommandId( KMPXCbaRightSoftkeyPos ) );
       
   626         if ( rsk )
       
   627             {
       
   628             // Color is not updated if it not found from the skin
       
   629             if ( !AknsUtils::GetCachedColor(
       
   630                 skin, color, KAknsIIDQsnTextColors,
       
   631                 EAknsCIQsnTextColorsCG46 ) )
       
   632                 {
       
   633                 TRAP_IGNORE(
       
   634                     AknLayoutUtils::OverrideControlColorL( *rsk,
       
   635                     EColorLabelText,
       
   636                     color ) );
       
   637                 }
       
   638             }
       
   639         cbgc->DrawDeferred();
       
   640         }
       
   641     }
       
   642 
       
   643 // ---------------------------------------------------------------------------
       
   644 // Handles foreground events
       
   645 // ---------------------------------------------------------------------------
       
   646 //
       
   647 EXPORT_C void CMPXCommonPlaybackViewContainer::HandleForegroundEventL(
       
   648     TBool aForeground )
       
   649     {
       
   650     MPX_FUNC( "CMPXCommonPlaybackViewContainer::HandleForegroundEventL" );
       
   651 
       
   652     iIsForeground = aForeground;
       
   653 
       
   654     if ( !aForeground && iEnableButtons )
       
   655         {
       
   656         // if losing foreground and buttons are enabled
       
   657         iButtonManager->HandleForegroundLostL();
       
   658         }
       
   659 
       
   660     if ( !aForeground && iTouchDown )
       
   661         {
       
   662         // Pointer events
       
   663         SetGloballyCapturing( EFalse );
       
   664         SetPointerCapture( EFalse );
       
   665 
       
   666         iTouchDown = EFalse;
       
   667         }
       
   668 
       
   669 	// Special case: if going to background but still partially visible
       
   670 	if( iActiveView && !aForeground )
       
   671 		{
       
   672 		CAknAppUi* appUi = (CAknAppUi*)CEikonEnv::Static()->AppUi();
       
   673 		if( !appUi->IsFaded() )
       
   674 		    {
       
   675 		    iActiveView = EFalse;
       
   676 		    }
       
   677 		}
       
   678 	else
       
   679 		{
       
   680 		iActiveView = aForeground;
       
   681 		}
       
   682 
       
   683     RefreshProgressBar();
       
   684     }
       
   685 
       
   686 // ---------------------------------------------------------------------------
       
   687 // From MMPXAlbumArtUtilObserver
       
   688 // Notify that extraction of album art started.
       
   689 // ---------------------------------------------------------------------------
       
   690 //
       
   691 EXPORT_C void CMPXCommonPlaybackViewContainer::ExtractAlbumArtStarted()
       
   692     {
       
   693     MPX_DEBUG1("CMPXCommonPlaybackViewContainer::ExtractAlbumArtStarted(): Entering");
       
   694 
       
   695     MPX_DEBUG1("CMPXCommonPlaybackViewContainer::ExtractAlbumArtStarted(): Exiting");
       
   696     }
       
   697 
       
   698 
       
   699 // ---------------------------------------------------------------------------
       
   700 // From MMPXAlbumArtUtilObserver
       
   701 // Album art is extracted from file and ready to use.
       
   702 // ---------------------------------------------------------------------------
       
   703 //
       
   704 EXPORT_C void CMPXCommonPlaybackViewContainer::ExtractAlbumArtCompleted(
       
   705     CFbsBitmap* aBitmap,
       
   706     TInt aErr )
       
   707     {
       
   708     // Here we are making the assumption that if we get an update on album
       
   709     // art, it is Ok to Start displaying the items.
       
   710     iLabels[ETextTrack]->MakeVisible( ETrue );
       
   711     iLabels[ETextArtist]->MakeVisible( ETrue );
       
   712     iLabels[ETextElapsedTime]->MakeVisible( ETrue);
       
   713     iLabels[ETextRemainingTime]->MakeVisible( ETrue);
       
   714     iPrerollCompleted = ETrue;
       
   715 
       
   716     MPX_DEBUG3( "CMPXCommonPlaybackViewContainer::ExtractAlbumArtCompleted(bitmap:0x%x, err:%d)",
       
   717         aBitmap, aErr );
       
   718 
       
   719     delete iTrackAlbumArt;
       
   720     iTrackAlbumArt = NULL;
       
   721 
       
   722     if ( aBitmap && KErrNone == aErr )
       
   723         {
       
   724         iTrackAlbumArt = aBitmap;
       
   725         }
       
   726 
       
   727     DrawDeferred();
       
   728     }
       
   729 
       
   730 // ---------------------------------------------------------------------------
       
   731 // From CCoeControl
       
   732 // Handles key events.
       
   733 // ---------------------------------------------------------------------------
       
   734 //
       
   735 EXPORT_C TKeyResponse CMPXCommonPlaybackViewContainer::OfferKeyEventL(
       
   736     const TKeyEvent& aKeyEvent,
       
   737     TEventCode aType )
       
   738     {
       
   739     MPX_DEBUG4( "CMPXCommonPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
       
   740         aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
       
   741 
       
   742     TKeyResponse response = EKeyWasNotConsumed;
       
   743 
       
   744     if ( iEnableButtons )
       
   745         {
       
   746         response = iButtonManager->OfferKeyEventL( aKeyEvent, aType );
       
   747         if ( response == EKeyWasConsumed )
       
   748             {
       
   749             CWindowGc& gc = SystemGc();
       
   750             gc.Activate( *DrawableWindow() );
       
   751 //            iButtonManager->RedrawIfNeeded(gc);
       
   752             gc.Deactivate();
       
   753             }
       
   754         }
       
   755 
       
   756     if ( response == EKeyWasNotConsumed )
       
   757         {
       
   758 // TODO
       
   759 /*
       
   760         if ( aKeyEvent.iCode == EKeyLeftArrow && !FeatureManager::FeatureSupported(
       
   761                     KFeatureIdSideVolumeKeys ))
       
   762             {
       
   763             iCommandObserver->ProcessCommandL( EMPlayerCmdDecreaseVolume) ;
       
   764             response = EKeyWasConsumed;
       
   765             }
       
   766         else if ( aKeyEvent.iCode == EKeyRightArrow && !FeatureManager::FeatureSupported(
       
   767                     KFeatureIdSideVolumeKeys ))
       
   768             {
       
   769             iCommandObserver->ProcessCommandL( EMPlayerCmdIncreaseVolume );
       
   770             response = EKeyWasConsumed;
       
   771             }
       
   772         else
       
   773             {
       
   774             // Do nothing
       
   775             }
       
   776 */
       
   777         }
       
   778 
       
   779     return response;
       
   780     }
       
   781 
       
   782 // ---------------------------------------------------------------------------
       
   783 // From CCoeControl
       
   784 // Handles a change to the control's resources.
       
   785 // ---------------------------------------------------------------------------
       
   786 //
       
   787 EXPORT_C void CMPXCommonPlaybackViewContainer::HandleResourceChange( TInt aType )
       
   788     {
       
   789     CCoeControl::HandleResourceChange( aType );
       
   790 
       
   791     if ( aType == KAknsMessageSkinChange )
       
   792         {
       
   793         // Reload icons
       
   794         TRAP_IGNORE(
       
   795             {
       
   796             CreateIconsL();
       
   797             } );
       
   798 
       
   799         // Make sure execute layout again
       
   800         iCurrentLayout = TRect();
       
   801         UpdateLayout(); // To make sure AknIconUtils::SetSize() gets called
       
   802         }
       
   803     else if ( aType == KEikDynamicLayoutVariantSwitch )
       
   804         {
       
   805         iLayoutObserver->HandleLayoutChange();
       
   806         }
       
   807     else
       
   808         {
       
   809         // pass
       
   810         }
       
   811     }
       
   812 
       
   813 // ---------------------------------------------------------------------------
       
   814 // From CCoeControl
       
   815 // Gets the control's help context.
       
   816 // ---------------------------------------------------------------------------
       
   817 //
       
   818 EXPORT_C void CMPXCommonPlaybackViewContainer::GetHelpContext(
       
   819     TCoeHelpContext& aContext ) const
       
   820     {
       
   821     aContext.iMajor = KAppUidMusicPlayerX;
       
   822 /*
       
   823     if ( iIsEmbedded )
       
   824         {
       
   825         // TODO: Handle for embedded mode
       
   826         aContext.iContext = KMUS_HLP_PLAYBACK_VIEW;
       
   827         }
       
   828     else
       
   829         {
       
   830         aContext.iContext = KMUS_HLP_PLAYBACK_VIEW;
       
   831         }
       
   832 */
       
   833     }
       
   834 
       
   835 // ---------------------------------------------------------------------------
       
   836 // Starts marquee for a playback label
       
   837 // ---------------------------------------------------------------------------
       
   838 //
       
   839 EXPORT_C void CMPXCommonPlaybackViewContainer::StartMarquee(
       
   840     TMPXPbvTextIndicator aLabel )
       
   841     {
       
   842     MPX_FUNC( "CMPXCommonPlaybackViewContainer::StartMarquee" );
       
   843     ASSERT( aLabel >= 0 && aLabel < iLabels.Count() );
       
   844     CMPXPlaybackViewInfoLabel* label = iLabels[aLabel];
       
   845     if ( label )
       
   846         {
       
   847         if ( label->IsVisible() )
       
   848             {
       
   849             label->StartMarquee();
       
   850             label->DrawDeferred();
       
   851             }
       
   852         }
       
   853     }
       
   854 
       
   855 // ---------------------------------------------------------------------------
       
   856 // Creates labels.
       
   857 // ---------------------------------------------------------------------------
       
   858 //
       
   859 EXPORT_C void CMPXCommonPlaybackViewContainer::CreateLabelsL()
       
   860     {
       
   861     CMPXPlaybackViewInfoLabel* label = NULL;
       
   862 
       
   863     for ( TInt index = 0; index < KLabelCount; ++index )
       
   864         {
       
   865         label = new ( ELeave ) CMPXPlaybackViewInfoLabel();
       
   866         CleanupStack::PushL( label );
       
   867         label->SetContainerWindowL( *this );
       
   868         label->SetTextL( KNullDesC );
       
   869         label->ConstructL(
       
   870             iEnableMarquee && ( index == ETextTrack ) );
       
   871 
       
   872         label->SetBackground( iBackground );
       
   873         User::LeaveIfError( iLabels.Append( label ) );
       
   874         CleanupStack::Pop( label );
       
   875         }
       
   876     }
       
   877 
       
   878 // ---------------------------------------------------------------------------
       
   879 // Creates icons.
       
   880 // ---------------------------------------------------------------------------
       
   881 //
       
   882 EXPORT_C void CMPXCommonPlaybackViewContainer::CreateIconsL()
       
   883     {
       
   884     FreeIcons();
       
   885 
       
   886     // Play/stop/pause icons
       
   887     iPlayIcon =
       
   888         iLayout->GetIndicatorIconMaskL( EIconPlay );
       
   889     iPauseIcon =
       
   890         iLayout->GetIndicatorIconMaskL(EIconPause );
       
   891 
       
   892     // Repeat, random, etc
       
   893     iRepeatAllIcon =
       
   894         iLayout->GetIndicatorIconMaskL( EIconRepeatAll );
       
   895     iRepeatOneIcon =
       
   896         iLayout->GetIndicatorIconMaskL( EIconRepeatOne );
       
   897     iRandomIcon =
       
   898         iLayout->GetIndicatorIconMaskL( EIconRandom );
       
   899 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
   900     iRealIcon =
       
   901         iLayout->GetIndicatorIconMaskL( EIconReal );
       
   902 #endif
       
   903 
       
   904     // Download slider
       
   905     iDownloadSlider = iLayout->GetIndicatorIconMaskL(
       
   906         EDownloadSlider );
       
   907     iPlaybackSlider = iLayout->GetIndicatorIconMaskL(
       
   908         EPlaybackSlider );
       
   909     iSliderBackground = iLayout->GetIndicatorIconMaskL(
       
   910         ESliderBackground );
       
   911 
       
   912     // Default album art
       
   913     iDefaultAlbumArt = iLayout->GetIndicatorIconMaskL(
       
   914         EAlbumArtArea );
       
   915     }
       
   916 
       
   917 // ---------------------------------------------------------------------------
       
   918 // Deletes all icon objects.
       
   919 // ---------------------------------------------------------------------------
       
   920 //
       
   921 EXPORT_C void CMPXCommonPlaybackViewContainer::FreeIcons()
       
   922     {
       
   923     delete iPauseIcon;
       
   924     iPauseIcon = NULL;
       
   925     delete iPlayIcon;
       
   926     iPlayIcon = NULL;
       
   927     delete iRandomIcon;
       
   928     iRandomIcon = NULL;
       
   929     delete iRepeatOneIcon;
       
   930     iRepeatOneIcon = NULL;
       
   931     delete iRepeatAllIcon;
       
   932     iRepeatAllIcon = NULL;
       
   933     delete iDownloadSlider;
       
   934     iDownloadSlider = NULL;
       
   935     delete iPlaybackSlider;
       
   936     iPlaybackSlider = NULL;
       
   937     delete iSliderBackground;
       
   938     iSliderBackground = NULL;
       
   939     delete iDefaultAlbumArt;
       
   940     iDefaultAlbumArt = NULL;
       
   941 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
   942     delete iRealIcon;
       
   943     iRealIcon = NULL;
       
   944 #endif
       
   945     }
       
   946 
       
   947 // ---------------------------------------------------------------------------
       
   948 // Draw an icon
       
   949 // ---------------------------------------------------------------------------
       
   950 //
       
   951 EXPORT_C void CMPXCommonPlaybackViewContainer::DrawIndicator(
       
   952     CWindowGc& aGc ,
       
   953     const TRect& aDirtyRect,
       
   954     const TRect& aIndicatorRect,
       
   955     const CGulIcon* aIcon,
       
   956     TBool aInvertMask ) const
       
   957     {
       
   958     if ( aIcon && aIndicatorRect.Intersects( aDirtyRect ) )
       
   959         {
       
   960         aGc.BitBltMasked(
       
   961             aIndicatorRect.iTl,
       
   962             aIcon->Bitmap(),
       
   963             TRect( aIndicatorRect.Size() ),
       
   964             aIcon->Mask(),
       
   965             aInvertMask );
       
   966         }
       
   967     }
       
   968 
       
   969 // ---------------------------------------------------------------------------
       
   970 // Redraw part of the screen.
       
   971 // ---------------------------------------------------------------------------
       
   972 //
       
   973 EXPORT_C void CMPXCommonPlaybackViewContainer::RedrawRect(
       
   974     const TRect& aRect) const
       
   975     {
       
   976 	CWindowGc& gc = SystemGc();
       
   977     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   978 
       
   979 	AknsDrawUtils::Background( skin, iBackground,
       
   980 			this, gc, aRect );
       
   981 
       
   982     TBool embedded = iEikonEnv->StartedAsServerApp();
       
   983 
       
   984     if ( iPrerollCompleted )
       
   985         {
       
   986         if ( iRepeatAllMode && !embedded )
       
   987             {
       
   988             DrawIndicator( gc, aRect, iRepeatIconRect, iRepeatAllIcon );
       
   989             }
       
   990 
       
   991         if ( iRepeatOneMode && !embedded )
       
   992             {
       
   993             DrawIndicator(gc, aRect, iRepeatIconRect, iRepeatOneIcon);
       
   994             }
       
   995 
       
   996         if ( iRandomMode && !embedded )
       
   997             {
       
   998             DrawIndicator(gc, aRect, iRandomIconRect, iRandomIcon);
       
   999             }
       
  1000 
       
  1001 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
  1002         if ( iRealAudioMode )
       
  1003             {
       
  1004             DrawIndicator( gc, aRect, iRealIconRect, iRealIcon );
       
  1005             }
       
  1006 #endif
       
  1007 
       
  1008         DrawIndicator( gc, aRect, iSliderBackgroundRect, iSliderBackground );
       
  1009         if ( iMode == EPlayMode || iMode == EPauseMode )
       
  1010             {
       
  1011 
       
  1012             DrawIndicator( gc, aRect, TRect(iDownloadSliderRect.iTl,
       
  1013                     iDownloadSlider->Bitmap()->SizeInPixels()),
       
  1014                     iDownloadSlider );
       
  1015             DrawIndicator(gc, aRect, TRect(iPlaybackSliderRect.iTl,
       
  1016                     iPlaybackSlider->Bitmap()->SizeInPixels() ),
       
  1017                     iPlaybackSlider );
       
  1018             }
       
  1019 
       
  1020         if ( iDisplayAlbumArt && aRect.Intersects( iAlbumArtRect ) )
       
  1021             {
       
  1022             if ( iTrackAlbumArt )
       
  1023                 {
       
  1024                 // Draw album art and frame
       
  1025                 gc.DrawBitmap( iAlbumArtRect, iTrackAlbumArt, iTrackAlbumArt->SizeInPixels() );
       
  1026                 
       
  1027                 TRgb color = KRgbBlack;
       
  1028                 AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
       
  1029                         EAknsCIQsnTextColorsCG50 );
       
  1030                 gc.SetPenStyle( CGraphicsContext::ESolidPen );
       
  1031                 gc.SetBrushStyle( CGraphicsContext::ENullBrush );
       
  1032                 gc.SetPenColor( color );
       
  1033                 gc.DrawRect( iAlbumArtRect );                    
       
  1034                 }
       
  1035             else
       
  1036                 {
       
  1037                 DrawIndicator( gc, aRect, iAlbumArtRect, iDefaultAlbumArt );
       
  1038                 }
       
  1039             }
       
  1040         }
       
  1041     }
       
  1042 
       
  1043 // ---------------------------------------------------------------------------
       
  1044 // Update progress bar graphics based on current playback
       
  1045 // and download position.
       
  1046 // ---------------------------------------------------------------------------
       
  1047 //
       
  1048 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateProgressBarGraphics()
       
  1049     {
       
  1050     MPX_FUNC("CMPXCommonPlaybackViewContainer::UpdateProgressBarGraphics()");
       
  1051     TSize downloadBarSize = iDownloadSliderRect.Size();
       
  1052     TSize playbackBarSize = iPlaybackSliderRect.Size();
       
  1053 
       
  1054     downloadBarSize.iWidth *= iDownloadRatio;
       
  1055     playbackBarSize.iWidth *= iPlaybackRatio;
       
  1056 
       
  1057     AknIconUtils::SetSize(
       
  1058         iDownloadSlider->Bitmap(),
       
  1059         downloadBarSize,
       
  1060         EAspectRatioNotPreserved );
       
  1061     AknIconUtils::SetSize(
       
  1062         iPlaybackSlider->Bitmap(),
       
  1063         playbackBarSize,
       
  1064         EAspectRatioNotPreserved );
       
  1065     }
       
  1066 
       
  1067 // ---------------------------------------------------------------------------
       
  1068 // Update progress bar graphics and redraw.
       
  1069 // Refresh happens only when backlight is ON and
       
  1070 // the UI is in foreground.
       
  1071 // Note: Some display types may not need backlight. In that case
       
  1072 // code may need to be adjusted accordingly.
       
  1073 // ---------------------------------------------------------------------------
       
  1074 //
       
  1075 EXPORT_C void CMPXCommonPlaybackViewContainer::RefreshProgressBar()
       
  1076     {
       
  1077     MPX_FUNC( "CMPXCommonPlaybackViewContainer::RefreshProgressBar" );
       
  1078 
       
  1079     MPX_DEBUG2(" iIsForeground : (%d)", iIsForeground);
       
  1080     MPX_DEBUG2(" iLightStatus : (%d)", iLightStatus);
       
  1081 
       
  1082     if ( iIsForeground && (iLightStatus == CHWRMLight::ELightOn) )
       
  1083 		{
       
  1084 		UpdateProgressBarGraphics();
       
  1085 		Window().Invalidate( iSliderPaneRect );
       
  1086 		}
       
  1087     }
       
  1088 
       
  1089 // ---------------------------------------------------------------------------
       
  1090 // Update label text color according to skin
       
  1091 // ---------------------------------------------------------------------------
       
  1092 //
       
  1093 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateLabelColorsL()
       
  1094     {
       
  1095     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1096     TRgb color = KRgbBlack;
       
  1097     // Color is not updated if it not found from the skin
       
  1098     AknsUtils::GetCachedColor(
       
  1099         skin,
       
  1100         color,
       
  1101         KAknsIIDQsnTextColors,
       
  1102         EAknsCIQsnTextColorsCG6 );
       
  1103 
       
  1104     for ( TInt i = 0; i < iLabels.Count(); i++ )
       
  1105         {
       
  1106         AknLayoutUtils::OverrideControlColorL(
       
  1107             *iLabels[i],
       
  1108             EColorLabelText,
       
  1109             color );
       
  1110         }
       
  1111     }
       
  1112 
       
  1113 // ---------------------------------------------------------------------------
       
  1114 // Update skin control context for background
       
  1115 // ---------------------------------------------------------------------------
       
  1116 //
       
  1117 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateBackgroundSkinControlContext(
       
  1118     const TRect& aRect )
       
  1119     {
       
  1120     CAknsBasicBackgroundControlContext* background =
       
  1121         static_cast<CAknsBasicBackgroundControlContext*>( iBackground );
       
  1122     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1123         {
       
  1124         TAknWindowLineLayout screenLayout =
       
  1125             AknLayout::screen();
       
  1126         TRect screenRect = screenLayout.Rect();
       
  1127         background->SetBitmap( KAknsIIDQsnBgAreaMain );
       
  1128         background->SetRect( screenRect );
       
  1129 
       
  1130         }
       
  1131     else
       
  1132         {
       
  1133         background->SetBitmap( KAknsIIDQsnBgAreaMain );
       
  1134         background->SetRect( aRect );
       
  1135         }
       
  1136 
       
  1137     }
       
  1138 
       
  1139 // ---------------------------------------------------------------------------
       
  1140 // Set FMTX mode.
       
  1141 // FMTX label shouldn't appear in some playback views
       
  1142 // ---------------------------------------------------------------------------
       
  1143 //
       
  1144 EXPORT_C void CMPXCommonPlaybackViewContainer::SetFMTXMode(
       
  1145     TBool aFMTXMode )
       
  1146     {
       
  1147 	if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
       
  1148 		{
       
  1149 	    iFMTXMode = aFMTXMode;
       
  1150 		}
       
  1151     }
       
  1152 
       
  1153 // ---------------------------------------------------------------------------
       
  1154 // From CCoeControl
       
  1155 // Responds to changes to the size and position of the contents of this
       
  1156 // control.
       
  1157 // ---------------------------------------------------------------------------
       
  1158 //
       
  1159 EXPORT_C void CMPXCommonPlaybackViewContainer::SizeChanged()
       
  1160     {
       
  1161     MPX_FUNC("CMPXCommonPlaybackViewContainer::SizeChanged()");
       
  1162     UpdateLayout();
       
  1163     UpdateBackgroundSkinControlContext( Rect() );
       
  1164     }
       
  1165 
       
  1166 // ---------------------------------------------------------------------------
       
  1167 // From CCoeControl
       
  1168 // Gets the number of controls contained in a compound control.
       
  1169 // ---------------------------------------------------------------------------
       
  1170 //
       
  1171 EXPORT_C TInt CMPXCommonPlaybackViewContainer::CountComponentControls() const
       
  1172     {
       
  1173     if(iPrerollCompleted)
       
  1174         {
       
  1175         return KLabelCount + 1; // ButtonManager
       
  1176         }
       
  1177     else
       
  1178         {
       
  1179         return 0;
       
  1180         }
       
  1181    }
       
  1182 // ---------------------------------------------------------------------------
       
  1183 // From CCoeControl
       
  1184 // Gets an indexed component of a compound control.
       
  1185 // ---------------------------------------------------------------------------
       
  1186 //
       
  1187 EXPORT_C CCoeControl* CMPXCommonPlaybackViewContainer::ComponentControl( TInt aIndex ) const
       
  1188     {
       
  1189     CCoeControl* control = NULL;
       
  1190     if(iPrerollCompleted)
       
  1191         {
       
  1192         if (aIndex < KLabelCount)
       
  1193             {
       
  1194             control = iLabels[aIndex];
       
  1195             }
       
  1196         else
       
  1197             {
       
  1198             control = iButtonManager;
       
  1199             }
       
  1200         }
       
  1201 
       
  1202     return control;
       
  1203     }
       
  1204 
       
  1205 // ---------------------------------------------------------------------------
       
  1206 // From CCoeControl
       
  1207 // Draws the control.
       
  1208 // ---------------------------------------------------------------------------
       
  1209 //
       
  1210 EXPORT_C void CMPXCommonPlaybackViewContainer::Draw( const TRect& aRect ) const
       
  1211     {
       
  1212     RedrawRect(aRect);
       
  1213     }
       
  1214 
       
  1215 // -----------------------------------------------------------------------------
       
  1216 // CMPXCommonPlaybackViewContainer::HandleButtonCommandL
       
  1217 // -----------------------------------------------------------------------------
       
  1218 //
       
  1219 EXPORT_C void CMPXCommonPlaybackViewContainer::HandleButtonCommandL( TInt aCommand )
       
  1220     {
       
  1221     MPX_DEBUG2("CMPXCommonPlaybackViewContainer::HandleButtonCommandL(%d) entering", aCommand);
       
  1222     if ( iCommandObserver )
       
  1223         {
       
  1224         iCommandObserver->ProcessCommandL( aCommand );
       
  1225         }
       
  1226     MPX_DEBUG1("CMPXCommonPlaybackViewContainer::HandleButtonCommandL() exiting");
       
  1227     }
       
  1228 
       
  1229 // ---------------------------------------------------------------------------
       
  1230 // CMPXCommonPlaybackViewContainer::HandlePointerEventL
       
  1231 // ---------------------------------------------------------------------------
       
  1232 //
       
  1233 EXPORT_C void CMPXCommonPlaybackViewContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
  1234     {
       
  1235     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL" );
       
  1236     if(AknLayoutUtils::PenEnabled())
       
  1237         {
       
  1238         TSize playbackBarSize = iPlaybackSliderRect.Size();
       
  1239         TReal width;
       
  1240         switch( aPointerEvent.iType )
       
  1241             {
       
  1242             case TPointerEvent::EButton1Down:
       
  1243                 {
       
  1244                 if ( iSliderPaneRect.Contains(aPointerEvent.iPosition) &&
       
  1245                         ( iMode == EPlayMode || iMode == EPauseMode ))
       
  1246                     {
       
  1247                     // Pointer events
       
  1248                     SetGloballyCapturing( ETrue );
       
  1249                     SetPointerCapture( ETrue );
       
  1250 
       
  1251                     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL btnDOWN" );
       
  1252                     iTouchDown = ETrue;
       
  1253                     width = aPointerEvent.iPosition.iX - iSliderBackgroundRect.iTl.iX;
       
  1254                     playbackBarSize.iWidth = width;
       
  1255                     AknIconUtils::SetSize(
       
  1256                         iPlaybackSlider->Bitmap(),
       
  1257                         playbackBarSize,
       
  1258                         EAspectRatioNotPreserved );
       
  1259                     }
       
  1260                 if ( iAlbumArtRect.Contains(aPointerEvent.iPosition ) )
       
  1261                     {
       
  1262                     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1263                     if (feedback)
       
  1264                         {
       
  1265                         feedback->InstantFeedback(ETouchFeedbackPopUp);
       
  1266                         }
       
  1267 
       
  1268                     if ( iCommandObserver )
       
  1269         								{
       
  1270                         iCommandObserver->ProcessCommandL( EMPXCmdVolumeChanged );
       
  1271                         }
       
  1272                     }
       
  1273                 break;
       
  1274                 }
       
  1275 
       
  1276             case TPointerEvent::EDrag:
       
  1277                 {
       
  1278                 if(iTouchDown && ( iMode == EPlayMode || iMode == EPauseMode ) )
       
  1279                     {
       
  1280                     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL ****btnDrag****" );
       
  1281 
       
  1282                     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1283                     if (feedback)
       
  1284                         {
       
  1285                         feedback->InstantFeedback(ETouchFeedbackSensitive);
       
  1286                         }
       
  1287 
       
  1288                     if (aPointerEvent.iPosition.iX <= iSliderBackgroundRect.iTl.iX)
       
  1289                         {
       
  1290                         width = 0;
       
  1291                         }
       
  1292                     else if (aPointerEvent.iPosition.iX >= iSliderBackgroundRect.iBr.iX)
       
  1293                         {
       
  1294                         width = iSliderBackgroundRect.iBr.iX - iSliderBackgroundRect.iTl.iX;
       
  1295                         }
       
  1296                     else
       
  1297                         {
       
  1298                         width = aPointerEvent.iPosition.iX - iSliderBackgroundRect.iTl.iX;
       
  1299                         }
       
  1300 
       
  1301                     playbackBarSize.iWidth = width;
       
  1302                     AknIconUtils::SetSize(
       
  1303                         iPlaybackSlider->Bitmap(),
       
  1304                         playbackBarSize,
       
  1305                         EAspectRatioNotPreserved );
       
  1306 
       
  1307                     // Update the ellapsed and remaining time texts for user feedback
       
  1308                     TReal totalWidth = iPlaybackSliderRect.Width();
       
  1309                     TReal ratio = width/totalWidth;
       
  1310                     TInt newSongPositionInSec = ratio * iTrackTotalLengthInSeconds;
       
  1311                                 CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode =
       
  1312                     CMPXCommonUiHelper::EMPXDuratAuto;
       
  1313                     if ( iTrackTotalLengthInSeconds > KOneHourInSeconds )
       
  1314                         {
       
  1315                         durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
       
  1316                         }
       
  1317 
       
  1318                     // Convert ellapsed time to text
       
  1319                     HBufC* position = iCommonUiHelper->DisplayableDurationL(
       
  1320                         newSongPositionInSec,
       
  1321                         durationMode );
       
  1322                     CleanupStack::PushL( position );
       
  1323 
       
  1324                     TInt remainingTime = iTrackTotalLengthInSeconds - newSongPositionInSec;
       
  1325                     if ( remainingTime < 0 )
       
  1326                         {
       
  1327                         remainingTime = 0;
       
  1328                         }
       
  1329 
       
  1330                     // Convert remaining time to text
       
  1331                     HBufC* remaining = iCommonUiHelper->DisplayableDurationL(
       
  1332                         remainingTime,
       
  1333                         durationMode );
       
  1334                     CleanupStack::PushL( remaining );
       
  1335 
       
  1336                     UpdateLabelL( ETextElapsedTime, *position );
       
  1337                     UpdateLabelL( ETextRemainingTime, *remaining );
       
  1338                     CleanupStack::PopAndDestroy( remaining );
       
  1339                     CleanupStack::PopAndDestroy( position );
       
  1340 
       
  1341                     // Invalidate rect so it will be redrawn immediately
       
  1342                     Window().Invalidate( iSliderPaneRect );
       
  1343                     }
       
  1344                 else
       
  1345                     {
       
  1346                     SetGloballyCapturing( EFalse );
       
  1347                     SetPointerCapture( EFalse );
       
  1348                     iTouchDown = EFalse;
       
  1349                     }
       
  1350                 break;
       
  1351                 }
       
  1352 
       
  1353             case TPointerEvent::EButton1Up:
       
  1354                 {
       
  1355                 MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL btnUP" );
       
  1356                 if(iTouchDown)
       
  1357                     {
       
  1358                     // Pointer events
       
  1359                     SetGloballyCapturing( EFalse );
       
  1360                     SetPointerCapture( EFalse );
       
  1361                     if ( ( iMode == EPlayMode || iMode == EPauseMode ) )
       
  1362                         {
       
  1363                         iTouchDown = EFalse;
       
  1364                         if ( aPointerEvent.iPosition.iX
       
  1365                                 <= iSliderBackgroundRect.iTl.iX )
       
  1366                             {
       
  1367                             width = 0;
       
  1368                             }
       
  1369                         else if ( aPointerEvent.iPosition.iX
       
  1370                                 >= iSliderBackgroundRect.iBr.iX )
       
  1371                             {
       
  1372                             width = iSliderBackgroundRect.iBr.iX
       
  1373                                     - iSliderBackgroundRect.iTl.iX;
       
  1374                             }
       
  1375                         else
       
  1376                             {
       
  1377                             width = aPointerEvent.iPosition.iX
       
  1378                                     - iSliderBackgroundRect.iTl.iX;
       
  1379                             }
       
  1380                         playbackBarSize.iWidth = width;
       
  1381                         AknIconUtils::SetSize( iPlaybackSlider->Bitmap(),
       
  1382                                 playbackBarSize, EAspectRatioNotPreserved );
       
  1383 
       
  1384                         // Set new song position based upon progress bar location
       
  1385                         TReal totalWidth = iPlaybackSliderRect.Width();
       
  1386                         TReal ratio = width / totalWidth;
       
  1387                         iNewSongPosition = (ratio
       
  1388                                 * iTrackTotalLengthInSeconds) * 1000;
       
  1389 
       
  1390                         // Invalidate rect so it will be redrawn immediately
       
  1391 					    Window().Invalidate( iSliderPaneRect );
       
  1392 					    iSeekTimer->Cancel();
       
  1393 					    iSeekTimer->Start( KSeekDelay, KSeekDelay, TCallBack( CallSetPosition, this ) );
       
  1394 					    iDragProgressBar = ETrue;
       
  1395                         }
       
  1396                     }
       
  1397                 break;
       
  1398                 }
       
  1399 
       
  1400             default:
       
  1401                 {
       
  1402                 MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL default" );
       
  1403                 break;
       
  1404                 }
       
  1405             }
       
  1406         }
       
  1407     }
       
  1408 
       
  1409 // ---------------------------------------------------------------------------
       
  1410 // CMPXCommonPlaybackViewContainer::GetNewSongPosition
       
  1411 // ---------------------------------------------------------------------------
       
  1412 //
       
  1413 EXPORT_C TInt CMPXCommonPlaybackViewContainer::GetNewSongPosition()
       
  1414     {
       
  1415     return iNewSongPosition;
       
  1416     }
       
  1417 
       
  1418 // -----------------------------------------------------------------------------
       
  1419 // CMPXCommonPlaybackViewContainer::LightStatusChanged
       
  1420 // -----------------------------------------------------------------------------
       
  1421 //
       
  1422 EXPORT_C void CMPXCommonPlaybackViewContainer::LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus )
       
  1423     {
       
  1424     MPX_FUNC( "CMPXCommonPlaybackViewContainer::LightStatusChanged" );
       
  1425     if ( aTarget == CHWRMLight::EPrimaryDisplay )
       
  1426         {
       
  1427 		MPX_DEBUG2(" LightStatusChanged: (%d)", aStatus);
       
  1428 		if ( ( aStatus == CHWRMLight::ELightOn || aStatus == CHWRMLight::ELightOff ) && aStatus != iLightStatus )
       
  1429 	    	{
       
  1430 			iLightStatus = aStatus;
       
  1431 			}
       
  1432         }
       
  1433     }
       
  1434 
       
  1435 // ---------------------------------------------------------------------------
       
  1436 // CMPXCommonPlaybackViewContainer::SetNewSongPosition
       
  1437 // ---------------------------------------------------------------------------
       
  1438 //
       
  1439 void CMPXCommonPlaybackViewContainer::SetNewSongPosition( const TInt64& aPositon )
       
  1440     {
       
  1441     iNewSongPosition = aPositon;
       
  1442     }
       
  1443 
       
  1444 // ---------------------------------------------------------------------------
       
  1445 // Helper function to set layout for all elements and set sizes for icons.
       
  1446 // ---------------------------------------------------------------------------
       
  1447 //
       
  1448 void CMPXCommonPlaybackViewContainer::DoUpdateLayoutL()
       
  1449     {
       
  1450     TRect myRect = Rect();
       
  1451     if ( myRect == iCurrentLayout )
       
  1452         {
       
  1453         // Layout has not changed, do nothing
       
  1454         return;
       
  1455         }
       
  1456 
       
  1457 
       
  1458     MPX_DEBUG5( "CMPXCommonPlaybackViewContainer::DoUpdateLayoutL() -- new layout: top-left (%d, %d) size (%d, %d)",
       
  1459         myRect.iTl.iX, myRect.iTl.iY, myRect.Size().iWidth, myRect.Size().iHeight );
       
  1460 
       
  1461     // Get layout data
       
  1462     iSliderPaneRect = iLayout->IndicatorLayout(
       
  1463         myRect, ESliderPane );
       
  1464     iLayout->LayoutLabel(
       
  1465         iLabels[ETextElapsedTime], iSliderPaneRect, ETextElapsedTime );
       
  1466     iLayout->LayoutLabel(
       
  1467         iLabels[ETextRemainingTime], iSliderPaneRect, ETextRemainingTime );
       
  1468     iLayout->LayoutLabel(
       
  1469         iLabels[ETextArtist], myRect, ETextArtist );
       
  1470     iLayout->LayoutLabel(
       
  1471         iLabels[ETextTrack], myRect, ETextTrack );
       
  1472     iLayout->LayoutLabel(
       
  1473         iLabels[ETextPlaylistCount], myRect, ETextPlaylistCount );
       
  1474     //iLayout->LayoutLabel(
       
  1475     //    iLabels[ETextEmpty], myRect, ETextEmpty );
       
  1476     // suppress download text per UI spec
       
  1477     //iLayout->LayoutLabel(
       
  1478     //    iLabels[ETextDownloadState], iSliderPaneRect, ETextDownloadState );
       
  1479 
       
  1480    	if ( iFMTXMode )
       
  1481        	{
       
  1482        	iLayout->LayoutLabel(
       
  1483            	iLabels[ETextFMFrequency], myRect, ETextFMFrequency );
       
  1484        	}
       
  1485 
       
  1486     // Check if the artist and title rects intersect, if so move them
       
  1487     TRect titleRect = iLabels[ETextTrack]->Rect();
       
  1488     TRect artistRect = iLabels[ETextArtist]->Rect();
       
  1489     if ( titleRect.Intersects( artistRect ))
       
  1490         {
       
  1491         TRect intersection = titleRect;
       
  1492         intersection.Intersection( artistRect );
       
  1493         TInt diff = -(intersection.Height());
       
  1494         iLayout->LayoutLabel(
       
  1495             iLabels[ETextTrack], myRect, ETextTrack, 0, diff );
       
  1496         }
       
  1497 
       
  1498     iIconLayout = iLayout->IndicatorLayout( myRect, EIconPlay );
       
  1499     iRandomIconRect = iLayout->IndicatorLayout( myRect, EIconRandom );
       
  1500     iRepeatIconRect = iLayout->IndicatorLayout( myRect, EIconRepeatAll );
       
  1501     iBackgroundLayout = myRect;
       
  1502 
       
  1503     iDownloadSliderRect = iLayout->IndicatorLayout(
       
  1504         iSliderPaneRect, EDownloadSlider );
       
  1505     iPlaybackSliderRect = iLayout->IndicatorLayout(
       
  1506         iSliderPaneRect, EPlaybackSlider );
       
  1507     iSliderBackgroundRect = iLayout->IndicatorLayout(
       
  1508         iSliderPaneRect, ESliderBackground );
       
  1509 
       
  1510     iAlbumArtRect = iLayout->IndicatorLayout(
       
  1511         myRect, EAlbumArtArea );
       
  1512 
       
  1513 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
  1514     iRealIconRect = iLayout->IndicatorLayout( myRect, EIconReal );
       
  1515 #endif
       
  1516 
       
  1517     // Scale icons
       
  1518     if ( iPauseIcon )
       
  1519         {
       
  1520         AknIconUtils::SetSize(
       
  1521             iPauseIcon->Bitmap(), iIconLayout.Size() );
       
  1522         }
       
  1523     if ( iPlayIcon )
       
  1524         {
       
  1525         AknIconUtils::SetSize(
       
  1526             iPlayIcon->Bitmap(), iIconLayout.Size() );
       
  1527         }
       
  1528     if ( iRandomIcon )
       
  1529         {
       
  1530         AknIconUtils::SetSize(
       
  1531             iRandomIcon->Bitmap(), iRandomIconRect.Size() );
       
  1532         }
       
  1533     if ( iRepeatAllIcon )
       
  1534         {
       
  1535         AknIconUtils::SetSize(
       
  1536             iRepeatAllIcon->Bitmap(), iRepeatIconRect.Size() );
       
  1537         }
       
  1538     if ( iRepeatOneIcon )
       
  1539         {
       
  1540         AknIconUtils::SetSize(
       
  1541             iRepeatOneIcon->Bitmap(), iRepeatIconRect.Size() );
       
  1542         }
       
  1543 
       
  1544     if ( iSliderBackground )
       
  1545         {
       
  1546         AknIconUtils::SetSize(
       
  1547             iSliderBackground->Bitmap(),
       
  1548             iSliderBackgroundRect.Size(),
       
  1549             EAspectRatioNotPreserved );
       
  1550         UpdateProgressBarGraphics();
       
  1551         if ( iMode == EPlayMode || iMode == EPauseMode )
       
  1552            {
       
  1553             MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1554             if ( feedback )
       
  1555                 {
       
  1556                 feedback->SetFeedbackArea( this, 0, iSliderPaneRect,
       
  1557                     ETouchFeedbackBasic, ETouchEventStylusDown);
       
  1558                 }
       
  1559            }
       
  1560         }
       
  1561 
       
  1562     if ( iDefaultAlbumArt )
       
  1563         {
       
  1564         AknIconUtils::SetSize(
       
  1565             iDefaultAlbumArt->Bitmap(), iAlbumArtRect.Size() );
       
  1566         }
       
  1567 
       
  1568 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
       
  1569     if (iRealIcon)
       
  1570         {
       
  1571         AknIconUtils::SetSize(
       
  1572              iRealIcon->Bitmap(), iRealIconRect.Size() );
       
  1573         }
       
  1574 #endif
       
  1575 
       
  1576     iCurrentLayout = myRect;
       
  1577 
       
  1578     if ( iEnableButtons )
       
  1579         {
       
  1580         if (iButtonManager)
       
  1581             {
       
  1582             iButtonManager->SetParentRect( myRect );
       
  1583             iButtonManager->SetRect(myRect);
       
  1584             }
       
  1585         }
       
  1586 
       
  1587     // Update label colors according to skin (ignore the color in layout data)
       
  1588     UpdateLabelColorsL();
       
  1589 
       
  1590     // update artist/title labels to use the full length of control
       
  1591     // other controls should not have been clipped in the first place
       
  1592     if ( iLabels[ ETextTrack ]->FullText().Length() > 0 )
       
  1593         {
       
  1594         HBufC* title = iLabels[ ETextTrack ]->FullText().AllocLC();
       
  1595         iLabels[ ETextTrack ]->SetLabelTextL( *title );
       
  1596         CleanupStack::PopAndDestroy( title );
       
  1597         }
       
  1598     if ( iLabels[ ETextArtist ]->FullText().Length() > 0 )
       
  1599         {
       
  1600         HBufC* title = iLabels[ ETextArtist ]->FullText().AllocLC();
       
  1601         iLabels[ ETextArtist ]->SetLabelTextL( *title );
       
  1602         CleanupStack::PopAndDestroy( title );
       
  1603         }
       
  1604 
       
  1605     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::DoUpdateLayoutL() exiting" );
       
  1606     }
       
  1607 
       
  1608 // -----------------------------------------------------------------------------
       
  1609 // CMPXCommonPlaybackViewContainer::ReStoreButtons
       
  1610 // -----------------------------------------------------------------------------
       
  1611 //
       
  1612 void CMPXCommonPlaybackViewContainer::RestoreButtons(
       
  1613     TMPXPlaybackState aState )
       
  1614     {
       
  1615     if ( iEnableButtons )
       
  1616         {
       
  1617         iButtonManager->RestoreButtonStates( aState );
       
  1618         DrawDeferred();
       
  1619         }
       
  1620     }
       
  1621 
       
  1622 TInt CMPXCommonPlaybackViewContainer::CallSetPosition()
       
  1623 	{
       
  1624 	TRAP_IGNORE( HandleButtonCommandL( EMPXPbvCmdPosition ) );
       
  1625 	iSeekTimer->Cancel();
       
  1626 	return 0;
       
  1627 	}
       
  1628 
       
  1629 TInt CMPXCommonPlaybackViewContainer::CallSetPosition( TAny* aAny )
       
  1630 	{
       
  1631 	return ((CMPXCommonPlaybackViewContainer*)aAny)->CallSetPosition();
       
  1632 	}
       
  1633 
       
  1634 // -----------------------------------------------------------------------------
       
  1635 // CMPXCommonPlaybackViewContainer::AdjustOrdinalPosition
       
  1636 // -----------------------------------------------------------------------------
       
  1637 //
       
  1638 void CMPXCommonPlaybackViewContainer::AdjustOrdinalPosition( TInt aNewOrdinalPosition )
       
  1639     {
       
  1640     return Window().SetOrdinalPosition( aNewOrdinalPosition );
       
  1641     }
       
  1642 
       
  1643 // -----------------------------------------------------------------------------
       
  1644 // CMPXCommonPlaybackViewContainer::BeginTransition
       
  1645 // -----------------------------------------------------------------------------
       
  1646 //
       
  1647 void CMPXCommonPlaybackViewContainer::BeginTransition()
       
  1648     {
       
  1649     iTransitionType = EMPXTranstionToRight;
       
  1650     const TInt flags = AknTransEffect::TParameter::EActivateExplicitCancel;
       
  1651     TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
       
  1652     GfxTransEffect::BeginFullScreen( iTransitionType, appRect,
       
  1653             AknTransEffect::EParameterType, AknTransEffect::GfxTransParam(KAppUidMusicPlayerX, flags));
       
  1654 
       
  1655     // start transition immediately. Other option would be to start it when the album thumb has
       
  1656     // been received.
       
  1657     EndTransition();
       
  1658     }
       
  1659 
       
  1660 // -----------------------------------------------------------------------------
       
  1661 // CMPXCommonPlaybackViewContainer::EndTransition
       
  1662 // -----------------------------------------------------------------------------
       
  1663 //
       
  1664 void CMPXCommonPlaybackViewContainer::EndTransition()
       
  1665     {
       
  1666     if( iTransitionType != EMPXTranstionNotDefined )
       
  1667         {
       
  1668         GfxTransEffect::EndFullScreen();
       
  1669         iTransitionType = EMPXTranstionNotDefined;
       
  1670         }
       
  1671     }
       
  1672 
       
  1673 
       
  1674 // -----------------------------------------------------------------------------
       
  1675 // CMPXCommonPlaybackViewContainer::SetTransitionType
       
  1676 // -----------------------------------------------------------------------------
       
  1677 //
       
  1678 void CMPXCommonPlaybackViewContainer::SetTransitionType( TTransitionType aTransitionType )
       
  1679     {
       
  1680 	iTransitionType = aTransitionType;
       
  1681     }
       
  1682 //  End of File