Skip to content

Commit

Permalink
Add Title ID sort method
Browse files Browse the repository at this point in the history
- Using existing TitleId constant in ApplicationSort
- Reuses the "DlcManagerTableHeadingTitleIdLabel" locale for fulfilling the need already, might not be optimal to do so in the long run but I wanted to make this as unobtrusive as possible
- Using app.Id for the comparer seems to work fine, not sure if using something else like IdString would be better?
  • Loading branch information
RAMDRAGONS committed Jan 21, 2025
1 parent ad3e80b commit 0c0c743
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ public string SortName
ApplicationSort.FileSize => LocaleManager.Instance[LocaleKeys.GameListHeaderFileSize],
ApplicationSort.Path => LocaleManager.Instance[LocaleKeys.GameListHeaderPath],
ApplicationSort.Favorite => LocaleManager.Instance[LocaleKeys.CommonFavorite],
ApplicationSort.TitleId => LocaleManager.Instance[LocaleKeys.DlcManagerTableHeadingTitleIdLabel],
_ => string.Empty,
};
}
Expand Down Expand Up @@ -694,6 +695,7 @@ public KeyGesture PauseKey
public IHostUIHandler UiHandler { get; internal set; }
public bool IsSortedByFavorite => SortMode == ApplicationSort.Favorite;
public bool IsSortedByTitle => SortMode == ApplicationSort.Title;
public bool IsSortedByTitleId => SortMode == ApplicationSort.TitleId;
public bool IsSortedByDeveloper => SortMode == ApplicationSort.Developer;
public bool IsSortedByLastPlayed => SortMode == ApplicationSort.LastPlayed;
public bool IsSortedByTimePlayed => SortMode == ApplicationSort.TotalTimePlayed;
Expand Down Expand Up @@ -726,6 +728,7 @@ private IComparer<ApplicationData> GetComparer()
ApplicationSort.FileSize => CreateComparer(IsAscending, app => app.FileSize),
ApplicationSort.Path => CreateComparer(IsAscending, app => app.Path),
ApplicationSort.Favorite => CreateComparer(IsAscending, app => new AppListFavoriteComparable(app)),
ApplicationSort.TitleId => CreateComparer(IsAscending, app => app.Id),
_ => null,
#pragma warning restore IDE0055
};
Expand Down
6 changes: 6 additions & 0 deletions src/Ryujinx/UI/Views/Main/MainViewControls.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
GroupName="Sort"
IsChecked="{Binding IsSortedByTitle, Mode=OneTime}"
Tag="Title" />
<RadioButton
Checked="Sort_Checked"
Content="{ext:Locale DlcManagerTableHeadingTitleIdLabel}"
GroupName="Sort"
IsChecked="{Binding IsSortedByTitleId, Mode=OneTime}"
Tag="TitleId" />
<RadioButton
Checked="Sort_Checked"
Content="{ext:Locale GameListHeaderDeveloper}"
Expand Down

0 comments on commit 0c0c743

Please sign in to comment.