mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-28 19:39:19 +01:00
feat: allow configuring the default page the installer opens to
This commit is contained in:
parent
9850ac3f15
commit
9875a7ea31
11 changed files with 98 additions and 43 deletions
|
|
@ -173,6 +173,27 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.profileManagerWidget = new(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum describing pages the plugin installer can be opened to.
|
||||
/// </summary>
|
||||
public enum PluginInstallerOpenKind
|
||||
{
|
||||
/// <summary>
|
||||
/// Open to the "All Plugins" page.
|
||||
/// </summary>
|
||||
AllPlugins,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Installed Plugins" page.
|
||||
/// </summary>
|
||||
InstalledPlugins,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Changelogs" page.
|
||||
/// </summary>
|
||||
Changelogs,
|
||||
}
|
||||
|
||||
private enum OperationStatus
|
||||
{
|
||||
Idle,
|
||||
|
|
@ -220,6 +241,28 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open to the installer to the page specified by <paramref name="kind"/>.
|
||||
/// </summary>
|
||||
/// <param name="kind">The page of the installer to open.</param>
|
||||
public void OpenTo(PluginInstallerOpenKind kind)
|
||||
{
|
||||
this.IsOpen = true;
|
||||
this.SetOpenPage(kind);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle to the installer to the page specified by <paramref name="kind"/>.
|
||||
/// </summary>
|
||||
/// <param name="kind">The page of the installer to open.</param>
|
||||
public void ToggleTo(PluginInstallerOpenKind kind)
|
||||
{
|
||||
this.Toggle();
|
||||
|
||||
if (this.IsOpen)
|
||||
this.SetOpenPage(kind);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void OnOpen()
|
||||
{
|
||||
|
|
@ -278,30 +321,6 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.imageCache.ClearIconCache();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the window on the plugin changelogs.
|
||||
/// </summary>
|
||||
public void OpenInstalledPlugins()
|
||||
{
|
||||
// Installed group
|
||||
this.categoryManager.CurrentGroupIdx = 1;
|
||||
// All category
|
||||
this.categoryManager.CurrentCategoryIdx = 0;
|
||||
this.IsOpen = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the window on the plugin changelogs.
|
||||
/// </summary>
|
||||
public void OpenPluginChangelogs()
|
||||
{
|
||||
// Changelog group
|
||||
this.categoryManager.CurrentGroupIdx = 3;
|
||||
// Plugins category
|
||||
this.categoryManager.CurrentCategoryIdx = 2;
|
||||
this.IsOpen = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current search text and marks it as prefilled.
|
||||
/// </summary>
|
||||
|
|
@ -386,6 +405,33 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
return true;
|
||||
}
|
||||
|
||||
private void SetOpenPage(PluginInstallerOpenKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case PluginInstallerOpenKind.AllPlugins:
|
||||
// Plugins group
|
||||
this.categoryManager.CurrentGroupIdx = 0;
|
||||
// All category
|
||||
this.categoryManager.CurrentCategoryIdx = 0;
|
||||
break;
|
||||
case PluginInstallerOpenKind.InstalledPlugins:
|
||||
// Installed group
|
||||
this.categoryManager.CurrentGroupIdx = 2;
|
||||
// All category
|
||||
this.categoryManager.CurrentCategoryIdx = 0;
|
||||
break;
|
||||
case PluginInstallerOpenKind.Changelogs:
|
||||
// Changelog group
|
||||
this.categoryManager.CurrentGroupIdx = 3;
|
||||
// Plugins category
|
||||
this.categoryManager.CurrentCategoryIdx = 2;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(kind), kind, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawProgressOverlay()
|
||||
{
|
||||
var pluginManager = Service<PluginManager>.Get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue