From ea8b7ed0b3e006295d2be8849a2717eb05ec962e Mon Sep 17 00:00:00 2001 From: goat Date: Tue, 18 Jul 2023 20:28:48 +0200 Subject: [PATCH] feat: add sort for in a profile/not in a profile --- .../Windows/PluginInstaller/PluginInstallerWindow.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index d3779ba3d..f87e46855 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -184,6 +184,7 @@ internal class PluginInstallerWindow : Window, IDisposable NewOrNot, NotInstalled, EnabledDisabled, + ProfileOrNot, } private bool AnyOperationInProgress => this.installStatus == OperationStatus.InProgress || @@ -505,6 +506,7 @@ internal class PluginInstallerWindow : Window, IDisposable (Locs.SortBy_NewOrNot, PluginSortKind.NewOrNot), (Locs.SortBy_NotInstalled, PluginSortKind.NotInstalled), (Locs.SortBy_EnabledDisabled, PluginSortKind.EnabledDisabled), + (Locs.SortBy_ProfileOrNot, PluginSortKind.ProfileOrNot), }; var longestSelectableWidth = sortSelectables.Select(t => ImGui.CalcTextSize(t.Localization).X).Max(); var selectableWidth = longestSelectableWidth + (style.FramePadding.X * 2); // This does not include the label @@ -2984,6 +2986,12 @@ internal class PluginInstallerWindow : Window, IDisposable }); this.pluginListInstalled.Sort((p1, p2) => (p2.State == PluginState.Loaded).CompareTo(p1.State == PluginState.Loaded)); break; + case PluginSortKind.ProfileOrNot: + this.pluginListAvailable.Sort((p1, p2) => p1.Name.CompareTo(p2.Name)); + + var profman = Service.Get(); + this.pluginListInstalled.Sort((p1, p2) => profman.IsInDefaultProfile(p1.InternalName).CompareTo(profman.IsInDefaultProfile(p2.InternalName))); + break; default: throw new InvalidEnumArgumentException("Unknown plugin sort type."); } @@ -3062,6 +3070,8 @@ internal class PluginInstallerWindow : Window, IDisposable public static string SortBy_EnabledDisabled => Loc.Localize("InstallerEnabledDisabled", "Enabled/Disabled"); + public static string SortBy_ProfileOrNot => Loc.Localize("InstallerProfileOrNot", "In a collection"); + public static string SortBy_Label => Loc.Localize("InstallerSortBy", "Sort By"); #endregion