mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewcontainer.cpp
branchRCL_3
changeset 14 943ff5625028
parent 1 8118492f1bdf
child 15 171e07ac910f
equal deleted inserted replaced
11:13afc0e517bd 14:943ff5625028
    51 #include <mpxcommonplaybackview.rsg>
    51 #include <mpxcommonplaybackview.rsg>
    52 #include <mpxcommonplaybackview.mbg>
    52 #include <mpxcommonplaybackview.mbg>
    53 #include <mpxconstants.h>
    53 #include <mpxconstants.h>
    54 #include <mpxfmtx.rsg> // For FF_FMTX
    54 #include <mpxfmtx.rsg> // For FF_FMTX
    55 #include <mpxappui.hrh>
    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
    56 
    60 
    57 #include "mpxcommonplaybackviewcontainer.h"
    61 #include "mpxcommonplaybackviewcontainer.h"
    58 #include "mpxcommonplaybackviewlayout.h"
    62 #include "mpxcommonplaybackviewlayout.h"
    59 #include "mpxcommonplaybackview.hrh"
    63 #include "mpxcommonplaybackview.hrh"
    60 #include "mpxplaybackview.hlp.hrh"
    64 #include "mpxplaybackview.hlp.hrh"
    61 #include "mpxplaybackviewinfolabel.h"
    65 #include "mpxplaybackviewinfolabel.h"
    62 #include "mpxplaybackviewlayoutinterface.h"
    66 #include "mpxplaybackviewlayoutinterface.h"
    63 #include "mpxlayoutswitchobserver.h"
    67 #include "mpxlayoutswitchobserver.h"
    64 #include "mpxcommonuihelper.h"
    68 #include "mpxcommonuihelper.h"
    65 #include <mpxinternalcrkeys.h>
       
    66 #include "mpxbuttonmanager.h"
    69 #include "mpxbuttonmanager.h"
    67 #include "mpxlog.h"
    70 #include "mpxlog.h"
    68 
       
    69 #include <touchfeedback.h>
       
    70 
    71 
    71 // CONSTANTS
    72 // CONSTANTS
    72 const TInt KLabelCount = ETextCount;
    73 const TInt KLabelCount = ETextCount;
    73 const TInt KMPXMinSecSeparatorIndex = 2;
    74 const TInt KMPXMinSecSeparatorIndex = 2;
    74 
    75 
   177 
   178 
   178     iTouchDown = EFalse;
   179     iTouchDown = EFalse;
   179     iActiveView = ETrue;
   180     iActiveView = ETrue;
   180     iPrerollCompleted = EFalse;
   181     iPrerollCompleted = EFalse;
   181 
   182 
       
   183     iLightStatus = CHWRMLight::ELightStatusUnknown;
       
   184     iIsForeground = EFalse ;
       
   185     iLight = CHWRMLight::NewL(this); 
       
   186 
   182 	DrawableWindow()->SetPointerGrab( ETrue );
   187 	DrawableWindow()->SetPointerGrab( ETrue );
   183     EnableDragEvents();
   188     EnableDragEvents();
   184 
   189 
   185     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::ConstructL() exiting" );
   190     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::ConstructL() exiting" );
   186     }
   191     }
   202     iLabels.ResetAndDestroy();
   207     iLabels.ResetAndDestroy();
   203     delete iMinSecFormatString;
   208     delete iMinSecFormatString;
   204     delete iShortFormatString;
   209     delete iShortFormatString;
   205     delete iCommonUiHelper;
   210     delete iCommonUiHelper;
   206 
   211 
   207 
   212     if ( iLight )
   208 
   213         {        
   209 
   214         delete iLight;
       
   215         iLight = NULL;
       
   216         }
   210 
   217 
   211     delete iButtonManager;
   218     delete iButtonManager;
   212 
   219 
   213    MTouchFeedback* feedback = MTouchFeedback::Instance();
   220    MTouchFeedback* feedback = MTouchFeedback::Instance();
   214    if (feedback)
   221    if (feedback)
   634 //
   641 //
   635 EXPORT_C void CMPXCommonPlaybackViewContainer::HandleForegroundEventL(
   642 EXPORT_C void CMPXCommonPlaybackViewContainer::HandleForegroundEventL(
   636     TBool aForeground )
   643     TBool aForeground )
   637     {
   644     {
   638     MPX_FUNC( "CMPXCommonPlaybackViewContainer::HandleForegroundEventL" );
   645     MPX_FUNC( "CMPXCommonPlaybackViewContainer::HandleForegroundEventL" );
       
   646 
       
   647     iIsForeground = aForeground;
       
   648 
   639     if ( !aForeground && iEnableButtons )
   649     if ( !aForeground && iEnableButtons )
   640         {
   650         {
   641         // if losing foreground and buttons are enabled
   651         // if losing foreground and buttons are enabled
   642         iButtonManager->HandleForegroundLostL();
   652         iButtonManager->HandleForegroundLostL();
   643         }
   653         }
  1045 // and download position.
  1055 // and download position.
  1046 // ---------------------------------------------------------------------------
  1056 // ---------------------------------------------------------------------------
  1047 //
  1057 //
  1048 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateProgressBarGraphics()
  1058 EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateProgressBarGraphics()
  1049     {
  1059     {
       
  1060     MPX_FUNC("CMPXCommonPlaybackViewContainer::UpdateProgressBarGraphics()");
  1050     TSize downloadBarSize = iDownloadSliderRect.Size();
  1061     TSize downloadBarSize = iDownloadSliderRect.Size();
  1051     TSize playbackBarSize = iPlaybackSliderRect.Size();
  1062     TSize playbackBarSize = iPlaybackSliderRect.Size();
  1052 
  1063 
  1053     downloadBarSize.iWidth *= iDownloadRatio;
  1064     downloadBarSize.iWidth *= iDownloadRatio;
  1054     playbackBarSize.iWidth *= iPlaybackRatio;
  1065     playbackBarSize.iWidth *= iPlaybackRatio;
  1063         EAspectRatioNotPreserved );
  1074         EAspectRatioNotPreserved );
  1064     }
  1075     }
  1065 
  1076 
  1066 // ---------------------------------------------------------------------------
  1077 // ---------------------------------------------------------------------------
  1067 // Update progress bar graphics and redraw.
  1078 // Update progress bar graphics and redraw.
       
  1079 // Refresh happens only when backlight is ON and
       
  1080 // the UI is in foreground. 
       
  1081 // Note: Some display types may not need backlight. In that case
       
  1082 // code may need to be adjusted accordingly.
  1068 // ---------------------------------------------------------------------------
  1083 // ---------------------------------------------------------------------------
  1069 //
  1084 //
  1070 EXPORT_C void CMPXCommonPlaybackViewContainer::RefreshProgressBar()
  1085 EXPORT_C void CMPXCommonPlaybackViewContainer::RefreshProgressBar()
  1071     {
  1086     {
  1072     UpdateProgressBarGraphics();
  1087     MPX_FUNC( "CMPXCommonPlaybackViewContainer::RefreshProgressBar" );
  1073     Window().Invalidate( iSliderPaneRect );
  1088 
       
  1089     MPX_DEBUG2(" iIsForeground : (%d)", iIsForeground);
       
  1090     MPX_DEBUG2(" iLightStatus : (%d)", iLightStatus);
       
  1091 
       
  1092     if ( iIsForeground && (iLightStatus == CHWRMLight::ELightOn) )
       
  1093 		{
       
  1094 		UpdateProgressBarGraphics();
       
  1095 		Window().Invalidate( iSliderPaneRect );
       
  1096 		}
  1074     }
  1097     }
  1075 
  1098 
  1076 // ---------------------------------------------------------------------------
  1099 // ---------------------------------------------------------------------------
  1077 // Update label text color according to skin
  1100 // Update label text color according to skin
  1078 // ---------------------------------------------------------------------------
  1101 // ---------------------------------------------------------------------------
  1084     // Color is not updated if it not found from the skin
  1107     // Color is not updated if it not found from the skin
  1085     AknsUtils::GetCachedColor(
  1108     AknsUtils::GetCachedColor(
  1086         skin,
  1109         skin,
  1087         color,
  1110         color,
  1088         KAknsIIDQsnTextColors,
  1111         KAknsIIDQsnTextColors,
  1089         EAknsCIQsnTextColorsCG50 );
  1112         EAknsCIQsnTextColorsCG6 );
  1090 
  1113 
  1091     for ( TInt i = 0; i < iLabels.Count(); i++ )
  1114     for ( TInt i = 0; i < iLabels.Count(); i++ )
  1092         {
  1115         {
  1093         AknLayoutUtils::OverrideControlColorL(
  1116         AknLayoutUtils::OverrideControlColorL(
  1094             *iLabels[i],
  1117             *iLabels[i],
  1401 EXPORT_C TInt CMPXCommonPlaybackViewContainer::GetNewSongPosition()
  1424 EXPORT_C TInt CMPXCommonPlaybackViewContainer::GetNewSongPosition()
  1402     {
  1425     {
  1403     return iNewSongPosition;
  1426     return iNewSongPosition;
  1404     }
  1427     }
  1405 
  1428 
       
  1429 // -----------------------------------------------------------------------------
       
  1430 // CMPXCommonPlaybackViewContainer::LightStatusChanged
       
  1431 // -----------------------------------------------------------------------------
       
  1432 //
       
  1433 EXPORT_C void CMPXCommonPlaybackViewContainer::LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus )
       
  1434     {
       
  1435     MPX_FUNC( "CMPXCommonPlaybackViewContainer::LightStatusChanged" );
       
  1436     if ( aTarget == CHWRMLight::EPrimaryDisplay )
       
  1437         {
       
  1438 		MPX_DEBUG2(" LightStatusChanged: (%d)", aStatus);
       
  1439 		if ( ( aStatus == CHWRMLight::ELightOn || aStatus == CHWRMLight::ELightOff ) && aStatus != iLightStatus )
       
  1440 	    	{	
       
  1441 			iLightStatus = aStatus;
       
  1442 			}
       
  1443         }
       
  1444     }
       
  1445 
  1406 // ---------------------------------------------------------------------------
  1446 // ---------------------------------------------------------------------------
  1407 // CMPXCommonPlaybackViewContainer::SetNewSongPosition
  1447 // CMPXCommonPlaybackViewContainer::SetNewSongPosition
  1408 // ---------------------------------------------------------------------------
  1448 // ---------------------------------------------------------------------------
  1409 //
  1449 //
  1410 void CMPXCommonPlaybackViewContainer::SetNewSongPosition( const TInt64& aPositon )
  1450 void CMPXCommonPlaybackViewContainer::SetNewSongPosition( const TInt64& aPositon )
  1607 //
  1647 //
  1608 void CMPXCommonPlaybackViewContainer::AdjustOrdinalPosition( TInt aNewOrdinalPosition )
  1648 void CMPXCommonPlaybackViewContainer::AdjustOrdinalPosition( TInt aNewOrdinalPosition )
  1609     {
  1649     {
  1610     return Window().SetOrdinalPosition( aNewOrdinalPosition );
  1650     return Window().SetOrdinalPosition( aNewOrdinalPosition );
  1611     }
  1651     }
       
  1652 
       
  1653 // -----------------------------------------------------------------------------
       
  1654 // CMPXCommonPlaybackViewContainer::BeginTransition
       
  1655 // -----------------------------------------------------------------------------
       
  1656 //
       
  1657 void CMPXCommonPlaybackViewContainer::BeginTransition()
       
  1658     {
       
  1659     iTransitionType = EMPXTranstionToRight;
       
  1660     const TInt flags = AknTransEffect::TParameter::EActivateExplicitCancel;
       
  1661     TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
       
  1662     GfxTransEffect::BeginFullScreen( iTransitionType, appRect,
       
  1663             AknTransEffect::EParameterType, AknTransEffect::GfxTransParam(KAppUidMusicPlayerX, flags));
       
  1664 
       
  1665     // start transition immediately. Other option would be to start it when the album thumb has
       
  1666     // been received.
       
  1667     EndTransition();
       
  1668     }
       
  1669 
       
  1670 // -----------------------------------------------------------------------------
       
  1671 // CMPXCommonPlaybackViewContainer::EndTransition
       
  1672 // -----------------------------------------------------------------------------
       
  1673 //
       
  1674 void CMPXCommonPlaybackViewContainer::EndTransition()
       
  1675     {
       
  1676     if( iTransitionType != EMPXTranstionNotDefined )
       
  1677         {
       
  1678         GfxTransEffect::EndFullScreen();
       
  1679         iTransitionType = EMPXTranstionNotDefined;
       
  1680         }
       
  1681     }
       
  1682 
  1612 //  End of File
  1683 //  End of File