From 900c05cdeb43896a24f1739a0d5f5a345abe3dcb Mon Sep 17 00:00:00 2001 From: Infi Date: Sun, 26 Feb 2023 15:13:15 +0100 Subject: [PATCH 1/4] pluginInterface: Add function to open the plugin installer --- Dalamud/Plugin/DalamudPluginInterface.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index 6524c90a8..38b98875f 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -17,6 +17,7 @@ using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Interface; using Dalamud.Interface.Internal; +using Dalamud.Interface.Internal.Windows.PluginInstaller; using Dalamud.Plugin.Internal; using Dalamud.Plugin.Internal.Types; using Dalamud.Plugin.Ipc; @@ -194,6 +195,22 @@ public sealed class DalamudPluginInterface : IDisposable /// public List PluginInternalNames => Service.Get().InstalledPlugins.Select(p => p.Manifest.InternalName).ToList(); + /// + /// Opens the . + /// + /// Returns false if the DalamudInterface was null. + public bool OpenPluginInstaller() + { + var dalamudInterface = Service.Get(); + if (dalamudInterface == null) + { + return false; + } + + dalamudInterface.OpenPluginInstaller(); + return true; + } + #region IPC /// From 4acadd5c9ed8dd1b91ce867fe4016f50df4f687b Mon Sep 17 00:00:00 2001 From: Infi Date: Sun, 26 Feb 2023 15:16:03 +0100 Subject: [PATCH 2/4] Use GetNullable --- Dalamud/Plugin/DalamudPluginInterface.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index 38b98875f..be13f4507 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -201,7 +201,7 @@ public sealed class DalamudPluginInterface : IDisposable /// Returns false if the DalamudInterface was null. public bool OpenPluginInstaller() { - var dalamudInterface = Service.Get(); + var dalamudInterface = Service.GetNullable(); // Can be null during boot if (dalamudInterface == null) { return false; From 94538d1728571b99aa807a6183ac47d959ea15d4 Mon Sep 17 00:00:00 2001 From: Infi Date: Sun, 26 Feb 2023 21:00:03 +0100 Subject: [PATCH 3/4] Make it search for the plugin and open the installed category --- .../Interface/Internal/DalamudInterface.cs | 18 +++++++++++ .../PluginInstaller/PluginInstallerWindow.cs | 31 ++++++++++++++++++- Dalamud/Plugin/DalamudPluginInterface.cs | 6 ++-- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index c62fbb89c..1ed528893 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -263,6 +263,15 @@ internal class DalamudInterface : IDisposable, IServiceType this.pluginWindow.BringToFront(); } + /// + /// Opens the on the plugin installed. + /// + public void OpenPluginInstallerPluginInstalled() + { + this.pluginWindow.OpenInstalledPlugins(); + this.pluginWindow.BringToFront(); + } + /// /// Opens the on the plugin changelogs. /// @@ -420,6 +429,15 @@ internal class DalamudInterface : IDisposable, IServiceType #endregion + /// + /// Sets the current search text for the plugin installer. + /// + /// The search term. + public void SetPluginInstallerSearchText(string text) + { + this.pluginWindow.SetSearchText(text); + } + /// /// Toggle the screen darkening effect used for the credits. /// diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 66f706bfe..ef77ee499 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -97,6 +97,7 @@ internal class PluginInstallerWindow : Window, IDisposable private bool hasDevPlugins = false; private string searchText = string.Empty; + private bool prefilledSearchTexted = false; private PluginSortKind sortKind = PluginSortKind.Alphabetical; private string filterText = Locs.SortBy_Alphabetical; @@ -202,7 +203,7 @@ internal class PluginInstallerWindow : Window, IDisposable _ = pluginManager.ReloadPluginMastersAsync(); - this.searchText = string.Empty; + if (!this.prefilledSearchTexted) this.searchText = string.Empty; this.sortKind = PluginSortKind.Alphabetical; this.filterText = Locs.SortBy_Alphabetical; @@ -218,6 +219,12 @@ internal class PluginInstallerWindow : Window, IDisposable public override void OnClose() { Service.Get().QueueSave(); + + if (this.prefilledSearchTexted) + { + this.prefilledSearchTexted = false; + this.searchText = string.Empty; + } } /// @@ -244,6 +251,18 @@ internal class PluginInstallerWindow : Window, IDisposable this.imageCache.ClearIconCache(); } + /// + /// Open the window on the plugin changelogs. + /// + public void OpenInstalledPlugins() + { + // Installed group + this.categoryManager.CurrentGroupIdx = 1; + // All category + this.categoryManager.CurrentCategoryIdx = 0; + this.IsOpen = true; + } + /// /// Open the window on the plugin changelogs. /// @@ -256,6 +275,16 @@ internal class PluginInstallerWindow : Window, IDisposable this.IsOpen = true; } + /// + /// Sets the current search text and marks it as prefilled. + /// + /// The search term. + public void SetSearchText(string text) + { + this.prefilledSearchTexted = true; + this.searchText = text; + } + private void DrawProgressOverlay() { var pluginManager = Service.Get(); diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index be13f4507..53138e63f 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -196,7 +196,7 @@ public sealed class DalamudPluginInterface : IDisposable public List PluginInternalNames => Service.Get().InstalledPlugins.Select(p => p.Manifest.InternalName).ToList(); /// - /// Opens the . + /// Opens the with the plugin name set as search target. /// /// Returns false if the DalamudInterface was null. public bool OpenPluginInstaller() @@ -207,7 +207,9 @@ public sealed class DalamudPluginInterface : IDisposable return false; } - dalamudInterface.OpenPluginInstaller(); + dalamudInterface.OpenPluginInstallerPluginInstalled(); + dalamudInterface.SetPluginInstallerSearchText(this.pluginName); + return true; } From c699c0242503b28fdde07114a5ad0b5af6c8249a Mon Sep 17 00:00:00 2001 From: Infi Date: Sun, 26 Feb 2023 21:05:51 +0100 Subject: [PATCH 4/4] small rename --- .../Windows/PluginInstaller/PluginInstallerWindow.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index ef77ee499..99559372f 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -97,7 +97,7 @@ internal class PluginInstallerWindow : Window, IDisposable private bool hasDevPlugins = false; private string searchText = string.Empty; - private bool prefilledSearchTexted = false; + private bool isSearchTextPrefilled = false; private PluginSortKind sortKind = PluginSortKind.Alphabetical; private string filterText = Locs.SortBy_Alphabetical; @@ -203,7 +203,7 @@ internal class PluginInstallerWindow : Window, IDisposable _ = pluginManager.ReloadPluginMastersAsync(); - if (!this.prefilledSearchTexted) this.searchText = string.Empty; + if (!this.isSearchTextPrefilled) this.searchText = string.Empty; this.sortKind = PluginSortKind.Alphabetical; this.filterText = Locs.SortBy_Alphabetical; @@ -220,9 +220,9 @@ internal class PluginInstallerWindow : Window, IDisposable { Service.Get().QueueSave(); - if (this.prefilledSearchTexted) + if (this.isSearchTextPrefilled) { - this.prefilledSearchTexted = false; + this.isSearchTextPrefilled = false; this.searchText = string.Empty; } } @@ -281,7 +281,7 @@ internal class PluginInstallerWindow : Window, IDisposable /// The search term. public void SetSearchText(string text) { - this.prefilledSearchTexted = true; + this.isSearchTextPrefilled = true; this.searchText = text; }