53 // --------------------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- |
54 // Two-phased constructor. |
54 // Two-phased constructor. |
55 // --------------------------------------------------------------------------- |
55 // --------------------------------------------------------------------------- |
56 // |
56 // |
57 EXPORT_C CGlxGridViewMLObserver* CGlxGridViewMLObserver::NewL( |
57 EXPORT_C CGlxGridViewMLObserver* CGlxGridViewMLObserver::NewL( |
58 MHgScrollBufferObserver& aHgScrollBufferObs, |
|
59 MGlxMediaList& aMediaList, CHgGrid* aHgGrid, |
58 MGlxMediaList& aMediaList, CHgGrid* aHgGrid, |
60 TGlxFilterItemType aFilterType) |
59 TGlxFilterItemType aFilterType) |
61 { |
60 { |
62 TRACER("CGlxGridViewMLObserver::NewL()"); |
61 TRACER("CGlxGridViewMLObserver::NewL()"); |
63 CGlxGridViewMLObserver* self = new (ELeave) CGlxGridViewMLObserver( |
62 CGlxGridViewMLObserver* self = new (ELeave) CGlxGridViewMLObserver( |
64 aHgScrollBufferObs, aMediaList, aHgGrid, aFilterType); |
63 aMediaList, aHgGrid, aFilterType); |
65 CleanupStack::PushL(self); |
64 CleanupStack::PushL(self); |
66 self->ConstructL(); |
65 self->ConstructL(); |
67 CleanupStack::Pop(self); |
66 CleanupStack::Pop(self); |
68 return self; |
67 return self; |
69 } |
68 } |
70 |
|
71 // --------------------------------------------------------------------------- |
69 // --------------------------------------------------------------------------- |
72 // C++ default constructor can NOT contain any code, that |
70 // C++ default constructor can NOT contain any code, that |
73 // might leave. |
71 // might leave. |
74 // --------------------------------------------------------------------------- |
72 // --------------------------------------------------------------------------- |
75 // |
73 // |
76 CGlxGridViewMLObserver::CGlxGridViewMLObserver( |
74 CGlxGridViewMLObserver::CGlxGridViewMLObserver(MGlxMediaList& aMediaList, |
77 MHgScrollBufferObserver& aHgScrollBufferObs, |
75 CHgGrid* aHgGrid, TGlxFilterItemType aFilterType) : |
78 MGlxMediaList& aMediaList, CHgGrid* aHgGrid, |
76 iMediaList(aMediaList), iHgGrid(aHgGrid), iFilterType(aFilterType) |
79 TGlxFilterItemType aFilterType) : |
|
80 iHgScrollBufferObs(aHgScrollBufferObs), iMediaList(aMediaList), iHgGrid( |
|
81 aHgGrid), iFilterType(aFilterType) |
|
82 { |
77 { |
83 TRACER("CGlxGridViewMLObserver::CGlxGridViewMLObserver()"); |
78 TRACER("CGlxGridViewMLObserver::CGlxGridViewMLObserver()"); |
84 } |
79 } |
85 |
80 |
86 // --------------------------------------------------------------------------- |
81 // --------------------------------------------------------------------------- |
87 // Symbian 2nd phase constructor can leave. |
82 // Symbian 2nd phase constructor can leave. |
88 // --------------------------------------------------------------------------- |
83 // --------------------------------------------------------------------------- |
89 // |
84 // |
90 void CGlxGridViewMLObserver::ConstructL() |
85 void CGlxGridViewMLObserver::ConstructL() |
91 { |
86 { |
92 TRACER("CGlxGridViewMLObserver::ConstructL()"); |
87 TRACER("CGlxGridViewMLObserver::ConstructL()"); |
93 iMediaList.AddMediaListObserverL(this); |
88 iMediaList.AddMediaListObserverL(this); |
94 // For DRm Utility |
89 // For DRm Utility |
97 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
92 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
98 CleanupClosePushL(*uiUtility); |
93 CleanupClosePushL(*uiUtility); |
99 iGridIconSize = uiUtility->GetGridIconSize(); |
94 iGridIconSize = uiUtility->GetGridIconSize(); |
100 iItemsPerPage = uiUtility->VisibleItemsInPageGranularityL(); |
95 iItemsPerPage = uiUtility->VisibleItemsInPageGranularityL(); |
101 CleanupStack::PopAndDestroy(uiUtility); |
96 CleanupStack::PopAndDestroy(uiUtility); |
102 |
97 |
103 iQualityTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, |
98 iQualityTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, |
104 GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, |
99 GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, |
105 iGridIconSize.iHeight ) ); |
100 iGridIconSize.iHeight ) ); |
106 |
101 |
107 iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, |
102 iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, |
108 GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth, |
103 GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth, |
109 iGridIconSize.iHeight ) ); |
104 iGridIconSize.iHeight ) ); |
110 |
105 |
111 iIconsFileName.Append(KDC_APP_BITMAP_DIR); |
106 iIconsFileName.Append(KDC_APP_BITMAP_DIR); |
112 iIconsFileName.Append(KGlxIconsFilename); |
107 iIconsFileName.Append(KGlxIconsFilename); |
113 iIsDefaultIconSet = EFalse; |
108 iIsDefaultIconSet = EFalse; |
114 |
109 |
115 iDiskErrorIntimated = EFalse; |
110 iDiskErrorIntimated = EFalse; |
116 } |
111 } |
117 |
112 |
118 // --------------------------------------------------------------------------- |
113 // --------------------------------------------------------------------------- |
119 // Destructor |
114 // Destructor |
131 } |
126 } |
132 |
127 |
133 // ---------------------------------------------------------------------------- |
128 // ---------------------------------------------------------------------------- |
134 // HandleItemAddedL |
129 // HandleItemAddedL |
135 // ---------------------------------------------------------------------------- |
130 // ---------------------------------------------------------------------------- |
136 // |
131 // |
137 void CGlxGridViewMLObserver::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, |
132 void CGlxGridViewMLObserver::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, |
138 MGlxMediaList* aList ) |
133 MGlxMediaList* aList ) |
139 { |
134 { |
140 TRACER("CGlxGridViewMLObserver::HandleItemAddedL()"); |
135 TRACER("CGlxGridViewMLObserver::HandleItemAddedL()"); |
141 GLX_DEBUG3("CGlxGridViewMLObserver::HandleItemAddedL() aStartIndex(%d)," |
136 GLX_DEBUG3("CGlxGridViewMLObserver::HandleItemAddedL() aStartIndex(%d)," |
142 " aEndIndex(%d)", aStartIndex, aEndIndex); |
137 " aEndIndex(%d)", aStartIndex, aEndIndex); |
171 } |
166 } |
172 |
167 |
173 // ---------------------------------------------------------------------------- |
168 // ---------------------------------------------------------------------------- |
174 // HandleItemRemoved |
169 // HandleItemRemoved |
175 // ---------------------------------------------------------------------------- |
170 // ---------------------------------------------------------------------------- |
176 // |
171 // |
177 void CGlxGridViewMLObserver::HandleItemRemovedL( TInt aStartIndex, |
172 void CGlxGridViewMLObserver::HandleItemRemovedL( TInt aStartIndex, |
178 TInt aEndIndex, MGlxMediaList* aList ) |
173 TInt aEndIndex, MGlxMediaList* aList ) |
179 { |
174 { |
180 TRACER("CGlxGridViewMLObserver::HandleItemRemovedL()"); |
175 TRACER("CGlxGridViewMLObserver::HandleItemRemovedL()"); |
181 GLX_DEBUG3("CGlxGridViewMLObserver::HandleItemRemovedL() aStartIndex(%d), aEndIndex(%d)", |
|
182 aStartIndex, aEndIndex); |
|
183 if (iHgGrid) |
176 if (iHgGrid) |
184 { |
177 { |
185 TInt mediaCount = aList->Count(); |
178 TInt mediaCount = aList->Count(); |
186 // If the last item is also deleted, refresh the view |
179 |
187 if (mediaCount <= 0) |
180 for (TInt i = aEndIndex; i>= aStartIndex; i--) |
188 { |
181 { |
189 if (iMediaList.VisibleWindowIndex() > iMediaList.Count()) |
182 iHgGrid->RemoveItem(i); |
|
183 } |
|
184 |
|
185 // If the last item is also deleted, this refreshes the view |
|
186 if (mediaCount <=0) |
|
187 { |
|
188 if(iMediaList.VisibleWindowIndex() > iMediaList.Count()) |
190 { |
189 { |
191 iMediaList.SetVisibleWindowIndexL(0); |
190 iMediaList.SetVisibleWindowIndexL(0); |
192 } |
191 } |
193 //This is done since the Hg doesnot refresh the screen |
192 //This is done since the Hg doesnot refresh the screen |
194 //when we remove all the items from the grid |
193 //when we remove all the items from the grid |
195 GLX_LOG_INFO("CGlxGridViewMLObserver::HandleItemRemovedL - Hg Reset"); |
194 iHgGrid->DrawDeferred(); |
196 iHgGrid->DrawDeferred(); |
195 iHgGrid->Reset(); |
197 iHgGrid->Reset(); |
196 return; |
198 return; |
197 } |
199 } |
198 else if (iMediaList.VisibleWindowIndex() > iMediaList.Count()) |
200 |
199 { |
201 if (aStartIndex == aEndIndex) |
200 iMediaList.SetVisibleWindowIndexL(iMediaList.Count()-1); |
202 { |
201 } |
203 iHgGrid->RemoveItem(aStartIndex); |
202 iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); |
204 } |
|
205 else |
|
206 { |
|
207 GLX_LOG_INFO("CGlxGridViewMLObserver::HandleItemRemovedL - Hg RemoveItems(+)"); |
|
208 // Need to disable the buffering support until HgGrid data model |
|
209 // is synced with Medialist; Otherwise, RequestL would result in |
|
210 // requesting same index for the no of items removed. |
|
211 iHgGrid->DisableScrollBuffer(); |
|
212 for (TInt i = aEndIndex; i >= aStartIndex; i--) |
|
213 { |
|
214 iHgGrid->RemoveItem(i); |
|
215 } |
|
216 // Enable Buffer support |
|
217 iHgGrid->EnableScrollBufferL(iHgScrollBufferObs, (KNoOfPages |
|
218 * iItemsPerPage), KBufferTresholdSize); |
|
219 GLX_LOG_INFO("CGlxGridViewMLObserver::HandleItemRemovedL - Hg RemoveItems(-)"); |
|
220 } |
|
221 |
|
222 if (iMediaList.VisibleWindowIndex() > iMediaList.Count()) |
|
223 { |
|
224 iMediaList.SetVisibleWindowIndexL(iMediaList.Count() - 1); |
|
225 } |
|
226 iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); |
|
227 } |
203 } |
228 } |
204 } |
229 |
205 |
230 // ---------------------------------------------------------------------------- |
206 // ---------------------------------------------------------------------------- |
231 // HandleAttributesAvailableL |
207 // HandleAttributesAvailableL |
232 // ---------------------------------------------------------------------------- |
208 // ---------------------------------------------------------------------------- |
233 // |
209 // |
234 void CGlxGridViewMLObserver::HandleAttributesAvailableL( TInt aItemIndex, |
210 void CGlxGridViewMLObserver::HandleAttributesAvailableL( TInt aItemIndex, |
235 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/ ) |
211 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/ ) |
236 { |
212 { |
237 TRACER("CGlxGridViewMLObserver::HandleAttributesAvailableL()"); |
213 TRACER("CGlxGridViewMLObserver::HandleAttributesAvailableL()"); |
238 GLX_LOG_INFO1("CGlxGridViewMLObserver::HandleAttributesAvailableL " |
214 GLX_LOG_INFO1("CGlxGridViewMLObserver::HandleAttributesAvailableL " |
239 "aItemIndex(%d)", aItemIndex); |
215 "aItemIndex(%d)", aItemIndex); |
288 SetIconL(aItemIndex, EMbmGlxiconsQgn_prop_image_corrupted, |
264 SetIconL(aItemIndex, EMbmGlxiconsQgn_prop_image_corrupted, |
289 EMbmGlxiconsQgn_prop_image_corrupted_mask, |
265 EMbmGlxiconsQgn_prop_image_corrupted_mask, |
290 CHgItem::EHgItemFlagsNone); |
266 CHgItem::EHgItemFlagsNone); |
291 } |
267 } |
292 } |
268 } |
293 |
269 |
294 //Now Update the items with the DRM/video icon and date/time |
270 //Now Update the items with the DRM/video icon and date/time |
295 UpdateItemsL(aItemIndex,aAttributes); |
271 UpdateItemsL(aItemIndex,aAttributes); |
296 |
272 |
297 //Now refresh the screen based on the attributes available index |
273 //Now refresh the screen based on the attributes available index |
298 RefreshScreenL(aItemIndex,aAttributes); |
274 RefreshScreenL(aItemIndex,aAttributes); |
299 } |
275 } |
300 |
276 |
301 // ---------------------------------------------------------------------------- |
277 // ---------------------------------------------------------------------------- |
302 // HandleFocusChangedL |
278 // HandleFocusChangedL |
303 // ---------------------------------------------------------------------------- |
279 // ---------------------------------------------------------------------------- |
304 // |
280 // |
305 void CGlxGridViewMLObserver::HandleFocusChangedL( NGlxListDefs:: |
281 void CGlxGridViewMLObserver::HandleFocusChangedL( NGlxListDefs:: |
306 TFocusChangeType /*aType*/, TInt aNewIndex, TInt aOldIndex, |
282 TFocusChangeType /*aType*/, TInt aNewIndex, TInt aOldIndex, |
307 MGlxMediaList* /*aList*/ ) |
283 MGlxMediaList* /*aList*/ ) |
308 { |
284 { |
309 TRACER("CGlxGridViewMLObserver::HandleFocusChangedL()"); |
285 TRACER("CGlxGridViewMLObserver::HandleFocusChangedL()"); |
310 if (aOldIndex != KErrNotFound) |
286 if (aOldIndex != KErrNotFound) |
311 { |
287 { |
321 } |
297 } |
322 |
298 |
323 // ---------------------------------------------------------------------------- |
299 // ---------------------------------------------------------------------------- |
324 // HandleItemSelected |
300 // HandleItemSelected |
325 // ---------------------------------------------------------------------------- |
301 // ---------------------------------------------------------------------------- |
|
302 // |
|
303 void CGlxGridViewMLObserver::HandleItemSelectedL(TInt /*aIndex*/, |
|
304 TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) |
|
305 { |
|
306 TRACER("CGlxGridViewMLObserver::HandleItemSelectedL()"); |
|
307 } |
|
308 |
|
309 // ---------------------------------------------------------------------------- |
|
310 // HandleMessageL |
|
311 // ---------------------------------------------------------------------------- |
|
312 // |
|
313 void CGlxGridViewMLObserver::HandleMessageL( const CMPXMessage& /*aMessage*/, |
|
314 MGlxMediaList* /*aList*/ ) |
|
315 { |
|
316 TRACER("CGlxGridViewMLObserver::HandleMessageL()"); |
|
317 } |
|
318 |
|
319 // ---------------------------------------------------------------------------- |
|
320 // HandleError |
|
321 // ---------------------------------------------------------------------------- |
326 // |
322 // |
327 void CGlxGridViewMLObserver::HandleItemSelectedL(TInt /*aIndex*/, |
323 void CGlxGridViewMLObserver::HandleError( TInt /*aError*/ ) |
328 TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) |
|
329 { |
|
330 TRACER("CGlxGridViewMLObserver::HandleItemSelectedL()"); |
|
331 } |
|
332 |
|
333 // ---------------------------------------------------------------------------- |
|
334 // HandleMessageL |
|
335 // ---------------------------------------------------------------------------- |
|
336 // |
|
337 void CGlxGridViewMLObserver::HandleMessageL( const CMPXMessage& /*aMessage*/, |
|
338 MGlxMediaList* /*aList*/ ) |
|
339 { |
|
340 TRACER("CGlxGridViewMLObserver::HandleMessageL()"); |
|
341 } |
|
342 |
|
343 // ---------------------------------------------------------------------------- |
|
344 // HandleError |
|
345 // ---------------------------------------------------------------------------- |
|
346 // |
|
347 void CGlxGridViewMLObserver::HandleError( TInt /*aError*/ ) |
|
348 { |
324 { |
349 TRACER("CGlxGridViewMLObserver::HandleError()"); |
325 TRACER("CGlxGridViewMLObserver::HandleError()"); |
350 TRAP_IGNORE(HandleErrorL()); |
326 TRAP_IGNORE(HandleErrorL()); |
351 } |
327 } |
352 |
328 |
357 void CGlxGridViewMLObserver::HandleErrorL() |
333 void CGlxGridViewMLObserver::HandleErrorL() |
358 { |
334 { |
359 TRACER("CGlxGridViewMLObserver::HandleErrorL()"); |
335 TRACER("CGlxGridViewMLObserver::HandleErrorL()"); |
360 |
336 |
361 TInt bitmapId = EMbmGlxiconsQgn_prop_image_corrupted; |
337 TInt bitmapId = EMbmGlxiconsQgn_prop_image_corrupted; |
362 TInt maskId = EMbmGlxiconsQgn_prop_image_corrupted_mask; |
338 TInt maskId = EMbmGlxiconsQgn_prop_image_corrupted_mask; |
363 TInt flags = CHgItem::EHgItemFlagsNone ; |
339 TInt flags = CHgItem::EHgItemFlagsNone ; |
364 |
340 |
365 for ( TInt i = 0; i < iMediaList.Count(); i++ ) |
341 for ( TInt i = 0; i < iMediaList.Count(); i++ ) |
366 { |
342 { |
367 const TGlxMedia& item = iMediaList.Item( i ); |
343 const TGlxMedia& item = iMediaList.Item( i ); |
368 TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( |
344 TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( |
369 item.Properties(), KGlxMediaIdThumbnail ); |
345 item.Properties(), KGlxMediaIdThumbnail ); |
370 |
346 |
371 if (KErrNone != thumbnailError) |
347 if (KErrNone != thumbnailError) |
372 { |
348 { |
373 switch (thumbnailError) |
349 switch (thumbnailError) |
374 { |
350 { |
375 case KErrCANoRights:; // Err id = -17452 |
351 case KErrCANoRights:; // Err id = -17452 |
400 maskId = EMbmGlxiconsQgn_prop_image_corrupted_mask; |
376 maskId = EMbmGlxiconsQgn_prop_image_corrupted_mask; |
401 flags = CHgItem::EHgItemFlagsNone; |
377 flags = CHgItem::EHgItemFlagsNone; |
402 } |
378 } |
403 |
379 |
404 } |
380 } |
405 break; |
381 break; |
406 } |
382 } |
407 |
383 |
408 SetIconL(i, bitmapId, maskId, flags); |
384 SetIconL(i, bitmapId, maskId, flags); |
409 } |
385 } |
410 } |
386 } |
411 iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); |
387 iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); |
412 } |
388 } |
413 |
389 |
414 // ---------------------------------------------------------------------------- |
390 // ---------------------------------------------------------------------------- |
415 // SetIconL |
391 // SetIconL |
416 // ---------------------------------------------------------------------------- |
392 // ---------------------------------------------------------------------------- |
417 // |
393 // |
418 void CGlxGridViewMLObserver::SetIconL(TInt aItemIndex, TInt aBitmapId, |
394 void CGlxGridViewMLObserver::SetIconL(TInt aItemIndex, TInt aBitmapId, |
419 TInt aMaskId, TInt aFlags) |
395 TInt aMaskId, TInt aFlags) |
420 { |
396 { |
421 TRACER("CGlxGridViewMLObserver::SetIconL()"); |
397 TRACER("CGlxGridViewMLObserver::SetIconL()"); |
422 CFbsBitmap* bitmap = NULL; |
398 CFbsBitmap* bitmap = NULL; |
438 } |
414 } |
439 |
415 |
440 // ---------------------------------------------------------------------------- |
416 // ---------------------------------------------------------------------------- |
441 // HandleCommandCompleteL |
417 // HandleCommandCompleteL |
442 // ---------------------------------------------------------------------------- |
418 // ---------------------------------------------------------------------------- |
443 // |
419 // |
444 void CGlxGridViewMLObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, |
420 void CGlxGridViewMLObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, |
445 TInt /*aError*/, MGlxMediaList* /*aList*/ ) |
421 TInt /*aError*/, MGlxMediaList* /*aList*/ ) |
446 { |
422 { |
447 TRACER("CGlxGridViewMLObserver::HandleCommandCompleteL()"); |
423 TRACER("CGlxGridViewMLObserver::HandleCommandCompleteL()"); |
448 } |
424 } |
449 |
425 |
450 // ---------------------------------------------------------------------------- |
426 // ---------------------------------------------------------------------------- |
451 // HandleMediaL |
427 // HandleMediaL |
452 // ---------------------------------------------------------------------------- |
428 // ---------------------------------------------------------------------------- |
453 // |
429 // |
454 void CGlxGridViewMLObserver::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) |
430 void CGlxGridViewMLObserver::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) |
455 { |
431 { |
456 TRACER("CGlxGridViewMLObserver::HandleMediaL()"); |
432 TRACER("CGlxGridViewMLObserver::HandleMediaL()"); |
457 } |
433 } |
458 |
434 |
487 CleanupStack::PopAndDestroy(emptyText); |
463 CleanupStack::PopAndDestroy(emptyText); |
488 } |
464 } |
489 |
465 |
490 GLX_DEBUG2("GridMLObserver::HandlePopulatedL() iMediaList.Count()=%d", |
466 GLX_DEBUG2("GridMLObserver::HandlePopulatedL() iMediaList.Count()=%d", |
491 iMediaList.Count()); |
467 iMediaList.Count()); |
492 |
468 |
493 if (iMediaList.Count() <= 0) |
469 if (iMediaList.Count() <= 0) |
494 { |
470 { |
495 GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetEmptyTextL()"); |
471 GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetEmptyTextL()"); |
496 iHgGrid->DrawNow(); |
472 iHgGrid->DrawNow(); |
497 } |
473 } |
498 |
474 |
499 GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetDefaultIconL()"); |
475 GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetDefaultIconL()"); |
500 SetDefaultIconL(ETrue); |
476 SetDefaultIconL(ETrue); |
501 } |
477 } |
502 } |
478 } |
503 |
479 |
504 // ---------------------------------------------------------------------------- |
480 // ---------------------------------------------------------------------------- |
505 // HandleItemModifiedL |
481 // HandleItemModifiedL |
506 // ---------------------------------------------------------------------------- |
482 // ---------------------------------------------------------------------------- |
507 // |
483 // |
508 void CGlxGridViewMLObserver::HandleItemModifiedL(const RArray<TInt>& aItemIndexes, |
484 void CGlxGridViewMLObserver::HandleItemModifiedL(const RArray<TInt>& aItemIndexes, |
509 MGlxMediaList* /*aList*/) |
485 MGlxMediaList* /*aList*/) |
510 { |
486 { |
511 TRACER("CGlxGridViewMLObserver::HandleItemModifiedL()"); |
487 TRACER("CGlxGridViewMLObserver::HandleItemModifiedL()"); |
512 for(TInt index = 0;index<aItemIndexes.Count();index++) |
488 for(TInt index = 0;index<aItemIndexes.Count();index++) |
513 { |
489 { |
514 TInt modifiedIndex = aItemIndexes[index]; |
490 TInt modifiedIndex = aItemIndexes[index]; |
515 iModifiedIndexes.AppendL(modifiedIndex); |
491 iModifiedIndexes.AppendL(modifiedIndex); |
516 } |
492 } |
517 } |
493 } |
518 |
494 |
519 // ---------------------------------------------------------------------------- |
495 // ---------------------------------------------------------------------------- |
520 // HasRelevantThumbnailAttribute |
496 // HasRelevantThumbnailAttribute |
521 // ---------------------------------------------------------------------------- |
497 // ---------------------------------------------------------------------------- |
522 // |
498 // |
523 TBool CGlxGridViewMLObserver::HasRelevantThumbnail(TInt aIndex) |
499 TBool CGlxGridViewMLObserver::HasRelevantThumbnail(TInt aIndex) |
528 iQualityTnAttrib ); |
504 iQualityTnAttrib ); |
529 const CGlxThumbnailAttribute* speedTn = item.ThumbnailAttribute( |
505 const CGlxThumbnailAttribute* speedTn = item.ThumbnailAttribute( |
530 iSpeedTnAttrib ); |
506 iSpeedTnAttrib ); |
531 if ( qualityTn || speedTn ) |
507 if ( qualityTn || speedTn ) |
532 { |
508 { |
533 GLX_DEBUG1("GridMLObserver::HasRelevantThumbnail() - TN avail"); |
509 GLX_DEBUG1("GridMLObserver::HasRelevantThumbnail() - TN avail"); |
534 return ETrue; |
510 return ETrue; |
535 } |
511 } |
536 return EFalse; |
512 return EFalse; |
537 } |
513 } |
538 |
514 |
539 |
515 |
540 // ---------------------------------------------------------------------------- |
516 // ---------------------------------------------------------------------------- |
541 // RefreshScreenL |
517 // RefreshScreenL |
542 // ---------------------------------------------------------------------------- |
518 // ---------------------------------------------------------------------------- |
543 // |
519 // |
544 void CGlxGridViewMLObserver::RefreshScreenL(TInt aItemIndex, |
520 void CGlxGridViewMLObserver::RefreshScreenL(TInt aItemIndex, |
545 const RArray<TMPXAttribute>& aAttributes) |
521 const RArray<TMPXAttribute>& aAttributes) |
546 { |
522 { |
547 TRACER("CGlxGridViewMLObserver::RefreshScreenL()"); |
523 TRACER("CGlxGridViewMLObserver::RefreshScreenL()"); |
548 GLX_DEBUG2("CGlxGridViewMLObserver::RefreshScreenL(%d)", aItemIndex); |
524 GLX_DEBUG2("CGlxGridViewMLObserver::RefreshScreenL(%d)", aItemIndex); |
564 { |
540 { |
565 if (HasRelevantThumbnail(lastOnScreen) && HasRelevantThumbnail( |
541 if (HasRelevantThumbnail(lastOnScreen) && HasRelevantThumbnail( |
566 firstIndex)) |
542 firstIndex)) |
567 { |
543 { |
568 GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
544 GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
569 " RefreshScreen - aItemIndex(%d)", aItemIndex); |
545 " RefreshScreen - aItemIndex(%d)", aItemIndex); |
570 iHgGrid->RefreshScreen(aItemIndex); |
546 iHgGrid->RefreshScreen(aItemIndex); |
571 } |
547 } |
572 } |
548 } |
573 |
549 |
574 if (!iIsDefaultIconSet) |
550 if (!iIsDefaultIconSet) |
575 { |
551 { |
576 GLX_DEBUG1("GridMLObserver::HandleAttributesAvailableL()" |
552 GLX_DEBUG1("GridMLObserver::HandleAttributesAvailableL()" |
577 " SetDefaultIconL() - 1"); |
553 " SetDefaultIconL() - 1"); |
578 SetDefaultIconL(EFalse); |
554 SetDefaultIconL(EFalse); |
587 if ( HasRelevantThumbnail(firstIndex) ) |
563 if ( HasRelevantThumbnail(firstIndex) ) |
588 { |
564 { |
589 if ( HasRelevantThumbnail(lastOnScreen) ) |
565 if ( HasRelevantThumbnail(lastOnScreen) ) |
590 { |
566 { |
591 GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
567 GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
592 " RefreshScreen - aItemIndex(%d)", aItemIndex); |
568 " RefreshScreen - aItemIndex(%d)", aItemIndex); |
593 iHgGrid->RefreshScreen(aItemIndex); |
569 iHgGrid->RefreshScreen(aItemIndex); |
594 } |
570 } |
595 else if (aItemIndex == lastOnScreen) |
571 else if (aItemIndex == lastOnScreen) |
596 { |
572 { |
597 GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
573 GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
598 " RefreshScreen - lastOnScreen(%d)", lastOnScreen); |
574 " RefreshScreen - lastOnScreen(%d)", lastOnScreen); |
599 iHgGrid->RefreshScreen(lastOnScreen); |
575 iHgGrid->RefreshScreen(lastOnScreen); |
600 } |
576 } |
601 } |
577 } |
602 |
578 |
603 if (!iIsDefaultIconSet) |
579 if (!iIsDefaultIconSet) |
604 { |
580 { |
605 GLX_DEBUG1("GridMLObserver::HandleAttributesAvailableL()" |
581 GLX_DEBUG1("GridMLObserver::HandleAttributesAvailableL()" |
606 " SetDefaultIconL() - 2"); |
582 " SetDefaultIconL() - 2"); |
607 SetDefaultIconL(EFalse); |
583 SetDefaultIconL(EFalse); |
608 } |
584 } |
609 } |
585 } |
610 } |
586 } |
611 |
587 |
612 if (iModifiedIndexes.Count() > 0) |
588 if (iModifiedIndexes.Count() > 0) |
613 { |
589 { |
614 for(TInt index = 0;index<iModifiedIndexes.Count();index++) |
590 for(TInt index = 0;index<iModifiedIndexes.Count();index++) |
615 { |
591 { |
616 if (iModifiedIndexes[index] == aItemIndex && |
592 if (iModifiedIndexes[index] == aItemIndex && |
617 HasRelevantThumbnail(aItemIndex)) |
593 HasRelevantThumbnail(aItemIndex)) |
618 { |
594 { |
619 GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
595 GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
620 " RefreshScreen - modified index(%d)", aItemIndex); |
596 " RefreshScreen - modified index(%d)", aItemIndex); |
621 iHgGrid->RefreshScreen(aItemIndex); |
597 iHgGrid->RefreshScreen(aItemIndex); |
623 iModifiedIndexes.Compress(); |
599 iModifiedIndexes.Compress(); |
624 } |
600 } |
625 } |
601 } |
626 } |
602 } |
627 } |
603 } |
628 |
604 |
629 // ---------------------------------------------------------------------------- |
605 // ---------------------------------------------------------------------------- |
630 // UpdateItemsL |
606 // UpdateItemsL |
631 // ---------------------------------------------------------------------------- |
607 // ---------------------------------------------------------------------------- |
632 // |
608 // |
633 void CGlxGridViewMLObserver::UpdateItemsL(TInt aItemIndex, |
609 void CGlxGridViewMLObserver::UpdateItemsL(TInt aItemIndex, |
634 const RArray<TMPXAttribute>& aAttributes) |
610 const RArray<TMPXAttribute>& aAttributes) |
635 { |
611 { |
636 TRACER("CGlxGridViewMLObserver::UpdateItemsL()"); |
612 TRACER("CGlxGridViewMLObserver::UpdateItemsL()"); |
637 TInt mediaCount = iMediaList.Count(); |
613 TInt mediaCount = iMediaList.Count(); |
638 const TGlxMedia& item = iMediaList.Item( aItemIndex ); |
614 const TGlxMedia& item = iMediaList.Item( aItemIndex ); |
639 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
615 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
640 |
616 |
641 if (aAttributes.Find(KMPXMediaDrmProtected, match) != KErrNotFound) |
617 if (aAttributes.Find(KMPXMediaDrmProtected, match) != KErrNotFound) |
642 { |
618 { |
643 if (item.IsDrmProtected()) |
619 if (item.IsDrmProtected()) |
644 { |
620 { |
645 const TDesC& uri = item.Uri(); |
621 const TDesC& uri = item.Uri(); |
682 } |
658 } |
683 } |
659 } |
684 } |
660 } |
685 } |
661 } |
686 } |
662 } |
687 |
663 |
688 if (aAttributes.Find(KMPXMediaGeneralDate, match) != KErrNotFound) |
664 if (aAttributes.Find(KMPXMediaGeneralDate, match) != KErrNotFound) |
689 { |
665 { |
690 TTime time(0); |
666 TTime time(0); |
691 if (item.GetDate(time)) |
667 if (item.GetDate(time)) |
692 { |
668 { |
693 iHgGrid->ItemL(aItemIndex).SetTime(time); |
669 iHgGrid->ItemL(aItemIndex).SetTime(time); |
694 } |
670 } |
695 } |
671 } |
696 |
672 |
697 if (aAttributes.Find(KMPXMediaGeneralCategory, match) != KErrNotFound) |
673 if (aAttributes.Find(KMPXMediaGeneralCategory, match) != KErrNotFound) |
698 { |
674 { |
699 if (item.Category() == EMPXVideo) |
675 if (item.Category() == EMPXVideo) |
700 { |
676 { |
701 iHgGrid->ItemL(aItemIndex).SetFlags(CHgItem::EHgItemFlagsVideo); |
677 iHgGrid->ItemL(aItemIndex).SetFlags(CHgItem::EHgItemFlagsVideo); |
702 } |
678 } |
703 } |
679 } |
704 } |
680 } |
705 |
681 |
706 // ---------------------------------------------------------------------------- |
682 // ---------------------------------------------------------------------------- |
707 // DisplayErrorNoteL |
683 // DisplayErrorNoteL |
708 // ---------------------------------------------------------------------------- |
684 // ---------------------------------------------------------------------------- |
709 // |
685 // |
710 void CGlxGridViewMLObserver::DisplayErrorNoteL(TInt aError) |
686 void CGlxGridViewMLObserver::DisplayErrorNoteL(TInt aError) |
711 { |
687 { |
712 TRACER("CGlxGridViewMLObserver::DisplayErrorNoteL()"); |
688 TRACER("CGlxGridViewMLObserver::DisplayErrorNoteL()"); |
713 GLX_LOG_INFO1("CGlxGridViewMLObserver::DisplayErrorNoteL() " |
689 GLX_LOG_INFO1("CGlxGridViewMLObserver::DisplayErrorNoteL() " |
714 " aError(%d)", aError); |
690 " aError(%d)", aError); |
733 CFbsBitmap* mask = new (ELeave) CFbsBitmap(); |
709 CFbsBitmap* mask = new (ELeave) CFbsBitmap(); |
734 CleanupStack::PushL(mask); |
710 CleanupStack::PushL(mask); |
735 TSize bmpSize = CHgGrid::PreferredImageSize(); |
711 TSize bmpSize = CHgGrid::PreferredImageSize(); |
736 bitmap->Create(bmpSize, EColor16M); |
712 bitmap->Create(bmpSize, EColor16M); |
737 mask->Create(bmpSize, EGray256); // Gray mask |
713 mask->Create(bmpSize, EGray256); // Gray mask |
738 const TInt scanlineLength = bmpSize.iWidth; // 1 byte per pixel |
714 const TInt scanlineLength = bmpSize.iWidth; // 1 byte per pixel |
739 RBuf8 maskData; |
715 RBuf8 maskData; |
740 maskData.Create(scanlineLength); |
716 maskData.Create(scanlineLength); |
741 maskData.FillZ(scanlineLength); // Init with zero |
717 maskData.FillZ(scanlineLength); // Init with zero |
742 |
718 |
743 mask->BeginDataAccess(); |
719 mask->BeginDataAccess(); |