diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index 746e31d4b..3c6059b77 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -266,6 +266,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. /// @@ -432,6 +441,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..99559372f 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 isSearchTextPrefilled = 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.isSearchTextPrefilled) 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.isSearchTextPrefilled) + { + this.isSearchTextPrefilled = 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.isSearchTextPrefilled = true; + this.searchText = text; + } + private void DrawProgressOverlay() { var pluginManager = Service.Get(); diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index 6524c90a8..53138e63f 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,24 @@ public sealed class DalamudPluginInterface : IDisposable /// public List PluginInternalNames => Service.Get().InstalledPlugins.Select(p => p.Manifest.InternalName).ToList(); + /// + /// Opens the with the plugin name set as search target. + /// + /// Returns false if the DalamudInterface was null. + public bool OpenPluginInstaller() + { + var dalamudInterface = Service.GetNullable(); // Can be null during boot + if (dalamudInterface == null) + { + return false; + } + + dalamudInterface.OpenPluginInstallerPluginInstalled(); + dalamudInterface.SetPluginInstallerSearchText(this.pluginName); + + return true; + } + #region IPC ///