Skip to content

Commit

Permalink
Add new sort mode -- Ungrouped
Browse files Browse the repository at this point in the history
The Ungrouped sort sorts song by title, placing every song into a single group.
This is mainly intended to be used with filters and/or playlists.
  • Loading branch information
bluebandit21 committed May 9, 2021
1 parent 43bb366 commit c9edaed
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ local sortTable = {
SortOrder_Stamina = THEME:GetString("SortOrder", "Stamina"),
SortOrder_JackSpeed = THEME:GetString("SortOrder", "JackSpeed"),
SortOrder_Chordjack = THEME:GetString("SortOrder", "Chordjack"),
SortOrder_Technical = THEME:GetString("SortOrder", "Technical")
SortOrder_Technical = THEME:GetString("SortOrder", "Technical"),
SortOrder_Ungrouped = THEME:GetString("SortOrder", "Ungrouped")
}

local translated_info = {
Expand Down
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ ChordjackText=Chordjack
TechnicalText=Technical
LengthText=Length
TopGradesText=Top Grades
UngroupedText=Ungrouped
[NetworkSyncManager]
LoginTimeout=Login timed out.
Expand Down Expand Up @@ -2046,6 +2047,7 @@ BPM=BPM
Genre=Genre
Group=Group
Length=Length
Ungrouped=Ungrouped
ModeMenu=Mode Menu
Popularity=Players' Best
Preferred=Preferred
Expand Down
3 changes: 2 additions & 1 deletion Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ SortOrders={ "SortOrder_Group", "SortOrder_Title", "SortOrder_BPM", "SortOrder_A
ShowSectionsInBPMSort=true
SortBPMDivision=20

ModeMenuChoiceNames="Group,Title,Bpm,TopGrades,Artist,Genre,Favorites,Overall,Stream,Jumpstream,Handstream,Stamina,JackSpeed,Chordjack,Technical,Length"
ModeMenuChoiceNames="Group,Title,Bpm,TopGrades,Artist,Genre,Favorites,Overall,Stream,Jumpstream,Handstream,Stamina,JackSpeed,Chordjack,Technical,Length,Ungrouped"
ChoiceGroup="sort,Group"
ChoiceTitle="sort,Title"
ChoiceBpm="sort,BPM"
Expand All @@ -609,6 +609,7 @@ ChoiceJackSpeed="sort,JackSpeed"
ChoiceChordjack="sort,Chordjack"
ChoiceTechnical="sort,Technical"
ChoiceLength="sort,Length"
ChoiceUngrouped="sort,Ungrouped"

CustomWheelItemNames=""

Expand Down
4 changes: 3 additions & 1 deletion src/Etterna/Actor/Menus/MusicWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,8 @@ MusicWheel::BuildWheelItemDatas(
GAMESTATE->m_sPreferredSongGroup == GROUP_ALL;
}
break;
case SORT_Ungrouped:
[[fallthrough]];
case SORT_TITLE:
SongUtil::SortSongPointerArrayByTitle(arraySongs);
break;
Expand Down Expand Up @@ -1749,7 +1751,7 @@ class LunaMusicWheel : public Luna<MusicWheel>
p->ReloadSongList(true, SArg(1));
return 1;
}
static auto ReloadSongList(T* p, lua_State * /*L*/) -> int
static auto ReloadSongList(T* p, lua_State* /*L*/) -> int
{
p->ReloadSongList(false, "");
return 1;
Expand Down
14 changes: 7 additions & 7 deletions src/Etterna/Models/Misc/GameConstantsAndTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ static const char* GameplayModeNames[] = {
XToString(GameplayMode);
LuaXType(GameplayMode);

static const char* SortOrderNames[] = { "Group", "Title", "BPM",
"TopGrades", "Artist", "Genre",
"ModeMenu", "Favorites", "Overall",
"Stream", "Jumpstream", "Handstream",
"Stamina", "JackSpeed", "Chordjack",
"Technical", "Length" };
static const char* SortOrderNames[] = {
"Group", "Title", "BPM", "TopGrades", "Artist",
"Genre", "ModeMenu", "Favorites", "Overall", "Stream",
"Jumpstream", "Handstream", "Stamina", "JackSpeed", "Chordjack",
"Technical", "Length", "Ungrouped"
};
XToString(SortOrder);
StringToX(SortOrder);
LuaXType(SortOrder);
Expand Down Expand Up @@ -269,7 +269,7 @@ LuaXType(CalcDiffValue);
static const char* CalcDebugMiscNames[] = { "Pts",
"PtLoss",
//"JackPtLoss",
"StamMod"};
"StamMod" };
XToString(CalcDebugMisc);
LuaXType(CalcDebugMisc);

Expand Down
2 changes: 2 additions & 0 deletions src/Etterna/Models/Misc/GameConstantsAndTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ enum SortOrder
SORT_Chordjack,
SORT_Technical,
SORT_LENGTH,
SORT_Ungrouped, /**< Sort by the song title, putting all songs into single
group. */
NUM_SortOrder,
SortOrder_Invalid
};
Expand Down
2 changes: 2 additions & 0 deletions src/Etterna/Models/Songs/SongUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,8 @@ SongUtil::GetSectionNameFromSongAndSort(const Song* pSong, SortOrder so)
}
case SORT_MODE_MENU:
return std::string();
case SORT_Ungrouped:
return "";
default:
FAIL_M(ssprintf("Invalid SortOrder: %i", so));
}
Expand Down

0 comments on commit c9edaed

Please sign in to comment.