35 #include <eikimage.h> |
35 #include <eikimage.h> |
36 |
36 |
37 #include "SmilPlayerIndicatorController.h" |
37 #include "SmilPlayerIndicatorController.h" |
38 #include "SmilPlayerPresentationController.h" |
38 #include "SmilPlayerPresentationController.h" |
39 #include "SmilPlayerVolumeIndicatorController.h" |
39 #include "SmilPlayerVolumeIndicatorController.h" |
40 #include "SmilPlayerPauseIndicatorTimer.h" |
|
41 #include "SmilPlayerTimeIndicatorTimer.h" |
40 #include "SmilPlayerTimeIndicatorTimer.h" |
42 |
41 |
43 // CONSTANTS |
42 // CONSTANTS |
44 _LIT(KSmilPlayerBitmapFile, "smilplayer.mbm"); |
43 _LIT(KSmilPlayerBitmapFile, "smilplayer.mbm"); |
45 |
44 |
98 |
97 |
99 InitializeIconIndicatorL( iPlayIndicator, |
98 InitializeIconIndicatorL( iPlayIndicator, |
100 KAknsIIDQgnIndiMmsPlay, |
99 KAknsIIDQgnIndiMmsPlay, |
101 EMbmSmilplayerQgn_indi_mms_play, |
100 EMbmSmilplayerQgn_indi_mms_play, |
102 EMbmSmilplayerQgn_indi_mms_play_mask ); |
101 EMbmSmilplayerQgn_indi_mms_play_mask ); |
103 |
|
104 iPauseTimer = CSmilPlayerPauseIndicatorTimer::NewL( this ); |
|
105 |
102 |
106 MakeVisible( EFalse ); |
103 MakeVisible( EFalse ); |
107 } |
104 } |
108 |
105 |
109 |
106 |
226 // Indicates that presentation has been stopped. Stops time indicator refreshing. |
222 // Indicates that presentation has been stopped. Stops time indicator refreshing. |
227 // ---------------------------------------------------------------------------- |
223 // ---------------------------------------------------------------------------- |
228 // |
224 // |
229 void CSmilPlayerIndicatorController::Stop() |
225 void CSmilPlayerIndicatorController::Stop() |
230 { |
226 { |
231 iPauseTimer->Cancel(); |
|
232 iPauseIndicator->MakeVisible( EFalse ); |
227 iPauseIndicator->MakeVisible( EFalse ); |
233 |
228 |
234 iPlayIndicator->MakeVisible( EFalse ); |
229 iPlayIndicator->MakeVisible( EFalse ); |
235 |
230 |
236 iTimeModel->Stop(); |
231 iTimeModel->Stop(); |
241 // Indicates that presentation has been started. Starts time indicator refreshing. |
236 // Indicates that presentation has been started. Starts time indicator refreshing. |
242 // ---------------------------------------------------------------------------- |
237 // ---------------------------------------------------------------------------- |
243 // |
238 // |
244 void CSmilPlayerIndicatorController::Start() |
239 void CSmilPlayerIndicatorController::Start() |
245 { |
240 { |
246 iPauseTimer->Cancel(); |
241 iPauseIndicator->MakeVisible( ETrue ); |
247 iPauseIndicator->MakeVisible( EFalse ); |
242 iPlayIndicator->MakeVisible( EFalse ); |
248 |
|
249 iPlayIndicator->MakeVisible( ETrue ); |
|
250 |
243 |
251 iTimeModel->Start(); |
244 iTimeModel->Start(); |
252 } |
245 } |
253 |
246 |
254 // ---------------------------------------------------------------------------- |
247 // ---------------------------------------------------------------------------- |
257 // and play indicator is set hidden. |
250 // and play indicator is set hidden. |
258 // ---------------------------------------------------------------------------- |
251 // ---------------------------------------------------------------------------- |
259 // |
252 // |
260 void CSmilPlayerIndicatorController::Pause() |
253 void CSmilPlayerIndicatorController::Pause() |
261 { |
254 { |
262 iPlayIndicator->MakeVisible( EFalse ); |
255 |
263 |
256 iPlayIndicator->MakeVisible( ETrue ); |
264 SetPauseIndicatorBlinking( ETrue ); |
257 iPauseIndicator->MakeVisible( EFalse ); |
|
258 DrawDeferred(); |
265 |
259 |
266 iTimeModel->Pause(); |
260 iTimeModel->Pause(); |
267 } |
261 } |
268 |
262 |
269 // ---------------------------------------------------------------------------- |
263 // ---------------------------------------------------------------------------- |
274 // ---------------------------------------------------------------------------- |
268 // ---------------------------------------------------------------------------- |
275 // |
269 // |
276 void CSmilPlayerIndicatorController::Resume() |
270 void CSmilPlayerIndicatorController::Resume() |
277 { |
271 { |
278 iTimeModel->Resume(); |
272 iTimeModel->Resume(); |
279 SetPauseIndicatorBlinking( EFalse ); |
273 iPauseIndicator->MakeVisible( ETrue ); |
280 |
274 iPlayIndicator->MakeVisible( EFalse ); |
281 iPlayIndicator->MakeVisible( ETrue ); |
275 DrawDeferred(); |
|
276 |
282 } |
277 } |
283 |
278 |
284 |
279 |
285 // ---------------------------------------------------------------------------- |
280 // ---------------------------------------------------------------------------- |
286 // CSmilPlayerIndicatorController::EndReached |
281 // CSmilPlayerIndicatorController::EndReached |
294 |
289 |
295 iTimeModel->EndReached(); |
290 iTimeModel->EndReached(); |
296 } |
291 } |
297 |
292 |
298 // ---------------------------------------------------------------------------- |
293 // ---------------------------------------------------------------------------- |
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 |
294 // CSmilPlayerIndicatorController::VolumeValue |
323 // Asks current volume level from volume controller if present and returns it |
295 // Asks current volume level from volume controller if present and returns it |
324 // caller. Otherwise return zero. |
296 // caller. Otherwise return zero. |
325 // ---------------------------------------------------------------------------- |
297 // ---------------------------------------------------------------------------- |
326 // |
298 // |
399 if ( iPresController->Presentation() ) |
371 if ( iPresController->Presentation() ) |
400 { |
372 { |
401 result = iPresController->Presentation()->Duration().IsFinite(); |
373 result = iPresController->Presentation()->Duration().IsFinite(); |
402 } |
374 } |
403 return result; |
375 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 } |
376 } |
417 |
377 |
418 // ---------------------------------------------------------------------------- |
378 // ---------------------------------------------------------------------------- |
419 // CSmilPlayerIndicatorController::HandleGainingForeground |
379 // CSmilPlayerIndicatorController::HandleGainingForeground |
420 // Starts pause indicator blinking if presentation is on the paused state. |
380 // Starts pause indicator blinking if presentation is on the paused state. |
422 // that timer would not waste processing time unnecessarely. |
382 // that timer would not waste processing time unnecessarely. |
423 // ---------------------------------------------------------------------------- |
383 // ---------------------------------------------------------------------------- |
424 // |
384 // |
425 void CSmilPlayerIndicatorController::HandleGainingForeground() |
385 void CSmilPlayerIndicatorController::HandleGainingForeground() |
426 { |
386 { |
427 if ( iPresController->Presentation() && |
387 |
428 iPresController->Presentation()->State() == CSmilPresentation::EPaused ) |
|
429 { |
|
430 SetPauseIndicatorBlinking( ETrue ); |
|
431 } |
|
432 } |
388 } |
433 |
389 |
434 // ---------------------------------------------------------------------------- |
390 // ---------------------------------------------------------------------------- |
435 // CSmilPlayerIndicatorController::HandleLosingForeground |
391 // CSmilPlayerIndicatorController::HandleLosingForeground |
436 // Stops the pause indicator blinking if presentation is on paused state. |
392 // Stops the pause indicator blinking if presentation is on paused state. |
437 // ---------------------------------------------------------------------------- |
393 // ---------------------------------------------------------------------------- |
438 // |
394 // |
439 void CSmilPlayerIndicatorController::HandleLosingForeground() |
395 void CSmilPlayerIndicatorController::HandleLosingForeground() |
440 { |
396 { |
441 if ( iPresController->Presentation() && |
397 |
442 iPresController->Presentation()->State() == CSmilPresentation::EPaused ) |
|
443 { |
|
444 SetPauseIndicatorBlinking( EFalse ); |
|
445 } |
|
446 } |
398 } |
447 |
399 |
448 // ---------------------------------------------------------------------------- |
400 // ---------------------------------------------------------------------------- |
449 // CSmilPlayerIndicatorController::LayoutIndicators |
401 // CSmilPlayerIndicatorController::LayoutIndicators |
450 // Sets correct layout for indicator controls according current LAF. |
402 // Sets correct layout for indicator controls according current LAF. |