Open the appropriate settings tab

This commit is contained in:
Asriel Camora
2024-07-03 15:32:42 -07:00
parent 43769d831a
commit 7520305824
5 changed files with 11 additions and 8 deletions
+7 -4
View File
@@ -65,7 +65,7 @@ public sealed class Plugin : IDalamudPlugin
ActionUtils.Initialize(); ActionUtils.Initialize();
Service.PluginInterface.UiBuilder.Draw += WindowSystem.Draw; Service.PluginInterface.UiBuilder.Draw += WindowSystem.Draw;
Service.PluginInterface.UiBuilder.OpenConfigUi += OpenSettingsWindow; Service.PluginInterface.UiBuilder.OpenConfigUi += OpenSettingsWindowForced;
Service.PluginInterface.UiBuilder.OpenMainUi += OpenCraftingLog; Service.PluginInterface.UiBuilder.OpenMainUi += OpenCraftingLog;
} }
@@ -116,15 +116,18 @@ public sealed class Plugin : IDalamudPlugin
SynthHelperWindow.QueueSuggestedActionExecution(); SynthHelperWindow.QueueSuggestedActionExecution();
[Command(name: "/craftimizer", description: "Open the settings window.")] [Command(name: "/craftimizer", description: "Open the settings window.")]
public void OpenSettingsWindow() private void OpenSettingsWindowForced() =>
OpenSettingsWindow(true);
public void OpenSettingsWindow(bool force = false)
{ {
if (SettingsWindow.IsOpen ^= true) if (SettingsWindow.IsOpen ^= !force || !SettingsWindow.IsOpen)
SettingsWindow.BringToFront(); SettingsWindow.BringToFront();
} }
public void OpenSettingsTab(string selectedTabLabel) public void OpenSettingsTab(string selectedTabLabel)
{ {
OpenSettingsWindow(); OpenSettingsWindow(true);
SettingsWindow.SelectTab(selectedTabLabel); SettingsWindow.SelectTab(selectedTabLabel);
} }
+1 -1
View File
@@ -151,7 +151,7 @@ public sealed class MacroEditor : Window, IDisposable
{ {
Icon = FontAwesomeIcon.Cog, Icon = FontAwesomeIcon.Cog,
IconOffset = new(2.5f, 1), IconOffset = new(2.5f, 1),
Click = _ => Service.Plugin.OpenSettingsWindow(), Click = _ => Service.Plugin.OpenSettingsTab("Macro Editor"),
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings") ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
} }
]; ];
+1 -1
View File
@@ -43,7 +43,7 @@ public sealed class MacroList : Window, IDisposable
{ {
Icon = FontAwesomeIcon.Cog, Icon = FontAwesomeIcon.Cog,
IconOffset = new(2.5f, 1), IconOffset = new(2.5f, 1),
Click = _ => Service.Plugin.OpenSettingsWindow(), Click = _ => Service.Plugin.OpenSettingsTab("General"),
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings") ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
} }
]; ];
+1 -1
View File
@@ -140,7 +140,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
{ {
Icon = FontAwesomeIcon.Cog, Icon = FontAwesomeIcon.Cog,
IconOffset = new(2.5f, 1), IconOffset = new(2.5f, 1),
Click = _ => Service.Plugin.OpenSettingsWindow(), Click = _ => Service.Plugin.OpenSettingsTab("Crafting Log"),
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings") ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
} }
]; ];
+1 -1
View File
@@ -97,7 +97,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
{ {
Icon = FontAwesomeIcon.Cog, Icon = FontAwesomeIcon.Cog,
IconOffset = new(2.5f, 1), IconOffset = new(2.5f, 1),
Click = _ => Service.Plugin.OpenSettingsWindow(), Click = _ => Service.Plugin.OpenSettingsTab("Synthesis Helper"),
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings") ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
} }
]; ];