20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 #include <bldvariant.hrh> |
21 #include <bldvariant.hrh> |
22 #include <AknUtils.h> |
22 #include <AknUtils.h> |
23 #include <centralrepository.h> |
23 #include <centralrepository.h> |
24 #include "IptvDebug.h" |
24 #include "IptvDebug.h" |
25 #include <MediatorEventProvider.h> |
|
26 #include "iptvlastwatcheddata.h" |
|
27 #include "iptvlastwatchedapi.h" |
|
28 #include "vcxhgmyvideosmodel.h" |
25 #include "vcxhgmyvideosmodel.h" |
29 #include "vcxhgmyvideoscollectionclient.h" |
26 #include "vcxhgmyvideoscollectionclient.h" |
30 #include "vcxhgmyvideosdownloadclient.h" |
27 #include "vcxhgmyvideosdownloadclient.h" |
31 #include "vcxnsmediatorids.h" |
|
32 #include "thumbnaildata.h" |
28 #include "thumbnaildata.h" |
33 |
29 #include "vcxhgmyvideoscenrepkeys.h" |
34 _LIT( KTemporaryThumbPath, "C:\\Data\\videocenter\\ecg\\lastwatched.bmp" ); |
30 #include "vcxhgmyvideosthumbnailmanager.h" |
35 |
31 |
36 // ============================ MEMBER FUNCTIONS =============================== |
32 // ============================ MEMBER FUNCTIONS =============================== |
37 |
33 |
38 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
39 // |
35 // |
40 // ----------------------------------------------------------------------------- |
36 // ----------------------------------------------------------------------------- |
41 // |
37 // |
42 CVcxHgMyVideosModel::CVcxHgMyVideosModel() |
38 CVcxHgMyVideosModel::CVcxHgMyVideosModel() |
43 : iAppState( EVcxMyVideosAppStateUnknown ), |
39 : iAppState( EVcxMyVideosAppStateUnknown ), |
44 iPreviousAppState( EVcxMyVideosAppStateUnknown ), |
40 iPreviousAppState( EVcxMyVideosAppStateUnknown ), |
45 iTnRequestId( KErrNotFound ), |
|
46 iSortOrder( EVcxMyVideosSortingNone ) |
41 iSortOrder( EVcxMyVideosSortingNone ) |
47 { |
42 { |
48 } |
43 } |
49 |
44 |
50 // ----------------------------------------------------------------------------- |
45 // ----------------------------------------------------------------------------- |
273 |
285 |
274 return resolution; |
286 return resolution; |
275 } |
287 } |
276 |
288 |
277 // ----------------------------------------------------------------------------- |
289 // ----------------------------------------------------------------------------- |
278 // CVcxHgMyVideosModel::SetVideoAsLastWatchedL() |
290 // CVcxHgMyVideosModel::ThumbnailManager() |
279 // ----------------------------------------------------------------------------- |
291 // ----------------------------------------------------------------------------- |
280 // |
292 // |
281 void CVcxHgMyVideosModel::SetVideoAsLastWatchedL( TVideoPlayerCustomMessage& aVideoInfo, |
293 CVcxHgMyVideosThumbnailManager& CVcxHgMyVideosModel::ThumbnailManager() const |
282 TInt aMpxId1, |
294 { |
283 TUint32 aAgeProfile ) |
295 return *iTnManager; |
284 { |
|
285 if ( iTnRequestId != KErrNotFound ) |
|
286 { |
|
287 ThumbnailManagerL()->CancelRequest( iTnRequestId ); |
|
288 iTnRequestId = KErrNotFound; |
|
289 } |
|
290 |
|
291 CopyVideoPlayerCustomMessageL( aVideoInfo, *VideoPlayerCustomMessageL() ); |
|
292 |
|
293 // Store data from Video Player Custom message to 'Last Watched' item on |
|
294 // disk. Un-used (legacy) data fields are resetted to dummy values. |
|
295 |
|
296 LastWatchedDataL()->SetIconPathL( VideoPlayerCustomMessageL()->iIcon ); |
|
297 /* |
|
298 LastWatchedDataL()->SetLastVideoPlayPoint( ViaPlayerCustomMessageL()->iStartPosition ); |
|
299 LastWatchedDataL()->SetMimeTypeL( ViaPlayerCustomMessageL()->iMimeType ); |
|
300 */ |
|
301 |
|
302 LastWatchedDataL()->SetNameL( VideoPlayerCustomMessageL()->iName ); |
|
303 LastWatchedDataL()->SetUriL( VideoPlayerCustomMessageL()->iContent ); |
|
304 |
|
305 // LastWatchedDataL()->SetContentType( ViaPlayerCustomMessageL()->iContentType ); |
|
306 |
|
307 LastWatchedDataL()->SetMpxId( aMpxId1 ); |
|
308 LastWatchedDataL()->SetServiceId( KIdUndefined ); |
|
309 LastWatchedDataL()->SetContentId( KIdUndefined ); |
|
310 LastWatchedDataL()->SetContentIndex( -1 ); |
|
311 LastWatchedDataL()->SetParentalControl( aAgeProfile ); |
|
312 LastWatchedDataL()->SetParametersL( KNullDesC8 ); |
|
313 LastWatchedDataL()->SetAppUid( TUid::Uid( 0 ) ); |
|
314 LastWatchedDataL()->SetViewUid( TUid::Uid( 0 ) ); |
|
315 LastWatchedDataL()->SetParameterId( TUid::Uid( 0 ) ); |
|
316 LastWatchedDataL()->SetLaunchType( CIptvLastWatchedData::EUndefined ); |
|
317 |
|
318 // Start fetching or generating thumbnail for last watched video. |
|
319 // The 'Last Watched' data is published only when thumb is available. |
|
320 CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( |
|
321 VideoPlayerCustomMessageL()->iContent, |
|
322 KNullDesC ); |
|
323 iTnRequestId = ThumbnailManagerL()->GetThumbnailL( *source ); |
|
324 CleanupStack::PopAndDestroy( source ); |
|
325 } |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // CVcxHgMyVideosModel::UpdateLastWatchedPlayPositionL() |
|
329 // ----------------------------------------------------------------------------- |
|
330 // |
|
331 void CVcxHgMyVideosModel::UpdateLastWatchedPlayPositionL( TUint32 aLastVideoPlayPoint ) |
|
332 { |
|
333 if ( iTnRequestId != KErrNotFound ) |
|
334 { |
|
335 LastWatchedDataL()->SetLastVideoPlayPoint( aLastVideoPlayPoint ); |
|
336 } |
|
337 else |
|
338 { |
|
339 LastWatchedApiL()->UpdateLastVideoPlayPointL( aLastVideoPlayPoint ); |
|
340 } |
|
341 } |
|
342 |
|
343 // ----------------------------------------------------------------------------- |
|
344 // CVcxHgMyVideosModel::GetLastWatchedDataL() |
|
345 // ----------------------------------------------------------------------------- |
|
346 // |
|
347 void CVcxHgMyVideosModel::GetLastWatchedDataL( TVideoPlayerCustomMessage& aVideoInfo, |
|
348 TUint32& /*aMpxId1 */, |
|
349 TUint32& aAgeProfile ) |
|
350 { |
|
351 LastWatchedApiL()->GetLastWatchedDataL( *LastWatchedDataL() ); |
|
352 |
|
353 aVideoInfo.iContent = LastWatchedDataL()->Uri(); |
|
354 aVideoInfo.iName = LastWatchedDataL()->Name(); |
|
355 aVideoInfo.iIcon = LastWatchedDataL()->IconPath(); |
|
356 |
|
357 aAgeProfile = LastWatchedDataL()->ParentalControl(); |
|
358 } |
|
359 |
|
360 // ----------------------------------------------------------------------------- |
|
361 // CVcxHgMyVideosModel::ThumbnailPreviewReady() |
|
362 // From MThumbnailManagerObserver, not used in Video Center. |
|
363 // ----------------------------------------------------------------------------- |
|
364 // |
|
365 void CVcxHgMyVideosModel::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/, |
|
366 TThumbnailRequestId /*aId*/ ) |
|
367 { |
|
368 } |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CVcxHgMyVideosModel::ThumbnailReady() |
|
372 // From MThumbnailManagerObserver |
|
373 // ----------------------------------------------------------------------------- |
|
374 // |
|
375 void CVcxHgMyVideosModel::ThumbnailReady( TInt aError, |
|
376 MThumbnailData& aThumbnail, |
|
377 TThumbnailRequestId aId ) |
|
378 { |
|
379 TRAP_IGNORE( HandleThumbnailReadyL( aError, aThumbnail, aId ) ); |
|
380 } |
|
381 |
|
382 // ----------------------------------------------------------------------------- |
|
383 // CVcxHgMyVideosModel::HandleThumbnailReadyL() |
|
384 // ----------------------------------------------------------------------------- |
|
385 // |
|
386 void CVcxHgMyVideosModel::HandleThumbnailReadyL( TInt aError, |
|
387 MThumbnailData& aThumbnail, |
|
388 TThumbnailRequestId aId ) |
|
389 { |
|
390 IPTVLOGSTRING3_LOW_LEVEL( |
|
391 "MPX My Videos UI # HandleThumbnailReadyL(error=%d, ID=%d)", aError, aId ); |
|
392 |
|
393 if ( aError == KErrNone && aId == iTnRequestId ) |
|
394 { |
|
395 iTnRequestId = KErrNotFound; |
|
396 |
|
397 // Save a copy of the bitmap to local file that Matrix Menu can access. |
|
398 CFbsBitmap* bitmap = aThumbnail.Bitmap(); |
|
399 bitmap->Save( KTemporaryThumbPath ); |
|
400 LastWatchedDataL()->SetIconPathL( KTemporaryThumbPath ); |
|
401 VideoPlayerCustomMessageL()->iIcon = KTemporaryThumbPath; |
|
402 } |
|
403 else |
|
404 { |
|
405 iTnRequestId = KErrNotFound; |
|
406 } |
|
407 |
|
408 LastWatchedApiL()->SetLastWatchedDataL( *LastWatchedDataL() ); |
|
409 TPckg<TVideoPlayerCustomMessage> videoInfoPckg( *VideoPlayerCustomMessageL() ); |
|
410 iMediatorEventProvider->RaiseEvent( KVcxNsVideoCenterMediatorDomain, |
|
411 KVcxNsPlayerGeneralCategory, |
|
412 KVcxNsMediatorEventPlayerLastWatch, |
|
413 TVersion( KVcxNsMediatorPlayerVersion, 0, 0 ), |
|
414 videoInfoPckg ); |
|
415 } |
|
416 |
|
417 // ----------------------------------------------------------------------------- |
|
418 // CVcxHgMyVideosModel::ResetDownloadNotification() |
|
419 // ----------------------------------------------------------------------------- |
|
420 // |
|
421 void CVcxHgMyVideosModel::ResetDownloadNotification() |
|
422 { |
|
423 iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ), |
|
424 TUid::Uid( KVcxNsMpxMediatorCategory ), |
|
425 KVcxNsMpxEventResetDownloadNotification, |
|
426 TVersion( KVcxNsMpxEventVersion, 0, 0 ), |
|
427 KNullDesC8() ); |
|
428 } |
|
429 |
|
430 // ----------------------------------------------------------------------------- |
|
431 // CVcxHgMyVideosModel::ThumbnailManagerL() |
|
432 // ----------------------------------------------------------------------------- |
|
433 // |
|
434 CThumbnailManager* CVcxHgMyVideosModel::ThumbnailManagerL() |
|
435 { |
|
436 if ( ! iTnManager ) |
|
437 { |
|
438 iTnManager = CThumbnailManager::NewL( *this ); |
|
439 iTnManager->SetThumbnailSizeL( EVideoListThumbnailSize ); |
|
440 iTnManager->SetDisplayModeL( EColor16M ); |
|
441 } |
|
442 return iTnManager; |
|
443 } |
|
444 |
|
445 // ----------------------------------------------------------------------------- |
|
446 // CVcxHgMyVideosModel::CopyVideoPlayerCustomMessageL() |
|
447 // ----------------------------------------------------------------------------- |
|
448 // |
|
449 void CVcxHgMyVideosModel::CopyVideoPlayerCustomMessageL( TVideoPlayerCustomMessage& aSource, |
|
450 TVideoPlayerCustomMessage& aTarget ) |
|
451 { |
|
452 aTarget.iContent = aSource.iContent; |
|
453 aTarget.iName = aSource.iName; |
|
454 aTarget.iIcon = aSource.iIcon; |
|
455 } |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // CVcxHgMyVideosModel::VideoPlayerCustomMessageL() |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 TVideoPlayerCustomMessage* CVcxHgMyVideosModel::VideoPlayerCustomMessageL() |
|
462 { |
|
463 if ( ! iVideoPlayerCustomMessage ) |
|
464 { |
|
465 iVideoPlayerCustomMessage = new (ELeave) TVideoPlayerCustomMessage; |
|
466 } |
|
467 return iVideoPlayerCustomMessage; |
|
468 } |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // CVcxHgMyVideosModel::LastWatchedApiL() |
|
472 // ----------------------------------------------------------------------------- |
|
473 // |
|
474 CIptvLastWatchedApi* CVcxHgMyVideosModel::LastWatchedApiL() |
|
475 { |
|
476 if ( ! iLastWatchedApi ) |
|
477 { |
|
478 iLastWatchedApi = CIptvLastWatchedApi::NewL(); |
|
479 } |
|
480 return iLastWatchedApi; |
|
481 } |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // CVcxHgMyVideosModel::LastWatchedDataL() |
|
485 // ----------------------------------------------------------------------------- |
|
486 // |
|
487 CIptvLastWatchedData* CVcxHgMyVideosModel::LastWatchedDataL() |
|
488 { |
|
489 if ( ! iLastWatchedData ) |
|
490 { |
|
491 iLastWatchedData = CIptvLastWatchedData::NewL(); |
|
492 } |
|
493 return iLastWatchedData; |
|
494 } |
296 } |
495 |
297 |
496 // ----------------------------------------------------------------------------- |
298 // ----------------------------------------------------------------------------- |
497 // CVcxHgMyVideosModel::HandleDriveMonitorEvent() |
299 // CVcxHgMyVideosModel::HandleDriveMonitorEvent() |
498 // ----------------------------------------------------------------------------- |
300 // ----------------------------------------------------------------------------- |