27 #include <glxtracer.h> |
27 #include <glxtracer.h> |
28 #include <glxlog.h> |
28 #include <glxlog.h> |
29 |
29 |
30 #include <glxuistd.h> // Fetch context priority def'ns |
30 #include <glxuistd.h> // Fetch context priority def'ns |
31 |
31 |
|
32 #include <ganes/HgDoubleGraphicList.h> |
|
33 |
|
34 |
32 const TInt KInitialThumbnailsTimeDelay(100000); |
35 const TInt KInitialThumbnailsTimeDelay(100000); |
33 const TInt KWaitCount(5); |
36 const TInt KWaitCount(5); |
34 const TInt KThumbnailStartTimeDelay(250000); |
37 const TInt KThumbnailStartTimeDelay(250000); |
35 const TInt KThumbnailIntervalTimeDelay(50000); |
38 const TInt KThumbnailIntervalTimeDelay(50000); |
36 const TInt KPreviewThumbnailFetchCount(1); |
39 const TInt KPreviewThumbnailFetchCount(1); |
|
40 |
|
41 // ---------------------------------------------------------------------------- |
|
42 // CWaitScheduler::NewL() |
|
43 // ---------------------------------------------------------------------------- |
|
44 CGlxWaitScheduler* CGlxWaitScheduler::NewL() |
|
45 { |
|
46 TRACER("CGlxWaitScheduler::NewL()"); |
|
47 CGlxWaitScheduler* self = new( ELeave ) CGlxWaitScheduler(); |
|
48 CleanupStack::PushL( self ); |
|
49 self->ConstructL( ); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 CGlxWaitScheduler::CGlxWaitScheduler() |
|
55 : CActive( EPriorityStandard ) |
|
56 { |
|
57 TRACER("CGlxWaitScheduler::CGlxWaitScheduler()"); |
|
58 CActiveScheduler::Add( this ); |
|
59 } |
|
60 |
|
61 void CGlxWaitScheduler::ConstructL() |
|
62 { |
|
63 TRACER("CGlxWaitScheduler::ConstructL()"); |
|
64 // Do nothing |
|
65 } |
|
66 |
|
67 CGlxWaitScheduler::~CGlxWaitScheduler() |
|
68 { |
|
69 TRACER("CGlxWaitScheduler::~CGlxWaitScheduler()"); |
|
70 Cancel(); |
|
71 } |
|
72 |
|
73 void CGlxWaitScheduler::WaitForRequest() |
|
74 { |
|
75 TRACER("CGlxWaitScheduler::WaitForRequest()"); |
|
76 SetActive(); |
|
77 iScheduler.Start(); |
|
78 } |
|
79 |
|
80 void CGlxWaitScheduler::RunL() |
|
81 { |
|
82 TRACER("CGlxWaitScheduler::RunL()"); |
|
83 iScheduler.AsyncStop(); |
|
84 } |
|
85 |
|
86 void CGlxWaitScheduler::DoCancel() |
|
87 { |
|
88 TRACER("CGlxWaitScheduler::DoCancel()"); |
|
89 //Do nothing |
|
90 } |
37 |
91 |
38 // ---------------------------------------------------------------------------- |
92 // ---------------------------------------------------------------------------- |
39 // NewL |
93 // NewL |
40 // ---------------------------------------------------------------------------- |
94 // ---------------------------------------------------------------------------- |
41 // |
95 // |
92 GlxFullThumbnailAttributeId(ETrue, |
146 GlxFullThumbnailAttributeId(ETrue, |
93 iGridIconSize.iWidth,iGridIconSize.iHeight) ); |
147 iGridIconSize.iWidth,iGridIconSize.iHeight) ); |
94 iThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth, |
148 iThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth, |
95 iGridIconSize.iHeight); |
149 iGridIconSize.iHeight); |
96 iThumbnailContext->AddAttributeL(tnAttr); |
150 iThumbnailContext->AddAttributeL(tnAttr); |
|
151 iBitmapScaler = CBitmapScaler::NewL(); |
97 } |
152 } |
98 |
153 |
99 // ---------------------------------------------------------------------------- |
154 // ---------------------------------------------------------------------------- |
100 // Destructor |
155 // Destructor |
101 // ---------------------------------------------------------------------------- |
156 // ---------------------------------------------------------------------------- |
119 iTimer->Cancel(); |
174 iTimer->Cancel(); |
120 } |
175 } |
121 delete iTimer; |
176 delete iTimer; |
122 iTimer = NULL; |
177 iTimer = NULL; |
123 iPreviewItemCount.Close(); |
178 iPreviewItemCount.Close(); |
|
179 |
|
180 if(iBitmapScaler) |
|
181 { |
|
182 delete iBitmapScaler; |
|
183 iBitmapScaler = NULL; |
|
184 } |
124 } |
185 } |
125 |
186 |
126 // ---------------------------------------------------------------------------- |
187 // ---------------------------------------------------------------------------- |
127 // TimerTickedL: we need to update only when required i.e, when the thumbnail count |
188 // TimerTickedL: we need to update only when required i.e, when the thumbnail count |
128 // has not reached till the max limit to be shown |
189 // has not reached till the max limit to be shown |
145 const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( |
206 const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( |
146 thumbnailAttribute ); |
207 thumbnailAttribute ); |
147 if (value) |
208 if (value) |
148 { |
209 { |
149 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
210 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
150 bitmap->Duplicate( value->iBitmap->Handle()); |
211 bitmap->Duplicate( value->iBitmap->Handle()); |
|
212 //ScaleBitmapToListSizeL(value->iBitmap, bitmap); |
151 iObserver.PreviewTNReadyL(bitmap, NULL,iProgressIndex); |
213 iObserver.PreviewTNReadyL(bitmap, NULL,iProgressIndex); |
152 } |
214 } |
153 } |
215 } |
154 } |
216 } |
155 else if (iPopulateListTNs && iMediaList && iMediaList->Count() == 0) |
217 else if (iPopulateListTNs && iMediaList && iMediaList->Count() == 0) |
177 thumbnailAttribute ); |
239 thumbnailAttribute ); |
178 if (value) |
240 if (value) |
179 { |
241 { |
180 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
242 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
181 bitmap->Duplicate( value->iBitmap->Handle()); |
243 bitmap->Duplicate( value->iBitmap->Handle()); |
|
244 //ScaleBitmapToListSizeL(value->iBitmap, bitmap); |
182 iObserver.PreviewTNReadyL(bitmap, NULL,iProgressIndex); |
245 iObserver.PreviewTNReadyL(bitmap, NULL,iProgressIndex); |
183 } |
246 } |
184 else |
247 else |
185 { |
248 { |
186 if (iTrialCount == KWaitCount) |
249 if (iTrialCount == KWaitCount) |
423 TRACER("CGlxPreviewThumbnailBinding::HandlePopulatedL()"); |
486 TRACER("CGlxPreviewThumbnailBinding::HandlePopulatedL()"); |
424 //Start the timer |
487 //Start the timer |
425 StartTimer(iPopulateListTNs); |
488 StartTimer(iPopulateListTNs); |
426 } |
489 } |
427 |
490 |
|
491 // ---------------------------------------------------------------------------- |
|
492 // ScaleBitmapToListSizeL |
|
493 // ---------------------------------------------------------------------------- |
|
494 // |
|
495 void CGlxPreviewThumbnailBinding::ScaleBitmapToListSizeL( |
|
496 CFbsBitmap* aSrcBitmap, CFbsBitmap* aDestBitmap) |
|
497 { |
|
498 TRACER("CGlxPreviewThumbnailBinding::ScaleBitmapToListSizeL()"); |
|
499 |
|
500 // Create the bitmap with the list preferred size |
|
501 aDestBitmap->Create(CHgDoubleGraphicList::PreferredImageSize(), EColor16MU); |
|
502 |
|
503 CGlxWaitScheduler* waitScheduler = CGlxWaitScheduler::NewL(); |
|
504 CleanupStack::PushL( waitScheduler ); |
|
505 |
|
506 iBitmapScaler->Scale(&waitScheduler->iStatus, *aSrcBitmap, |
|
507 *aDestBitmap, ETrue); |
|
508 waitScheduler->WaitForRequest(); |
|
509 |
|
510 CleanupStack::PopAndDestroy( waitScheduler ); |
|
511 } |