From 8a8c6ccae2126e0c7da86e876dd8d9d400a60e8a Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Fri, 22 May 2026 22:59:27 +0200 Subject: [PATCH] refactor(settings): rebuild the General tab into collapsible sections --- .../Resources/HellionStrings.Designer.cs | 12 +-- HellionChat/Resources/HellionStrings.resx | 31 ++++---- HellionChat/Ui/SettingsTabs/General.cs | 78 +++++++++---------- 3 files changed, 63 insertions(+), 58 deletions(-) diff --git a/HellionChat/Resources/HellionStrings.Designer.cs b/HellionChat/Resources/HellionStrings.Designer.cs index 4f16eb2..ce73f14 100644 --- a/HellionChat/Resources/HellionStrings.Designer.cs +++ b/HellionChat/Resources/HellionStrings.Designer.cs @@ -278,11 +278,6 @@ internal class HellionStrings internal static string Settings_Themes_ApplyChatColors_Apply => Get(nameof(Settings_Themes_ApplyChatColors_Apply)); internal static string Settings_Themes_ApplyChatColors_Keep => Get(nameof(Settings_Themes_ApplyChatColors_Keep)); - // Hellion Chat — General-Tab section headings - internal static string Settings_General_Input_Heading => Get(nameof(Settings_General_Input_Heading)); - internal static string Settings_General_Audio_Heading => Get(nameof(Settings_General_Audio_Heading)); - internal static string Settings_General_Performance_Heading => Get(nameof(Settings_General_Performance_Heading)); - internal static string Settings_General_Language_Heading => Get(nameof(Settings_General_Language_Heading)); internal static string Settings_Language_FFXIVCoverage_Warning => Get(nameof(Settings_Language_FFXIVCoverage_Warning)); // Hellion Chat — Appearance-Tab section headings @@ -494,4 +489,11 @@ internal class HellionStrings // v1.5.6: custom sound volume internal static string Settings_General_CustomSoundVolume_Name => Get(nameof(Settings_General_CustomSoundVolume_Name)); internal static string Settings_General_CustomSoundVolume_Description => Get(nameof(Settings_General_CustomSoundVolume_Description)); + + // v1.5.6: General tab collapsible section titles (R6) + internal static string Settings_Section_Input => Get(nameof(Settings_Section_Input)); + internal static string Settings_Section_Sound => Get(nameof(Settings_Section_Sound)); + internal static string Settings_Section_Language => Get(nameof(Settings_Section_Language)); + internal static string Settings_Section_Performance => Get(nameof(Settings_Section_Performance)); + internal static string Settings_Section_Sound_TabsHint => Get(nameof(Settings_Section_Sound_TabsHint)); } diff --git a/HellionChat/Resources/HellionStrings.resx b/HellionChat/Resources/HellionStrings.resx index 061432e..74ca24b 100644 --- a/HellionChat/Resources/HellionStrings.resx +++ b/HellionChat/Resources/HellionStrings.resx @@ -596,20 +596,6 @@ About - - - Input - - - Audio & notifications - - - Performance - - - Language & input aids - - Theme @@ -1149,4 +1135,21 @@ Playback volume for the three bundled custom notification sounds. Does not affect the 16 game sounds. + + + + Input + + + Sound + + + Language + + + Performance + + + Which sound plays per tab is set in the Channels tab. + diff --git a/HellionChat/Ui/SettingsTabs/General.cs b/HellionChat/Ui/SettingsTabs/General.cs index 8aed26b..1e48b42 100644 --- a/HellionChat/Ui/SettingsTabs/General.cs +++ b/HellionChat/Ui/SettingsTabs/General.cs @@ -21,22 +21,22 @@ internal sealed class General : ISettingsTab public void Draw(bool sectionJustEntered) { - DrawInputSection(); + DrawInputSection(sectionJustEntered); ImGui.Spacing(); - DrawAudioSection(); + DrawSoundSection(sectionJustEntered); ImGui.Spacing(); - DrawPerformanceSection(); + DrawLanguageSection(sectionJustEntered); ImGui.Spacing(); - DrawLanguageSection(); + DrawPerformanceSection(sectionJustEntered); } - private void DrawInputSection() + private void DrawInputSection(bool sectionJustEntered) { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_General_Input_Heading); + // Collapse every time the tab is freshly entered so state doesn't bleed across sessions. + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_Input); if (!tree.Success) - { return; - } using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) { @@ -83,13 +83,13 @@ internal sealed class General : ISettingsTab } } - private void DrawAudioSection() + private void DrawSoundSection(bool sectionJustEntered) { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_General_Audio_Heading); + // Collapse every time the tab is freshly entered so state doesn't bleed across sessions. + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_Sound); if (!tree.Success) - { return; - } using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) { @@ -112,42 +112,26 @@ internal sealed class General : ISettingsTab { Mutable.CustomSoundVolume = customSoundVolumePercent / 100f; } - ImGuiUtil.HelpMarker(HellionStrings.Settings_General_CustomSoundVolume_Description); - - ImGui.Checkbox(Language.Options_ShowNoviceNetwork_Name, ref Mutable.ShowNoviceNetwork); - ImGuiUtil.HelpMarker(Language.Options_ShowNoviceNetwork_Description); + // Show the functional description and the per-tab navigation hint together. + ImGuiUtil.HelpMarker(HellionStrings.Settings_General_CustomSoundVolume_Description + "\n\n" + HellionStrings.Settings_Section_Sound_TabsHint); } } - private void DrawPerformanceSection() + private void DrawLanguageSection(bool sectionJustEntered) { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_General_Performance_Heading); + // Collapse every time the tab is freshly entered so state doesn't bleed across sessions. + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_Language); if (!tree.Success) - { return; - } using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) { - ImGui.SetNextItemWidth(200f * ImGuiHelpers.GlobalScale); - if (ImGui.InputInt(Language.Options_MaxLinesToShow_Name, ref Mutable.MaxLinesToRender)) - { - Mutable.MaxLinesToRender = Math.Clamp(Mutable.MaxLinesToRender, 1, 10_000); - } - ImGuiUtil.HelpMarker(Language.Options_MaxLinesToShow_Description); - } - } + ImGui.Checkbox(Language.Options_SortAutoTranslate_Name, ref Mutable.SortAutoTranslate); + ImGuiUtil.HelpMarker(Language.Options_SortAutoTranslate_Description); - private void DrawLanguageSection() - { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_General_Language_Heading); - if (!tree.Success) - { - return; - } + ImGui.Spacing(); - using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) - { using ( var combo = ImGuiUtil.BeginComboVertical( Language.Options_Language_Name, @@ -201,9 +185,25 @@ internal sealed class General : ISettingsTab string.Format(Language.Options_CommandHelpSide_Description, Plugin.PluginName) ); ImGui.Spacing(); + } + } - ImGui.Checkbox(Language.Options_SortAutoTranslate_Name, ref Mutable.SortAutoTranslate); - ImGuiUtil.HelpMarker(Language.Options_SortAutoTranslate_Description); + private void DrawPerformanceSection(bool sectionJustEntered) + { + // Collapse every time the tab is freshly entered so state doesn't bleed across sessions. + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_Performance); + if (!tree.Success) + return; + + using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) + { + ImGui.SetNextItemWidth(200f * ImGuiHelpers.GlobalScale); + if (ImGui.InputInt(Language.Options_MaxLinesToShow_Name, ref Mutable.MaxLinesToRender)) + { + Mutable.MaxLinesToRender = Math.Clamp(Mutable.MaxLinesToRender, 1, 10_000); + } + ImGuiUtil.HelpMarker(Language.Options_MaxLinesToShow_Description); } } }