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