Open the appropriate settings tab
This commit is contained in:
@@ -65,7 +65,7 @@ public sealed class Plugin : IDalamudPlugin
|
||||
ActionUtils.Initialize();
|
||||
|
||||
Service.PluginInterface.UiBuilder.Draw += WindowSystem.Draw;
|
||||
Service.PluginInterface.UiBuilder.OpenConfigUi += OpenSettingsWindow;
|
||||
Service.PluginInterface.UiBuilder.OpenConfigUi += OpenSettingsWindowForced;
|
||||
Service.PluginInterface.UiBuilder.OpenMainUi += OpenCraftingLog;
|
||||
}
|
||||
|
||||
@@ -116,15 +116,18 @@ public sealed class Plugin : IDalamudPlugin
|
||||
SynthHelperWindow.QueueSuggestedActionExecution();
|
||||
|
||||
[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();
|
||||
}
|
||||
|
||||
public void OpenSettingsTab(string selectedTabLabel)
|
||||
{
|
||||
OpenSettingsWindow();
|
||||
OpenSettingsWindow(true);
|
||||
SettingsWindow.SelectTab(selectedTabLabel);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public sealed class MacroEditor : Window, IDisposable
|
||||
{
|
||||
Icon = FontAwesomeIcon.Cog,
|
||||
IconOffset = new(2.5f, 1),
|
||||
Click = _ => Service.Plugin.OpenSettingsWindow(),
|
||||
Click = _ => Service.Plugin.OpenSettingsTab("Macro Editor"),
|
||||
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
|
||||
}
|
||||
];
|
||||
|
||||
@@ -43,7 +43,7 @@ public sealed class MacroList : Window, IDisposable
|
||||
{
|
||||
Icon = FontAwesomeIcon.Cog,
|
||||
IconOffset = new(2.5f, 1),
|
||||
Click = _ => Service.Plugin.OpenSettingsWindow(),
|
||||
Click = _ => Service.Plugin.OpenSettingsTab("General"),
|
||||
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
|
||||
}
|
||||
];
|
||||
|
||||
@@ -140,7 +140,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
|
||||
{
|
||||
Icon = FontAwesomeIcon.Cog,
|
||||
IconOffset = new(2.5f, 1),
|
||||
Click = _ => Service.Plugin.OpenSettingsWindow(),
|
||||
Click = _ => Service.Plugin.OpenSettingsTab("Crafting Log"),
|
||||
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
|
||||
}
|
||||
];
|
||||
|
||||
@@ -97,7 +97,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
{
|
||||
Icon = FontAwesomeIcon.Cog,
|
||||
IconOffset = new(2.5f, 1),
|
||||
Click = _ => Service.Plugin.OpenSettingsWindow(),
|
||||
Click = _ => Service.Plugin.OpenSettingsTab("Synthesis Helper"),
|
||||
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user