17 #include <AknUtils.h> // For AknLayoutUtils to calculate rect |
17 #include <AknUtils.h> // For AknLayoutUtils to calculate rect |
18 #include <glxtracer.h> |
18 #include <glxtracer.h> |
19 #include <StringLoader.h> |
19 #include <StringLoader.h> |
20 #include <AknsBasicBackgroundControlContext.h> |
20 #include <AknsBasicBackgroundControlContext.h> |
21 #include <caf/caferr.h> |
21 #include <caf/caferr.h> |
22 #include <featmgr.h> // Feature Manager |
|
23 |
22 |
24 // Ganes Headers |
23 // Ganes Headers |
25 #include <gulicon.h> // Gul Icons |
24 #include <gulicon.h> // Gul Icons |
26 #include <ganes/HgItem.h> // HG Items |
25 #include <ganes/HgItem.h> // HG Items |
27 #include <ganes/HgGrid.h> // Hg Grid Widget |
26 #include <ganes/HgGrid.h> // Hg Grid Widget |
28 |
27 |
29 // Framework |
28 // Framework |
30 #include <data_caging_path_literals.hrh> |
29 #include <data_caging_path_literals.hrh> |
31 #include <glxcollectionplugindownloads.hrh> |
|
32 #include <glxcommandhandlers.hrh> // For EGlxCmdFullScreenBack |
30 #include <glxcommandhandlers.hrh> // For EGlxCmdFullScreenBack |
33 #include <glxcollectionpluginall.hrh> // All item collection plugin id |
31 #include <glxcollectionpluginall.hrh> // All item collection plugin id |
34 |
32 |
35 |
33 |
36 #include <glxnavigationalstate.h> // For Navigational State |
34 #include <glxnavigationalstate.h> // For Navigational State |
46 #include "glxgridviewimp.h" |
44 #include "glxgridviewimp.h" |
47 #include "glxgridviewmlobserver.h" // medialist observer for Hg Grid |
45 #include "glxgridviewmlobserver.h" // medialist observer for Hg Grid |
48 |
46 |
49 const TInt KNoOfPages(3); |
47 const TInt KNoOfPages(3); |
50 const TInt KBufferTresholdSize(3); // in rows |
48 const TInt KBufferTresholdSize(3); // in rows |
51 const TInt KMaxNoOfSeamlessLinks(2); |
|
52 |
49 |
53 // ======== MEMBER FUNCTIONS ======== |
50 // ======== MEMBER FUNCTIONS ======== |
54 |
51 |
55 // --------------------------------------------------------------------------- |
52 // --------------------------------------------------------------------------- |
56 // Two-phased constructor. |
53 // Two-phased constructor. |
286 " lastOnScreen / aRequestEnd i(%d)", i); |
279 " lastOnScreen / aRequestEnd i(%d)", i); |
287 iHgGrid->RefreshScreen(i); |
280 iHgGrid->RefreshScreen(i); |
288 } |
281 } |
289 } |
282 } |
290 } |
283 } |
291 } |
|
292 |
|
293 if (iDownloadsPlugin && aRequestStart == KMaxNoOfSeamlessLinks) |
|
294 { |
|
295 SetDownloadLinksTimeL(); |
|
296 } |
284 } |
297 } |
285 } |
298 |
286 |
299 // ---------------------------------------------------------------------------- |
287 // ---------------------------------------------------------------------------- |
300 // HasRelevantThumbnail |
288 // HasRelevantThumbnail |
382 TRACER("CGlxGridViewContainer::CreateHgGridWidgetL()"); |
370 TRACER("CGlxGridViewContainer::CreateHgGridWidgetL()"); |
383 |
371 |
384 TInt mediaCount = iMediaList->Count(); |
372 TInt mediaCount = iMediaList->Count(); |
385 if (!iHgGrid) |
373 if (!iHgGrid) |
386 { |
374 { |
|
375 TSize tnSize = CHgGrid::PreferredImageSize(); |
|
376 GLX_DEBUG3("GlxGrid: CHgGrid::PreferredImageSize() w(%d) h(%d)", |
|
377 tnSize.iWidth, tnSize.iHeight); |
387 TFileName resFile(KDC_APP_BITMAP_DIR); |
378 TFileName resFile(KDC_APP_BITMAP_DIR); |
388 resFile.Append(KGlxIconsFilename); |
379 resFile.Append(KGlxIconsFilename); |
389 CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, |
380 CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, |
390 EMbmGlxiconsQgn_prop_image_notcreated); |
381 EMbmGlxiconsQgn_prop_image_notcreated); |
391 AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize()); |
382 AknIconUtils::SetSize(bitmap, tnSize); |
392 TRect rect = iEikonEnv->EikAppUi()->ClientRect(); |
383 TRect rect = iEikonEnv->EikAppUi()->ClientRect(); |
393 // Create Hg grid object |
384 // Create Hg grid object |
394 iHgGrid = CHgGrid::NewL (rect,mediaCount,CGulIcon::NewL(bitmap)); |
385 iHgGrid = CHgGrid::NewL (rect,mediaCount,CGulIcon::NewL(bitmap)); |
395 } |
386 } |
396 if (mediaCount) |
387 |
397 { |
|
398 // Mediacount would give the no of static items present and |
|
399 // coz medialist doesnt have all the item at |
|
400 // this stage, it will focus index for only download icons. |
|
401 // For other grid views, we have to set focus elsewhere |
|
402 for (TInt i=0; i<mediaCount; i++) |
|
403 { |
|
404 const TGlxMedia& item = iMediaList->Item(i); |
|
405 TIconInfo icon; |
|
406 if (item.GetIconInfo(icon) ) |
|
407 { |
|
408 CFbsBitmap* bitmap = AknIconUtils::CreateIconL(icon.bmpfile, icon.bitmapId); |
|
409 AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize()); |
|
410 iHgGrid->ItemL(i).SetIcon(CGulIcon::NewL(bitmap)); |
|
411 } |
|
412 } |
|
413 // Setting the initial focus |
|
414 iHgGrid->SetSelectedIndex(iMediaList->FocusIndex()); |
|
415 } |
|
416 // Setting to MopParent to update background skin |
388 // Setting to MopParent to update background skin |
417 iHgGrid->SetMopParent(this); |
389 iHgGrid->SetMopParent(this); |
418 // Setting Selction observer for getting callback on key event change |
390 // Setting Selction observer for getting callback on key event change |
419 iHgGrid->SetSelectionObserver(*this); |
391 iHgGrid->SetSelectionObserver(*this); |
420 |
392 |
446 CreateHgGridWidgetL(); |
418 CreateHgGridWidgetL(); |
447 // Create an observer and pass MediaList and HGGrid objects |
419 // Create an observer and pass MediaList and HGGrid objects |
448 CreateGridMediaListObserverL(); |
420 CreateGridMediaListObserverL(); |
449 // Create Grid once again after returning from FS as No calls for handleItem added. |
421 // Create Grid once again after returning from FS as No calls for handleItem added. |
450 CreateGridAfterFSDeactivatedL(); |
422 CreateGridAfterFSDeactivatedL(); |
451 if (iUiUtility->IsPenSupported()) |
|
452 { |
|
453 // Fetch fullscreen thumbnails of the focused item with low priority |
|
454 FetchFSThumbnailL(); |
|
455 } |
|
456 } |
423 } |
457 |
424 |
458 // --------------------------------------------------------------------------- |
425 // --------------------------------------------------------------------------- |
459 // SetGridThumbnailContextL |
426 // SetGridThumbnailContextL |
460 // --------------------------------------------------------------------------- |
427 // --------------------------------------------------------------------------- |
466 iMediaList->SetStaticItemsEnabled(ETrue); |
433 iMediaList->SetStaticItemsEnabled(ETrue); |
467 |
434 |
468 iThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context |
435 iThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context |
469 iThumbnailContext->SetDefaultSpec( iGridIconSize.iWidth,iGridIconSize.iHeight ); |
436 iThumbnailContext->SetDefaultSpec( iGridIconSize.iWidth,iGridIconSize.iHeight ); |
470 iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal ); |
437 iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal ); |
471 |
|
472 iDownloadsPlugin = EFalse; |
|
473 CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathParent ); |
|
474 if (path->Id() == KGlxCollectionPluginDownloadsImplementationUid) |
|
475 { |
|
476 iDownloadsPlugin = ETrue; |
|
477 } |
|
478 CleanupStack::PopAndDestroy(path); |
|
479 } |
438 } |
480 |
439 |
481 // --------------------------------------------------------------------------- |
440 // --------------------------------------------------------------------------- |
482 // CreateGridMediaListObserverL |
441 // CreateGridMediaListObserverL |
483 // --------------------------------------------------------------------------- |
442 // --------------------------------------------------------------------------- |
562 { |
519 { |
563 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
520 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
564 bitmap->Duplicate( speedTn->iBitmap->Handle()); |
521 bitmap->Duplicate( speedTn->iBitmap->Handle()); |
565 iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); |
522 iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); |
566 GLX_LOG_INFO1("### CGlxGridViewContainer::SetIconsL speedTn-Index is %d",index); |
523 GLX_LOG_INFO1("### CGlxGridViewContainer::SetIconsL speedTn-Index is %d",index); |
567 } |
|
568 else if (item.GetIconInfo(icon)) |
|
569 { |
|
570 GLX_LOG_INFO1("CGlxGridViewContainer::SetIconsL - icon(%d)", index); |
|
571 CFbsBitmap* bitmap = AknIconUtils::CreateIconL(icon.bmpfile, icon.bitmapId); |
|
572 AknIconUtils::SetSize(bitmap, setSize); |
|
573 iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); |
|
574 GLX_LOG_INFO1("### CGlxGridViewContainer::SetIconsL GetIconInfo-Index is %d",index); |
|
575 } |
524 } |
576 else if ( KErrNone != tnError && KErrNotSupported != tnError && KErrCANoRights !=tnError) |
525 else if ( KErrNone != tnError && KErrNotSupported != tnError && KErrCANoRights !=tnError) |
577 { |
526 { |
578 GLX_LOG_INFO2("CGlxGridViewContainer::SetIconsL - image_corrupted tnError(%d), i(%d)", |
527 GLX_LOG_INFO2("CGlxGridViewContainer::SetIconsL - image_corrupted tnError(%d), i(%d)", |
579 tnError, index); |
528 tnError, index); |
658 { |
607 { |
659 iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsVideo); |
608 iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsVideo); |
660 } |
609 } |
661 } |
610 } |
662 |
611 |
663 // --------------------------------------------------------------------------- |
612 |
664 // FetchFSThumbnailL |
|
665 // --------------------------------------------------------------------------- |
|
666 // |
|
667 void CGlxGridViewContainer::FetchFSThumbnailL() |
|
668 { |
|
669 TRACER("CGlxGridViewContainer::FetchFSThumbnailL()"); |
|
670 TSize dispSize = iUiUtility->DisplaySize(); |
|
671 iFsFromFocusOutwardIterator.SetRangeOffsets(0,0); |
|
672 |
|
673 iFsThumbnailContext = CGlxThumbnailContext::NewL(&iFsFromFocusOutwardIterator); |
|
674 |
|
675 if (dispSize.iHeight > dispSize.iWidth) |
|
676 { |
|
677 iFsThumbnailContext->SetDefaultSpec(dispSize.iHeight, dispSize.iWidth); |
|
678 } |
|
679 else |
|
680 { |
|
681 iFsThumbnailContext->SetDefaultSpec(dispSize.iWidth, dispSize.iHeight); |
|
682 } |
|
683 iMediaList->AddContextL(iFsThumbnailContext, KGlxFetchContextPriorityLow); |
|
684 } |
|
685 |
|
686 // --------------------------------------------------------------------------- |
|
687 // SetDownloadLinksTimeL |
|
688 // --------------------------------------------------------------------------- |
|
689 // |
|
690 void CGlxGridViewContainer::SetDownloadLinksTimeL() |
|
691 { |
|
692 TRACER("CGlxGridViewContainer::SetDownloadLinksTimeL()"); |
|
693 // Sets up TLS, must be done before FeatureManager is used. |
|
694 FeatureManager::InitializeLibL(); |
|
695 TInt mediaCount = iMediaList->Count(); |
|
696 if (FeatureManager::FeatureSupported(KFeatureIdSeamlessLinks)) |
|
697 { |
|
698 if (iDownloadsPlugin && mediaCount > iHgGrid->ItemsOnScreen() ) |
|
699 { |
|
700 TTime time(0); |
|
701 if (iMediaList->Item(KMaxNoOfSeamlessLinks).GetDate(time)) |
|
702 { |
|
703 if (iMediaList->Item(0).IsStatic()) |
|
704 { |
|
705 iHgGrid->ItemL(0).SetTime(time); // Image Downloads link Icon |
|
706 } |
|
707 if (iMediaList->Item(1).IsStatic()) |
|
708 { |
|
709 iHgGrid->ItemL(1).SetTime(time); // Video Downloads link Icon |
|
710 } |
|
711 } |
|
712 } |
|
713 } |
|
714 // Frees the TLS. Must be done after FeatureManager is used. |
|
715 FeatureManager::UnInitializeLib(); |
|
716 } |
|
717 |
|
718 // --------------------------------------------------------------------------- |
|
719 // RemoveFSThumbnailContext |
|
720 // --------------------------------------------------------------------------- |
|
721 // |
|
722 void CGlxGridViewContainer::RemoveFSThumbnailContext() |
|
723 { |
|
724 TRACER("CGlxGridViewContainer::RemoveFSThumbnailContext()"); |
|
725 if (iMediaList) |
|
726 { |
|
727 iMediaList->RemoveContext(iFsThumbnailContext); |
|
728 delete iFsThumbnailContext; |
|
729 iFsThumbnailContext = NULL; |
|
730 } |
|
731 } |
|
732 |
|
733 // ----------------------------------------------------------------------------- |
613 // ----------------------------------------------------------------------------- |
734 // MopSupplyObject |
614 // MopSupplyObject |
735 // To handle Skin support |
615 // To handle Skin support |
736 // ----------------------------------------------------------------------------- |
616 // ----------------------------------------------------------------------------- |
737 // |
617 // |