52 // --------------------------------------------------------------------------- |
52 // --------------------------------------------------------------------------- |
53 // Two-phased constructor. |
53 // Two-phased constructor. |
54 // --------------------------------------------------------------------------- |
54 // --------------------------------------------------------------------------- |
55 // |
55 // |
56 CGlxGridViewContainer* CGlxGridViewContainer::NewL(MGlxMediaList *aMediaList, |
56 CGlxGridViewContainer* CGlxGridViewContainer::NewL(MGlxMediaList *aMediaList, |
57 CGlxUiUtility* aUiUtility, |
57 CGlxUiUtility* aUiUtility, MGlxGridEventObserver& aObserver, |
58 MGlxGridEventObserver& aObserver,CAknToolbar* aToolbar) |
58 CAknToolbar* aToolbar) |
59 { |
59 { |
60 TRACER("CGlxGridViewContainer::NewL"); |
60 TRACER("CGlxGridViewContainer::NewL"); |
61 CGlxGridViewContainer* self = CGlxGridViewContainer::NewLC(aMediaList,aUiUtility,aObserver,aToolbar) ; |
61 CGlxGridViewContainer* self = CGlxGridViewContainer::NewLC(aMediaList, |
62 CleanupStack::Pop(self) ; |
62 aUiUtility, aObserver, aToolbar); |
63 return self ; |
63 CleanupStack::Pop(self); |
64 } |
64 return self; |
|
65 } |
65 |
66 |
66 // --------------------------------------------------------------------------- |
67 // --------------------------------------------------------------------------- |
67 // Two-phased constructor. |
68 // Two-phased constructor. |
68 // --------------------------------------------------------------------------- |
69 // --------------------------------------------------------------------------- |
69 // |
70 // |
70 CGlxGridViewContainer* CGlxGridViewContainer::NewLC(MGlxMediaList *aMediaList, |
71 CGlxGridViewContainer* CGlxGridViewContainer::NewLC( |
71 CGlxUiUtility* aUiUtility, |
72 MGlxMediaList *aMediaList, CGlxUiUtility* aUiUtility, |
72 MGlxGridEventObserver& aObserver,CAknToolbar* aToolbar) |
73 MGlxGridEventObserver& aObserver, CAknToolbar* aToolbar) |
73 { |
74 { |
74 TRACER("CGlxGridViewContainer::NewLC"); |
75 TRACER("CGlxGridViewContainer::NewLC"); |
75 CGlxGridViewContainer* self = new(ELeave) CGlxGridViewContainer(aMediaList,aUiUtility,aObserver,aToolbar); |
76 CGlxGridViewContainer* self = new (ELeave) CGlxGridViewContainer( |
76 CleanupStack::PushL(self ) ; |
77 aMediaList, aUiUtility, aObserver, aToolbar); |
77 self->ConstructL() ; |
78 CleanupStack::PushL(self); |
78 return self ; |
79 self->ConstructL(); |
79 } |
80 return self; |
|
81 } |
80 |
82 |
81 // --------------------------------------------------------------------------- |
83 // --------------------------------------------------------------------------- |
82 // Destructor |
84 // Destructor |
83 // --------------------------------------------------------------------------- |
85 // --------------------------------------------------------------------------- |
84 // |
86 // |
85 CGlxGridViewContainer::~CGlxGridViewContainer() |
87 CGlxGridViewContainer::~CGlxGridViewContainer() |
86 { |
88 { |
87 TRACER("CGlxGridViewContainer::~CGlxGridViewContainer"); |
89 TRACER("CGlxGridViewContainer::~CGlxGridViewContainer"); |
88 |
|
89 delete iMMCNotifier; |
90 delete iMMCNotifier; |
90 iMMCNotifier = NULL; |
91 iMMCNotifier = NULL; |
91 |
92 |
92 if(iBgContext) |
93 if(iBgContext) |
93 { |
94 { |
123 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
124 // C++ default constructor can NOT contain any code, that |
125 // C++ default constructor can NOT contain any code, that |
125 // might leave. |
126 // might leave. |
126 // --------------------------------------------------------------------------- |
127 // --------------------------------------------------------------------------- |
127 // |
128 // |
128 CGlxGridViewContainer::CGlxGridViewContainer(MGlxMediaList *aMediaList,CGlxUiUtility* aUiUtility, |
129 CGlxGridViewContainer::CGlxGridViewContainer(MGlxMediaList *aMediaList, |
129 MGlxGridEventObserver& aObserver,CAknToolbar* aToolbar) |
130 CGlxUiUtility* aUiUtility, MGlxGridEventObserver& aObserver, |
130 : iMediaList(aMediaList),iUiUtility(aUiUtility),iGlxGridViewObserver(aObserver),iToolbar(aToolbar) |
131 CAknToolbar* aToolbar) : |
131 { |
132 iMediaList(aMediaList), iUiUtility(aUiUtility), iGlxGridViewObserver( |
132 TRACER("CGlxGridViewContainer::CGlxGridViewContainer"); |
133 aObserver), iToolbar(aToolbar) |
133 } |
134 { |
|
135 TRACER("CGlxGridViewContainer::CGlxGridViewContainer"); |
|
136 } |
134 |
137 |
135 // --------------------------------------------------------------------------- |
138 // --------------------------------------------------------------------------- |
136 // Symbian 2nd phase constructor can leave. |
139 // Symbian 2nd phase constructor can leave. |
137 // --------------------------------------------------------------------------- |
140 // --------------------------------------------------------------------------- |
138 // |
141 // |
139 void CGlxGridViewContainer::ConstructL() |
142 void CGlxGridViewContainer::ConstructL() |
140 { |
143 { |
141 TRACER("CGlxGridViewContainer::ConstructL()"); |
144 TRACER("CGlxGridViewContainer::ConstructL()"); |
142 |
|
143 //create the container window. |
145 //create the container window. |
144 CreateWindowL(); |
146 CreateWindowL(); |
145 |
147 |
146 // Making the default FSActivation as false |
148 // Making the default FSActivation as false |
147 iFullscreenViewActivated = EFalse; |
149 iFullscreenViewActivated = EFalse; |
380 // --------------------------------------------------------------------------- |
381 // --------------------------------------------------------------------------- |
381 // |
382 // |
382 void CGlxGridViewContainer::CreateHgGridWidgetL() |
383 void CGlxGridViewContainer::CreateHgGridWidgetL() |
383 { |
384 { |
384 TRACER("CGlxGridViewContainer::CreateHgGridWidgetL()"); |
385 TRACER("CGlxGridViewContainer::CreateHgGridWidgetL()"); |
385 |
|
386 TInt mediaCount = iMediaList->Count(); |
386 TInt mediaCount = iMediaList->Count(); |
387 GLX_DEBUG2("GlxGrid: CHgGrid::CreateHgGridWidgetL() " |
387 GLX_DEBUG2("GlxGrid: CHgGrid::CreateHgGridWidgetL() " |
388 "mediaCount(%d)", mediaCount); |
388 "mediaCount(%d)", mediaCount); |
389 if (!iHgGrid) |
389 if (!iHgGrid) |
390 { |
390 { |
450 // GetHgGridRect |
450 // GetHgGridRect |
451 // --------------------------------------------------------------------------- |
451 // --------------------------------------------------------------------------- |
452 // |
452 // |
453 TRect CGlxGridViewContainer::GetHgGridRect() |
453 TRect CGlxGridViewContainer::GetHgGridRect() |
454 { |
454 { |
455 TRACER("CGlxGridViewContainer::GetHgGridRect()"); |
455 TRACER("CGlxGridViewContainer::GetHgGridRect()"); |
456 |
|
457 TRect clientrect = iEikonEnv->EikAppUi()->ClientRect(); |
456 TRect clientrect = iEikonEnv->EikAppUi()->ClientRect(); |
458 TRect apprect = iEikonEnv->EikAppUi()->ApplicationRect(); |
457 TRect apprect = iEikonEnv->EikAppUi()->ApplicationRect(); |
459 if(apprect.Height()>apprect.Width()) |
458 if (apprect.Height() > apprect.Width()) |
460 { |
459 { |
461 //portrait: |
460 //portrait: |
462 //height : apprect height - (status pane height + toolbar height + cba height) |
461 //height : apprect height - (status pane height + toolbar height + cba height) |
463 //width remains 360. |
462 //width remains 360. |
464 clientrect.SetHeight(apprect.Height() - ((clientrect.iTl.iY) + (iToolbar->Size().iHeight) + (iEikonEnv->AppUiFactory()->Cba()->Rect().Height()))); |
463 clientrect.SetHeight(apprect.Height() - ((clientrect.iTl.iY) |
|
464 + (iToolbar->Size().iHeight) |
|
465 + (iEikonEnv->AppUiFactory()->Cba()->Rect().Height()))); |
465 } |
466 } |
466 else |
467 else |
467 { |
468 { |
468 //Landscape: |
469 //Landscape: |
469 //height : apprect - (status pane height + cba height) |
470 //height : apprect - (status pane height + cba height) |
470 //width : apprect width - toolbarwidth. |
471 //width : apprect width - toolbarwidth. |
471 clientrect.SetHeight(apprect.Height() - ((clientrect.iTl.iY) + (iEikonEnv->AppUiFactory()->Cba()->Rect().Height()))); |
472 clientrect.SetHeight(apprect.Height() - ((clientrect.iTl.iY) |
|
473 + (iEikonEnv->AppUiFactory()->Cba()->Rect().Height()))); |
472 clientrect.SetWidth(apprect.Width() - iToolbar->Size().iWidth); |
474 clientrect.SetWidth(apprect.Width() - iToolbar->Size().iWidth); |
473 } |
475 } |
474 return clientrect; |
476 return clientrect; |
475 } |
477 } |
476 // --------------------------------------------------------------------------- |
478 // --------------------------------------------------------------------------- |
477 // CreateGridL |
479 // CreateGridL |
478 // --------------------------------------------------------------------------- |
480 // --------------------------------------------------------------------------- |
591 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
593 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
592 bitmap->Duplicate( speedTn->iBitmap->Handle()); |
594 bitmap->Duplicate( speedTn->iBitmap->Handle()); |
593 iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); |
595 iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); |
594 GLX_LOG_INFO1("### CGlxGridViewContainer::SetIconsL speedTn-Index is %d",index); |
596 GLX_LOG_INFO1("### CGlxGridViewContainer::SetIconsL speedTn-Index is %d",index); |
595 } |
597 } |
596 else if ((KErrCANoRights ==tnError) || (KErrDiskFull ==tnError)) |
598 else if ((KErrCANoRights ==tnError) || (KErrDiskFull ==tnError) |
|
599 || (item.Category() == EMPXVideo && KErrNone != tnError)) |
597 { |
600 { |
598 /* |
601 /* |
599 * this is a safe code added to show default |
602 * this is a safe code added to show default |
600 * TNM returns -17452 in case SD DRM files |
603 * TNM returns -17452 in case SD DRM files |
601 * this code is added as coming from other view to |
604 * this code is added as coming from other view to |
606 * The same thing is needs to be done for the case when there is no |
609 * The same thing is needs to be done for the case when there is no |
607 * disk space for the thumbnails to be created. |
610 * disk space for the thumbnails to be created. |
608 * In such a case we need to show default thumbnails instead of corrupted. |
611 * In such a case we need to show default thumbnails instead of corrupted. |
609 * |
612 * |
610 */ |
613 */ |
611 GLX_LOG_INFO2("CGlxGridViewContainer::SetIconsL - image_defaultthumbnail tnError(%d), i(%d)", |
614 GLX_LOG_INFO2( |
612 tnError, index); |
615 "CGlxGridViewContainer::SetIconsL - image_defaultthumbnail tnError(%d), i(%d)", |
613 CFbsBitmap* bitmap = NULL; |
616 tnError, index); |
614 CFbsBitmap* mask = NULL; |
617 SetIconL(index, EMbmGlxiconsQgn_prop_image_notcreated, |
615 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
|
616 bitmap, mask, iIconsFileName, EMbmGlxiconsQgn_prop_image_notcreated, |
|
617 EMbmGlxiconsQgn_prop_image_notcreated_mask); |
618 EMbmGlxiconsQgn_prop_image_notcreated_mask); |
618 __ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
619 __ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
620 |
|
621 AknIconUtils::SetSize(bitmap, iHgGridImageSize, |
|
622 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
623 AknIconUtils::SetSize(mask, iHgGridImageSize, |
|
624 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
625 |
|
626 iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap, mask)); |
|
627 CleanupStack::Pop(mask); |
|
628 CleanupStack::Pop(bitmap); |
|
629 } |
619 } |
630 else if(KErrNone != tnError) |
620 else if(KErrNone != tnError) |
631 { |
621 { |
632 GLX_LOG_INFO2("CGlxGridViewContainer::SetIconsL - image_corrupted tnError(%d), i(%d)", |
622 GLX_LOG_INFO2( |
|
623 "CGlxGridViewContainer::SetIconsL - image_corrupted tnError(%d), i(%d)", |
633 tnError, index); |
624 tnError, index); |
634 CFbsBitmap* bitmap = NULL; |
625 SetIconL(index, EMbmGlxiconsQgn_prop_image_corrupted, |
635 CFbsBitmap* mask = NULL; |
|
636 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
|
637 bitmap, mask, iIconsFileName, EMbmGlxiconsQgn_prop_image_corrupted, |
|
638 EMbmGlxiconsQgn_prop_image_corrupted_mask); |
626 EMbmGlxiconsQgn_prop_image_corrupted_mask); |
639 __ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
640 __ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
641 |
|
642 AknIconUtils::SetSize(bitmap, iHgGridImageSize, |
|
643 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
644 AknIconUtils::SetSize(mask, iHgGridImageSize, |
|
645 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
646 |
|
647 iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap, mask)); |
|
648 CleanupStack::Pop(mask); |
|
649 CleanupStack::Pop(bitmap); |
|
650 } |
627 } |
651 |
628 |
652 if (item.IsDrmProtected()) |
629 if (item.IsDrmProtected()) |
653 { |
630 { |
654 const TDesC& uri = item.Uri(); |
631 const TDesC& uri = item.Uri(); |
697 if (item.Category() == EMPXVideo) |
674 if (item.Category() == EMPXVideo) |
698 { |
675 { |
699 iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsVideo); |
676 iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsVideo); |
700 } |
677 } |
701 } |
678 } |
702 |
679 |
|
680 // ---------------------------------------------------------------------------- |
|
681 // SetIconL |
|
682 // ---------------------------------------------------------------------------- |
|
683 // |
|
684 void CGlxGridViewContainer::SetIconL(TInt aItemIndex, TInt aBitmapId, |
|
685 TInt aMaskId) |
|
686 { |
|
687 TRACER("CGlxGridViewContainer::SetIconL()"); |
|
688 CFbsBitmap* bitmap = NULL; |
|
689 CFbsBitmap* mask = NULL; |
|
690 TSize setSize = CHgGrid::PreferredImageSize(); |
|
691 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, bitmap, |
|
692 mask, iIconsFileName, aBitmapId, aMaskId); |
|
693 __ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
694 __ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
695 |
|
696 AknIconUtils::SetSize(bitmap, setSize, |
|
697 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
698 AknIconUtils::SetSize(mask, setSize, |
|
699 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
700 |
|
701 iHgGrid->ItemL(aItemIndex).SetIcon(CGulIcon::NewL(bitmap, mask)); |
|
702 CleanupStack::Pop(mask); |
|
703 CleanupStack::Pop(bitmap); |
|
704 } |
703 |
705 |
704 // ----------------------------------------------------------------------------- |
706 // ----------------------------------------------------------------------------- |
705 // MopSupplyObject |
707 // MopSupplyObject |
706 // To handle Skin support |
708 // To handle Skin support |
707 // ----------------------------------------------------------------------------- |
709 // ----------------------------------------------------------------------------- |