From 4b98ea31ccadeb585971fd66c457851ad77e80d6 Mon Sep 17 00:00:00 2001 From: Raymond Date: Sun, 3 Oct 2021 11:27:31 -0400 Subject: [PATCH] Merge category code into preexisting method Keep installed plugins after installation in available tab. --- .../Internal/Windows/PluginInstallerWindow.cs | 58 +++++-------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs index 73e5f99b9..e359bbffe 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs @@ -525,30 +525,38 @@ namespace Dalamud.Interface.Internal.Windows return; } - var filteredList = pluginList + var filteredManifests = pluginList .Where(rm => !this.IsManifestFiltered(rm)) .ToList(); - if (filteredList.Count == 0) + if (filteredManifests.Count == 0) { ImGui.TextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching); return; } - var i = 0; - foreach (var manifest in filteredList) + // reset opened list of collapsibles when switching between categories + if (this.categoryManager.IsContentDirty) { - var (isInstalled, plugin) = this.IsManifestInstalled(manifest); + this.openPluginCollapsibles.Clear(); + } + + var categoryManifestsList = this.categoryManager.GetCurrentCategoryContent(filteredManifests); + + var i = 0; + foreach (var manifest in categoryManifestsList) + { + var remoteManifest = manifest as RemotePluginManifest; + var (isInstalled, plugin) = this.IsManifestInstalled(remoteManifest); ImGui.PushID($"{manifest.InternalName}{manifest.AssemblyVersion}"); - if (isInstalled) { this.DrawInstalledPlugin(plugin, i++, true); } else { - this.DrawAvailablePlugin(manifest, i++); + this.DrawAvailablePlugin(remoteManifest, i++); } ImGui.PopID(); @@ -742,41 +750,7 @@ namespace Dalamud.Interface.Internal.Windows } else { - var pluginList = this.pluginListAvailable; - if (pluginList.Count > 0) - { - // reset opened list of collapsibles when switching between categories - if (this.categoryManager.IsContentDirty) - { - this.openPluginCollapsibles.Clear(); - } - - var filteredManifests = pluginList.Where(rm => !this.IsManifestFiltered(rm) && !this.IsManifestInstalled(rm).IsInstalled); - var categoryManifestsList = this.categoryManager.GetCurrentCategoryContent(filteredManifests); - - if (categoryManifestsList.Count > 0) - { - var i = 0; - foreach (var manifest in categoryManifestsList) - { - var rmManifest = manifest as RemotePluginManifest; - if (rmManifest != null) - { - ImGui.PushID($"{rmManifest.InternalName}{rmManifest.AssemblyVersion}"); - this.DrawAvailablePlugin(rmManifest, i++); - ImGui.PopID(); - } - } - } - else - { - ImGui.Text(Locs.TabBody_SearchNoMatching); - } - } - else - { - ImGui.Text(Locs.TabBody_SearchNoCompatible); - } + this.DrawAvailablePluginList(); } ImGui.PopStyleVar();