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();
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);
}