64 #include <ganes/HgItem.h> |
64 #include <ganes/HgItem.h> |
65 #include <ganes/HgScrollerWithTitle.h> |
65 #include <ganes/HgScrollerWithTitle.h> |
66 #include <ganes/HgVgMediaWall.h> |
66 #include <ganes/HgVgMediaWall.h> |
67 |
67 |
68 #include <layoutmetadata.cdl.h> |
68 #include <layoutmetadata.cdl.h> |
|
69 #include <AknLayout2ScalableDef.h> |
|
70 #include <aknlayoutscalable_apps.cdl.h> |
69 #include <akntranseffect.h> // For transition effects |
71 #include <akntranseffect.h> // For transition effects |
70 #include <gfxtranseffect/gfxtranseffect.h> // For transition effects |
72 #include <gfxtranseffect/gfxtranseffect.h> // For transition effects |
71 |
73 |
72 #include "mpxcommoncontainer.hrh" |
74 #include "mpxcommoncontainer.hrh" |
73 #include "mpxcollectionviewhg.hrh" |
75 #include "mpxcollectionviewhg.hrh" |
1075 { |
1077 { |
1076 MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxCurrentItemIndex" ); |
1078 MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxCurrentItemIndex" ); |
1077 |
1079 |
1078 // TODO, check if we need to support this with other view types also |
1080 // TODO, check if we need to support this with other view types also |
1079 // David: This needs to be supported for Mediawall and Tbone |
1081 // David: This needs to be supported for Mediawall and Tbone |
1080 if ( iListWidget ) |
1082 if ( iListWidget && iCurrentViewType == EMPXViewList ) |
1081 { |
1083 { |
1082 iListWidget->SetSelectedIndex( aIndex ); |
1084 // aIndex is the song index, so need take "ShuffleAll" item |
|
1085 // into account |
|
1086 iListWidget->SetSelectedIndex( aIndex + iShuffleItem ); |
1083 } |
1087 } |
1084 } |
1088 } |
1085 |
1089 |
1086 |
1090 |
1087 // ----------------------------------------------------------------------------- |
1091 // ----------------------------------------------------------------------------- |
1184 TInt count( mediaArray.Count() ); |
1188 TInt count( mediaArray.Count() ); |
1185 MPX_DEBUG2( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionL count=%d", count); |
1189 MPX_DEBUG2( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionL count=%d", count); |
1186 |
1190 |
1187 HandleLbxItemRemovalL(); |
1191 HandleLbxItemRemovalL(); |
1188 TViewType prevViewType = iCurrentViewType; |
1192 TViewType prevViewType = iCurrentViewType; |
1189 //no songs and no allbums, then its list view |
1193 |
1190 if ( count > 0 ) |
1194 ResolveCurrentViewType( count ); |
1191 { |
1195 |
1192 ResolveCurrentViewType(); |
|
1193 } |
|
1194 else |
|
1195 { |
|
1196 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
|
1197 if( landscapeOrientation ) |
|
1198 iCurrentViewType = EMPXViewMediawall; |
|
1199 else |
|
1200 iCurrentViewType = EMPXViewList; |
|
1201 } |
|
1202 |
|
1203 iThumbnailReqMap.Reset(); |
1196 iThumbnailReqMap.Reset(); |
1204 if (ShuffleItemPresent()) |
1197 if (ShuffleItemPresent()) |
1205 iShuffleItem = 1; |
1198 iShuffleItem = 1; |
1206 else |
1199 else |
1207 iShuffleItem = 0; |
1200 iShuffleItem = 0; |
1465 // Resize the list when contents of media array changed. |
1458 // Resize the list when contents of media array changed. |
1466 // --------------------------------------------------------------------------- |
1459 // --------------------------------------------------------------------------- |
1467 // |
1460 // |
1468 void CMPXCollectionViewHgContainer::ResizeListL(const CMPXMediaArray& aMediaArray, TInt aCount) |
1461 void CMPXCollectionViewHgContainer::ResizeListL(const CMPXMediaArray& aMediaArray, TInt aCount) |
1469 { |
1462 { |
|
1463 MPX_FUNC( "CMPXCollectionViewHgContainer::ResizeListL" ); |
|
1464 TInt mediaCount = aMediaArray.Count(); |
|
1465 |
1470 if( iListWidget ) |
1466 if( iListWidget ) |
1471 { |
1467 { |
1472 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1468 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1473 TInt index = iListWidget->SelectedIndex(); |
1469 TInt mediaIndex = MediaIndex(iListWidget->SelectedIndex()); |
|
1470 mediaIndex = ( mediaIndex >= 0 && (mediaIndex < (mediaCount)) ) ? mediaIndex : (mediaCount - 1); |
|
1471 |
1474 iListWidget->InitScreenL( clientRect ); |
1472 iListWidget->InitScreenL( clientRect ); |
1475 iListWidget->Reset(); |
1473 iListWidget->Reset(); |
1476 if ( aCount ) |
1474 if ( aCount ) |
1477 { |
1475 { |
1478 iListWidget->ResizeL( aCount ); |
1476 iListWidget->ResizeL( aCount ); |
1479 ProvideDataWithoutThumbnailsL(aMediaArray); |
1477 ProvideDataWithoutThumbnailsL(aMediaArray); |
1480 iListWidget->SetSelectedIndex( index ); |
1478 iListWidget->SetSelectedIndex( mediaIndex + iShuffleItem ); |
1481 } |
1479 } |
1482 else |
1480 else |
1483 { |
1481 { |
1484 iListWidget->RefreshScreen(0); |
1482 iListWidget->RefreshScreen(0); |
1485 } |
1483 } |
1486 } |
1484 } |
1487 else if( iMediaWall ) |
1485 else if( iMediaWall ) |
1488 { |
1486 { |
1489 // In case of mediawall components we switch to different view type if orientation changes |
1487 // In case of mediawall components we switch to different view type if orientation changes |
1490 // so there is no need to set new client rect for mediawall. |
1488 // so there is no need to set new client rect for mediawall. |
1491 TInt index = iMediaWall->SelectedIndex(); |
1489 TInt mediaIndex = MediaIndex(iMediaWall->SelectedIndex()); |
|
1490 |
|
1491 // Correct the array index if it is out of range |
|
1492 // This case may happen when last album or album beside selected album is deleted |
|
1493 mediaIndex = ( mediaIndex >= 0 && ( mediaIndex < mediaCount ) ) ? mediaIndex : (mediaCount - 1); |
|
1494 |
|
1495 if( iSelectedAlbumIndex != mediaIndex ) |
|
1496 { |
|
1497 iSelectedAlbumIndex = mediaIndex; |
|
1498 SaveSelectedAlbumItemL( iSelectedAlbumIndex ); |
|
1499 } |
|
1500 |
1492 iMediaWall->Reset(); |
1501 iMediaWall->Reset(); |
1493 if ( aCount ) |
1502 if ( aCount ) |
1494 { |
1503 { |
1495 iMediaWall->ResizeL( aCount ); |
1504 iMediaWall->ResizeL( aCount ); |
1496 ProvideDataWithoutThumbnailsMwL(aMediaArray); |
1505 ProvideDataWithoutThumbnailsMwL(aMediaArray); |
1497 index = index >= 0 ? index : 0; |
1506 |
1498 iMediaWall->SetSelectedIndex( index ); |
1507 iMediaWall->SetSelectedIndex( mediaIndex + iShuffleItem); |
1499 if ( iCurrentViewType == EMPXViewTBone ) |
1508 if ( iCurrentViewType == EMPXViewTBone ) |
1500 { |
1509 { |
1501 OpenAlbumL( index ); |
1510 OpenAlbumL( mediaIndex ); |
1502 } |
1511 } |
1503 } |
1512 } |
1504 else |
1513 else |
1505 { |
1514 { |
1506 iMediaWall->RefreshScreen(0); |
1515 iMediaWall->RefreshScreen(0); |
1518 if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible()) |
1527 if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible()) |
1519 ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue); |
1528 ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue); |
1520 |
1529 |
1521 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1530 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1522 iThumbnailManager->SetSizeL( EAudioListThumbnailSize ); |
1531 iThumbnailManager->SetSizeL( EAudioListThumbnailSize ); |
|
1532 iImageSize = CHgDoubleGraphicListFlat::PreferredImageSize(); |
1523 |
1533 |
1524 if( !iListWidget ) |
1534 if( !iListWidget ) |
1525 { |
1535 { |
1526 iListWidget = CHgDoubleGraphicListFlat::NewL ( |
1536 iListWidget = CHgDoubleGraphicListFlat::NewL ( |
1527 clientRect, |
1537 clientRect, |
1545 ProvideDataWithoutThumbnailsL(aMediaArray); |
1555 ProvideDataWithoutThumbnailsL(aMediaArray); |
1546 iListWidget->MakeVisible(ETrue); |
1556 iListWidget->MakeVisible(ETrue); |
1547 iListWidget->InitScreenL(clientRect); |
1557 iListWidget->InitScreenL(clientRect); |
1548 } |
1558 } |
1549 |
1559 |
1550 |
1560 if ( (iAlbumIndex > 0) && (iAlbumIndex < aCount) ) |
|
1561 { |
|
1562 iListWidget->SetSelectedIndex( iAlbumIndex + iShuffleItem ); |
|
1563 } |
|
1564 |
1551 // TODO. Define here in which views we need to have buffering enabled in the list |
1565 // TODO. Define here in which views we need to have buffering enabled in the list |
1552 if( iContext == EContextGroupAlbum || |
1566 if( ( iContext == EContextGroupAlbum || |
1553 iContext == EContextGroupArtist || |
1567 iContext == EContextGroupArtist || |
1554 iContext == EContextGroupSong || |
1568 iContext == EContextGroupSong || |
1555 iContext == EContextItemPlaylist ) |
1569 iContext == EContextItemPlaylist ) && ( aCount > 0) ) |
1556 { |
1570 { |
1557 iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4); |
1571 iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4); |
1558 } |
1572 } |
1559 else |
1573 else |
1560 { |
1574 { |
1576 ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse); |
1590 ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse); |
1577 iThumbnailManager->SetSizeL( EAudioGridThumbnailSize ); |
1591 iThumbnailManager->SetSizeL( EAudioGridThumbnailSize ); |
1578 |
1592 |
1579 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1593 TRect clientRect = ((CAknView*)iView)->ClientRect(); |
1580 |
1594 |
1581 // Temporary until we have real layout data |
1595 TAknLayoutRect mediawallLayout; |
1582 TRect mediaWallRect = TRect(clientRect.iTl, TPoint(clientRect.iBr.iX, 250)); |
1596 mediawallLayout.LayoutRect( clientRect, AknLayoutScalable_Apps::cf0_flow_pane(0) ); |
1583 TRect mwListRect = TRect(TPoint(clientRect.iTl.iX, 250), clientRect.iBr); |
1597 |
|
1598 TAknLayoutRect listLayout; |
|
1599 listLayout.LayoutRect( clientRect, AknLayoutScalable_Apps::listscroll_cf0_pane(0) ); |
|
1600 |
|
1601 TRect mediaWallRect = mediawallLayout.Rect(); |
|
1602 TRect mwListRect = listLayout.Rect(); |
|
1603 |
|
1604 // get front rectange from layout |
|
1605 TAknLayoutRect frontRect; |
|
1606 frontRect.LayoutRect( mediaWallRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) ); |
|
1607 iImageSize = frontRect.Rect().Size(); |
1584 |
1608 |
1585 if( iMediaWall ) |
1609 if( iMediaWall ) |
1586 { |
1610 { |
1587 delete iMediaWall; |
1611 delete iMediaWall; |
1588 iMediaWall = 0; |
1612 iMediaWall = 0; |
1664 if( iTranstionType == EMPXTranstionNotDefined ) |
1688 if( iTranstionType == EMPXTranstionNotDefined ) |
1665 iMediaWall->RefreshScreen(iAlbumIndex); |
1689 iMediaWall->RefreshScreen(iAlbumIndex); |
1666 OpenAlbumL(iAlbumIndex); |
1690 OpenAlbumL(iAlbumIndex); |
1667 } |
1691 } |
1668 iMwListWidget->RefreshScreen(0); |
1692 iMwListWidget->RefreshScreen(0); |
1669 |
1693 iDefaultIconSet = ETrue; |
1670 } |
1694 } |
1671 |
1695 |
1672 // ---------------------------------------------------------------------------- |
1696 // ---------------------------------------------------------------------------- |
1673 // Prepare view for displaying data in Media wall format. |
1697 // Prepare view for displaying data in Media wall format. |
1674 // ---------------------------------------------------------------------------- |
1698 // ---------------------------------------------------------------------------- |
1676 { |
1700 { |
1677 MPX_FUNC("CMPXCollectionViewHgContainer::PrepareMediaWallL"); |
1701 MPX_FUNC("CMPXCollectionViewHgContainer::PrepareMediaWallL"); |
1678 TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect(); |
1702 TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect(); |
1679 ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse); |
1703 ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse); |
1680 iThumbnailManager->SetSizeL( EAudioFullScreenThumbnailSize ); |
1704 iThumbnailManager->SetSizeL( EAudioFullScreenThumbnailSize ); |
|
1705 // get front rectange from layout |
|
1706 TAknLayoutRect frontRect; |
|
1707 frontRect.LayoutRect( appRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) ); |
|
1708 iImageSize = frontRect.Rect().Size(); |
1681 |
1709 |
1682 if( iMediaWall ) |
1710 if( iMediaWall ) |
1683 { |
1711 { |
1684 delete iMediaWall; |
1712 delete iMediaWall; |
1685 iMediaWall = 0; |
1713 iMediaWall = 0; |
1752 // Add shuffle list item to the top of the list. |
1780 // Add shuffle list item to the top of the list. |
1753 // ---------------------------------------------------------------------------- |
1781 // ---------------------------------------------------------------------------- |
1754 void CMPXCollectionViewHgContainer::SetShuffleItemToListL(CHgScroller* aScroller ) |
1782 void CMPXCollectionViewHgContainer::SetShuffleItemToListL(CHgScroller* aScroller ) |
1755 { |
1783 { |
1756 CHgItem* item = CHgItem::NewL(); |
1784 CHgItem* item = CHgItem::NewL(); |
1757 // Todo: Localize |
1785 HBufC* shuffleText = StringLoader::LoadLC( |
1758 item->SetTitleL( _L("Shuffle All") ); |
1786 R_MPX_TBONE_SHUFFLE ); |
|
1787 item->SetTitleL( *shuffleText ); |
|
1788 CleanupStack::PopAndDestroy( shuffleText ); |
1759 |
1789 |
1760 CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle]; |
1790 CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle]; |
1761 CFbsBitmap* bitmap = icon->Bitmap(); |
1791 CFbsBitmap* bitmap = icon->Bitmap(); |
1762 CFbsBitmap* mask = icon->Mask(); |
1792 CFbsBitmap* mask = icon->Mask(); |
1763 |
1793 |
1811 } |
1841 } |
1812 |
1842 |
1813 // ---------------------------------------------------------------------------- |
1843 // ---------------------------------------------------------------------------- |
1814 // Resolve the current view type based on the browsing context |
1844 // Resolve the current view type based on the browsing context |
1815 // ---------------------------------------------------------------------------- |
1845 // ---------------------------------------------------------------------------- |
1816 void CMPXCollectionViewHgContainer::ResolveCurrentViewType() |
1846 void CMPXCollectionViewHgContainer::ResolveCurrentViewType( TInt aCount ) |
1817 { |
1847 { |
1818 iCurrentViewType = EMPXViewUnknown; |
1848 iCurrentViewType = EMPXViewUnknown; |
1819 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
1849 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
1820 switch (iContext) |
1850 switch (iContext) |
1821 { |
1851 { |
1850 } |
1880 } |
1851 default: |
1881 default: |
1852 iCurrentViewType = EMPXViewList; |
1882 iCurrentViewType = EMPXViewList; |
1853 break; |
1883 break; |
1854 } |
1884 } |
|
1885 |
|
1886 // if tbone view is empty, switch back to Albums list or meidawall view |
|
1887 if( ( iCurrentViewType == EMPXViewTBone ) && ( aCount < 1 ) ) |
|
1888 { |
|
1889 if( landscapeOrientation ) |
|
1890 iCurrentViewType = EMPXViewMediawall; |
|
1891 else |
|
1892 iCurrentViewType = EMPXViewList; |
|
1893 } |
|
1894 |
1855 } |
1895 } |
1856 |
1896 |
1857 // ---------------------------------------------------------------------------- |
1897 // ---------------------------------------------------------------------------- |
1858 // Clears the previous view content. |
1898 // Clears the previous view content. |
1859 // ---------------------------------------------------------------------------- |
1899 // ---------------------------------------------------------------------------- |
1959 // Handle item command |
1999 // Handle item command |
1960 // --------------------------------------------------------------------------- |
2000 // --------------------------------------------------------------------------- |
1961 // |
2001 // |
1962 void CMPXCollectionViewHgContainer::HandleItemCommandL( TInt aCommand ) |
2002 void CMPXCollectionViewHgContainer::HandleItemCommandL( TInt aCommand ) |
1963 { |
2003 { |
1964 MPX_FUNC( "CMPXCollectionViewHgContainer::HandleItemCommanddL" ); |
2004 MPX_FUNC( "CMPXCollectionViewHgContainer::HandleItemCommandL" ); |
1965 |
2005 MPX_DEBUG3("CMPXCollectionViewHgContainer::HandleItemCommandL iCurrentViewType = %d, iContext = %d", iCurrentViewType, iContext); |
1966 if( aCommand == EMPXCmdPlay ) |
2006 if( aCommand == EMPXCmdPlay ) |
1967 { |
2007 { |
1968 if ( iContext == EContextGroupAlbum ) |
2008 TInt index = CurrentLbxItemIndex(); |
1969 { |
2009 if (!ShufflePlayAllL(index)) |
1970 iSelectedAlbumIndex = MediaIndex(iListWidget->SelectedIndex()); |
2010 { |
1971 SaveSelectedAlbumItemL(iSelectedAlbumIndex); |
2011 switch( iContext ) |
1972 // Open first song of album & playlist for entire album is created. |
2012 { |
1973 PlayAlbumL(iSelectedAlbumIndex); |
2013 case EContextGroupAlbum: |
1974 } |
2014 case EContextItemAlbum: |
1975 else if ( iContext == EContextGroupPlaylist ) |
2015 { |
1976 { |
2016 iSelectedAlbumIndex = index; |
1977 TInt index = MediaIndex(iListWidget->SelectedIndex()); |
2017 SaveSelectedAlbumItemL(index); |
1978 PlayPlaylistL(index); |
2018 // Open first song of album & playlist for entire album is created. |
1979 } |
2019 PlayAlbumL(index); |
1980 else if ( iContext == EContextGroupGenre ) |
2020 break; |
1981 { |
2021 } |
1982 TInt index = MediaIndex(iListWidget->SelectedIndex()); |
2022 case EContextGroupPlaylist: |
1983 PlayGenreL(index); |
2023 { |
|
2024 PlayPlaylistL(index); |
|
2025 break; |
|
2026 } |
|
2027 case EContextGroupGenre: |
|
2028 { |
|
2029 PlayGenreL(index); |
|
2030 break; |
|
2031 } |
|
2032 default: |
|
2033 break; |
|
2034 } |
1984 } |
2035 } |
1985 } |
2036 } |
1986 } |
2037 } |
1987 |
2038 |
1988 // --------------------------------------------------------------------------- |
2039 // --------------------------------------------------------------------------- |
2010 if( iCurrentViewType == EMPXViewTBone && iSelectedAlbumIndex != index ) |
2061 if( iCurrentViewType == EMPXViewTBone && iSelectedAlbumIndex != index ) |
2011 { |
2062 { |
2012 if ( aControl == iMediaWall ) |
2063 if ( aControl == iMediaWall ) |
2013 { |
2064 { |
2014 iSelectedAlbumIndex = index; |
2065 iSelectedAlbumIndex = index; |
|
2066 iAlbumIndex = index; |
2015 OpenAlbumL(index); |
2067 OpenAlbumL(index); |
2016 } |
2068 } |
2017 } |
2069 } |
2018 else if( iCurrentViewType == EMPXViewMediawall ) |
2070 else if( iCurrentViewType == EMPXViewMediawall ) |
2019 { |
2071 { |
2020 iSelectedAlbumIndex = index; |
2072 iSelectedAlbumIndex = index; |
|
2073 iAlbumIndex = index; |
2021 } |
2074 } |
2022 } |
2075 } |
2023 |
2076 |
2024 |
2077 |
2025 // --------------------------------------------------------------------------- |
2078 // --------------------------------------------------------------------------- |
2929 CMPXMedia* aMedia ) |
2982 CMPXMedia* aMedia ) |
2930 { |
2983 { |
2931 MPX_FUNC( "CMPXCollectionViewHgContainer::SetTitleL" ); |
2984 MPX_FUNC( "CMPXCollectionViewHgContainer::SetTitleL" ); |
2932 |
2985 |
2933 |
2986 |
2934 if ( iContext == EContextGroupAlbum || iContext == EContextItemAlbum ) |
2987 if ( iContext == EContextGroupAlbum || iContext == EContextItemAlbum ) |
2935 { |
2988 { |
2936 |
2989 if ( aMedia->IsSupported( KMPXMediaMusicArtist ) ) |
2937 if ( aMedia->IsSupported( KMPXMediaMusicArtist ) ) |
2990 { |
2938 { |
2991 const TDesC& title = aMedia->ValueText( KMPXMediaMusicArtist ); |
2939 const TDesC& title = aMedia->ValueText( KMPXMediaMusicArtist ); |
2992 if ( title.Compare( KNullDesC ) != 0 ) |
2940 if ( title.Compare( KNullDesC ) != 0 ) |
2993 { |
2941 { |
2994 aVisualItem->SetTitleL( title ); |
2942 aVisualItem->SetTitleL( title ); |
2995 } |
2943 } |
2996 else |
2944 else |
2997 { |
2945 { |
2998 HBufC* unknownText = NULL; |
2946 HBufC* unknownText = |
2999 if ( iContext == EContextGroupAlbum ) |
2947 StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN ); |
3000 { |
2948 aVisualItem->SetTitleL( *unknownText ); |
3001 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
2949 CleanupStack::PopAndDestroy( unknownText ); |
3002 if ( landscapeOrientation ) |
2950 } |
3003 { |
2951 } |
3004 unknownText = |
2952 } |
3005 StringLoader::LoadLC( R_MPX_MEDIAWALL_ARTIST_UNKNOWN ); |
2953 else |
3006 } |
2954 { |
3007 else |
2955 if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) ) |
3008 { |
2956 { |
3009 unknownText = |
2957 const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle ); |
3010 StringLoader::LoadLC( R_MPX_MP_LIST_ARTIST_UNKNOWN ); |
2958 if ( title.Compare( KNullDesC ) != 0 ) |
3011 } |
2959 { |
3012 } |
2960 aVisualItem->SetTitleL( title ); |
3013 else |
2961 } |
3014 { |
2962 else |
3015 unknownText = |
2963 { |
3016 StringLoader::LoadLC( R_MPX_MEDIAWALL_ARTIST_UNKNOWN ); |
2964 HBufC* unknownText = |
3017 } |
2965 StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN ); |
3018 aVisualItem->SetTitleL( *unknownText ); |
2966 aVisualItem->SetTitleL( *unknownText ); |
3019 CleanupStack::PopAndDestroy( unknownText ); |
2967 CleanupStack::PopAndDestroy( unknownText ); |
3020 } |
2968 } |
3021 } |
2969 } |
3022 } |
2970 } |
3023 else |
|
3024 { |
|
3025 if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) ) |
|
3026 { |
|
3027 const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle ); |
|
3028 if ( title.Compare( KNullDesC ) != 0 ) |
|
3029 { |
|
3030 aVisualItem->SetTitleL( title ); |
|
3031 } |
|
3032 else |
|
3033 { |
|
3034 HBufC* unknownText = |
|
3035 StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN ); |
|
3036 aVisualItem->SetTitleL( *unknownText ); |
|
3037 CleanupStack::PopAndDestroy( unknownText ); |
|
3038 } |
|
3039 } |
|
3040 } |
2971 } |
3041 } |
2972 |
3042 |
2973 // ----------------------------------------------------------------------------- |
3043 // ----------------------------------------------------------------------------- |
2974 // Set song title to the visual item |
3044 // Set song title to the visual item |
2975 // ----------------------------------------------------------------------------- |
3045 // ----------------------------------------------------------------------------- |
2978 CHgItem* aVisualItem, |
3048 CHgItem* aVisualItem, |
2979 CMPXMedia* aMedia ) |
3049 CMPXMedia* aMedia ) |
2980 { |
3050 { |
2981 MPX_FUNC( "CMPXCollectionViewHgContainer::SetSongTitleL" ); |
3051 MPX_FUNC( "CMPXCollectionViewHgContainer::SetSongTitleL" ); |
2982 |
3052 |
2983 |
3053 if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) ) |
2984 if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) ) |
3054 { |
2985 { |
3055 const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle ); |
2986 const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle ); |
3056 if ( title.Compare( KNullDesC ) != 0 ) |
2987 if ( title.Compare( KNullDesC ) != 0 ) |
3057 { |
2988 { |
3058 aVisualItem->SetTitleL( title ); |
2989 aVisualItem->SetTitleL( title ); |
3059 } |
2990 } |
3060 else |
2991 else |
3061 { |
2992 { |
3062 HBufC* unknownText = |
2993 HBufC* unknownText = |
3063 StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN ); |
2994 StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN ); |
3064 aVisualItem->SetTitleL( *unknownText ); |
2995 aVisualItem->SetTitleL( *unknownText ); |
3065 CleanupStack::PopAndDestroy( unknownText ); |
2996 CleanupStack::PopAndDestroy( unknownText ); |
3066 } |
2997 } |
3067 } |
2998 } |
|
2999 } |
3068 } |
3000 |
3069 |
3001 // ----------------------------------------------------------------------------- |
3070 // ----------------------------------------------------------------------------- |
3002 // Set Detail - Count to the visual item |
3071 // Set Detail - Count to the visual item |
3003 // ----------------------------------------------------------------------------- |
3072 // ----------------------------------------------------------------------------- |
3077 void CMPXCollectionViewHgContainer::SetDetailArtistL( |
3146 void CMPXCollectionViewHgContainer::SetDetailArtistL( |
3078 CHgItem* aVisualItem, |
3147 CHgItem* aVisualItem, |
3079 CMPXMedia* aMedia ) |
3148 CMPXMedia* aMedia ) |
3080 { |
3149 { |
3081 MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailArtistL" ); |
3150 MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailArtistL" ); |
3082 if ( aMedia->IsSupported( KMPXMediaMusicArtist ) ) |
3151 |
3083 { |
3152 if ( aMedia->IsSupported( KMPXMediaMusicArtist ) ) |
3084 // AK - Needs to be localized |
3153 { |
3085 TBuf<KMPXMaxFileLength> detailText; |
3154 // AK - Needs to be localized |
3086 const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist ); |
3155 TBuf<KMPXMaxFileLength> detailText; |
3087 if ( artist.Compare( KNullDesC ) != 0 ) |
3156 const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist ); |
3088 { |
3157 if ( artist.Compare( KNullDesC ) != 0 ) |
3089 detailText.Copy(artist.Left(detailText.MaxLength())); |
3158 { |
3090 aVisualItem->SetTextL( detailText ); |
3159 detailText.Copy(artist.Left(detailText.MaxLength())); |
3091 } |
3160 aVisualItem->SetTextL( detailText ); |
3092 else |
3161 } |
3093 { |
3162 else |
|
3163 { |
3094 HBufC* unknownText = |
3164 HBufC* unknownText = |
3095 StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN ); |
3165 StringLoader::LoadLC( R_MPX_SONGS_ARTIST_UNKNOWN ); |
3096 aVisualItem->SetTextL( *unknownText ); |
3166 aVisualItem->SetTextL( *unknownText ); |
3097 CleanupStack::PopAndDestroy( unknownText ); |
3167 CleanupStack::PopAndDestroy( unknownText ); |
3098 } |
3168 } |
3099 } |
3169 } |
3100 } |
3170 } |
3101 |
3171 |
3102 // ----------------------------------------------------------------------------- |
3172 // ----------------------------------------------------------------------------- |
3103 // Set Detail - Album to the visual item |
3173 // Set Detail - Album to the visual item |
3104 // ----------------------------------------------------------------------------- |
3174 // ----------------------------------------------------------------------------- |
3123 { |
3193 { |
3124 detailText.Copy( album.Left(detailText.MaxLength())); |
3194 detailText.Copy( album.Left(detailText.MaxLength())); |
3125 aVisualItem->SetTextL( detailText ); |
3195 aVisualItem->SetTextL( detailText ); |
3126 } |
3196 } |
3127 else |
3197 else |
3128 { |
3198 { |
3129 HBufC* unknownText = |
3199 HBufC* unknownText = NULL; |
3130 StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN ); |
3200 if ( iContext == EContextGroupAlbum ) |
|
3201 { |
|
3202 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
|
3203 if ( landscapeOrientation ) |
|
3204 { |
|
3205 unknownText = |
|
3206 StringLoader::LoadLC( R_MPX_MEDIAWALL_ALBUM_UNKNOWN ); |
|
3207 } |
|
3208 else |
|
3209 { |
|
3210 unknownText = |
|
3211 StringLoader::LoadLC( R_MPX_MP_LIST_ALBUM_UNKNOWN ); |
|
3212 } |
|
3213 } |
|
3214 else |
|
3215 { |
|
3216 unknownText = |
|
3217 StringLoader::LoadLC( R_MPX_MEDIAWALL_ALBUM_UNKNOWN ); |
|
3218 } |
3131 aVisualItem->SetTextL( *unknownText ); |
3219 aVisualItem->SetTextL( *unknownText ); |
3132 CleanupStack::PopAndDestroy( unknownText ); |
3220 CleanupStack::PopAndDestroy( unknownText ); |
3133 } |
3221 } |
3134 } |
3222 } |
3135 } |
3223 } |
3474 { |
3562 { |
3475 CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle]; |
3563 CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle]; |
3476 CFbsBitmap* bitmap = icon->Bitmap(); |
3564 CFbsBitmap* bitmap = icon->Bitmap(); |
3477 CFbsBitmap* mask = icon->Mask(); |
3565 CFbsBitmap* mask = icon->Mask(); |
3478 |
3566 |
3479 TSize size(240,240); |
3567 TSize size(CHgDoubleGraphicListFlat::PreferredImageSize()); |
3480 CHgItem* item = NULL; |
3568 CHgItem* item = NULL; |
3481 if( iCurrentViewType == EMPXViewMediawall || iCurrentViewType == EMPXViewTBone ) |
3569 if( iCurrentViewType == EMPXViewMediawall || iCurrentViewType == EMPXViewTBone ) |
3482 { |
3570 { |
3483 item = &iMediaWall->ItemL(0); |
3571 item = &iMediaWall->ItemL(0); |
|
3572 TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect(); |
|
3573 // get front rectange from layout |
|
3574 TAknLayoutRect frontRect; |
|
3575 frontRect.LayoutRect( appRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) ); |
|
3576 size = frontRect.Rect().Size(); |
3484 } |
3577 } |
3485 else if( iCurrentViewType == EMPXViewList ) |
3578 else if( iCurrentViewType == EMPXViewList ) |
3486 { |
3579 { |
3487 item = &iListWidget->ItemL(0); |
3580 item = &iListWidget->ItemL(0); |
3488 size = CHgDoubleGraphicListFlat::PreferredImageSize(); |
|
3489 } |
3581 } |
3490 else |
3582 else |
3491 { |
3583 { |
3492 User::Leave( KErrNotSupported ); |
3584 User::Leave( KErrNotSupported ); |
3493 } |
3585 } |
3517 TBool res(EFalse); |
3609 TBool res(EFalse); |
3518 |
3610 |
3519 const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray(); |
3611 const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray(); |
3520 const TInt count( mediaArray.Count() ); |
3612 const TInt count( mediaArray.Count() ); |
3521 |
3613 |
3522 if ( count > 1 && iContext == EContextGroupAlbum || |
3614 if ( count > 1 && iContext == EContextGroupAlbum ) |
3523 iContext == EContextGroupSong || |
3615 { |
3524 iContext == EContextGroupGenre || |
3616 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
3525 iContext == EContextItemPlaylist || |
3617 if ( landscapeOrientation ) |
3526 iContext == EContextItemGenre || |
3618 { |
3527 iContext == EContextItemSong ) |
3619 HBufC* shuffleText = StringLoader::LoadLC( |
3528 { |
3620 R_MPX_MEDIAWALL_TITLE_SHUFFLE_ALL ); |
3529 aItem->SetTitleL( _L("Shuffle All") ); |
3621 aItem->SetTitleL( *shuffleText ); |
3530 |
3622 CleanupStack::PopAndDestroy( shuffleText ); |
3531 // We can try to set icon too. |
3623 } |
3532 SetDetailIconShuffleL(); |
3624 else |
3533 res = ETrue; |
3625 { |
3534 } |
3626 HBufC* shuffleText = StringLoader::LoadLC( |
3535 |
3627 R_MPX_SHUFFLE ); |
3536 return res; |
3628 aItem->SetTitleL( *shuffleText ); |
|
3629 CleanupStack::PopAndDestroy( shuffleText ); |
|
3630 } |
|
3631 |
|
3632 // We can try to set icon too. |
|
3633 SetDetailIconShuffleL(); |
|
3634 res = ETrue; |
|
3635 } |
|
3636 |
|
3637 if ( count > 1 && |
|
3638 iContext == EContextGroupSong || |
|
3639 iContext == EContextGroupGenre || |
|
3640 iContext == EContextItemPlaylist || |
|
3641 iContext == EContextItemGenre || |
|
3642 iContext == EContextItemSong ) |
|
3643 { |
|
3644 HBufC* shuffleText = StringLoader::LoadLC( |
|
3645 R_MPX_SHUFFLE ); |
|
3646 aItem->SetTitleL( *shuffleText ); |
|
3647 CleanupStack::PopAndDestroy( shuffleText ); |
|
3648 |
|
3649 // We can try to set icon too. |
|
3650 SetDetailIconShuffleL(); |
|
3651 res = ETrue; |
|
3652 } |
|
3653 |
|
3654 return res; |
3537 } |
3655 } |
3538 |
3656 |
3539 // ----------------------------------------------------------------------------- |
3657 // ----------------------------------------------------------------------------- |
3540 // Sets the current category. |
3658 // Sets the current category. |
3541 // ----------------------------------------------------------------------------- |
3659 // ----------------------------------------------------------------------------- |
3794 ids.AppendL(id); |
3912 ids.AppendL(id); |
3795 } |
3913 } |
3796 |
3914 |
3797 cpath->AppendL(ids.Array()); // top level items |
3915 cpath->AppendL(ids.Array()); // top level items |
3798 |
3916 |
3799 TBool shuffle(EFalse); |
|
3800 |
|
3801 if ( aSelectAll ) // Plays all songs without shuffle |
3917 if ( aSelectAll ) // Plays all songs without shuffle |
3802 { |
3918 { |
3803 cpath->Set(0); |
3919 cpath->Set(0); |
3804 } |
3920 } |
3805 else |
3921 else |
3806 { |
3922 { |
3807 if ( count > 1 ) // We need to adjust in case aIndex is the shuffle item |
3923 if ( count > 1 ) // We need to adjust in case aIndex is the shuffle item |
3808 { |
3924 { |
3809 if ( aIndex == 0 ) // Plays all songs shuffled |
3925 if ( aIndex == 0 ) // Plays all songs shuffled |
3810 { |
3926 { |
3811 shuffle = ETrue; |
|
3812 TTime time; |
3927 TTime time; |
3813 time.UniversalTime(); |
3928 time.UniversalTime(); |
3814 TInt64 seed = time.Int64(); |
3929 TInt64 seed = time.Int64(); |
3815 TInt randIndex = Math::Rand(seed) % count; |
3930 TInt randIndex = Math::Rand(seed) % count; |
3816 cpath->Set(randIndex); |
3931 cpath->Set(randIndex); |
|
3932 iPlaybackUtility->SetL( EPbPropertyRandomMode, ETrue ); |
3817 } |
3933 } |
3818 else |
3934 else |
3819 { |
3935 { |
3820 cpath->Set(aIndex-1); // actual selection |
3936 cpath->Set(aIndex-1); // actual selection |
3821 } |
3937 } |
3829 MPX_DEBUG_PATH(*cpath); |
3945 MPX_DEBUG_PATH(*cpath); |
3830 |
3946 |
3831 TMPXPlaybackState pbState( iPlaybackUtility->StateL() ); |
3947 TMPXPlaybackState pbState( iPlaybackUtility->StateL() ); |
3832 if ( pbState == EPbStatePlaying || pbState == EPbStatePaused ) |
3948 if ( pbState == EPbStatePlaying || pbState == EPbStatePaused ) |
3833 { |
3949 { |
3834 if ( IsPlayingCurrentIndexL(cpath) && !shuffle ) |
3950 if ( IsPlayingCurrentIndexL(cpath) ) |
3835 { |
3951 { |
3836 if ( pbState == EPbStatePaused ) |
3952 if ( pbState == EPbStatePaused ) |
3837 { |
3953 { |
3838 iPlaybackUtility->CommandL( EPbCmdPlay ); |
3954 iPlaybackUtility->CommandL( EPbCmdPlay ); |
3839 } |
3955 } |
3840 iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse ); |
3956 iView->ProcessCommandL( EMPXCmdGoToNowPlaying ); |
3841 iView->ProcessCommandL( EMPXCmdGoToNowPlaying ); |
|
3842 } |
3957 } |
3843 else |
3958 else |
3844 { |
3959 { |
3845 iPlaybackUtility->SetL( EPbPropertyRandomMode, shuffle ); |
3960 iCollectionUtility->Collection().OpenL(*cpath); |
3846 iCollectionUtility->Collection().OpenL(*cpath); |
|
3847 } |
3961 } |
3848 } |
3962 } |
3849 else |
3963 else |
3850 { |
3964 { |
3851 iPlaybackUtility->SetL( EPbPropertyRandomMode, shuffle ); |
|
3852 iCollectionUtility->Collection().OpenL(*cpath); |
3965 iCollectionUtility->Collection().OpenL(*cpath); |
3853 } |
3966 } |
3854 |
3967 |
3855 CleanupStack::PopAndDestroy( cpath ); |
3968 CleanupStack::PopAndDestroy( cpath ); |
3856 |
3969 |
4312 const TDesC& album = iSelectedMediaInAlbumView->ValueText( KMPXMediaMusicAlbum ); |
4424 const TDesC& album = iSelectedMediaInAlbumView->ValueText( KMPXMediaMusicAlbum ); |
4313 if ( album.Compare( KNullDesC ) != 0 ) |
4425 if ( album.Compare( KNullDesC ) != 0 ) |
4314 { |
4426 { |
4315 dialog->SetTitleL( album ); |
4427 dialog->SetTitleL( album ); |
4316 } |
4428 } |
|
4429 else |
|
4430 { |
|
4431 HBufC* unknownText = |
|
4432 StringLoader::LoadLC( R_MPX_MEDIAWALL_POPUP_TITLE_UNKNOWN ); |
|
4433 dialog->SetTitleL( *unknownText ); |
|
4434 CleanupStack::PopAndDestroy( unknownText ); |
|
4435 } |
4317 } |
4436 } |
4318 |
4437 |
4319 CMPXMediaArray* songArray(const_cast<CMPXMediaArray*>( aResults.Value<CMPXMediaArray>( |
4438 CMPXMediaArray* songArray(const_cast<CMPXMediaArray*>( aResults.Value<CMPXMediaArray>( |
4320 KMPXMediaArrayContents ) ) ); |
4439 KMPXMediaArrayContents ) ) ); |
4321 User::LeaveIfNull( songArray ); |
4440 User::LeaveIfNull( songArray ); |
4323 |
4442 |
4324 CDesC16ArrayFlat* songList = new (ELeave) CDesC16ArrayFlat(songCount); |
4443 CDesC16ArrayFlat* songList = new (ELeave) CDesC16ArrayFlat(songCount); |
4325 |
4444 |
4326 if ( songCount > 1 ) |
4445 if ( songCount > 1 ) |
4327 { |
4446 { |
4328 // Todo: Use localized string. |
4447 HBufC* shuffleText = StringLoader::LoadLC( |
4329 songList->AppendL( _L("Shuffle All") ); |
4448 R_MPX_MEDIAWALL_DIALOG_SHUFFLE ); |
|
4449 songList->AppendL( *shuffleText ); |
|
4450 CleanupStack::PopAndDestroy( shuffleText ); |
4330 } |
4451 } |
4331 |
4452 |
4332 for ( TInt i = 0; i < songCount; i++ ) |
4453 for ( TInt i = 0; i < songCount; i++ ) |
4333 { |
4454 { |
4334 // Just get the exiting item and update the fields + icon. |
4455 // Just get the exiting item and update the fields + icon. |