1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
47 #include "vcxhgmyvideosindicatorhelper.h" |
47 #include "vcxhgmyvideosindicatorhelper.h" |
48 #include "vcxhgmyvideosvideodetailsdialog.h" |
48 #include "vcxhgmyvideosvideodetailsdialog.h" |
49 #include "vcxhgmyvideosvideolist.h" |
49 #include "vcxhgmyvideosvideolist.h" |
50 #include "vcxhgmyvideospanics.h" |
50 #include "vcxhgmyvideospanics.h" |
51 |
51 |
52 |
|
53 #include <videoplayercustommessage.h> |
|
54 |
|
55 // CONSTANTS |
52 // CONSTANTS |
56 const TUint KVcxSecondsInMinute( 60 ); |
53 const TUint KVcxSecondsInMinute( 60 ); |
57 const TUint KVcxSecondsInHour( 3600 ); |
54 const TUint KVcxSecondsInHour( 3600 ); |
58 const TUint KVcxVideoSizeGB( 0x40000000 ); |
55 const TUint KVcxVideoSizeGB( 0x40000000 ); |
59 const TUint KVcxVideoSizeHalfGB( 0x20000000 ); |
56 const TUint KVcxVideoSizeHalfGB( 0x20000000 ); |
377 break; |
373 break; |
378 } |
374 } |
379 } |
375 } |
380 |
376 |
381 // ----------------------------------------------------------------------------- |
377 // ----------------------------------------------------------------------------- |
382 // CVcxHgMyVideosVideoModelHandler::GetVideoPlayerCustomMessage() |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 TInt CVcxHgMyVideosVideoModelHandler::GetVideoPlayerCustomMessage( |
|
386 TInt aIndex, TVideoPlayerCustomMessage& aVideoInfo, TInt& aMpxId1 ) |
|
387 { |
|
388 CMPXMedia* media = iVideoArray->MPXMedia( aIndex ); |
|
389 |
|
390 if ( ( ! media ) || ( ! media->IsSupported( KMPXMediaGeneralId ) ) ) |
|
391 { |
|
392 return KErrNotFound; |
|
393 } |
|
394 |
|
395 TMPXItemId mpxItemId = media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
396 |
|
397 if ( GetVideoPlayerCustomMessage( mpxItemId, aVideoInfo ) != KErrNone ) |
|
398 { |
|
399 return KErrNotFound; |
|
400 } |
|
401 |
|
402 aMpxId1 = ( media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ).iId1; |
|
403 |
|
404 return KErrNone; |
|
405 } |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // CVcxHgMyVideosVideoModelHandler::GetVideoPlayerCustomMessage() |
|
409 // ----------------------------------------------------------------------------- |
|
410 // |
|
411 TInt CVcxHgMyVideosVideoModelHandler::GetVideoPlayerCustomMessage( |
|
412 TMPXItemId& aMpxItemId, TVideoPlayerCustomMessage& aVideoInfo ) |
|
413 { |
|
414 CMPXMedia* media = iVideoArray->MPXMediaByMPXItemId( aMpxItemId ); |
|
415 |
|
416 if ( ! media ) |
|
417 { |
|
418 return KErrNotFound; |
|
419 } |
|
420 |
|
421 if ( media->IsSupported( KMPXMediaGeneralUri ) ) |
|
422 { |
|
423 aVideoInfo.iContent = media->ValueText( KMPXMediaGeneralUri ); |
|
424 } |
|
425 |
|
426 if ( media->IsSupported( KMPXMediaGeneralTitle ) ) |
|
427 { |
|
428 aVideoInfo.iName = media->ValueText( KMPXMediaGeneralTitle ); |
|
429 } |
|
430 |
|
431 if ( media->IsSupported( KMPXMediaGeneralThumbnail1 ) ) |
|
432 { |
|
433 aVideoInfo.iIcon = media->ValueText( KMPXMediaGeneralThumbnail1 ); |
|
434 } |
|
435 |
|
436 return KErrNone; |
|
437 } |
|
438 |
|
439 // ----------------------------------------------------------------------------- |
|
440 // CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL() |
378 // CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL() |
441 // ----------------------------------------------------------------------------- |
379 // ----------------------------------------------------------------------------- |
442 // |
380 // |
443 TInt32 CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL( TInt aIndex ) |
381 TInt32 CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL( TInt aIndex ) |
444 { |
382 { |
493 } |
431 } |
494 return EFalse; |
432 return EFalse; |
495 } |
433 } |
496 |
434 |
497 // ----------------------------------------------------------------------------- |
435 // ----------------------------------------------------------------------------- |
498 // CVcxHgMyVideosVideoModelHandler::ClearNewVideoIndicatorL() |
|
499 // Informative call about video being played. Method removes possible new indicator |
|
500 // from video. |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 void CVcxHgMyVideosVideoModelHandler::ClearNewVideoIndicatorL( TInt aIndex ) |
|
504 { |
|
505 CMPXMedia* media = iVideoArray->MPXMedia( aIndex ); |
|
506 |
|
507 if ( media ) |
|
508 { |
|
509 if ( media->IsSupported( KMPXMediaGeneralFlags ) && |
|
510 media->IsSupported( KMPXMediaGeneralId ) ) |
|
511 { |
|
512 TUint32 flags = media->ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ); |
|
513 if ( flags & EVcxMyVideosVideoNew ) |
|
514 { |
|
515 flags &= ~EVcxMyVideosVideoNew; |
|
516 CVcxHgMyVideosCollectionClient& collectionClient = iModel.CollectionClient(); |
|
517 collectionClient.SetAttributeL( *media, KMPXMediaGeneralFlags, flags ); |
|
518 |
|
519 if ( media->IsSupported( KVcxMediaMyVideosOrigin ) && |
|
520 ( media->ValueTObjectL<TUint8>( KVcxMediaMyVideosOrigin ) == EVcxMyVideosOriginDownloaded ) ) |
|
521 { |
|
522 iModel.ResetDownloadNotification(); |
|
523 } |
|
524 } |
|
525 } |
|
526 } |
|
527 } |
|
528 |
|
529 // ----------------------------------------------------------------------------- |
|
530 // CVcxHgMyVideosVideoModelHandler::ClearNewVideoIndicatorL() |
|
531 // Informative call about video being played. Method removes possible new indicator |
|
532 // from video. |
|
533 // ----------------------------------------------------------------------------- |
|
534 // |
|
535 void CVcxHgMyVideosVideoModelHandler::ClearNewVideoIndicatorL( TMPXItemId& aMpxItemId ) |
|
536 { |
|
537 CMPXMedia* media = iVideoArray->MPXMediaByMPXItemId( aMpxItemId ); |
|
538 |
|
539 if ( media ) |
|
540 { |
|
541 if ( media->IsSupported( KMPXMediaGeneralFlags ) && |
|
542 media->IsSupported( KMPXMediaGeneralId ) ) |
|
543 { |
|
544 TUint32 flags = media->ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ); |
|
545 if ( flags & EVcxMyVideosVideoNew ) |
|
546 { |
|
547 flags &= ~EVcxMyVideosVideoNew; |
|
548 CVcxHgMyVideosCollectionClient& collectionClient = iModel.CollectionClient(); |
|
549 collectionClient.SetAttributeL( *media, KMPXMediaGeneralFlags, flags ); |
|
550 |
|
551 if ( media->IsSupported( KVcxMediaMyVideosOrigin ) && |
|
552 ( media->ValueTObjectL<TUint8>( KVcxMediaMyVideosOrigin ) == EVcxMyVideosOriginDownloaded ) ) |
|
553 { |
|
554 iModel.ResetDownloadNotification(); |
|
555 } |
|
556 } |
|
557 } |
|
558 } |
|
559 } |
|
560 |
|
561 // ----------------------------------------------------------------------------- |
|
562 // CVcxHgMyVideosVideoModelHandler::ShowVideoDetailsDialogL() |
436 // CVcxHgMyVideosVideoModelHandler::ShowVideoDetailsDialogL() |
563 // ----------------------------------------------------------------------------- |
437 // ----------------------------------------------------------------------------- |
564 // |
438 // |
565 void CVcxHgMyVideosVideoModelHandler::ShowVideoDetailsDialogL() |
439 void CVcxHgMyVideosVideoModelHandler::ShowVideoDetailsDialogL() |
566 { |
440 { |
578 // ----------------------------------------------------------------------------- |
452 // ----------------------------------------------------------------------------- |
579 // |
453 // |
580 CMyVideosIndicator& CVcxHgMyVideosVideoModelHandler::VideoIndicator() |
454 CMyVideosIndicator& CVcxHgMyVideosVideoModelHandler::VideoIndicator() |
581 { |
455 { |
582 return *iVideoIndicator; |
456 return *iVideoIndicator; |
583 } |
|
584 |
|
585 // ----------------------------------------------------------------------------- |
|
586 // CVcxHgMyVideosVideoModelHandler::LastPlaybackPosition() |
|
587 // ----------------------------------------------------------------------------- |
|
588 // |
|
589 TInt CVcxHgMyVideosVideoModelHandler::LastPlaybackPosition( const TDesC& aContentUri ) |
|
590 { |
|
591 TInt position = 0; |
|
592 |
|
593 if ( CIptvUtil::LastPlaybackPositionFeatureSupported() ) |
|
594 { |
|
595 CMPXMedia* media = iVideoArray->MPXMediaByUri( aContentUri ); |
|
596 |
|
597 if ( media ) |
|
598 { |
|
599 if ( media->IsSupported( KMPXMediaGeneralLastPlaybackPosition ) ) |
|
600 { |
|
601 position = *media->Value<TInt>( KMPXMediaGeneralLastPlaybackPosition ); |
|
602 } |
|
603 } |
|
604 IPTVLOGSTRING3_LOW_LEVEL( "MPX My Videos UI # Found position %d for clip %S", |
|
605 position, &aContentUri ); |
|
606 } |
|
607 else |
|
608 { |
|
609 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # LastPlaybackPosition() - Feature is not supported, position = 0" ); |
|
610 } |
|
611 |
|
612 return position; |
|
613 } |
|
614 |
|
615 // ----------------------------------------------------------------------------- |
|
616 // CVcxHgMyVideosVideoModelHandler::SetLastPlaybackPositionL() |
|
617 // ----------------------------------------------------------------------------- |
|
618 // |
|
619 void CVcxHgMyVideosVideoModelHandler::SetLastPlaybackPositionL( const TDesC& aContentUri, |
|
620 TInt aPosition ) |
|
621 { |
|
622 if ( CIptvUtil::LastPlaybackPositionFeatureSupported() ) |
|
623 { |
|
624 CMPXMedia* media = iVideoArray->MPXMediaByUri( aContentUri ); |
|
625 |
|
626 // If media is not in our own list, it was launched from external source. In this |
|
627 // case the MPX Media object could be fetched on background to allow position storing. |
|
628 if ( ! media ) |
|
629 { |
|
630 media = iModel.CollectionClient().GetLatestFetchedMpxMediaL(); |
|
631 |
|
632 if ( media ) |
|
633 { |
|
634 TBool match( EFalse ); |
|
635 if ( media->IsSupported( KMPXMediaGeneralUri ) ) |
|
636 { |
|
637 if ( aContentUri.CompareF( media->ValueText( KMPXMediaGeneralUri ) ) == 0 ) |
|
638 { |
|
639 match = ETrue; |
|
640 } |
|
641 } |
|
642 if ( ! match ) |
|
643 { |
|
644 media = NULL; |
|
645 } |
|
646 } |
|
647 } |
|
648 |
|
649 if ( media ) |
|
650 { |
|
651 IPTVLOGSTRING3_LOW_LEVEL( "MPX My Videos UI # Storing position %d for clip %S", |
|
652 aPosition, &aContentUri ); |
|
653 |
|
654 // Change data type of last playback position? |
|
655 |
|
656 iModel.CollectionClient().SetAttributeL( *media, |
|
657 KMPXMediaGeneralLastPlaybackPosition, |
|
658 TUint32( aPosition ) ); |
|
659 } |
|
660 iModel.UpdateLastWatchedPlayPositionL( aPosition ); |
|
661 } |
|
662 else |
|
663 { |
|
664 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # SetLastPlaybackPositionL() - Feature is not supported" ); |
|
665 } |
|
666 } |
457 } |
667 |
458 |
668 // ----------------------------------------------------------------------------- |
459 // ----------------------------------------------------------------------------- |
669 // CVcxHgMyVideosVideoModelHandler::GetVideoName() |
460 // CVcxHgMyVideosVideoModelHandler::GetVideoName() |
670 // ----------------------------------------------------------------------------- |
461 // ----------------------------------------------------------------------------- |
880 TInt requestStart = ( aRequestStart >= 0 ? aRequestStart : 0 ); |
671 TInt requestStart = ( aRequestStart >= 0 ? aRequestStart : 0 ); |
881 TInt requestEnd = ( aRequestEnd < videoCount ? aRequestEnd : ( videoCount - 1 ) ); |
672 TInt requestEnd = ( aRequestEnd < videoCount ? aRequestEnd : ( videoCount - 1 ) ); |
882 |
673 |
883 IPTVLOGSTRING3_LOW_LEVEL( |
674 IPTVLOGSTRING3_LOW_LEVEL( |
884 "MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::HandleRequestL - aRequestStart: %d, aRequestEnd: %d", requestStart, requestEnd ); |
675 "MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::HandleRequestL - aRequestStart: %d, aRequestEnd: %d", requestStart, requestEnd ); |
885 |
676 |
|
677 TBool flushNeeded = EFalse; |
886 for ( TInt i = requestStart; i <= requestEnd; i++ ) |
678 for ( TInt i = requestStart; i <= requestEnd; i++ ) |
887 { |
679 { |
888 UpdateVideoListItemL( i ); |
680 UpdateVideoListItemL( i ); |
889 iDataUpdater->RequestDataL( iVideoArray->ArrayIndexToMpxItemIdL( i ) ); |
681 iDataUpdater->AddToRequestBufferL( iVideoArray->ArrayIndexToMpxItemIdL( i ) ); |
|
682 flushNeeded = ETrue; |
|
683 } |
|
684 if ( flushNeeded ) |
|
685 { |
|
686 iDataUpdater->FlushRequestBufferL(); |
890 } |
687 } |
891 |
688 |
892 iScroller.DrawDeferred(); |
689 iScroller.DrawDeferred(); |
893 |
690 |
894 IPTVLOGSTRING_LOW_LEVEL( |
691 IPTVLOGSTRING_LOW_LEVEL( |
1371 iScroller.DisableScrollBuffer(); |
1168 iScroller.DisableScrollBuffer(); |
1372 iScroller.EnableScrollBufferL( *this, KHgBufferSize, KHgBufferTreshold ); |
1169 iScroller.EnableScrollBufferL( *this, KHgBufferSize, KHgBufferTreshold ); |
1373 } |
1170 } |
1374 else |
1171 else |
1375 { |
1172 { |
1376 iScroller.ResizeL( videoCount ); |
1173 ResizeScrollerL( iVideoArray->VideoCount() ); |
1377 } |
1174 } |
1378 |
1175 |
1379 TInt highlight( KErrNotFound ); |
1176 TInt highlight( KErrNotFound ); |
1380 |
1177 |
1381 if ( iRestoreHighlightPosition ) |
1178 if ( iRestoreHighlightPosition ) |
1609 { |
1406 { |
1610 // No strip |
1407 // No strip |
1611 iScroller.SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar ); |
1408 iScroller.SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar ); |
1612 } |
1409 } |
1613 } |
1410 } |
|
1411 |
|
1412 // ----------------------------------------------------------------------------- |
|
1413 // CVcxHgMyVideosVideoModelHandler::ResetScrollerItemsL() |
|
1414 // ----------------------------------------------------------------------------- |
|
1415 // |
|
1416 void CVcxHgMyVideosVideoModelHandler::ResetScrollerItemsL() |
|
1417 { |
|
1418 // Reset items for refetch |
|
1419 TInt count = iScroller.ItemCount(); |
|
1420 for ( TInt i = 0; i < count; ++i ) |
|
1421 { |
|
1422 iScroller.ItemL( i ).SetIcon( NULL ); |
|
1423 } |
|
1424 } |
|
1425 |
|
1426 // ----------------------------------------------------------------------------- |
|
1427 // CVcxHgMyVideosVideoModelHandler::ResetScrollerBufferAndItemsL() |
|
1428 // ----------------------------------------------------------------------------- |
|
1429 // |
|
1430 void CVcxHgMyVideosVideoModelHandler::ResetScrollerBufferAndItemsL() |
|
1431 { |
|
1432 // Reset scroll buffer and items for refetch |
|
1433 iScroller.DisableScrollBuffer(); |
|
1434 iScroller.EnableScrollBufferL( *this, KHgBufferSize, KHgBufferTreshold ); |
|
1435 ResetScrollerItemsL(); |
|
1436 } |
|
1437 |
|
1438 // ----------------------------------------------------------------------------- |
|
1439 // CVcxHgMyVideosVideoModelHandler::ResizeScrollerL() |
|
1440 // ----------------------------------------------------------------------------- |
|
1441 // |
|
1442 void CVcxHgMyVideosVideoModelHandler::ResizeScrollerL( TInt aNewItemCount ) |
|
1443 { |
|
1444 if (iScroller.ItemCount() > 0) |
|
1445 { |
|
1446 // Reset scroller without time consuming scaling of icons never shown |
|
1447 iScroller.DisableScrollBuffer(); |
|
1448 iScroller.ResizeL( aNewItemCount ); |
|
1449 iScroller.EnableScrollBufferL( *this, KHgBufferSize, KHgBufferTreshold ); |
|
1450 ResetScrollerItemsL(); |
|
1451 } |
|
1452 else |
|
1453 { |
|
1454 // CHgScroller::Reset() was already called, no need to reset tricks |
|
1455 iScroller.ResizeL( aNewItemCount ); |
|
1456 } |
|
1457 } |