mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewcontainer.cpp
branchRCL_3
changeset 15 171e07ac910f
parent 14 943ff5625028
child 17 c8156a91d13c
equal deleted inserted replaced
14:943ff5625028 15:171e07ac910f
    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>
    56 #include <mpxinternalcrkeys.h>
    57 #include <touchfeedback.h>
    57 #include <touchfeedback.h>
    58 #include <akntranseffect.h>                 // For transition effects
    58 #include <akntranseffect.h>                 // For transition effects
    59 #include <gfxtranseffect\gfxtranseffect.h>  // For transition effects
    59 #include <gfxtranseffect/gfxtranseffect.h>  // For transition effects
    60 
    60 
    61 #include "mpxcommonplaybackviewcontainer.h"
    61 #include "mpxcommonplaybackviewcontainer.h"
    62 #include "mpxcommonplaybackviewlayout.h"
    62 #include "mpxcommonplaybackviewlayout.h"
    63 #include "mpxcommonplaybackview.hrh"
    63 #include "mpxcommonplaybackview.hrh"
    64 #include "mpxplaybackview.hlp.hrh"
    64 #include "mpxplaybackview.hlp.hrh"
   180     iActiveView = ETrue;
   180     iActiveView = ETrue;
   181     iPrerollCompleted = EFalse;
   181     iPrerollCompleted = EFalse;
   182 
   182 
   183     iLightStatus = CHWRMLight::ELightStatusUnknown;
   183     iLightStatus = CHWRMLight::ELightStatusUnknown;
   184     iIsForeground = EFalse ;
   184     iIsForeground = EFalse ;
   185     iLight = CHWRMLight::NewL(this); 
   185     iLight = CHWRMLight::NewL(this);
   186 
   186 
   187 	DrawableWindow()->SetPointerGrab( ETrue );
   187 	DrawableWindow()->SetPointerGrab( ETrue );
   188     EnableDragEvents();
   188     EnableDragEvents();
   189 
   189 
   190     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::ConstructL() exiting" );
   190     MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::ConstructL() exiting" );
   208     delete iMinSecFormatString;
   208     delete iMinSecFormatString;
   209     delete iShortFormatString;
   209     delete iShortFormatString;
   210     delete iCommonUiHelper;
   210     delete iCommonUiHelper;
   211 
   211 
   212     if ( iLight )
   212     if ( iLight )
   213         {        
   213         {
   214         delete iLight;
   214         delete iLight;
   215         iLight = NULL;
   215         iLight = NULL;
   216         }
   216         }
   217 
   217 
   218     delete iButtonManager;
   218     delete iButtonManager;
   717     if ( aBitmap && KErrNone == aErr )
   717     if ( aBitmap && KErrNone == aErr )
   718         {
   718         {
   719         iTrackAlbumArt = aBitmap;
   719         iTrackAlbumArt = aBitmap;
   720         }
   720         }
   721 
   721 
   722     DrawDeferred(); 
   722     DrawDeferred();
   723     //Window().Invalidate( iAlbumArtRect );
   723     //Window().Invalidate( iAlbumArtRect );
   724     //Window().Invalidate( iSliderPaneRect );
   724     //Window().Invalidate( iSliderPaneRect );
   725     }
   725     }
   726 
   726 
   727 // ---------------------------------------------------------------------------
   727 // ---------------------------------------------------------------------------
  1018 
  1018 
  1019         if ( iDisplayAlbumArt && aRect.Intersects( iAlbumArtRect ) )
  1019         if ( iDisplayAlbumArt && aRect.Intersects( iAlbumArtRect ) )
  1020             {
  1020             {
  1021             if ( iTrackAlbumArt )
  1021             if ( iTrackAlbumArt )
  1022                 {
  1022                 {
  1023                 // Calculating the CenterPoint for Drawing the albumart image 
       
  1024                 TSize bmpSizeInPixels = iTrackAlbumArt->SizeInPixels();
       
  1025                 TInt xPos = ( iAlbumArtRect.Width() - bmpSizeInPixels.iWidth )
       
  1026                         / 2;
       
  1027                 TInt yPos =
       
  1028                         ( iAlbumArtRect.Height() - bmpSizeInPixels.iHeight )
       
  1029                                 / 2;
       
  1030                 TPoint Centerpos = TPoint(xPos, yPos );
       
  1031                 // bitmap top left corner position
       
  1032                 Centerpos += iAlbumArtRect.iTl;
       
  1033 
       
  1034                 // Draw album art and frame
  1023                 // Draw album art and frame
  1035                 gc.BitBlt( Centerpos, iTrackAlbumArt);
  1024                 gc.DrawBitmap( iAlbumArtRect, iTrackAlbumArt, iTrackAlbumArt->SizeInPixels() );
       
  1025                 
  1036                 TRgb color = KRgbBlack;
  1026                 TRgb color = KRgbBlack;
  1037                 AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
  1027                 AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
  1038                         EAknsCIQsnTextColorsCG50 );
  1028                         EAknsCIQsnTextColorsCG50 );
  1039                 TRect imageRect( Centerpos, iTrackAlbumArt->SizeInPixels() );
       
  1040                 gc.SetPenStyle( CGraphicsContext::ESolidPen );
  1029                 gc.SetPenStyle( CGraphicsContext::ESolidPen );
  1041                 gc.SetBrushStyle( CGraphicsContext::ENullBrush );
  1030                 gc.SetBrushStyle( CGraphicsContext::ENullBrush );
  1042                 gc.SetPenColor( color );
  1031                 gc.SetPenColor( color );
  1043                 gc.DrawRect( imageRect );
  1032                 gc.DrawRect( iAlbumArtRect );                    
  1044                 }
  1033                 }
  1045             else
  1034             else
  1046                 {
  1035                 {
  1047                 DrawIndicator( gc, aRect, iAlbumArtRect, iDefaultAlbumArt );
  1036                 DrawIndicator( gc, aRect, iAlbumArtRect, iDefaultAlbumArt );
  1048                 }
  1037                 }
  1075     }
  1064     }
  1076 
  1065 
  1077 // ---------------------------------------------------------------------------
  1066 // ---------------------------------------------------------------------------
  1078 // Update progress bar graphics and redraw.
  1067 // Update progress bar graphics and redraw.
  1079 // Refresh happens only when backlight is ON and
  1068 // Refresh happens only when backlight is ON and
  1080 // the UI is in foreground. 
  1069 // the UI is in foreground.
  1081 // Note: Some display types may not need backlight. In that case
  1070 // Note: Some display types may not need backlight. In that case
  1082 // code may need to be adjusted accordingly.
  1071 // code may need to be adjusted accordingly.
  1083 // ---------------------------------------------------------------------------
  1072 // ---------------------------------------------------------------------------
  1084 //
  1073 //
  1085 EXPORT_C void CMPXCommonPlaybackViewContainer::RefreshProgressBar()
  1074 EXPORT_C void CMPXCommonPlaybackViewContainer::RefreshProgressBar()
  1139 
  1128 
  1140         }
  1129         }
  1141     else
  1130     else
  1142         {
  1131         {
  1143         background->SetBitmap( KAknsIIDQsnBgAreaMain );
  1132         background->SetBitmap( KAknsIIDQsnBgAreaMain );
  1144         background->SetRect( aRect );        
  1133         background->SetRect( aRect );
  1145         }
  1134         }
  1146 
  1135 
  1147     }
  1136     }
  1148 
  1137 
  1149 // ---------------------------------------------------------------------------
  1138 // ---------------------------------------------------------------------------
  1187         }
  1176         }
  1188     else
  1177     else
  1189         {
  1178         {
  1190         return 0;
  1179         return 0;
  1191         }
  1180         }
  1192    } 
  1181    }
  1193 // ---------------------------------------------------------------------------
  1182 // ---------------------------------------------------------------------------
  1194 // From CCoeControl
  1183 // From CCoeControl
  1195 // Gets an indexed component of a compound control.
  1184 // Gets an indexed component of a compound control.
  1196 // ---------------------------------------------------------------------------
  1185 // ---------------------------------------------------------------------------
  1197 //
  1186 //
  1250         TReal width;
  1239         TReal width;
  1251         switch( aPointerEvent.iType )
  1240         switch( aPointerEvent.iType )
  1252             {
  1241             {
  1253             case TPointerEvent::EButton1Down:
  1242             case TPointerEvent::EButton1Down:
  1254                 {
  1243                 {
  1255                 if ( iSliderPaneRect.Contains(aPointerEvent.iPosition) && 
  1244                 if ( iSliderPaneRect.Contains(aPointerEvent.iPosition) &&
  1256                         ( iMode == EPlayMode || iMode == EPauseMode ))
  1245                         ( iMode == EPlayMode || iMode == EPauseMode ))
  1257                     {
  1246                     {
  1258                     // Pointer events
  1247                     // Pointer events
  1259                     SetGloballyCapturing( ETrue );
  1248                     SetGloballyCapturing( ETrue );
  1260                     SetPointerCapture( ETrue );
  1249                     SetPointerCapture( ETrue );
  1267                         iPlaybackSlider->Bitmap(),
  1256                         iPlaybackSlider->Bitmap(),
  1268                         playbackBarSize,
  1257                         playbackBarSize,
  1269                         EAspectRatioNotPreserved );
  1258                         EAspectRatioNotPreserved );
  1270                     }
  1259                     }
  1271                 if ( iAlbumArtRect.Contains(aPointerEvent.iPosition ) )
  1260                 if ( iAlbumArtRect.Contains(aPointerEvent.iPosition ) )
  1272                     {                    
  1261                     {
  1273                     MTouchFeedback* feedback = MTouchFeedback::Instance();
  1262                     MTouchFeedback* feedback = MTouchFeedback::Instance();
  1274                     if (feedback)
  1263                     if (feedback)
  1275                         {
  1264                         {
  1276                         feedback->InstantFeedback(ETouchFeedbackBasic);
  1265                         feedback->InstantFeedback(ETouchFeedbackBasic);
  1277                         }                
  1266                         }
  1278                  
  1267 
  1279                     if ( iCommandObserver )
  1268                     if ( iCommandObserver )
  1280         								{
  1269         								{
  1281                         iCommandObserver->ProcessCommandL( EMPXCmdVolumeChanged );
  1270                         iCommandObserver->ProcessCommandL( EMPXCmdVolumeChanged );
  1282                         }
  1271                         }
  1283                     }
  1272                     }
  1435     MPX_FUNC( "CMPXCommonPlaybackViewContainer::LightStatusChanged" );
  1424     MPX_FUNC( "CMPXCommonPlaybackViewContainer::LightStatusChanged" );
  1436     if ( aTarget == CHWRMLight::EPrimaryDisplay )
  1425     if ( aTarget == CHWRMLight::EPrimaryDisplay )
  1437         {
  1426         {
  1438 		MPX_DEBUG2(" LightStatusChanged: (%d)", aStatus);
  1427 		MPX_DEBUG2(" LightStatusChanged: (%d)", aStatus);
  1439 		if ( ( aStatus == CHWRMLight::ELightOn || aStatus == CHWRMLight::ELightOff ) && aStatus != iLightStatus )
  1428 		if ( ( aStatus == CHWRMLight::ELightOn || aStatus == CHWRMLight::ELightOff ) && aStatus != iLightStatus )
  1440 	    	{	
  1429 	    	{
  1441 			iLightStatus = aStatus;
  1430 			iLightStatus = aStatus;
  1442 			}
  1431 			}
  1443         }
  1432         }
  1444     }
  1433     }
  1445 
  1434 
  1617 
  1606 
  1618 // -----------------------------------------------------------------------------
  1607 // -----------------------------------------------------------------------------
  1619 // CMPXCommonPlaybackViewContainer::ReStoreButtons
  1608 // CMPXCommonPlaybackViewContainer::ReStoreButtons
  1620 // -----------------------------------------------------------------------------
  1609 // -----------------------------------------------------------------------------
  1621 //
  1610 //
  1622 void CMPXCommonPlaybackViewContainer::RestoreButtons( 
  1611 void CMPXCommonPlaybackViewContainer::RestoreButtons(
  1623     TMPXPlaybackState aState )
  1612     TMPXPlaybackState aState )
  1624     {
  1613     {
  1625     if ( iEnableButtons )
  1614     if ( iEnableButtons )
  1626         {
  1615         {
  1627         iButtonManager->RestoreButtonStates( aState );
  1616         iButtonManager->RestoreButtonStates( aState );