videoplayback/videoplaybackcontrols/src/mpxvideoplaybackprogressbar.cpp
branchRCL_3
changeset 12 7f2b2a65da29
parent 11 8970fbd719ec
child 14 55fa1ec415c6
equal deleted inserted replaced
11:8970fbd719ec 12:7f2b2a65da29
    13 *
    13 *
    14 * Description: Progress bar control
    14 * Description: Progress bar control
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: e003sa33#20 %
    18 // Version : %version: 21 %
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include <eikenv.h>
    22 #include <eikenv.h>
    23 #include <gulicon.h>
    23 #include <gulicon.h>
    84     //  Read time format strings from AVKON resource
    84     //  Read time format strings from AVKON resource
    85     //
    85     //
    86     iMinSecFormatString = iEikonEnv->AllocReadResourceL(R_QTN_TIME_DURAT_MIN_SEC);
    86     iMinSecFormatString = iEikonEnv->AllocReadResourceL(R_QTN_TIME_DURAT_MIN_SEC);
    87     iHourMinSecFormatString = iEikonEnv->AllocReadResourceL(R_QTN_TIME_DURAT_LONG);
    87     iHourMinSecFormatString = iEikonEnv->AllocReadResourceL(R_QTN_TIME_DURAT_LONG);
    88 
    88 
    89 
       
    90 #ifdef RD_TACTILE_FEEDBACK
    89 #ifdef RD_TACTILE_FEEDBACK
    91     iFeedback = MTouchFeedback::Instance();
    90     iFeedback = MTouchFeedback::Instance();
    92 #endif //RD_TACTILE_FEEDBACK
    91 #endif //RD_TACTILE_FEEDBACK
    93 }
    92 }
    94 
    93 
   180         delete iDurationLabel;
   179         delete iDurationLabel;
   181         iDurationLabel = NULL;
   180         iDurationLabel = NULL;
   182     }
   181     }
   183 
   182 
   184 #ifdef RD_TACTILE_FEEDBACK
   183 #ifdef RD_TACTILE_FEEDBACK
   185     if (iFeedback)
   184     if ( iFeedback )
   186     {
   185     {
   187         iFeedback->RemoveFeedbackForControl(this);
   186         iFeedback->RemoveFeedbackForControl( this );
   188     }
   187     }
   189 #endif //RD_TACTILE_FEEDBACK
   188 #endif //RD_TACTILE_FEEDBACK
   190 
   189 
   191 }
   190 }
   192 
   191 
   215     MPX_DEBUG(_L("CMPXVideoPlaybackProgressBar::SetLayoutL()"));
   214     MPX_DEBUG(_L("CMPXVideoPlaybackProgressBar::SetLayoutL()"));
   216 
   215 
   217     //
   216     //
   218     // Calculate icon rects
   217     // Calculate icon rects
   219     //
   218     //
   220 
       
   221     TRect progressRect = Rect();
   219     TRect progressRect = Rect();
   222     TInt topMarginHeight = ( progressRect.iBr.iY - KMPXProgressBarHeight ) / 2 - 10;
   220     TInt topMarginHeight = ( progressRect.iBr.iY - KMPXProgressBarHeight ) / 2 - 10;
   223     progressRect.iTl.iY += topMarginHeight;
   221     progressRect.iTl.iY += topMarginHeight;
   224     progressRect.iBr.iY = progressRect.iTl.iY + KMPXProgressBarHeight;
   222     progressRect.iBr.iY = progressRect.iTl.iY + KMPXProgressBarHeight;
   225 
   223 
   282     TFileName iconsPath;
   280     TFileName iconsPath;
   283     iController->LocateBitmapFileL( iconsPath );
   281     iController->LocateBitmapFileL( iconsPath );
   284 
   282 
   285     delete iFrameIcon;
   283     delete iFrameIcon;
   286     iFrameIcon = NULL;
   284     iFrameIcon = NULL;
       
   285 
   287     iFrameIcon = AknsUtils::CreateGulIconL(
   286     iFrameIcon = AknsUtils::CreateGulIconL(
   288         skin,
   287         skin,
   289         KAknsIIDQgnGrafMup2BarFrame,
   288         KAknsIIDQgnGrafMup2BarFrame,
   290         iconsPath,
   289         iconsPath,
   291         EMbmMpxvideoplaybackcontrolsQgn_graf_mup2_bar_frame,
   290         EMbmMpxvideoplaybackcontrolsQgn_graf_mup2_bar_frame,
   298                                EAspectRatioNotPreserved );
   297                                EAspectRatioNotPreserved );
   299     }
   298     }
   300 
   299 
   301     delete iPlaybackIcon;
   300     delete iPlaybackIcon;
   302     iPlaybackIcon = NULL;
   301     iPlaybackIcon = NULL;
       
   302 
   303     iPlaybackIcon = AknsUtils::CreateGulIconL(
   303     iPlaybackIcon = AknsUtils::CreateGulIconL(
   304         skin,
   304         skin,
   305         KAknsIIDQgnGrafMup2BarProgress2,
   305         KAknsIIDQgnGrafMup2BarProgress2,
   306         iconsPath,
   306         iconsPath,
   307         EMbmMpxvideoplaybackcontrolsQgn_graf_mup2_bar_progress_2,
   307         EMbmMpxvideoplaybackcontrolsQgn_graf_mup2_bar_progress_2,
   372 {
   372 {
   373     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackProgressBar::HandleButtonDownEventL()"),
   373     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackProgressBar::HandleButtonDownEventL()"),
   374                    _L("ratio = %f"), aRatio );
   374                    _L("ratio = %f"), aRatio );
   375 
   375 
   376     iPointerEventStarted = ETrue;
   376     iPointerEventStarted = ETrue;
   377     iWasPlaying = iController->State() == EPbStatePlaying? ETrue:EFalse;
   377     iWasPlaying = iController->State() == EPbStatePlaying ? ETrue : EFalse;
   378 
   378 
   379     if ( iWasPlaying )
   379     if ( iWasPlaying )
   380     {
   380     {
   381         iController->HandleCommandL( EMPXPbvCmdCustomPause );
   381         iController->HandleCommandL( EMPXPbvCmdCustomPause );
   382     }
   382     }
   386     {
   386     {
   387 #ifdef SYMBIAN_BUILD_GCE
   387 #ifdef SYMBIAN_BUILD_GCE
   388         iFeedback->InstantFeedback( ETouchFeedbackSlider );
   388         iFeedback->InstantFeedback( ETouchFeedbackSlider );
   389 #else
   389 #else
   390         iFeedback->InstantFeedback( ETouchFeedbackBasic );
   390         iFeedback->InstantFeedback( ETouchFeedbackBasic );
   391 #endif //SYMBIAN_BUILD_GCE        
   391 #endif //SYMBIAN_BUILD_GCE
   392     }
   392     }
   393 #endif //RD_TACTILE_FEEDBACK
   393 #endif //RD_TACTILE_FEEDBACK
   394 
   394 
   395     iDragging = EFalse;
   395     iDragging = EFalse;
   396 
   396 
   419     {
   419     {
   420 #ifdef SYMBIAN_BUILD_GCE
   420 #ifdef SYMBIAN_BUILD_GCE
   421         iFeedback->InstantFeedback( ETouchFeedbackSlider );
   421         iFeedback->InstantFeedback( ETouchFeedbackSlider );
   422 #else
   422 #else
   423         iFeedback->InstantFeedback( ETouchFeedbackSensitive );
   423         iFeedback->InstantFeedback( ETouchFeedbackSensitive );
   424 #endif //SYMBIAN_BUILD_GCE        
   424 #endif //SYMBIAN_BUILD_GCE
   425     }
   425     }
   426 #endif //RD_TACTILE_FEEDBACK
   426 #endif //RD_TACTILE_FEEDBACK
   427 
   427 
   428     iDragging = ETrue;
   428     iDragging = ETrue;
   429 
   429 
   500             gc.Clear( aRect );
   500             gc.Clear( aRect );
   501         }
   501         }
   502     }
   502     }
   503     else
   503     else
   504     {
   504     {
   505         // draw a solid background so that the entire progress
   505         //
   506         // bar is shown not just the area representing the
   506         //  draw a solid background so that the entire progress
   507         // portion that has been played.
   507         //  bar is shown not just the area representing the
       
   508         //  portion that has been played.
       
   509         //
   508         gc.SetBrushColor( KRgbBlack );
   510         gc.SetBrushColor( KRgbBlack );
   509         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   511         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   510         gc.DrawRect( aRect );
   512         gc.DrawRect( aRect );
   511         gc.SetBrushStyle(CGraphicsContext::ENullBrush);
   513         gc.SetBrushStyle(CGraphicsContext::ENullBrush);
   512     }
   514     }
   628 // CMPXVideoPlaybackProgressBar::PositionChangedL()
   630 // CMPXVideoPlaybackProgressBar::PositionChangedL()
   629 // -------------------------------------------------------------------------------------------------
   631 // -------------------------------------------------------------------------------------------------
   630 //
   632 //
   631 void CMPXVideoPlaybackProgressBar::PositionChangedL( TInt aPosition, TBool aUserChanged )
   633 void CMPXVideoPlaybackProgressBar::PositionChangedL( TInt aPosition, TBool aUserChanged )
   632 {
   634 {
   633     MPX_DEBUG(_L("CMPXVideoPlaybackProgressBar::PositionChangedL() [%d]"), aPosition );
   635     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackProgressBar::PositionChangedL()"),
       
   636                    _L("aPosition = %d, aUserChanged = %d"), aPosition, aUserChanged );
   634 
   637 
   635     //
   638     //
   636     //  We will ignore position information which engine sent
   639     //  We will ignore position information which engine sent
   637     //  after we issue SetPosition()
   640     //  after we issue SetPosition()
   638     //
   641     //
   720 //   CMPXVideoPlaybackProgressBar::SetTextLWithReadableTimeL()
   723 //   CMPXVideoPlaybackProgressBar::SetTextLWithReadableTimeL()
   721 // -------------------------------------------------------------------------------------------------
   724 // -------------------------------------------------------------------------------------------------
   722 //
   725 //
   723 void CMPXVideoPlaybackProgressBar::SetTextLWithReadableTimeL( TInt aTime, CEikLabel* aLabel )
   726 void CMPXVideoPlaybackProgressBar::SetTextLWithReadableTimeL( TInt aTime, CEikLabel* aLabel )
   724 {
   727 {
   725     MPX_DEBUG(_L("CMPXVideoPlaybackProgressBar::SetTextLWithReadableTimeL() [%d]"), aTime);
   728     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackProgressBar::SetTextLWithReadableTimeL()"),
       
   729                    _L("aTime = %d"), aTime );
   726 
   730 
   727     TBuf<16> text;
   731     TBuf<16> text;
   728 
   732 
   729     TTime time = TTime( (TInt64)aTime * KMPXMicroSeconds );
   733     TTime time = TTime( (TInt64)aTime * KMPXMicroSeconds );
   730 
   734 
   766 
   770 
   767     if ( aDetails->iPlaybackMode == EMPXVideoProgressiveDownload )
   771     if ( aDetails->iPlaybackMode == EMPXVideoProgressiveDownload )
   768     {
   772     {
   769         delete iDownloadIcon;
   773         delete iDownloadIcon;
   770         iDownloadIcon = NULL;
   774         iDownloadIcon = NULL;
       
   775 
   771         iDownloadIcon = AknsUtils::CreateGulIconL(
   776         iDownloadIcon = AknsUtils::CreateGulIconL(
   772             skin,
   777             skin,
   773             KAknsIIDQgnGrafMup2BarProgress,
   778             KAknsIIDQgnGrafMup2BarProgress,
   774             iconsPath,
   779             iconsPath,
   775             EMbmMpxvideoplaybackcontrolsQgn_graf_mup2_bar_progress,
   780             EMbmMpxvideoplaybackcontrolsQgn_graf_mup2_bar_progress,
   794 
   799 
   795     if ( AknLayoutUtils::PenEnabled() && aDetails->iSeekable )
   800     if ( AknLayoutUtils::PenEnabled() && aDetails->iSeekable )
   796     {
   801     {
   797         delete iSliderIcon;
   802         delete iSliderIcon;
   798         iSliderIcon = NULL;
   803         iSliderIcon = NULL;
       
   804 
   799         iSliderIcon = AknsUtils::CreateGulIconL(
   805         iSliderIcon = AknsUtils::CreateGulIconL(
   800             skin,
   806             skin,
   801             KAknsIIDQgnGrafNsliderMarker,
   807             KAknsIIDQgnGrafNsliderMarker,
   802             iconsPath,
   808             iconsPath,
   803             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_marker,
   809             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_marker,
   804             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_marker_mask );
   810             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_marker_mask );
   805 
   811 
   806         delete iSelectedSliderIcon;
   812         delete iSelectedSliderIcon;
   807         iSelectedSliderIcon = NULL;
   813         iSelectedSliderIcon = NULL;
       
   814 
   808         iSelectedSliderIcon = AknsUtils::CreateGulIconL(
   815         iSelectedSliderIcon = AknsUtils::CreateGulIconL(
   809             skin,
   816             skin,
   810             KAknsIIDQgnGrafNsliderMarkerSelected,
   817             KAknsIIDQgnGrafNsliderMarkerSelected,
   811             iconsPath,
   818             iconsPath,
   812             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_marker_selected,
   819             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_marker_selected,
   854 // CMPXVideoPlaybackProgressBar::Reset
   861 // CMPXVideoPlaybackProgressBar::Reset
   855 // -------------------------------------------------------------------------------------------------
   862 // -------------------------------------------------------------------------------------------------
   856 //
   863 //
   857 void CMPXVideoPlaybackProgressBar::Reset()
   864 void CMPXVideoPlaybackProgressBar::Reset()
   858 {
   865 {
       
   866     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackProgressBar::Reset()"));
       
   867 
   859     if ( iPointerEventStarted || iDragging )
   868     if ( iPointerEventStarted || iDragging )
   860     {
   869     {
   861         TPointerEvent event;
   870         TPointerEvent event;
   862         event.iType = TPointerEvent::EButton1Up;
   871         event.iType = TPointerEvent::EButton1Up;
   863         event.iPosition.iX = iSliderRect.iTl.iX;
   872         event.iPosition.iX = iSliderRect.iTl.iX;