mobilemessaging/smilui/playersrc/SmilPlayerIndicatorController.cpp
changeset 79 2981cb3aa489
equal deleted inserted replaced
25:84d9eb65b26f 79:2981cb3aa489
       
     1 /*
       
     2 * Copyright (c) 2005 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: SmilPlayerIndicatorController implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <gulicon.h>                // CGulIcon
       
    22 #include <AknUtils.h>               // AknLayoutUtils
       
    23 #include <AknsUtils.h>              // AknsUtils
       
    24 #include <AknStatuspaneUtils.h>     // AknStatuspaneUtils
       
    25 
       
    26 #include <applayout.cdl.h>
       
    27 #include <smilplayer.mbg>
       
    28 #include <AknsConstants.h>
       
    29 
       
    30 #include <data_caging_path_literals.hrh> 
       
    31 #include <aknlayoutscalable_apps.cdl.h>
       
    32 #include <aknlayoutscalable_avkon.cdl.h>
       
    33 
       
    34 #include <eiklabel.h>
       
    35 #include <eikimage.h>
       
    36 
       
    37 #include "SmilPlayerIndicatorController.h"
       
    38 #include "SmilPlayerPresentationController.h"
       
    39 #include "SmilPlayerVolumeIndicatorController.h"
       
    40 #include "SmilPlayerTimeIndicatorTimer.h"
       
    41 
       
    42 // CONSTANTS
       
    43 _LIT(KSmilPlayerBitmapFile, "smilplayer.mbm");
       
    44 
       
    45 const TInt KMilliSecondsToSecondsCoefficient = 1000;
       
    46 const TInt KColorWhite = 0;
       
    47 
       
    48 // ============================ MEMBER FUNCTIONS ===============================
       
    49 
       
    50 // ----------------------------------------------------------------------------
       
    51 // CSmilPlayerIndicatorController::CSmilIndicatorControllerler
       
    52 // C++ constructor 
       
    53 // ----------------------------------------------------------------------------
       
    54 //
       
    55 CSmilPlayerIndicatorController::CSmilPlayerIndicatorController( 
       
    56                                                     CSmilPlayerPresentationController* aPresController ) :
       
    57     iPresController( aPresController ),
       
    58     iShowTimeIndicator( ETrue )
       
    59     {
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------------------------------
       
    63 // CSmilPlayerIndicatorController::ConstructL
       
    64 // Symbian second phase constructor. Sets indicator controller as foreground
       
    65 // observer so that event about foreground/background changes are received.
       
    66 // This is needed in order to stop pause timer when SMIL Player is set to 
       
    67 // background and start it again when SMIL Player is set foreground. Creates
       
    68 // volume controller if volume is enabled and all other indicator controls and
       
    69 // their timers.
       
    70 // ----------------------------------------------------------------------------
       
    71 //
       
    72 void CSmilPlayerIndicatorController::ConstructL( const CCoeControl* aParent, 
       
    73                                                  TBool aVolumeEnabled  )
       
    74     {
       
    75     iCoeEnv->AddForegroundObserverL( *this );
       
    76     
       
    77     SetContainerWindowL( *aParent );
       
    78     
       
    79     if ( aVolumeEnabled )
       
    80         {
       
    81         iVolumeController = CSmilPlayerVolumeIndicatorController::NewL( this );
       
    82         iVolumeController->SetObserver( this );
       
    83         }
       
    84     
       
    85     iTimeIndicator = new(ELeave) CEikLabel;
       
    86 
       
    87     iTimeIndicator->SetTextL( KNullDesC );
       
    88     iTimeIndicator->SetContainerWindowL( *this );
       
    89     iTimeIndicator->MakeVisible( EFalse );
       
    90     
       
    91     iTimeModel = CSmilPlayerTimeIndicatorTimer::NewL( this, iCoeEnv );
       
    92     
       
    93     InitializeIconIndicatorL( iPauseIndicator, 
       
    94                               KAknsIIDQgnIndiMmsPause,
       
    95                               EMbmSmilplayerQgn_indi_mms_pause,
       
    96                               EMbmSmilplayerQgn_indi_mms_pause_mask );
       
    97     
       
    98     InitializeIconIndicatorL( iPlayIndicator, 
       
    99                               KAknsIIDQgnIndiMmsPlay,
       
   100                               EMbmSmilplayerQgn_indi_mms_play,
       
   101                               EMbmSmilplayerQgn_indi_mms_play_mask );
       
   102     
       
   103     MakeVisible( EFalse );
       
   104     }
       
   105 
       
   106 
       
   107 // ----------------------------------------------------------------------------
       
   108 // CSmilPlayerIndicatorController::NewL
       
   109 // Symbian two phased constructor
       
   110 // ----------------------------------------------------------------------------
       
   111 //
       
   112 CSmilPlayerIndicatorController*
       
   113 CSmilPlayerIndicatorController::NewL( const CCoeControl* aParent, 
       
   114                                       CSmilPlayerPresentationController* aPresController,
       
   115                                       TBool aVolumeEnabled )
       
   116     {
       
   117     CSmilPlayerIndicatorController* self = new(ELeave) CSmilPlayerIndicatorController( aPresController );
       
   118 
       
   119     CleanupStack::PushL( self );
       
   120     self->ConstructL( aParent, aVolumeEnabled );
       
   121     CleanupStack::Pop( self );
       
   122 
       
   123     return self;
       
   124     }
       
   125 
       
   126 // ----------------------------------------------------------------------------
       
   127 // CSmilPlayerIndicatorController::~CSmilPlayerIndicatorController
       
   128 // Destructor
       
   129 // ----------------------------------------------------------------------------
       
   130 //
       
   131 CSmilPlayerIndicatorController::~CSmilPlayerIndicatorController()
       
   132     {
       
   133     iCoeEnv->RemoveForegroundObserver( *this );
       
   134     
       
   135     delete iVolumeController;
       
   136     delete iTimeIndicator;
       
   137         
       
   138     delete iTimeModel;
       
   139     delete iPauseIndicator;
       
   140 
       
   141     delete iPlayIndicator;
       
   142 
       
   143     iPresController = NULL; // For LINT
       
   144     }
       
   145 
       
   146 // ----------------------------------------------------------------------------
       
   147 // CSmilPlayerIndicatorController::OfferKeyEventL
       
   148 // Forwards key event to volume controller if present.
       
   149 // ----------------------------------------------------------------------------
       
   150 //
       
   151 TKeyResponse CSmilPlayerIndicatorController::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
   152                                                              TEventCode aType )
       
   153     {
       
   154     TKeyResponse result( EKeyWasNotConsumed );
       
   155     
       
   156     if ( iVolumeController )
       
   157         {
       
   158         result = iVolumeController->OfferKeyEventL( aKeyEvent, aType );
       
   159         }
       
   160     return result;
       
   161     }
       
   162 
       
   163 // ----------------------------------------------------------------------------
       
   164 // CSmilPlayerIndicatorController::CountComponentControls
       
   165 // Returns number of child controls.
       
   166 // ----------------------------------------------------------------------------
       
   167 //
       
   168 TInt CSmilPlayerIndicatorController::CountComponentControls() const
       
   169     {
       
   170     // return nbr of controls inside this container
       
   171     TInt result( 3 );
       
   172 
       
   173     if ( iVolumeController )
       
   174         {
       
   175         result++;
       
   176         }
       
   177     return result;
       
   178     }
       
   179 
       
   180 // ----------------------------------------------------------------------------
       
   181 // CSmilPlayerIndicatorController::ComponentControl
       
   182 // Returns specified child controls.
       
   183 // ----------------------------------------------------------------------------
       
   184 //
       
   185 CCoeControl* CSmilPlayerIndicatorController::ComponentControl( TInt aIndex ) const
       
   186     {
       
   187     CCoeControl* result = NULL;
       
   188 
       
   189     switch( aIndex )
       
   190         {
       
   191         case 0:
       
   192             {
       
   193             result = iPauseIndicator;
       
   194             break;
       
   195             }
       
   196         case 1:
       
   197             {
       
   198             result = iPlayIndicator;
       
   199             break;
       
   200             }
       
   201         case 2:
       
   202             {
       
   203             result = iTimeIndicator;
       
   204             break;
       
   205             }
       
   206         case 3:
       
   207             {
       
   208             result = iVolumeController;
       
   209             break;
       
   210             }
       
   211         default:
       
   212             {
       
   213             break;
       
   214             }
       
   215         }
       
   216 
       
   217     return result;
       
   218     }
       
   219 
       
   220 // ----------------------------------------------------------------------------
       
   221 // CSmilPlayerIndicatorController::Stop
       
   222 // Indicates that presentation has been stopped. Stops time indicator refreshing.
       
   223 // ----------------------------------------------------------------------------
       
   224 //
       
   225 void CSmilPlayerIndicatorController::Stop()
       
   226     {
       
   227     iPauseIndicator->MakeVisible( EFalse );
       
   228     
       
   229     iPlayIndicator->MakeVisible( EFalse );
       
   230         
       
   231     iTimeModel->Stop();
       
   232     }
       
   233 
       
   234 // ----------------------------------------------------------------------------
       
   235 // CSmilPlayerIndicatorController::Start
       
   236 // Indicates that presentation has been started. Starts time indicator refreshing.
       
   237 // ----------------------------------------------------------------------------
       
   238 //
       
   239 void CSmilPlayerIndicatorController::Start()
       
   240     {
       
   241     iPauseIndicator->MakeVisible( ETrue );
       
   242     iPlayIndicator->MakeVisible( EFalse );
       
   243         
       
   244     iTimeModel->Start();
       
   245     }
       
   246         
       
   247 // ----------------------------------------------------------------------------
       
   248 // CSmilPlayerIndicatorController::Pause
       
   249 // Indicates that presentation has been paused. Pauses time indicator refreshing
       
   250 // and play indicator is set hidden.
       
   251 // ----------------------------------------------------------------------------
       
   252 //
       
   253 void CSmilPlayerIndicatorController::Pause()
       
   254     {
       
   255     
       
   256     iPlayIndicator->MakeVisible( ETrue );
       
   257     iPauseIndicator->MakeVisible( EFalse );
       
   258     DrawDeferred();
       
   259     
       
   260     iTimeModel->Pause();
       
   261     }
       
   262 
       
   263 // ----------------------------------------------------------------------------
       
   264 // CSmilPlayerIndicatorController::Resume
       
   265 // Indicates that presentation has been resumed. Starts time indicator refreshing.
       
   266 // And prevents time indicator from showing if duration is not finite. Also sets
       
   267 // play indicator visible.
       
   268 // ----------------------------------------------------------------------------
       
   269 //
       
   270 void CSmilPlayerIndicatorController::Resume()
       
   271     {
       
   272     iTimeModel->Resume();
       
   273     iPauseIndicator->MakeVisible( ETrue );
       
   274     iPlayIndicator->MakeVisible( EFalse );
       
   275     DrawDeferred();
       
   276     
       
   277     }
       
   278 
       
   279         
       
   280 // ----------------------------------------------------------------------------
       
   281 // CSmilPlayerIndicatorController::EndReached
       
   282 // Indicates the presentation end has been reached. This notification from presentation
       
   283 // controller is forwarded to time indicator timer. Also hides play indicator.
       
   284 // ----------------------------------------------------------------------------
       
   285 //
       
   286 void CSmilPlayerIndicatorController::EndReached()
       
   287     {
       
   288     iPlayIndicator->MakeVisible( EFalse );
       
   289     
       
   290     iTimeModel->EndReached();
       
   291     }
       
   292 
       
   293 // ----------------------------------------------------------------------------
       
   294 // CSmilPlayerIndicatorController::VolumeValue
       
   295 // Asks current volume level from volume controller if present and returns it
       
   296 // caller. Otherwise return zero.
       
   297 // ----------------------------------------------------------------------------
       
   298 //
       
   299 TInt CSmilPlayerIndicatorController::VolumeValue() const
       
   300     {
       
   301     TInt result( 0 );
       
   302     if ( iVolumeController )
       
   303         {
       
   304         result = iVolumeController->VolumeValue();
       
   305         }
       
   306     return result;
       
   307     }
       
   308 
       
   309 // ----------------------------------------------------------------------------
       
   310 // CSmilPlayerIndicatorController::TimeChangedL
       
   311 // Called by timer indicator timer. Updates time indicator with new time string.
       
   312 // On landscape mode time indicator is not shown if volume indicator is visible
       
   313 // ----------------------------------------------------------------------------
       
   314 //
       
   315 void CSmilPlayerIndicatorController::TimeChangedL( const TDesC& aTimeString )
       
   316     {
       
   317     if ( !iTimeIndicator->IsVisible() )
       
   318         {
       
   319         if ( iShowTimeIndicator ||
       
   320              !iVolumeController || 
       
   321              !iVolumeController->IsVisible() )
       
   322             {
       
   323             iTimeIndicator->MakeVisible( ETrue );
       
   324             }
       
   325         }       
       
   326         
       
   327     iTimeIndicator->SetTextL( aTimeString );
       
   328     iTimeIndicator->DrawDeferred();
       
   329     }
       
   330 
       
   331 // ----------------------------------------------------------------------------
       
   332 // CSmilPlayerIndicatorController::CurrentTime
       
   333 // Returns current presentation time.
       
   334 // ----------------------------------------------------------------------------
       
   335 //
       
   336 TInt CSmilPlayerIndicatorController::CurrentTime() const
       
   337     {
       
   338     TInt result( 0 );
       
   339     if ( iPresController->Presentation() )
       
   340         {
       
   341         result = iPresController->Presentation()->CurrentTime().Value() / 
       
   342                  KMilliSecondsToSecondsCoefficient;
       
   343         }
       
   344     return result;
       
   345     }
       
   346 
       
   347 // ----------------------------------------------------------------------------
       
   348 // CSmilPlayerIndicatorController::PresentationDuration
       
   349 // Returns presentation duration.
       
   350 // ----------------------------------------------------------------------------
       
   351 //
       
   352 TInt CSmilPlayerIndicatorController::PresentationDuration() const
       
   353     {
       
   354     TInt result( 0 );
       
   355     if ( iPresController->Presentation() )
       
   356         {
       
   357         result = iPresController->Presentation()->Duration().Value() /
       
   358                  KMilliSecondsToSecondsCoefficient;
       
   359         }
       
   360     return result;
       
   361     }
       
   362 
       
   363 // ----------------------------------------------------------------------------
       
   364 // CSmilPlayerIndicatorController::IsDurationFinite
       
   365 // Returns whether presentation duration is finite (i.e. not infinite).
       
   366 // ----------------------------------------------------------------------------
       
   367 //
       
   368 TBool CSmilPlayerIndicatorController::IsDurationFinite() const
       
   369     {
       
   370     TBool result( EFalse );
       
   371     if ( iPresController->Presentation() )
       
   372         {
       
   373         result = iPresController->Presentation()->Duration().IsFinite();
       
   374         }
       
   375     return result;
       
   376     }
       
   377 
       
   378 // ----------------------------------------------------------------------------
       
   379 // CSmilPlayerIndicatorController::HandleGainingForeground
       
   380 // Starts pause indicator blinking if presentation is on the paused state. 
       
   381 // Pause indicator blinking was stopped when player was sent to background so
       
   382 // that timer would not waste processing time unnecessarely.
       
   383 // ----------------------------------------------------------------------------
       
   384 //
       
   385 void CSmilPlayerIndicatorController::HandleGainingForeground()
       
   386     {
       
   387 
       
   388     }
       
   389 
       
   390 // ----------------------------------------------------------------------------
       
   391 // CSmilPlayerIndicatorController::HandleLosingForeground
       
   392 // Stops the pause indicator blinking if presentation is on paused state.
       
   393 // ----------------------------------------------------------------------------
       
   394 //
       
   395 void CSmilPlayerIndicatorController::HandleLosingForeground()
       
   396     {
       
   397 
       
   398     }
       
   399 
       
   400 // ----------------------------------------------------------------------------
       
   401 // CSmilPlayerIndicatorController::LayoutIndicators
       
   402 // Sets correct layout for indicator controls according current LAF.
       
   403 // On landscape mode only time indicator or volume indicator is shown at once.
       
   404 // Both are shown on the same place and time indicator is hidden if volume indicator
       
   405 // shown.
       
   406 // ----------------------------------------------------------------------------
       
   407 //
       
   408 void CSmilPlayerIndicatorController::LayoutIndicators()
       
   409     {
       
   410     TAknLayoutRect smilstatusVolumePane;
       
   411     if ( AknStatuspaneUtils::StaconPaneActive() )
       
   412         {
       
   413 		smilstatusVolumePane.LayoutRect( Rect(), AknLayout::Navi_pane_tab_elements_Line_1() );
       
   414         }
       
   415     else
       
   416         {
       
   417 		smilstatusVolumePane.LayoutRect( Rect(), 
       
   418                                      AknLayoutScalable_Apps::smil_status_volume_pane() );
       
   419         }
       
   420     
       
   421     TAknLayoutRect stateIndicatorIcon;
       
   422     TAknLayoutText timeLayout;
       
   423     if( iPresController->UseWidescreenStatusPane() )
       
   424         {            
       
   425         TAknLayoutRect naviSmilPane;
       
   426          naviSmilPane.LayoutRect(Rect(), AknLayoutScalable_Avkon::navi_smil_pane( 0 ));
       
   427         stateIndicatorIcon.LayoutRect( naviSmilPane.Rect(),
       
   428                                    AknLayoutScalable_Avkon::navi_smil_pane_g1( 0 ) );
       
   429         timeLayout.LayoutText(  naviSmilPane.Rect(),
       
   430                             AknLayoutScalable_Avkon::navi_smil_pane_t1() );
       
   431         }
       
   432     else
       
   433         {
       
   434     stateIndicatorIcon.LayoutRect( Rect(),
       
   435                                    AknLayoutScalable_Apps::smil_status_pane_g1() );
       
   436         timeLayout.LayoutText(  Rect(),
       
   437                              AknLayoutScalable_Apps::smil_status_pane_t1() );
       
   438         }
       
   439     
       
   440     if ( iVolumeController )
       
   441         {
       
   442         iVolumeController->SetRect( smilstatusVolumePane.Rect() );
       
   443         }
       
   444     
       
   445     
       
   446     TRect timeRect;
       
   447     
       
   448     // TODO: Remove hack when changes have been made to LAF.
       
   449     if ( AknStatuspaneUtils::StaconPaneActive() )
       
   450         {
       
   451         timeRect = smilstatusVolumePane.Rect();
       
   452         
       
   453         iShowTimeIndicator = EFalse;
       
   454         iTimeIndicator->MakeVisible( EFalse );
       
   455         }
       
   456     else
       
   457         {
       
   458         timeRect = timeLayout.TextRect();
       
   459         
       
   460         iShowTimeIndicator = ETrue;
       
   461         }
       
   462         
       
   463     iTimeIndicator->SetRect( timeRect );
       
   464     iTimeIndicator->SetFont( timeLayout.Font() );
       
   465     
       
   466     TRAP_IGNORE( UpdateTextColorL() );
       
   467     
       
   468     TInt align( ELayoutAlignNone );
       
   469     switch( timeLayout.Align() )
       
   470         {
       
   471         case CGraphicsContext::ELeft:
       
   472             {
       
   473             align = ELayoutAlignLeft;
       
   474             break;
       
   475             }
       
   476         case CGraphicsContext::ECenter:
       
   477             {
       
   478             align = ELayoutAlignCenter;
       
   479             break;
       
   480             }
       
   481         case CGraphicsContext::ERight:
       
   482             {
       
   483             align = ELayoutAlignRight;
       
   484             break;
       
   485             }
       
   486         default:
       
   487             {
       
   488             break;
       
   489             }
       
   490         }
       
   491     iTimeIndicator->SetLabelAlignment( align );
       
   492     
       
   493     SetIconIndicatorExtent( iPauseIndicator, stateIndicatorIcon.Rect() );
       
   494     SetIconIndicatorExtent( iPlayIndicator, stateIndicatorIcon.Rect() );
       
   495  
       
   496     DrawDeferred();
       
   497     }
       
   498 
       
   499 // ----------------------------------------------------------------------------
       
   500 // CSmilPlayerIndicatorController::InitializeIconIndicatorL
       
   501 // Creates and initializes given icon control with specified bitmap and mask.
       
   502 // ----------------------------------------------------------------------------
       
   503 //
       
   504 void CSmilPlayerIndicatorController::InitializeIconIndicatorL( CEikImage*& aIndicator, 
       
   505                                                                const TAknsItemID& aItem, 
       
   506                                                                const TInt aBitmapIndex,
       
   507                                                                const TInt aMaskIndex ) const
       
   508     {
       
   509     aIndicator = new(ELeave) CEikImage;
       
   510     aIndicator->SetContainerWindowL( *this );
       
   511     aIndicator->MakeVisible( EFalse );
       
   512     
       
   513     SetIconIndicatorBitmapL( aIndicator, aItem, aBitmapIndex, aMaskIndex );
       
   514     }
       
   515 
       
   516 // ----------------------------------------------------------------------------
       
   517 // CSmilPlayerIndicatorController::HandleControlEventL
       
   518 // Handles control events from volume indicator controller. 
       
   519 // Sets new volume to presentation if it has been changed.
       
   520 // On landscape mode toggles time and volume indicators.
       
   521 // ----------------------------------------------------------------------------
       
   522 //
       
   523 void CSmilPlayerIndicatorController::HandleControlEventL( CCoeControl* aControl, 
       
   524                                                           TCoeEvent aEventType )
       
   525     {
       
   526     if ( aControl == iVolumeController &&
       
   527          aEventType == MCoeControlObserver::EEventStateChanged )
       
   528         {
       
   529         TInt currentVolume( VolumeValue() * 10 );
       
   530         if ( iPresController->Presentation() )
       
   531             {
       
   532             if ( currentVolume != iPresController->Presentation()->Volume() )
       
   533                 {
       
   534                 iPresController->Presentation()->SetVolume( currentVolume );
       
   535                 }
       
   536             }
       
   537         }
       
   538     }
       
   539     
       
   540 // ---------------------------------------------------------
       
   541 // CSmilPlayerIndicatorController::HandlePointerEventL
       
   542 // Process pointer events. Forwards corresponding pointer event 
       
   543 // to volume controller if present. Otherwise performs play pausing
       
   544 // on tapping.
       
   545 // ---------------------------------------------------------
       
   546 //
       
   547 #ifdef RD_SCALABLE_UI_V2
       
   548 void CSmilPlayerIndicatorController::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   549     {
       
   550     if ( AknLayoutUtils::PenEnabled() )
       
   551         {
       
   552         if ( iVolumeController &&
       
   553              iVolumeController->Rect().Contains( aPointerEvent.iPosition ) )
       
   554                 {
       
   555                 if (iPlayIndicator && !(iPlayIndicator->Rect().Contains( aPointerEvent.iPosition) ) ||
       
   556                         (iPauseIndicator && !iPauseIndicator->Rect().Contains( aPointerEvent.iPosition )))
       
   557                     {
       
   558                     iVolumeController->HandlePointerEventL( aPointerEvent );
       
   559                     }
       
   560                 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   561                     {
       
   562                     iPresController->PlayPauseTappedL();
       
   563                     }
       
   564                 
       
   565                 }
       
   566         else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   567             {
       
   568             iPresController->PlayPauseTappedL();    
       
   569             }
       
   570         }            
       
   571     }  
       
   572 
       
   573 #else
       
   574 void CSmilPlayerIndicatorController::HandlePointerEventL( const TPointerEvent& /*aPointerEvent*/ )
       
   575     {  
       
   576     }
       
   577 #endif // RD_SCALABLE_UI_V2
       
   578 
       
   579 // ----------------------------------------------------------------------------
       
   580 // CSmilPlayerIndicatorController::HandleResourceChange
       
   581 //
       
   582 // Handles skin (theme) changing.
       
   583 // ----------------------------------------------------------------------------
       
   584 //
       
   585 void CSmilPlayerIndicatorController::HandleResourceChange( TInt aType )
       
   586 	{
       
   587 	CCoeControl::HandleResourceChange( aType );
       
   588 	
       
   589 	if ( aType == KAknsMessageSkinChange )
       
   590 		{		
       
   591 	    TRAP_IGNORE( DoHandleSkinChangeL() );
       
   592 		}
       
   593 	}
       
   594 
       
   595 // ---------------------------------------------------------
       
   596 // CSmilPlayerIndicatorController::DoHandleSkinChangeL
       
   597 // ---------------------------------------------------------
       
   598 //
       
   599 void CSmilPlayerIndicatorController::DoHandleSkinChangeL()
       
   600     {
       
   601     UpdateTextColorL();
       
   602     SetIconIndicatorBitmapL( iPauseIndicator, 
       
   603                              KAknsIIDQgnIndiMmsPause,
       
   604                              EMbmSmilplayerQgn_indi_mms_pause,
       
   605                              EMbmSmilplayerQgn_indi_mms_pause_mask );
       
   606     
       
   607     SetIconIndicatorBitmapL( iPlayIndicator, 
       
   608                              KAknsIIDQgnIndiMmsPlay,
       
   609                              EMbmSmilplayerQgn_indi_mms_play,
       
   610                              EMbmSmilplayerQgn_indi_mms_play_mask );
       
   611     
       
   612     DrawDeferred();
       
   613     }
       
   614 
       
   615 // ---------------------------------------------------------
       
   616 // CSmilPlayerIndicatorController::UpdateTextColorL
       
   617 //
       
   618 // Sets the correct text color for time indicator from currently 
       
   619 // used theme. 
       
   620 // ---------------------------------------------------------
       
   621 //
       
   622 void CSmilPlayerIndicatorController::UpdateTextColorL()
       
   623     {
       
   624     TRgb timeColor( AKN_LAF_COLOR( KColorWhite ) );
       
   625     
       
   626     AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), 
       
   627                                timeColor, 
       
   628                                KAknsIIDQsnIconColors,
       
   629                                EAknsCIQsnIconColorsCG7 );
       
   630     
       
   631     iTimeIndicator->OverrideColorL( EColorLabelText, timeColor );
       
   632     }
       
   633 
       
   634 // ----------------------------------------------------------------------------
       
   635 // CSmilPlayerIndicatorController::LayoutArrowIcons
       
   636 //
       
   637 // Sets correct size for arrow icons.
       
   638 // ----------------------------------------------------------------------------
       
   639 //
       
   640 void CSmilPlayerIndicatorController::SetIconIndicatorBitmapL( CEikImage*& aIndicator, 
       
   641                                                               const TAknsItemID& aItem, 
       
   642                                                               const TInt aBitmapIndex,
       
   643                                                               const TInt aMaskIndex ) const
       
   644     {
       
   645     TParse fileParse;
       
   646     User::LeaveIfError( fileParse.Set( KSmilPlayerBitmapFile, &KDC_APP_BITMAP_DIR, NULL ) );
       
   647     
       
   648     CFbsBitmap* bitmap = NULL;
       
   649     CFbsBitmap* mask = NULL;
       
   650     
       
   651     AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), 
       
   652                                  aItem,
       
   653                                  KAknsIIDQsnIconColors,
       
   654                                  EAknsCIQsnIconColorsCG7,
       
   655                                  bitmap, 
       
   656                                  mask,
       
   657                                  fileParse.FullName(), 
       
   658                                  aBitmapIndex,
       
   659                                  aMaskIndex,
       
   660                                  AKN_LAF_COLOR( KColorWhite ) ); 
       
   661                                      
       
   662     
       
   663     aIndicator->SetNewBitmaps( bitmap, mask );
       
   664     
       
   665     if ( aIndicator->Size() != TSize() )
       
   666         {
       
   667         SetIconIndicatorExtent( aIndicator, aIndicator->Rect() );
       
   668         }
       
   669     }
       
   670 
       
   671 // ----------------------------------------------------------------------------
       
   672 // CSmilPlayerIndicatorController::SetIconIndicatorExtent
       
   673 //
       
   674 // Sets given icon extent to specified one.
       
   675 // ----------------------------------------------------------------------------
       
   676 //
       
   677 void CSmilPlayerIndicatorController::SetIconIndicatorExtent( CEikImage* aIconIndicator,
       
   678                                                              TRect aExtent ) const
       
   679     {
       
   680     TInt result = AknIconUtils::SetSize( const_cast<CFbsBitmap*>( aIconIndicator->Bitmap() ), 
       
   681                                          aExtent.Size() );
       
   682     
       
   683     if ( result == KErrNone )
       
   684         {
       
   685         if ( aExtent != aIconIndicator->Rect() )
       
   686             {
       
   687             aIconIndicator->SetRect( aExtent );
       
   688             }
       
   689         }
       
   690     else
       
   691         {
       
   692         aIconIndicator->SetRect( TRect() );
       
   693         }
       
   694     }
       
   695 
       
   696 // End of File