mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-20 23:07:43 +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();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using CheapLoc;
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||
using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Utility;
|
||||
|
|
@ -120,6 +121,12 @@ public class SettingsTabLook : SettingsTab
|
|||
Loc.Localize("DalamudSettingToggleTsmHint", "This will allow you to access certain Dalamud and Plugin functionality from the title screen."),
|
||||
c => c.ShowTsm,
|
||||
(v, c) => c.ShowTsm = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
Loc.Localize("DalamudSettingInstallerOpenDefault", "Open the Plugin Installer to the \"Installed Plugins\" tab by default"),
|
||||
Loc.Localize("DalamudSettingInstallerOpenDefaultHint", "This will allow you to open the Plugin Installer to the \"Installed Plugins\" tab by default, instead of the \"Available Plugins\" tab."),
|
||||
c => c.PluginInstallerOpen == PluginInstallerWindow.PluginInstallerOpenKind.InstalledPlugins,
|
||||
(v, c) => c.PluginInstallerOpen = v ? PluginInstallerWindow.PluginInstallerOpenKind.InstalledPlugins : PluginInstallerWindow.PluginInstallerOpenKind.AllPlugins),
|
||||
};
|
||||
|
||||
public override string Title => Loc.Localize("DalamudSettingsVisual", "Look & Feel");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue