videoplayback/videoplaybackcontrols/src/mpxvideoplaybackvolumebar.cpp
branchRCL_3
changeset 54 315810614048
parent 45 baf439b22ddd
equal deleted inserted replaced
53:2d690156cf8f 54:315810614048
    14 * Description: Volume bar control
    14 * Description: Volume bar control
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // Version : %version: 24 %
    19 // Version : %version: 27 %
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <eikenv.h>
    23 #include <eikenv.h>
    24 #include <gulicon.h>
    24 #include <gulicon.h>
   281     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   281     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   282 
   282 
   283     TFileName iconsPath;
   283     TFileName iconsPath;
   284     iController->LocateBitmapFileL( iconsPath );
   284     iController->LocateBitmapFileL( iconsPath );
   285 
   285 
       
   286     CreateSliderIconsL();
       
   287     
   286     delete iSpeakerIcon;
   288     delete iSpeakerIcon;
   287     iSpeakerIcon = NULL;
   289     iSpeakerIcon = NULL;
   288     iSpeakerIcon = AknsUtils::CreateGulIconL(
   290     iSpeakerIcon = AknsUtils::CreateGulIconL(
   289             skin,
   291             skin,
   290             KAknsIIDQgnIndiNsliderUnmuted,
   292             KAknsIIDQgnIndiNsliderUnmuted,
   331         AknIconUtils::SetSize( iNoAudioIcon->Bitmap(),
   333         AknIconUtils::SetSize( iNoAudioIcon->Bitmap(),
   332                                iSpeakerRect.Size(),
   334                                iSpeakerRect.Size(),
   333                                EAspectRatioPreserved );
   335                                EAspectRatioPreserved );
   334     }
   336     }
   335 
   337 
   336     delete iSliderIcon;
       
   337     iSliderIcon = NULL;
       
   338     iSliderIcon = AknsUtils::CreateGulIconL(
       
   339             skin,
       
   340             KAknsIIDQgnGrafNsliderVerticalMarker,
       
   341             iconsPath,
       
   342             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_vertical_marker,
       
   343             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_vertical_marker_mask );
       
   344 
       
   345     if ( iSliderIcon )
       
   346     {
       
   347         AknIconUtils::SetSize( iSliderIcon->Bitmap(),
       
   348                                TSize(KMPXSliderWidth, KMPXSliderHeight),
       
   349                                EAspectRatioNotPreserved );
       
   350     }
       
   351 
       
   352     delete iSliderSelectedIcon;
       
   353     iSliderSelectedIcon = NULL;
       
   354     iSliderSelectedIcon = AknsUtils::CreateGulIconL(
       
   355             skin,
       
   356             KAknsIIDQgnGrafNsliderVerticalMarkerSelected,
       
   357             iconsPath,
       
   358             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_vertical_marker_selected,
       
   359             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_vertical_marker_selected_mask );
       
   360 
       
   361     if ( iSliderSelectedIcon )
       
   362     {
       
   363         AknIconUtils::SetSize( iSliderSelectedIcon->Bitmap(),
       
   364                                TSize(KMPXSliderWidth, KMPXSliderHeight),
       
   365                                EAspectRatioNotPreserved );
       
   366     }
       
   367 
       
   368     delete iVolumeUpIcon;
   338     delete iVolumeUpIcon;
   369     iVolumeUpIcon = NULL;
   339     iVolumeUpIcon = NULL;
   370     iVolumeUpIcon = AknsUtils::CreateGulIconL(
   340     iVolumeUpIcon = AknsUtils::CreateGulIconL(
   371             skin,
   341             skin,
   372             KAknsIIDQgnIndiCam4ZoomMax,
   342             KAknsIIDQgnIndiCam4ZoomMax,
   485     switch ( aPointerEvent.iType )
   455     switch ( aPointerEvent.iType )
   486     {
   456     {
   487         case TPointerEvent::EButtonRepeat:
   457         case TPointerEvent::EButtonRepeat:
   488         {
   458         {
   489 #ifdef RD_TACTILE_FEEDBACK
   459 #ifdef RD_TACTILE_FEEDBACK
   490             if ( iFeedback )
   460             if ( iFeedback && !iController->FileDetails()->iTvOutConnected )
   491             {
   461             {
   492 #ifdef SYMBIAN_BUILD_GCE
       
   493                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   462                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   494 #else
       
   495                 iFeedback->InstantFeedback( ETouchFeedbackSensitive );
       
   496 #endif //SYMBIAN_BUILD_GCE
       
   497             }
   463             }
   498 #endif //RD_TACTILE_FEEDBACK
   464 #endif //RD_TACTILE_FEEDBACK
   499             iController->HandleCommandL( EMPXPbvCmdIncreaseVolume );
   465             iController->HandleCommandL( EMPXPbvCmdIncreaseVolume );
   500             iDragging = EVolumeIncreaseDragging;
   466             iDragging = EVolumeIncreaseDragging;
   501 
   467 
   514             break;
   480             break;
   515         }
   481         }
   516         case TPointerEvent::EButton1Up:
   482         case TPointerEvent::EButton1Up:
   517         {
   483         {
   518 #ifdef RD_TACTILE_FEEDBACK
   484 #ifdef RD_TACTILE_FEEDBACK
   519             if ( iFeedback )
   485             if ( iFeedback && !iController->FileDetails()->iTvOutConnected )
   520             {
   486             {
   521 #ifdef SYMBIAN_BUILD_GCE
       
   522                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   487                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   523 #else
       
   524                 iFeedback->InstantFeedback( ETouchFeedbackBasic );
       
   525 #endif //SYMBIAN_BUILD_GCE
       
   526             }
   488             }
   527 #endif //RD_TACTILE_FEEDBACK
   489 #endif //RD_TACTILE_FEEDBACK
   528 
   490 
   529             iController->HandleCommandL( EMPXPbvCmdIncreaseVolume );
   491             iController->HandleCommandL( EMPXPbvCmdIncreaseVolume );
   530 
   492 
   547     switch ( aPointerEvent.iType )
   509     switch ( aPointerEvent.iType )
   548     {
   510     {
   549         case TPointerEvent::EButtonRepeat:
   511         case TPointerEvent::EButtonRepeat:
   550         {
   512         {
   551 #ifdef RD_TACTILE_FEEDBACK
   513 #ifdef RD_TACTILE_FEEDBACK
   552             if ( iFeedback )
   514             if ( iFeedback && !iController->FileDetails()->iTvOutConnected )
   553             {
   515             {
   554 #ifdef SYMBIAN_BUILD_GCE
       
   555                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   516                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   556 #else
       
   557                 iFeedback->InstantFeedback( ETouchFeedbackSensitive );
       
   558 #endif //SYMBIAN_BUILD_GCE
       
   559             }
   517             }
   560 #endif //RD_TACTILE_FEEDBACK
   518 #endif //RD_TACTILE_FEEDBACK
   561             iController->HandleCommandL( EMPXPbvCmdDecreaseVolume );
   519             iController->HandleCommandL( EMPXPbvCmdDecreaseVolume );
   562             iDragging = EVolumeDecreaseDragging;
   520             iDragging = EVolumeDecreaseDragging;
   563 
   521 
   576             break;
   534             break;
   577         }
   535         }
   578         case TPointerEvent::EButton1Up:
   536         case TPointerEvent::EButton1Up:
   579         {
   537         {
   580 #ifdef RD_TACTILE_FEEDBACK
   538 #ifdef RD_TACTILE_FEEDBACK
   581             if ( iFeedback )
   539             if ( iFeedback && !iController->FileDetails()->iTvOutConnected )
   582             {
   540             {
   583 #ifdef SYMBIAN_BUILD_GCE
       
   584                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   541                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   585 #else
       
   586                 iFeedback->InstantFeedback( ETouchFeedbackBasic );
       
   587 #endif //SYMBIAN_BUILD_GCE
       
   588             }
   542             }
   589 #endif //RD_TACTILE_FEEDBACK
   543 #endif //RD_TACTILE_FEEDBACK
   590 
   544 
   591             iController->HandleCommandL( EMPXPbvCmdDecreaseVolume );
   545             iController->HandleCommandL( EMPXPbvCmdDecreaseVolume );
   592 
   546 
   611         case TPointerEvent::EButton1Up:
   565         case TPointerEvent::EButton1Up:
   612         {
   566         {
   613 #ifdef RD_TACTILE_FEEDBACK
   567 #ifdef RD_TACTILE_FEEDBACK
   614             if ( iFeedback )
   568             if ( iFeedback )
   615             {
   569             {
   616 #ifdef SYMBIAN_BUILD_GCE
       
   617                 iFeedback->InstantFeedback( ETouchFeedbackBasicButton );
   570                 iFeedback->InstantFeedback( ETouchFeedbackBasicButton );
   618 #else
       
   619                 iFeedback->InstantFeedback( ETouchFeedbackBasic );
       
   620 #endif //SYMBIAN_BUILD_GCE
       
   621             }
   571             }
   622 #endif //RD_TACTILE_FEEDBACK
   572 #endif //RD_TACTILE_FEEDBACK
   623 
   573 
   624             if ( iMuted )
   574             if ( iMuted )
   625             {
   575             {
   684     switch ( aPointerEvent.iType )
   634     switch ( aPointerEvent.iType )
   685     {
   635     {
   686         case TPointerEvent::EButton1Down:
   636         case TPointerEvent::EButton1Down:
   687         {
   637         {
   688 #ifdef RD_TACTILE_FEEDBACK
   638 #ifdef RD_TACTILE_FEEDBACK
   689             if ( iFeedback )
   639             if ( iFeedback && !iController->FileDetails()->iTvOutConnected )
   690             {
   640             {
   691                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   641                 iFeedback->InstantFeedback( ETouchFeedbackSlider );
   692             }
   642             }
   693 #endif //RD_TACTILE_FEEDBACK
   643 #endif //RD_TACTILE_FEEDBACK
   694 
   644 
   705             break;
   655             break;
   706         }
   656         }
   707         case TPointerEvent::EDrag:
   657         case TPointerEvent::EDrag:
   708         {
   658         {
   709 #ifdef RD_TACTILE_FEEDBACK
   659 #ifdef RD_TACTILE_FEEDBACK
   710             if ( iFeedback && giveDynamicSliderFeedback )
   660             if ( iFeedback && giveDynamicSliderFeedback && 
       
   661                  !iController->FileDetails()->iTvOutConnected )
   711             {
   662             {
   712                 iFeedback->StartFeedback( this,
   663                 iFeedback->StartFeedback( this,
   713                                           ETouchDynamicSlider,
   664                                           ETouchDynamicSlider,
   714                                           &aPointerEvent,
   665                                           &aPointerEvent,
   715                                           KDynamicSliderFeedbackIntensity,
   666                                           KDynamicSliderFeedbackIntensity,
   930                          ETrue );
   881                          ETrue );
   931     }
   882     }
   932 
   883 
   933     if ( iController->FileDetails() &&
   884     if ( iController->FileDetails() &&
   934          iController->FileDetails()->iAudioEnabled &&
   885          iController->FileDetails()->iAudioEnabled &&
       
   886          !iController->FileDetails()->iTvOutConnected &&
   935          iSliderIcon &&
   887          iSliderIcon &&
   936          iSliderSelectedIcon )
   888          iSliderSelectedIcon )
   937     {
   889     {
   938         if ( iDragging == EVolumeBarDragging )
   890         if ( iDragging == EVolumeBarDragging )
   939         {
   891         {
  1013                    _L("aVolume = %d"), aVolume );
   965                    _L("aVolume = %d"), aVolume );
  1014 
   966 
  1015     iController->HandleCommandL( EMPXPbvCmdSetVolume, aVolume );
   967     iController->HandleCommandL( EMPXPbvCmdSetVolume, aVolume );
  1016 }
   968 }
  1017 
   969 
       
   970 // -------------------------------------------------------------------------------------------------
       
   971 // CMPXVideoPlaybackVolumeBar::UpdateTVOutStatus()
       
   972 // -------------------------------------------------------------------------------------------------
       
   973 //
       
   974 void CMPXVideoPlaybackVolumeBar::UpdateTVOutStatusL( TBool aConnected )
       
   975 {
       
   976     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackVolumeBar::UpdateTVOutStatus()"));
       
   977     
       
   978     if ( aConnected )
       
   979     {
       
   980         if ( iSliderIcon )
       
   981         {
       
   982             delete iSliderIcon;
       
   983             iSliderIcon = NULL;
       
   984         }
       
   985         
       
   986         if ( iSliderSelectedIcon )
       
   987         {
       
   988             delete iSliderSelectedIcon;
       
   989             iSliderSelectedIcon = NULL;
       
   990         }
       
   991     }
       
   992     else
       
   993     {
       
   994         CreateSliderIconsL();
       
   995     }  
       
   996 }
       
   997 
       
   998 // -------------------------------------------------------------------------------------------------
       
   999 // CMPXVideoPlaybackVolumeBar::CreateSliderIconsL()
       
  1000 // -------------------------------------------------------------------------------------------------
       
  1001 //
       
  1002 void CMPXVideoPlaybackVolumeBar::CreateSliderIconsL()
       
  1003 {
       
  1004     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackVolumeBar::CreateSliderIconsL()"));
       
  1005     
       
  1006     //
       
  1007     // Create icons
       
  1008     //
       
  1009     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1010     
       
  1011     TFileName iconsPath;
       
  1012     iController->LocateBitmapFileL( iconsPath );
       
  1013     
       
  1014     delete iSliderIcon;
       
  1015     iSliderIcon = NULL;
       
  1016     iSliderIcon = AknsUtils::CreateGulIconL(
       
  1017             skin,
       
  1018             KAknsIIDQgnGrafNsliderVerticalMarker,
       
  1019             iconsPath,
       
  1020             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_vertical_marker,
       
  1021             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_vertical_marker_mask );
       
  1022     
       
  1023     if ( iSliderIcon )
       
  1024     {
       
  1025         AknIconUtils::SetSize( iSliderIcon->Bitmap(),
       
  1026                                TSize(KMPXSliderWidth, KMPXSliderHeight),
       
  1027                                EAspectRatioNotPreserved );
       
  1028     }
       
  1029     
       
  1030     delete iSliderSelectedIcon;
       
  1031     iSliderSelectedIcon = NULL;
       
  1032     iSliderSelectedIcon = AknsUtils::CreateGulIconL(
       
  1033             skin,
       
  1034             KAknsIIDQgnGrafNsliderVerticalMarkerSelected,
       
  1035             iconsPath,
       
  1036             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_vertical_marker_selected,
       
  1037             EMbmMpxvideoplaybackcontrolsQgn_graf_nslider_vertical_marker_selected_mask );
       
  1038     
       
  1039     if ( iSliderSelectedIcon )
       
  1040     {
       
  1041         AknIconUtils::SetSize( iSliderSelectedIcon->Bitmap(),
       
  1042                                TSize(KMPXSliderWidth, KMPXSliderHeight),
       
  1043                                EAspectRatioNotPreserved );
       
  1044     }
       
  1045 }
  1018 //  End of File
  1046 //  End of File