feat(PluginInstaller): add "not installed" sort

This commit is contained in:
goaaats 2022-01-15 02:17:37 +01:00
parent 70ef1ed45f
commit 7128bc166b
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -130,6 +130,7 @@ namespace Dalamud.Interface.Internal.Windows
DownloadCount,
LastUpdate,
NewOrNot,
NotInstalled,
}
/// <inheritdoc/>
@ -203,6 +204,7 @@ namespace Dalamud.Interface.Internal.Windows
(Locs.SortBy_DownloadCounts, PluginSortKind.DownloadCount),
(Locs.SortBy_LastUpdate, PluginSortKind.LastUpdate),
(Locs.SortBy_NewOrNot, PluginSortKind.NewOrNot),
(Locs.SortBy_NotInstalled, PluginSortKind.NotInstalled),
};
var longestSelectableWidth = sortSelectables.Select(t => ImGui.CalcTextSize(t.Localization).X).Max();
var selectableWidth = longestSelectableWidth + (style.FramePadding.X * 2); // This does not include the label
@ -1960,6 +1962,11 @@ namespace Dalamud.Interface.Internal.Windows
this.pluginListInstalled.Sort((p1, p2) => this.WasPluginSeen(p1.Manifest.InternalName)
.CompareTo(this.WasPluginSeen(p2.Manifest.InternalName)));
break;
case PluginSortKind.NotInstalled:
this.pluginListAvailable.Sort((p1, p2) => this.pluginListInstalled.Any(x => x.Manifest.InternalName == p1.InternalName)
.CompareTo(this.pluginListInstalled.Any(x => x.Manifest.InternalName == p2.InternalName)));
this.pluginListInstalled.Sort((p1, p2) => p1.Manifest.Name.CompareTo(p2.Manifest.Name)); // Makes no sense for installed plugins
break;
default:
throw new InvalidEnumArgumentException("Unknown plugin sort type.");
}
@ -2063,6 +2070,8 @@ namespace Dalamud.Interface.Internal.Windows
public static string SortBy_NewOrNot => Loc.Localize("InstallerNewOrNot", "New or not");
public static string SortBy_NotInstalled => Loc.Localize("InstallerNotInstalled", "Not Installed");
public static string SortBy_Label => Loc.Localize("InstallerSortBy", "Sort By");
#endregion