427 |
427 |
428 // ----------------------------------------------------------------------------- |
428 // ----------------------------------------------------------------------------- |
429 // Draws a list box item |
429 // Draws a list box item |
430 // ----------------------------------------------------------------------------- |
430 // ----------------------------------------------------------------------------- |
431 // |
431 // |
432 void CMPXCommonContainerHgImp::DrawLbxItem( TInt aIndex ) |
432 void CMPXCommonContainerHgImp::DrawLbxItemL( TInt aIndex ) |
433 { |
433 { |
434 MPX_DEBUG2( "CMPXCommonContainerHgImp::DrawLbxItem (aIndex=%d)", aIndex ); |
434 MPX_DEBUG2( "CMPXCommonContainerHgImp::DrawLbxItemL (aIndex=%d)", aIndex ); |
435 if ( iListWidget && iBottomIndex > 0 ) |
435 if ( iListWidget && iBottomIndex > 0 ) |
436 { |
436 { |
437 CHgItem* item = &iListWidget->ItemL(aIndex); |
437 CHgItem* item = &iListWidget->ItemL(aIndex); |
438 SetDetailIndicatorL(item, aIndex); |
438 SetDetailIndicatorL(item, aIndex); |
439 iListWidget->RefreshScreen(aIndex); |
439 iListWidget->RefreshScreen(aIndex); |
704 |
704 |
705 // --------------------------------------------------------------------------- |
705 // --------------------------------------------------------------------------- |
706 // Custom handling of menu pane for markable lists |
706 // Custom handling of menu pane for markable lists |
707 // --------------------------------------------------------------------------- |
707 // --------------------------------------------------------------------------- |
708 // |
708 // |
709 void CMPXCommonContainerHgImp::HandleMarkableListDynInitMenuPane( |
709 void CMPXCommonContainerHgImp::HandleMarkableListDynInitMenuPaneL( |
710 TInt aResourceId, |
710 TInt aResourceId, |
711 CEikMenuPane* aMenuPane ) |
711 CEikMenuPane* aMenuPane ) |
712 { |
712 { |
713 MPX_FUNC( "CMPXCommonContainerHgImp::HandleMarkableListDynInitMenuPane" ); |
713 MPX_FUNC( "CMPXCommonContainerHgImp::HandleMarkableListDynInitMenuPane" ); |
714 |
714 |
1001 for ( TInt i = aBufferStart; i <= aBufferEnd; i++ ) |
1001 for ( TInt i = aBufferStart; i <= aBufferEnd; i++ ) |
1002 { |
1002 { |
1003 iThumbnailReqMap[ i ] = EFalse; |
1003 iThumbnailReqMap[ i ] = EFalse; |
1004 } |
1004 } |
1005 |
1005 |
1006 |
1006 MPX_TRAPD( err, |
1007 if ( aDirection == EHgBufferReset || aDirection == EHgBufferScrollDown || aDirection == EHgBufferScrollUp) |
1007 if ( aDirection == EHgBufferReset || aDirection == EHgBufferScrollDown || aDirection == EHgBufferScrollUp) |
1008 { |
1008 { |
1009 // For index range in visible-area |
1009 // For index range in visible-area |
1010 ProvideDataIntersectL(aBufferStart, aBufferEnd); |
1010 ProvideDataIntersectL(aBufferStart, aBufferEnd); |
1011 // For index range elsewhere |
1011 // For index range elsewhere |
1012 ProvideDataDifferenceL(aBufferStart, aBufferEnd); |
1012 ProvideDataDifferenceL(aBufferStart, aBufferEnd); |
1013 } |
1013 } |
1014 else |
1014 else |
1015 { |
1015 { |
1016 ProvideDataL(aBufferStart, aBufferEnd); |
1016 ProvideDataL(aBufferStart, aBufferEnd); |
1017 } |
1017 } ); |
1018 |
1018 |
1019 //RefreshL(aBufferStart); |
1019 if( err != KErrNone ) |
|
1020 { |
|
1021 MPX_DEBUG2( "CMPXCommonContainerHgImp::Request leave err = %d", err ); |
|
1022 } |
|
1023 //Refresh(aBufferStart); |
1020 // When in main collection view, list can be refresh |
1024 // When in main collection view, list can be refresh |
1021 // without waiting on thumbnails since this list doesn't |
1025 // without waiting on thumbnails since this list doesn't |
1022 // require thumbnails. |
1026 // require thumbnails. |
1023 if ( iContext == EContextGroupCollection || |
1027 if ( iContext == EContextGroupCollection || |
1024 iContext == EContextGroupPlaylist || |
1028 iContext == EContextGroupPlaylist || |
1228 index = *ret; |
1232 index = *ret; |
1229 } |
1233 } |
1230 |
1234 |
1231 if ( aError == KErrNone && ret ) |
1235 if ( aError == KErrNone && ret ) |
1232 { |
1236 { |
|
1237 CMPXMedia* currentMedia( NULL ); |
1233 const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray(); |
1238 const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray(); |
1234 CMPXMedia* currentMedia( mediaArray.AtL( index ) ); |
1239 MPX_TRAPD( err, currentMedia = mediaArray.AtL( index ) ); |
|
1240 if( err != KErrNone ) |
|
1241 { |
|
1242 __ASSERT_DEBUG( EFalse, User::Panic( _L( "CMPXCommonContainerHgImp::ThumbnailReady()" ), err ) ); |
|
1243 return; |
|
1244 } |
|
1245 |
1235 if ( currentMedia->IsSupported( KMPXMediaGeneralId ) ) |
1246 if ( currentMedia->IsSupported( KMPXMediaGeneralId ) ) |
1236 { |
1247 { |
1237 CFbsBitmap* bmap = aThumbnail.DetachBitmap(); |
1248 CFbsBitmap* bmap = aThumbnail.DetachBitmap(); |
1238 if ( bmap ) |
1249 if ( bmap ) |
1239 { |
1250 { |
1240 CGulIcon* icon = CGulIcon::NewL(bmap, NULL); |
1251 CGulIcon* icon( NULL ); |
1241 |
1252 MPX_TRAP( err, icon = CGulIcon::NewL( bmap, NULL ) ); |
|
1253 if( err != KErrNone ) |
|
1254 { |
|
1255 __ASSERT_DEBUG( EFalse, User::Panic( _L( "CMPXCommonContainerHgImp::ThumbnailReady()" ), err ) ); |
|
1256 return; |
|
1257 } |
|
1258 |
1242 if ( iScrollerWithTitle && !iTitleSet ) |
1259 if ( iScrollerWithTitle && !iTitleSet ) |
1243 { |
1260 { |
1244 iScrollerWithTitle->TitleItem().SetIcon(icon); |
1261 iScrollerWithTitle->TitleItem().SetIcon(icon); |
1245 iScrollerWithTitle->MakeVisible(ETrue); |
1262 iScrollerWithTitle->MakeVisible(ETrue); |
1246 iListWidget->MakeVisible( ETrue ); |
1263 iListWidget->MakeVisible( ETrue ); |
1248 iScrollerWithTitle->DrawNow(); |
1265 iScrollerWithTitle->DrawNow(); |
1249 iTitleSet = ETrue; |
1266 iTitleSet = ETrue; |
1250 } |
1267 } |
1251 else |
1268 else |
1252 { |
1269 { |
1253 iListWidget->ItemL(index).SetIcon(icon); |
1270 MPX_TRAPD( err, iListWidget->ItemL(index).SetIcon(icon); ) |
|
1271 if( err != KErrNone ) |
|
1272 { |
|
1273 MPX_DEBUG2( "CMPXCommonContainerHgImp::ThumbnailReady--iListWidget->ItemL(index).SetIcon(icon) leave err%d", err); |
|
1274 } |
1254 iThumbnailReqMap[index] = ETrue; |
1275 iThumbnailReqMap[index] = ETrue; |
1255 RefreshL(index); |
1276 Refresh( index ); |
1256 } |
1277 } |
1257 } |
1278 } |
1258 } |
1279 } |
1259 iThumbnailReqHashMap.Remove( (TInt)aId); |
1280 iThumbnailReqHashMap.Remove( (TInt)aId); |
1260 |
1281 |
1265 iRequestQueue.Remove(*iAlbumArtRequest); |
1286 iRequestQueue.Remove(*iAlbumArtRequest); |
1266 --iQueueCounter; |
1287 --iQueueCounter; |
1267 TInt index = iAlbumArtRequest->iIndex; |
1288 TInt index = iAlbumArtRequest->iIndex; |
1268 |
1289 |
1269 const TDesC& albumArtUri = *(iAlbumArtRequest->iAlbumArtUri); |
1290 const TDesC& albumArtUri = *(iAlbumArtRequest->iAlbumArtUri); |
1270 |
1291 TRAP_IGNORE |
|
1292 ( |
1271 CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( albumArtUri, KMPXAlbumMimeType ); |
1293 CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( albumArtUri, KMPXAlbumMimeType ); |
1272 |
|
1273 delete iAlbumArtRequest->iAlbumArtUri; |
1294 delete iAlbumArtRequest->iAlbumArtUri; |
1274 delete iAlbumArtRequest; |
1295 delete iAlbumArtRequest; |
1275 // Using negative index as priority will ensure that thumbnail requests |
1296 // Using negative index as priority will ensure that thumbnail requests |
1276 // are processed in the order they were requested. |
1297 // are processed in the order they were requested. |
1277 TInt ret = NULL; |
1298 TInt ret = NULL; |
1278 TInt reqId; |
1299 TInt reqId; |
1279 TRAPD(err, reqId = (TInt) iThumbnailManager->GetThumbnailL( *source, (TAny*)ret, -index )); |
1300 MPX_TRAP(err, reqId = (TInt) iThumbnailManager->GetThumbnailL( *source, (TAny*)ret, -index )); |
1280 if ( err == KErrNone) |
1301 if ( err == KErrNone) |
1281 { |
1302 { |
1282 iThumbnailReqHashMap.InsertL( reqId, index ); |
1303 iThumbnailReqHashMap.InsertL( reqId, index ); |
1283 } |
1304 } |
1284 CleanupStack::PopAndDestroy( source ); |
1305 CleanupStack::PopAndDestroy( source ); |
|
1306 ); |
1285 } |
1307 } |
1286 else |
1308 else |
1287 { |
1309 { |
1288 //request queue is empty, decrease outstanding requests count |
1310 //request queue is empty, decrease outstanding requests count |
1289 iRequestCount--; |
1311 iRequestCount--; |
1336 iScrollerWithTitle->DrawNow(); |
1360 iScrollerWithTitle->DrawNow(); |
1337 iTitleSet = ETrue; |
1361 iTitleSet = ETrue; |
1338 } |
1362 } |
1339 else |
1363 else |
1340 { |
1364 { |
1341 RefreshL(aIndex); |
1365 Refresh(aIndex); |
1342 } |
1366 } |
1343 } |
1367 } |
1344 // --------------------------------------------------------------------------- |
1368 // --------------------------------------------------------------------------- |
1345 // Refresh list as needed. |
1369 // Refresh list as needed. |
1346 // This function tries to determine the best time to refresh the screen as to |
1370 // This function tries to determine the best time to refresh the screen as to |
1347 // avoid too many redraws. In some cases, multiple refresh is unavoidable. |
1371 // avoid too many redraws. In some cases, multiple refresh is unavoidable. |
1348 // --------------------------------------------------------------------------- |
1372 // --------------------------------------------------------------------------- |
1349 // |
1373 // |
1350 void CMPXCommonContainerHgImp::RefreshL(TInt aIndex) |
1374 void CMPXCommonContainerHgImp::Refresh(TInt aIndex) |
1351 { |
1375 { |
1352 MPX_FUNC( "CMPXCommonContainerHgImp::Refresh" ); |
1376 MPX_FUNC( "CMPXCommonContainerHgImp::Refresh" ); |
1353 |
1377 |
1354 TInt mediaCount = iListBoxArray->MediaArray().Count(); |
1378 TInt mediaCount = iListBoxArray->MediaArray().Count(); |
1355 |
1379 |
2426 |
2450 |
2427 // ----------------------------------------------------------------------------- |
2451 // ----------------------------------------------------------------------------- |
2428 // CMPXCommonContainerHgImp::SetScrollbarType |
2452 // CMPXCommonContainerHgImp::SetScrollbarType |
2429 // ----------------------------------------------------------------------------- |
2453 // ----------------------------------------------------------------------------- |
2430 // |
2454 // |
2431 void CMPXCommonContainerHgImp::SetScrollbarType() |
2455 void CMPXCommonContainerHgImp::SetScrollbarTypeL() |
2432 { |
2456 { |
2433 MPX_FUNC( "CMPXCommonContainerHgImp::SetScrollbarType" ); |
2457 MPX_FUNC( "CMPXCommonContainerHgImp::SetScrollbarType" ); |
2434 |
2458 |
2435 if ( iContext == EContextGroupCollection || |
2459 if ( iContext == EContextGroupCollection || |
2436 iContext == EContextGroupPlaylist || |
2460 iContext == EContextGroupPlaylist || |