Update Banner handling for new sorts

This commit is contained in:
Crash Cringle
2025-03-03 23:36:06 -08:00
committed by teejusb
parent b482c26612
commit c3886adb07
7 changed files with 36 additions and 15 deletions
+19 -6
View File
@@ -228,14 +228,27 @@ void Banner::LoadRandom()
void Banner::LoadFromSortOrder( SortOrder so )
{
// TODO: See if the check for nullptr/PREFERRED(?) is needed.
if( so == SortOrder_Invalid )
switch( so )
{
LoadFallback();
}
else
{
if( so != SORT_GROUP && so != SORT_RECENT && so != SORT_RECENT_P1 && so != SORT_RECENT_P2 )
case SortOrder_Invalid:
LoadFallback();
break;
case SORT_GROUP:
break;
// This is necessary to prevent multiple banners from matching for SORT_RECENT and SORT_POPULARITY
case SORT_RECENT:
case SORT_RECENT_P1:
case SORT_RECENT_P2:
Load( THEME->GetPathG("Banner",ssprintf("%s",SortOrderToString(SORT_RECENT).c_str())) );
break;
case SORT_POPULARITY:
case SORT_POPULARITY_P1:
case SORT_POPULARITY_P2:
Load( THEME->GetPathG("Banner",ssprintf("%s",SortOrderToString(SORT_POPULARITY).c_str())) );
break;
default:
Load( THEME->GetPathG("Banner",ssprintf("%s",SortOrderToString(so).c_str())) );
break;
}
m_bScrolling = (bool)SCROLL_SORT_ORDER;
}
+2 -2
View File
@@ -625,7 +625,7 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
case SORT_POPULARITY:
if( (int) arraySongs.size() > MOST_PLAYED_SONGS_TO_SHOW )
arraySongs.erase( arraySongs.begin()+MOST_PLAYED_SONGS_TO_SHOW, arraySongs.end() );
bUseSections = false;
bUseSections = true;
break;
case SORT_POPULARITY_P1:
if( PROFILEMAN->IsPersistentProfile(PLAYER_1) )
@@ -666,7 +666,7 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
SongUtil::SortByMostRecentlyPlayedForMachine( arraySongs );
if( (int) arraySongs.size() > RECENT_SONGS_TO_SHOW )
arraySongs.erase( arraySongs.begin()+RECENT_SONGS_TO_SHOW, arraySongs.end() );
bUseSections = false;
bUseSections = true;
break;
case SORT_RECENT_P1:
if( PROFILEMAN->IsPersistentProfile(PLAYER_1) )
+1 -5
View File
@@ -642,9 +642,6 @@ void SongUtil::SortSongPointerArrayByNumPlays( std::vector<Song*> &vpSongsInOut,
g_mapSongSortVal.clear();
}
static LocalizedString SECTION_RECENTLY_PLAYED("SongSort", "Recently Played");
static LocalizedString SECTION_POPULAR_SONGS("SongSort", "Most Played");
RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so )
{
if( pSong == nullptr )
@@ -713,11 +710,10 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
case SORT_POPULARITY:
case SORT_POPULARITY_P1:
case SORT_POPULARITY_P2:
return SECTION_POPULAR_SONGS.GetValue();
case SORT_RECENT:
case SORT_RECENT_P1:
case SORT_RECENT_P2:
return SECTION_RECENTLY_PLAYED.GetValue();
return THEME->GetString("MusicWheel", ssprintf("%s%s", SortOrderToString(so).c_str(), "Text"));
case SORT_TOP_GRADES_P1:
{
int iCounts[NUM_Grade];