MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / setSortMode

Function setSortMode

src/OpenLoco/src/Ui/Windows/MusicSelection.cpp:64–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 static const WindowEventList& getEvents();
63
64 static void setSortMode(Ui::Window& window, Jukebox::MusicSortMode sortMode)
65 {
66 window.sortMode = static_cast<uint16_t>(sortMode);
67
68 playlist = Jukebox::makeAllMusicPlaylist(sortMode);
69
70 // Set table header button captions
71 window.widgets[widx::sort_title].text = StringIds::table_header_title;
72 window.widgets[widx::sort_years].text = StringIds::table_header_years;
73 switch (sortMode)
74 {
75 case Jukebox::MusicSortMode::original:
76 break;
77 case Jukebox::MusicSortMode::titleAscending:
78 window.widgets[widx::sort_title].text = StringIds::table_header_title_asc;
79 break;
80 case Jukebox::MusicSortMode::titleDescending:
81 window.widgets[widx::sort_title].text = StringIds::table_header_title_desc;
82 break;
83 case Jukebox::MusicSortMode::yearsAscending:
84 window.widgets[widx::sort_years].text = StringIds::table_header_years_asc;
85 break;
86 case Jukebox::MusicSortMode::yearsDescending:
87 window.widgets[widx::sort_years].text = StringIds::table_header_years_desc;
88 break;
89 }
90 }
91
92 // Cycles window.sortMode: (MusicSortMode::original or other) → order1 → order2 → MusicSortMode::original
93 static void cycleSortMode(Ui::Window& window, Jukebox::MusicSortMode order1, Jukebox::MusicSortMode order2)

Callers 2

cycleSortModeFunction · 0.85
openFunction · 0.85

Calls 1

makeAllMusicPlaylistFunction · 0.85

Tested by

no test coverage detected