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