79 #include "mpxcollectionviewhgplaylisthelper.h" |
79 #include "mpxcollectionviewhgplaylisthelper.h" |
80 #include "mpxcollectionviewhgtnloader.h" |
80 #include "mpxcollectionviewhgtnloader.h" |
81 #include "mpxcbahandler.h" |
81 #include "mpxcbahandler.h" |
82 #include "mpxselectedalbumhandler.h" |
82 #include "mpxselectedalbumhandler.h" |
83 #include "mpxpopuplist.h" |
83 #include "mpxpopuplist.h" |
|
84 #include "mpxcollectionviewhgswitchbuffer.h" |
84 |
85 |
85 // CONSTANTS |
86 // CONSTANTS |
86 _LIT( KMPXCollectionViewRscPath, "mpxcollectionviewhg.rsc" ); |
87 _LIT( KMPXCollectionViewRscPath, "mpxcollectionviewhg.rsc" ); |
87 _LIT( KMPXCollectionViewIconFile, "mpxcollectionviewhg.mbm" ); |
88 _LIT( KMPXCollectionViewIconFile, "mpxcollectionviewhg.mbm" ); |
88 const TInt KMPXListSelectionCount = 5; |
89 const TInt KMPXListSelectionCount = 5; |
96 #endif |
97 #endif |
97 // Added by Harri. Buffer size has to be smaller with mediawall, otherwise IVE3 runs out of memory |
98 // Added by Harri. Buffer size has to be smaller with mediawall, otherwise IVE3 runs out of memory |
98 #ifdef __WINS__ |
99 #ifdef __WINS__ |
99 const TInt KMPXListBufferSizeWithMediaWall = 20; |
100 const TInt KMPXListBufferSizeWithMediaWall = 20; |
100 #else |
101 #else |
101 const TInt KMPXListBufferSizeWithMediaWall = 80; |
102 const TInt KMPXListBufferSizeWithMediaWall = 40; |
102 #endif |
103 #endif |
103 const TInt KMPXMaxFileLength = 256; |
104 const TInt KMPXMaxFileLength = 256; |
104 const TReal KIconFactor = 0.7; |
105 const TReal KIconFactor = 0.7; |
105 |
106 |
106 const TInt KThumbLoadingPauseForTransition(500000); |
107 const TInt KThumbLoadingPauseForTransition(500000); |
292 MPX_FUNC( "CMPXCollectionViewHgContainer::MopSupplyObject" ); |
293 MPX_FUNC( "CMPXCollectionViewHgContainer::MopSupplyObject" ); |
293 if( aId.iUid == MAknsControlContext::ETypeId && iBgContext ) |
294 if( aId.iUid == MAknsControlContext::ETypeId && iBgContext ) |
294 { |
295 { |
295 return MAknsControlContext::SupplyMopObject(aId, iBgContext ); |
296 return MAknsControlContext::SupplyMopObject(aId, iBgContext ); |
296 } |
297 } |
297 |
298 |
298 return CCoeControl::MopSupplyObject(aId); |
299 return CCoeControl::MopSupplyObject(aId); |
299 } |
300 } |
300 |
301 |
301 // --------------------------------------------------------------------------- |
302 // --------------------------------------------------------------------------- |
302 // Sets playback status |
303 // Sets playback status |
763 |
764 |
764 |
765 |
765 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
766 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
766 SetRect( clientRect ); |
767 SetRect( clientRect ); |
767 iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect()); |
768 iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect()); |
768 |
769 |
769 // call HandleLbxItemAdditionL |
770 // call HandleLbxItemAdditionL |
770 HandleLbxItemAdditionL(); |
771 HandleLbxItemAdditionL(); |
771 } |
772 } |
772 ); |
773 ); |
773 if(iMediaWall) |
774 if(iMediaWall) |
1189 TInt count( mediaArray.Count() ); |
1190 TInt count( mediaArray.Count() ); |
1190 MPX_DEBUG2( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionL count=%d", count); |
1191 MPX_DEBUG2( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionL count=%d", count); |
1191 |
1192 |
1192 HandleLbxItemRemovalL(); |
1193 HandleLbxItemRemovalL(); |
1193 TViewType prevViewType = iCurrentViewType; |
1194 TViewType prevViewType = iCurrentViewType; |
1194 |
1195 |
1195 ResolveCurrentViewType( count ); |
1196 ResolveCurrentViewType( count ); |
1196 |
1197 |
1197 iThumbnailReqMap.Reset(); |
1198 iThumbnailReqMap.Reset(); |
1198 if (ShuffleItemPresent()) |
1199 if (ShuffleItemPresent()) |
1199 iShuffleItem = 1; |
1200 iShuffleItem = 1; |
1200 else |
1201 else |
1201 iShuffleItem = 0; |
1202 iShuffleItem = 0; |
1218 // MediaWall sets the default icon in the construction phase. |
1219 // MediaWall sets the default icon in the construction phase. |
1219 iDefaultIconSet = EFalse; |
1220 iDefaultIconSet = EFalse; |
1220 |
1221 |
1221 if( !iLayoutSwitch ) |
1222 if( !iLayoutSwitch ) |
1222 { |
1223 { |
1223 // We only need to use this for one transition coming |
1224 // We only need to use this for one transition coming |
1224 // from playback view. |
1225 // from playback view. |
1225 TBool pbv = (iPreviousViewId == TUid::Uid(KMPXPluginTypePlaybackUid)) ? ETrue : EFalse; |
1226 TBool pbv = (iPreviousViewId == TUid::Uid(KMPXPluginTypePlaybackUid)) ? ETrue : EFalse; |
1226 if ( pbv ) |
1227 if ( pbv ) |
1227 { |
1228 { |
1228 iPreviousViewId = TUid::Uid(0); |
1229 iPreviousViewId = TUid::Uid(0); |
1229 } |
1230 } |
1230 BeginFullScreenAnimation( pbv ); |
1231 BeginFullScreenAnimation( pbv ); |
1231 } |
1232 } |
1232 |
1233 |
1233 switch (iCurrentViewType) |
1234 switch (iCurrentViewType) |
1234 { |
1235 { |
1235 case EMPXViewMediawall: |
1236 case EMPXViewMediawall: |
1236 { |
1237 { |
1237 TMPXPlaybackState pbState( iPlaybackUtility->StateL() ); |
1238 TMPXPlaybackState pbState( iPlaybackUtility->StateL() ); |
1238 if ( pbState == EPbStatePlaying || pbState == EPbStatePaused ) |
1239 if ( pbState == EPbStatePlaying || pbState == EPbStatePaused || pbState == EPbStateStopped ) |
|
1240 { |
1239 RestoreSelectedAlbumItemL(mediaArray); |
1241 RestoreSelectedAlbumItemL(mediaArray); |
|
1242 } |
1240 PrepareMediaWallL(mediaArray, count); |
1243 PrepareMediaWallL(mediaArray, count); |
1241 iOpenAlbumTracks = EFalse; |
1244 iOpenAlbumTracks = EFalse; |
1242 break; |
1245 break; |
1243 } |
1246 } |
1244 case EMPXViewTBone: |
1247 case EMPXViewTBone: |
1245 { |
1248 { |
1246 RestoreSelectedAlbumItemL(mediaArray); |
1249 RestoreSelectedAlbumItemL(mediaArray); |
1247 PrepareMediaWallWithListL( mediaArray, count ); |
1250 PrepareMediaWallWithListL( mediaArray, count ); |
1248 // We need to adjust the CBA for this view. |
1251 // We need to adjust the CBA for this view. |
1249 if( iCbaHandler ) |
1252 if( iCbaHandler ) |
1250 iCbaHandler->UpdateCba(); |
1253 { |
|
1254 iCbaHandler->UpdateCba(); |
|
1255 } |
1251 break; |
1256 break; |
1252 } |
1257 } |
1253 case EMPXViewList: |
1258 case EMPXViewList: |
1254 { |
1259 { |
1255 PrepareListL(mediaArray, count); |
1260 PrepareListL(mediaArray, count); |
1461 // |
1466 // |
1462 void CMPXCollectionViewHgContainer::ResizeListL(const CMPXMediaArray& aMediaArray, TInt aCount) |
1467 void CMPXCollectionViewHgContainer::ResizeListL(const CMPXMediaArray& aMediaArray, TInt aCount) |
1463 { |
1468 { |
1464 MPX_FUNC( "CMPXCollectionViewHgContainer::ResizeListL" ); |
1469 MPX_FUNC( "CMPXCollectionViewHgContainer::ResizeListL" ); |
1465 TInt mediaCount = aMediaArray.Count(); |
1470 TInt mediaCount = aMediaArray.Count(); |
1466 |
1471 |
1467 if( iListWidget ) |
1472 if( iListWidget ) |
1468 { |
1473 { |
1469 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1474 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1470 TInt mediaIndex = MediaIndex(iListWidget->SelectedIndex()); |
1475 TInt mediaIndex = MediaIndex(iListWidget->SelectedIndex()); |
|
1476 mediaIndex = ( KErrNotFound == mediaIndex ) ? iListWidget->FirstIndexOnScreen() : mediaIndex; |
1471 mediaIndex = ( mediaIndex >= 0 && (mediaIndex < (mediaCount)) ) ? mediaIndex : (mediaCount - 1); |
1477 mediaIndex = ( mediaIndex >= 0 && (mediaIndex < (mediaCount)) ) ? mediaIndex : (mediaCount - 1); |
1472 |
1478 |
1473 TInt prevItemCount = iListWidget->ItemCount(); |
1479 TInt prevItemCount = iListWidget->ItemCount(); |
1474 |
1480 |
1475 iListWidget->InitScreenL( clientRect ); |
1481 iListWidget->InitScreenL( clientRect ); |
1476 iListWidget->Reset(); |
1482 iListWidget->Reset(); |
1477 if ( aCount ) |
1483 if ( aCount ) |
1478 { |
1484 { |
1479 // enable scroll buffering now as it has not been enabled when empty list was constructed |
1485 // enable scroll buffering now as it has not been enabled when empty list was constructed |
1480 if ( !prevItemCount ) |
1486 if ( !prevItemCount ) |
1481 { |
1487 { |
1482 iListWidget->EnableScrollBufferL( *this, KMPXListBufferSize, KMPXListBufferSize/4 ); |
1488 iListWidget->EnableScrollBufferL( *this, KMPXListBufferSize, KMPXListBufferSize/4 ); |
1483 } |
1489 } |
1484 iListWidget->ResizeL( aCount ); |
1490 iListWidget->ResizeL( aCount ); |
1485 ProvideDataWithoutThumbnailsL(aMediaArray); |
1491 ProvideDataWithoutThumbnailsL(aMediaArray); |
1486 iListWidget->SetSelectedIndex( mediaIndex + iShuffleItem ); |
1492 iListWidget->SetSelectedIndex( mediaIndex + iShuffleItem ); |
1487 } |
1493 } |
1493 else if( iMediaWall ) |
1499 else if( iMediaWall ) |
1494 { |
1500 { |
1495 // In case of mediawall components we switch to different view type if orientation changes |
1501 // In case of mediawall components we switch to different view type if orientation changes |
1496 // so there is no need to set new client rect for mediawall. |
1502 // so there is no need to set new client rect for mediawall. |
1497 TInt mediaIndex = MediaIndex(iMediaWall->SelectedIndex()); |
1503 TInt mediaIndex = MediaIndex(iMediaWall->SelectedIndex()); |
1498 |
1504 |
1499 // Correct the array index if it is out of range |
1505 // Correct the array index if it is out of range |
1500 // This case may happen when last album or album beside selected album is deleted |
1506 // This case may happen when last album or album beside selected album is deleted |
1501 // mediaIndex -1 is valid and it represents shuffle item |
1507 // mediaIndex -1 is valid and it represents shuffle item |
1502 |
1508 |
1503 if ( mediaIndex >= mediaCount || mediaIndex < -1) |
1509 if ( mediaIndex >= mediaCount || mediaIndex < -1) |
1504 { |
1510 { |
1505 mediaIndex = mediaCount - 1; // last item of the list |
1511 mediaIndex = mediaCount - 1; // last item of the list |
1506 } |
1512 } |
1507 |
1513 |
1508 //in case of shuffle item is seleted (mediaIndex -1), there is no need to save it. |
1514 //in case of shuffle item is seleted (mediaIndex -1), there is no need to save it. |
1509 if( (iSelectedAlbumIndex != mediaIndex) && ( mediaIndex != -1) ) |
1515 if( (iSelectedAlbumIndex != mediaIndex) && ( mediaIndex != -1) ) |
1510 { |
1516 { |
1511 iSelectedAlbumIndex = mediaIndex; |
1517 iSelectedAlbumIndex = mediaIndex; |
1512 SaveSelectedAlbumItemL( iSelectedAlbumIndex ); |
1518 SaveSelectedAlbumItemL( iSelectedAlbumIndex ); |
1513 } |
1519 } |
1514 |
1520 |
1515 iMediaWall->Reset(); |
1521 iMediaWall->Reset(); |
1516 if ( aCount ) |
1522 if ( aCount ) |
1517 { |
1523 { |
1518 iMediaWall->ResizeL( aCount ); |
1524 iMediaWall->ResizeL( aCount ); |
1519 ProvideDataWithoutThumbnailsMwL(aMediaArray); |
1525 ProvideDataWithoutThumbnailsMwL(aMediaArray); |
1520 |
1526 |
1521 iMediaWall->SetSelectedIndex( mediaIndex + iShuffleItem); |
1527 iMediaWall->SetSelectedIndex( mediaIndex + iShuffleItem); |
1522 if ( iCurrentViewType == EMPXViewTBone ) |
1528 if ( iCurrentViewType == EMPXViewTBone ) |
1523 { |
1529 { |
1524 OpenAlbumL( mediaIndex ); |
1530 OpenAlbumL( mediaIndex ); |
1525 } |
1531 } |
1536 // ---------------------------------------------------------------------------- |
1542 // ---------------------------------------------------------------------------- |
1537 void CMPXCollectionViewHgContainer::PrepareListL(const CMPXMediaArray& aMediaArray, TInt aCount) |
1543 void CMPXCollectionViewHgContainer::PrepareListL(const CMPXMediaArray& aMediaArray, TInt aCount) |
1538 { |
1544 { |
1539 MPX_FUNC("CMPXCollectionViewHgContainer::PrepareListL"); |
1545 MPX_FUNC("CMPXCollectionViewHgContainer::PrepareListL"); |
1540 |
1546 |
1541 if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible()) |
1547 if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible()) |
1542 ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue); |
1548 ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue); |
1543 |
1549 |
1544 if( iCbaHandler ) |
1550 if( iCbaHandler ) |
1545 iCbaHandler->UpdateCba(); |
1551 iCbaHandler->UpdateCba(); |
1546 |
1552 |
1547 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1553 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1548 iThumbnailManager->SetSizeL( EAudioListThumbnailSize ); |
1554 iThumbnailManager->SetSizeL( EAudioListThumbnailSize ); |
1549 iImageSize = CHgDoubleGraphicListFlat::PreferredImageSize(); |
1555 iImageSize = CHgDoubleGraphicListFlat::PreferredImageSize(); |
1550 |
1556 |
1551 if( !iListWidget ) |
1557 if( !iListWidget ) |
1552 { |
1558 { |
1553 iListWidget = CHgDoubleGraphicListFlat::NewL ( |
1559 iListWidget = CHgDoubleGraphicListFlat::NewL ( |
1554 clientRect, |
1560 clientRect, |
1555 aCount, |
1561 aCount, |
1556 NULL, |
1562 NULL, |
1557 NULL ); |
1563 NULL ); |
1558 iListWidget->SetMenuProviderL(this); |
1564 iListWidget->SetMenuProviderL(this); |
1559 iListWidget->SetSelectionObserver(*this); |
1565 iListWidget->SetSelectionObserver(*this); |
1560 // TODO. check if this is correct for all lists |
1566 // TODO. check if this is correct for all lists |
1561 iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled ); |
1567 iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled ); |
1562 iListWidget->SetFocus(ETrue); |
1568 iListWidget->SetFocus(ETrue); |
1573 ProvideDataWithoutThumbnailsL(aMediaArray); |
1579 ProvideDataWithoutThumbnailsL(aMediaArray); |
1574 iListWidget->MakeVisible(ETrue); |
1580 iListWidget->MakeVisible(ETrue); |
1575 iListWidget->InitScreenL(clientRect); |
1581 iListWidget->InitScreenL(clientRect); |
1576 } |
1582 } |
1577 |
1583 |
1578 if ( (iAlbumIndex > 0) && (iAlbumIndex < aCount) ) |
1584 if ( (iAlbumIndex >= 0) && (iAlbumIndex < aCount) ) |
1579 { |
1585 { |
1580 iListWidget->SetSelectedIndex( iAlbumIndex + iShuffleItem ); |
1586 iListWidget->SetSelectedIndex( iAlbumIndex + iShuffleItem ); |
1581 } |
1587 } |
1582 |
1588 else if ( KErrNotFound == iAlbumIndex ) |
|
1589 { |
|
1590 if ( iSelectedAlbumIndex >= 0 && iSelectedAlbumIndex < aCount) |
|
1591 { |
|
1592 iListWidget->SetSelectedIndex( iSelectedAlbumIndex + iShuffleItem ); |
|
1593 } |
|
1594 else |
|
1595 { |
|
1596 iListWidget->SetSelectedIndex( iListWidget->FirstIndexOnScreen() + iShuffleItem ); |
|
1597 } |
|
1598 } |
|
1599 |
1583 // TODO. Define here in which views we need to have buffering enabled in the list |
1600 // TODO. Define here in which views we need to have buffering enabled in the list |
1584 if( ( ( iContext == EContextGroupAlbum ) || |
1601 if( ( ( iContext == EContextGroupAlbum ) || |
1585 ( iContext == EContextGroupArtist ) || |
1602 ( iContext == EContextGroupArtist ) || |
1586 ( iContext == EContextGroupSong ) || |
1603 ( iContext == EContextGroupSong ) || |
1587 ( iContext == EContextItemGenre ) || |
1604 ( iContext == EContextItemGenre ) || |
1588 ( iContext == EContextItemPlaylist ) ) && |
1605 ( iContext == EContextItemPlaylist ) ) && |
1589 // Check if the list is empty, Enable scroll buffer won't call requst if list is empty |
1606 // Check if the list is empty, Enable scroll buffer won't call requst if list is empty |
1590 ( iListWidget->ItemCount() != 0 ) ) |
1607 ( iListWidget->ItemCount() != 0 ) ) |
1591 { |
1608 { |
1592 MPX_DEBUG1("CMPXCollectionViewHgContainer::PrepareListL - EnableScrollBufferL"); |
1609 MPX_DEBUG1("CMPXCollectionViewHgContainer::PrepareListL - EnableScrollBufferL"); |
1593 iListWidget->EnableScrollBufferL( *this, KMPXListBufferSize, KMPXListBufferSize/4 ); |
1610 iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4); |
1594 } |
1611 } |
1595 else |
1612 else |
1596 { |
1613 { |
1597 EndFullScreenAnimation(); |
1614 EndFullScreenAnimation(); |
1598 iListWidget->RefreshScreen(0); |
1615 iListWidget->RefreshScreen(0); |
1729 // get front rectange from layout |
1746 // get front rectange from layout |
1730 TAknLayoutRect frontRect; |
1747 TAknLayoutRect frontRect; |
1731 frontRect.LayoutRect( appRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) ); |
1748 frontRect.LayoutRect( appRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) ); |
1732 iImageSize = frontRect.Rect().Size(); |
1749 iImageSize = frontRect.Rect().Size(); |
1733 |
1750 |
|
1751 CMPXCollectionViewHgSwitchBuffer* switchBuffer(NULL); |
|
1752 |
|
1753 if( iListWidget && (iPrevContext == EContextGroupAlbum || iPrevContext == EContextItemAlbum ) ) |
|
1754 { |
|
1755 switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iListWidget ); |
|
1756 } |
|
1757 else if ( iMediaWall ) |
|
1758 { |
|
1759 switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iMediaWall ); |
|
1760 switchBuffer->SetIndexOffset(1); |
|
1761 } |
1734 if( iMediaWall ) |
1762 if( iMediaWall ) |
1735 { |
1763 { |
1736 delete iMediaWall; |
1764 delete iMediaWall; |
1737 iMediaWall = 0; |
1765 iMediaWall = 0; |
1738 delete iMwListWidget; |
1766 delete iMwListWidget; |
1818 } |
1846 } |
1819 |
1847 |
1820 iMediaWall->SetOpenedItemRect( iPopupListRect ); |
1848 iMediaWall->SetOpenedItemRect( iPopupListRect ); |
1821 iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationZoomToFront ); |
1849 iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationZoomToFront ); |
1822 |
1850 |
|
1851 if( switchBuffer ) |
|
1852 { |
|
1853 switchBuffer->FillFromBufferL( *iMediaWall ); |
|
1854 CleanupStack::PopAndDestroy( switchBuffer ); |
|
1855 switchBuffer = NULL; |
|
1856 } |
1823 iDefaultIconSet = ETrue; |
1857 iDefaultIconSet = ETrue; |
1824 } |
1858 } |
1825 |
1859 |
1826 // ---------------------------------------------------------------------------- |
1860 // ---------------------------------------------------------------------------- |
1827 // Add shuffle list item to the top of the list. |
1861 // Add shuffle list item to the top of the list. |
1927 } |
1961 } |
1928 default: |
1962 default: |
1929 iCurrentViewType = EMPXViewList; |
1963 iCurrentViewType = EMPXViewList; |
1930 break; |
1964 break; |
1931 } |
1965 } |
1932 |
1966 |
1933 // if tbone view is empty, switch back to Albums list or meidawall view |
1967 // if tbone view is empty, switch back to Albums list or meidawall view |
1934 if( ( iCurrentViewType == EMPXViewTBone ) && ( aCount < 1 ) ) |
1968 if( ( iCurrentViewType == EMPXViewTBone ) && ( aCount < 1 ) ) |
1935 { |
1969 { |
1936 if( landscapeOrientation ) |
1970 if( landscapeOrientation ) |
1937 iCurrentViewType = EMPXViewMediawall; |
1971 iCurrentViewType = EMPXViewMediawall; |
1938 else |
1972 else |
1939 iCurrentViewType = EMPXViewList; |
1973 iCurrentViewType = EMPXViewList; |
1940 } |
1974 } |
1941 |
1975 |
1942 } |
1976 } |
1943 |
1977 |
1944 // ---------------------------------------------------------------------------- |
1978 // ---------------------------------------------------------------------------- |
1945 // Clears the previous view content. |
1979 // Clears the previous view content. |
1946 // ---------------------------------------------------------------------------- |
1980 // ---------------------------------------------------------------------------- |
2056 if (!ShufflePlayAllL(index)) |
2090 if (!ShufflePlayAllL(index)) |
2057 { |
2091 { |
2058 switch( iContext ) |
2092 switch( iContext ) |
2059 { |
2093 { |
2060 case EContextGroupAlbum: |
2094 case EContextGroupAlbum: |
2061 case EContextItemAlbum: |
2095 case EContextItemAlbum: |
2062 { |
2096 { |
2063 iSelectedAlbumIndex = index; |
2097 iSelectedAlbumIndex = index; |
2064 SaveSelectedAlbumItemL(index); |
2098 SaveSelectedAlbumItemL(index); |
2065 // Open first song of album & playlist for entire album is created. |
2099 // Open first song of album & playlist for entire album is created. |
2066 PlayAlbumL(index); |
2100 PlayAlbumL(index); |
2067 break; |
2101 break; |
2068 } |
2102 } |
2069 case EContextGroupPlaylist: |
2103 case EContextGroupPlaylist: |
2070 { |
2104 { |
2071 PlayPlaylistL(index); |
2105 PlayPlaylistL(index); |
2108 if( iCurrentViewType == EMPXViewTBone && iSelectedAlbumIndex != index ) |
2142 if( iCurrentViewType == EMPXViewTBone && iSelectedAlbumIndex != index ) |
2109 { |
2143 { |
2110 if ( aControl == iMediaWall ) |
2144 if ( aControl == iMediaWall ) |
2111 { |
2145 { |
2112 iSelectedAlbumIndex = index; |
2146 iSelectedAlbumIndex = index; |
2113 iAlbumIndex = index; |
2147 iAlbumIndex = index; |
2114 OpenAlbumL(index); |
2148 OpenAlbumL(index); |
2115 } |
2149 } |
2116 } |
2150 } |
2117 else if( iCurrentViewType == EMPXViewMediawall ) |
2151 else if( iCurrentViewType == EMPXViewMediawall ) |
2118 { |
2152 { |
3046 if ( iContext == EContextGroupAlbum ) |
3080 if ( iContext == EContextGroupAlbum ) |
3047 { |
3081 { |
3048 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
3082 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
3049 if ( landscapeOrientation ) |
3083 if ( landscapeOrientation ) |
3050 { |
3084 { |
3051 unknownText = |
3085 unknownText = |
3052 StringLoader::LoadLC( R_MPX_MEDIAWALL_ARTIST_UNKNOWN ); |
3086 StringLoader::LoadLC( R_MPX_MEDIAWALL_ARTIST_UNKNOWN ); |
3053 } |
3087 } |
3054 else |
3088 else |
3055 { |
3089 { |
3056 unknownText = |
3090 unknownText = |
3057 StringLoader::LoadLC( R_MPX_MP_LIST_ARTIST_UNKNOWN ); |
3091 StringLoader::LoadLC( R_MPX_MP_LIST_ARTIST_UNKNOWN ); |
3058 } |
3092 } |
3059 } |
3093 } |
3060 else |
3094 else |
3061 { |
3095 { |
3062 unknownText = |
3096 unknownText = |
3063 StringLoader::LoadLC( R_MPX_MEDIAWALL_ARTIST_UNKNOWN ); |
3097 StringLoader::LoadLC( R_MPX_MEDIAWALL_ARTIST_UNKNOWN ); |
3064 } |
3098 } |
3065 aVisualItem->SetTitleL( *unknownText ); |
3099 aVisualItem->SetTitleL( *unknownText ); |
3066 CleanupStack::PopAndDestroy( unknownText ); |
3100 CleanupStack::PopAndDestroy( unknownText ); |
3067 } |
3101 } |
3068 } |
3102 } |
3124 void CMPXCollectionViewHgContainer::SetDetailCountL( |
3158 void CMPXCollectionViewHgContainer::SetDetailCountL( |
3125 CHgItem* aVisualItem, |
3159 CHgItem* aVisualItem, |
3126 CMPXMedia* aMedia ) |
3160 CMPXMedia* aMedia ) |
3127 { |
3161 { |
3128 MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailCountL" ); |
3162 MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailCountL" ); |
3129 if ( aMedia->IsSupported( KMPXMediaGeneralCount ) ) |
3163 if ( aMedia->IsSupported( KMPXMediaGeneralCount ) ) |
3130 { |
3164 { |
3131 TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) ); |
3165 TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) ); |
3132 |
3166 |
3133 if ( iContext == EContextGroupGenre ) |
3167 if ( iContext == EContextGroupGenre ) |
3134 { |
3168 { |
3135 HBufC* numSongsText = NULL; |
3169 HBufC* numSongsText = NULL; |
3136 if ( count > 1 || count == 0 ) |
3170 if ( count > 1 || count == 0 ) |
3137 { |
3171 { |
3138 numSongsText = StringLoader::LoadLC( R_MPX_MUSIC_NUM_SONGS, count ); |
3172 numSongsText = StringLoader::LoadLC( R_MPX_MUSIC_NUM_SONGS, count ); |
3139 } |
3173 } |
3140 else |
3174 else |
3141 { |
3175 { |
3142 numSongsText = StringLoader::LoadLC( R_MPX_MUSIC_ONE_SONG ); |
3176 numSongsText = StringLoader::LoadLC( R_MPX_MUSIC_ONE_SONG ); |
3143 } |
3177 } |
3144 TPtr ptr = numSongsText->Des(); |
3178 TPtr ptr = numSongsText->Des(); |
3145 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
3179 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
3146 aVisualItem->SetTextL( ptr ); |
3180 aVisualItem->SetTextL( ptr ); |
3147 CleanupStack::PopAndDestroy( numSongsText ); |
3181 CleanupStack::PopAndDestroy( numSongsText ); |
3203 { |
3237 { |
3204 detailText.Copy( album.Left(detailText.MaxLength())); |
3238 detailText.Copy( album.Left(detailText.MaxLength())); |
3205 aVisualItem->SetTextL( detailText ); |
3239 aVisualItem->SetTextL( detailText ); |
3206 } |
3240 } |
3207 else |
3241 else |
3208 { |
3242 { |
3209 HBufC* unknownText = NULL; |
3243 HBufC* unknownText = NULL; |
3210 if ( iContext == EContextGroupAlbum ) |
3244 if ( iContext == EContextGroupAlbum ) |
3211 { |
3245 { |
3212 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
3246 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
3213 if ( landscapeOrientation ) |
3247 if ( landscapeOrientation ) |
3214 { |
3248 { |
3215 unknownText = |
3249 unknownText = |
3216 StringLoader::LoadLC( R_MPX_MEDIAWALL_ALBUM_UNKNOWN ); |
3250 StringLoader::LoadLC( R_MPX_MEDIAWALL_ALBUM_UNKNOWN ); |
3217 } |
3251 } |
3218 else |
3252 else |
3219 { |
3253 { |
3220 unknownText = |
3254 unknownText = |
3221 StringLoader::LoadLC( R_MPX_MP_LIST_ALBUM_UNKNOWN ); |
3255 StringLoader::LoadLC( R_MPX_MP_LIST_ALBUM_UNKNOWN ); |
3222 } |
3256 } |
3223 } |
3257 } |
3224 else |
3258 else |
3225 { |
3259 { |
3226 unknownText = |
3260 unknownText = |
3227 StringLoader::LoadLC( R_MPX_MEDIAWALL_ALBUM_UNKNOWN ); |
3261 StringLoader::LoadLC( R_MPX_MEDIAWALL_ALBUM_UNKNOWN ); |
3228 } |
3262 } |
3229 aVisualItem->SetTextL( *unknownText ); |
3263 aVisualItem->SetTextL( *unknownText ); |
3230 CleanupStack::PopAndDestroy( unknownText ); |
3264 CleanupStack::PopAndDestroy( unknownText ); |
3231 } |
3265 } |
3232 } |
3266 } |
3243 { |
3277 { |
3244 MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailDurationL" ); |
3278 MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailDurationL" ); |
3245 if ( iContext == EContextGroupPlaylist && |
3279 if ( iContext == EContextGroupPlaylist && |
3246 aMedia->IsSupported( KMPXMediaGeneralDuration ) && |
3280 aMedia->IsSupported( KMPXMediaGeneralDuration ) && |
3247 aMedia->IsSupported( KMPXMediaGeneralCount ) ) |
3281 aMedia->IsSupported( KMPXMediaGeneralCount ) ) |
3248 { |
3282 { |
3249 TBuf<KMPXMaxFileLength> detailText; |
3283 TBuf<KMPXMaxFileLength> detailText; |
3250 TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) ); |
3284 TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) ); |
3251 TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration ); |
3285 TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration ); |
3252 |
3286 |
3253 UpdateTimeIndicatorsL(detailText, duration); |
3287 UpdateTimeIndicatorsL(detailText, duration); |
3254 HBufC* numSongsDurationText = NULL; |
3288 HBufC* numSongsDurationText = NULL; |
3255 if ( count > 1 || count == 0 ) |
3289 if ( count > 1 || count == 0 ) |
3256 { |
3290 { |
3257 numSongsDurationText = StringLoader::LoadLC( R_MPX_MUSIC_NUM_SONGS_DURATION, detailText, count ); |
3291 numSongsDurationText = StringLoader::LoadLC( R_MPX_MUSIC_NUM_SONGS_DURATION, detailText, count ); |
3258 } |
3292 } |
3259 else |
3293 else |
3260 { |
3294 { |
3261 numSongsDurationText = StringLoader::LoadLC( R_MPX_MUSIC_ONE_SONG_DURATION, detailText ); |
3295 numSongsDurationText = StringLoader::LoadLC( R_MPX_MUSIC_ONE_SONG_DURATION, detailText ); |
3262 } |
3296 } |
3263 TPtr ptr = numSongsDurationText->Des(); |
3297 TPtr ptr = numSongsDurationText->Des(); |
3264 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
3298 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
3265 aVisualItem->SetTextL( ptr ); |
3299 aVisualItem->SetTextL( ptr ); |
3266 CleanupStack::PopAndDestroy( numSongsDurationText ); |
3300 CleanupStack::PopAndDestroy( numSongsDurationText ); |
3267 } |
3301 } |
3268 else if ( iContext == EContextItemPodcast && |
3302 else if ( iContext == EContextItemPodcast && |
3269 aMedia->IsSupported( KMPXMediaGeneralDuration ) && |
3303 aMedia->IsSupported( KMPXMediaGeneralDuration ) && |
3608 const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray(); |
3642 const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray(); |
3609 const TInt count( mediaArray.Count() ); |
3643 const TInt count( mediaArray.Count() ); |
3610 |
3644 |
3611 if ( count > 1 && iContext == EContextGroupAlbum ) |
3645 if ( count > 1 && iContext == EContextGroupAlbum ) |
3612 { |
3646 { |
3613 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
3647 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
3614 if ( landscapeOrientation ) |
3648 if ( landscapeOrientation ) |
3615 { |
3649 { |
3616 HBufC* shuffleText = StringLoader::LoadLC( |
3650 HBufC* shuffleText = StringLoader::LoadLC( |
3617 R_MPX_MEDIAWALL_TITLE_SHUFFLE_ALL ); |
3651 R_MPX_MEDIAWALL_TITLE_SHUFFLE_ALL ); |
3618 aItem->SetTitleL( *shuffleText ); |
3652 aItem->SetTitleL( *shuffleText ); |
3619 CleanupStack::PopAndDestroy( shuffleText ); |
3653 CleanupStack::PopAndDestroy( shuffleText ); |
3620 } |
3654 } |
3621 else |
3655 else |
3622 { |
3656 { |
3623 HBufC* shuffleText = StringLoader::LoadLC( |
3657 HBufC* shuffleText = StringLoader::LoadLC( |
3624 R_MPX_SHUFFLE ); |
3658 R_MPX_SHUFFLE ); |
3625 aItem->SetTitleL( *shuffleText ); |
3659 aItem->SetTitleL( *shuffleText ); |
3626 CleanupStack::PopAndDestroy( shuffleText ); |
3660 CleanupStack::PopAndDestroy( shuffleText ); |
3627 } |
3661 } |
3628 |
3662 |
3629 // We can try to set icon too. |
3663 // We can try to set icon too. |
3630 SetDetailIconShuffleL(); |
3664 SetDetailIconShuffleL(); |
3631 res = ETrue; |
3665 res = ETrue; |
3632 } |
3666 } |
3658 void CMPXCollectionViewHgContainer::SetCollectionContextL() |
3692 void CMPXCollectionViewHgContainer::SetCollectionContextL() |
3659 { |
3693 { |
3660 MPX_FUNC( "CMPXCollectionViewHgContainer::SetCollectionContextL" ); |
3694 MPX_FUNC( "CMPXCollectionViewHgContainer::SetCollectionContextL" ); |
3661 |
3695 |
3662 const CMPXMedia& media = iListBoxArray->ContainerMedia(); |
3696 const CMPXMedia& media = iListBoxArray->ContainerMedia(); |
3663 |
3697 |
3664 if ( NULL == &media ) |
3698 if ( NULL == &media ) |
3665 { |
3699 { |
3666 MPX_DEBUG1( "CMPXCollectionViewHgContainer::SetCollectionContextL NO media"); |
3700 MPX_DEBUG1( "CMPXCollectionViewHgContainer::SetCollectionContextL NO media"); |
3667 User::Leave(KErrNotFound); |
3701 User::Leave(KErrNotFound); |
3668 } |
3702 } |
3669 |
3703 |
3670 TMPXGeneralType containerType( EMPXNoType ); |
3704 TMPXGeneralType containerType( EMPXNoType ); |
3671 if ( media.IsSupported( KMPXMediaGeneralType ) ) |
3705 if ( media.IsSupported( KMPXMediaGeneralType ) ) |
3672 { |
3706 { |
3673 containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
3707 containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
3674 } |
3708 } |
4403 // Shows the album songs in songs dialog. |
4437 // Shows the album songs in songs dialog. |
4404 // ----------------------------------------------------------------------------- |
4438 // ----------------------------------------------------------------------------- |
4405 // |
4439 // |
4406 void CMPXCollectionViewHgContainer::ShowAlbumSongsDialogL( const CMPXMedia& aResults ) |
4440 void CMPXCollectionViewHgContainer::ShowAlbumSongsDialogL( const CMPXMedia& aResults ) |
4407 { |
4441 { |
4408 CAknSinglePopupMenuStyleListBox* listBox = new ( ELeave ) CAknSinglePopupMenuStyleListBox; |
4442 CAknSingleGraphicPopupMenuStyleListBox* listBox = new ( ELeave ) CAknSingleGraphicPopupMenuStyleListBox; |
4409 CleanupStack::PushL( listBox ); |
4443 CleanupStack::PushL( listBox ); |
4410 |
4444 |
4411 CAknPopupList* dialog = CAknPopupList::NewL(listBox, R_MPX_COLLECTION_ALBUMSONGS_LIST_CBA, |
4445 CAknPopupList* dialog = CAknPopupList::NewL(listBox, R_MPX_COLLECTION_ALBUMSONGS_LIST_CBA, |
4412 AknPopupLayouts::EDynMenuWindow ); |
4446 AknPopupLayouts::EDynMenuWindow ); |
4413 |
4447 |
4447 |
4481 |
4448 if ( songCount > 1 ) |
4482 if ( songCount > 1 ) |
4449 { |
4483 { |
4450 HBufC* shuffleText = StringLoader::LoadLC( |
4484 HBufC* shuffleText = StringLoader::LoadLC( |
4451 R_MPX_MEDIAWALL_DIALOG_SHUFFLE ); |
4485 R_MPX_MEDIAWALL_DIALOG_SHUFFLE ); |
4452 songList->AppendL( *shuffleText ); |
4486 // Make room for 3 more formatting characters. |
|
4487 HBufC* finalText = HBufC::NewLC(shuffleText->Length() + 3); |
|
4488 TPtr ptr = finalText->Des(); |
|
4489 // This tells the list to use icon at index 0 of array index. |
|
4490 ptr.Append(_L("0\t")); |
|
4491 ptr.Append(shuffleText->Des()); |
|
4492 songList->AppendL( *finalText ); |
|
4493 CleanupStack::PopAndDestroy( finalText ); |
4453 CleanupStack::PopAndDestroy( shuffleText ); |
4494 CleanupStack::PopAndDestroy( shuffleText ); |
|
4495 CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 ); |
|
4496 CleanupStack::PushL( iconArray ); |
|
4497 // Prepare icon array. |
|
4498 CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle]; |
|
4499 CGulIcon* iconCopy = CGulIcon::NewL(icon->Bitmap(), icon->Mask()); |
|
4500 iconCopy->SetBitmapsOwnedExternally(ETrue); |
|
4501 iconArray->AppendL(iconCopy); |
|
4502 |
|
4503 listBox->ItemDrawer()->ColumnData()->SetIconArrayL( iconArray ); |
|
4504 CleanupStack::Pop(); // iconArray |
4454 } |
4505 } |
4455 |
4506 |
4456 for ( TInt i = 0; i < songCount; i++ ) |
4507 for ( TInt i = 0; i < songCount; i++ ) |
4457 { |
4508 { |
4458 // Just get the exiting item and update the fields + icon. |
4509 // Just get the exiting item and update the fields + icon. |
4464 break; |
4515 break; |
4465 } |
4516 } |
4466 if ( currentMedia->IsSupported( KMPXMediaGeneralTitle ) ) |
4517 if ( currentMedia->IsSupported( KMPXMediaGeneralTitle ) ) |
4467 { |
4518 { |
4468 const TDesC& title = currentMedia->ValueText( KMPXMediaGeneralTitle ); |
4519 const TDesC& title = currentMedia->ValueText( KMPXMediaGeneralTitle ); |
4469 songList->AppendL( title ); |
4520 HBufC* finalText = HBufC::NewLC(title.Length() + 2); |
|
4521 TPtr ptr = finalText->Des(); |
|
4522 ptr.Append(_L("\t")); |
|
4523 ptr.Append(title); |
|
4524 songList->AppendL( *finalText ); |
|
4525 CleanupStack::PopAndDestroy( finalText ); |
4470 } |
4526 } |
4471 } |
4527 } |
4472 |
4528 |
4473 CTextListBoxModel* model = listBox->Model(); |
4529 CTextListBoxModel* model = listBox->Model(); |
4474 model->SetItemTextArray( songList ); |
4530 model->SetItemTextArray( songList ); |
4741 { |
4797 { |
4742 CMPXCollectionViewHgContainer* self = static_cast<CMPXCollectionViewHgContainer*>(aPtr); |
4798 CMPXCollectionViewHgContainer* self = static_cast<CMPXCollectionViewHgContainer*>(aPtr); |
4743 if( self ) |
4799 if( self ) |
4744 { |
4800 { |
4745 //check if the pointer to ContainerMedia exists |
4801 //check if the pointer to ContainerMedia exists |
4746 const CMPXMedia& media = self->iListBoxArray->ContainerMedia(); |
4802 const CMPXMedia& media = self->iListBoxArray->ContainerMedia(); |
4747 if ( NULL == &media ) |
4803 if ( NULL == &media ) |
4748 { |
4804 { |
4749 return KErrNone; |
4805 return KErrNone; |
4750 } |
4806 } |
4751 |
4807 |
4752 |
4808 |
4753 self->HandleLbxItemAdditionL(); |
4809 MPX_TRAPD( err, self->HandleLbxItemAdditionL() ); |
|
4810 if ( err != KErrNone ) |
|
4811 { |
|
4812 MPX_DEBUG2("CMPXCollectionViewHgContainer::AsyncCallback() return err%d", err ); |
|
4813 return err; |
|
4814 } |
4754 |
4815 |
4755 if( self->iCbaHandler ) |
4816 if( self->iCbaHandler ) |
4756 { |
4817 { |
4757 self->iCbaHandler->UpdateCba(); |
4818 self->iCbaHandler->UpdateCba(); |
4758 } |
4819 } |
4759 } |
4820 } |
4760 return KErrNone; |
4821 return KErrNone; |
4761 } |
4822 } |
4889 // |
4950 // |
4890 void CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL() |
4951 void CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL() |
4891 { |
4952 { |
4892 MPX_FUNC( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL" ); |
4953 MPX_FUNC( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL" ); |
4893 MPX_DEBUG2( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL - iContext %d", iContext ); |
4954 MPX_DEBUG2( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL - iContext %d", iContext ); |
4894 |
4955 |
4895 TInt resId( 0 ); |
4956 TInt resId( 0 ); |
4896 |
4957 |
4897 switch ( iContext ) |
4958 switch ( iContext ) |
4898 { |
4959 { |
4899 case EContextGroupAlbum: |
4960 case EContextGroupAlbum: |
4900 { |
4961 { |
4901 resId = R_MPX_VMP_NO_ALBUMS; |
4962 resId = R_MPX_VMP_NO_ALBUMS; |