refactor(settings): rebuild the General tab into collapsible sections

This commit is contained in:
2026-05-22 22:59:27 +02:00
parent eafa20748c
commit 8a8c6ccae2
3 changed files with 63 additions and 58 deletions
+7 -5
View File
@@ -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_Apply => Get(nameof(Settings_Themes_ApplyChatColors_Apply));
internal static string Settings_Themes_ApplyChatColors_Keep => Get(nameof(Settings_Themes_ApplyChatColors_Keep)); 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)); internal static string Settings_Language_FFXIVCoverage_Warning => Get(nameof(Settings_Language_FFXIVCoverage_Warning));
// Hellion Chat — Appearance-Tab section headings // Hellion Chat — Appearance-Tab section headings
@@ -494,4 +489,11 @@ internal class HellionStrings
// v1.5.6: custom sound volume // 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_Name => Get(nameof(Settings_General_CustomSoundVolume_Name));
internal static string Settings_General_CustomSoundVolume_Description => Get(nameof(Settings_General_CustomSoundVolume_Description)); 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));
} }
+17 -14
View File
@@ -596,20 +596,6 @@
<value>About</value> <value>About</value>
</data> </data>
<!-- Hellion Chat — General tab section headings -->
<data name="Settings_General_Input_Heading" xml:space="preserve">
<value>Input</value>
</data>
<data name="Settings_General_Audio_Heading" xml:space="preserve">
<value>Audio &amp; notifications</value>
</data>
<data name="Settings_General_Performance_Heading" xml:space="preserve">
<value>Performance</value>
</data>
<data name="Settings_General_Language_Heading" xml:space="preserve">
<value>Language &amp; input aids</value>
</data>
<!-- Hellion Chat — Appearance tab section headings --> <!-- Hellion Chat — Appearance tab section headings -->
<data name="Settings_Appearance_Theme_Heading" xml:space="preserve"> <data name="Settings_Appearance_Theme_Heading" xml:space="preserve">
<value>Theme</value> <value>Theme</value>
@@ -1149,4 +1135,21 @@
<data name="Settings_General_CustomSoundVolume_Description" xml:space="preserve"> <data name="Settings_General_CustomSoundVolume_Description" xml:space="preserve">
<value>Playback volume for the three bundled custom notification sounds. Does not affect the 16 game sounds.</value> <value>Playback volume for the three bundled custom notification sounds. Does not affect the 16 game sounds.</value>
</data> </data>
<!-- v1.5.6: General tab section titles (collapsible, R6) -->
<data name="Settings_Section_Input" xml:space="preserve">
<value>Input</value>
</data>
<data name="Settings_Section_Sound" xml:space="preserve">
<value>Sound</value>
</data>
<data name="Settings_Section_Language" xml:space="preserve">
<value>Language</value>
</data>
<data name="Settings_Section_Performance" xml:space="preserve">
<value>Performance</value>
</data>
<data name="Settings_Section_Sound_TabsHint" xml:space="preserve">
<value>Which sound plays per tab is set in the Channels tab.</value>
</data>
</root> </root>
+39 -39
View File
@@ -21,22 +21,22 @@ internal sealed class General : ISettingsTab
public void Draw(bool sectionJustEntered) public void Draw(bool sectionJustEntered)
{ {
DrawInputSection(); DrawInputSection(sectionJustEntered);
ImGui.Spacing(); ImGui.Spacing();
DrawAudioSection(); DrawSoundSection(sectionJustEntered);
ImGui.Spacing(); ImGui.Spacing();
DrawPerformanceSection(); DrawLanguageSection(sectionJustEntered);
ImGui.Spacing(); 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) if (!tree.Success)
{
return; return;
}
using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) 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) if (!tree.Success)
{
return; return;
}
using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false))
{ {
@@ -112,42 +112,26 @@ internal sealed class General : ISettingsTab
{ {
Mutable.CustomSoundVolume = customSoundVolumePercent / 100f; Mutable.CustomSoundVolume = customSoundVolumePercent / 100f;
} }
ImGuiUtil.HelpMarker(HellionStrings.Settings_General_CustomSoundVolume_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);
ImGui.Checkbox(Language.Options_ShowNoviceNetwork_Name, ref Mutable.ShowNoviceNetwork);
ImGuiUtil.HelpMarker(Language.Options_ShowNoviceNetwork_Description);
} }
} }
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) if (!tree.Success)
{
return; return;
}
using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false))
{ {
ImGui.SetNextItemWidth(200f * ImGuiHelpers.GlobalScale); ImGui.Checkbox(Language.Options_SortAutoTranslate_Name, ref Mutable.SortAutoTranslate);
if (ImGui.InputInt(Language.Options_MaxLinesToShow_Name, ref Mutable.MaxLinesToRender)) ImGuiUtil.HelpMarker(Language.Options_SortAutoTranslate_Description);
{
Mutable.MaxLinesToRender = Math.Clamp(Mutable.MaxLinesToRender, 1, 10_000);
}
ImGuiUtil.HelpMarker(Language.Options_MaxLinesToShow_Description);
}
}
private void DrawLanguageSection() ImGui.Spacing();
{
using var tree = ImRaii.TreeNode(HellionStrings.Settings_General_Language_Heading);
if (!tree.Success)
{
return;
}
using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false))
{
using ( using (
var combo = ImGuiUtil.BeginComboVertical( var combo = ImGuiUtil.BeginComboVertical(
Language.Options_Language_Name, Language.Options_Language_Name,
@@ -201,9 +185,25 @@ internal sealed class General : ISettingsTab
string.Format(Language.Options_CommandHelpSide_Description, Plugin.PluginName) string.Format(Language.Options_CommandHelpSide_Description, Plugin.PluginName)
); );
ImGui.Spacing(); ImGui.Spacing();
}
}
ImGui.Checkbox(Language.Options_SortAutoTranslate_Name, ref Mutable.SortAutoTranslate); private void DrawPerformanceSection(bool sectionJustEntered)
ImGuiUtil.HelpMarker(Language.Options_SortAutoTranslate_Description); {
// 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);
} }
} }
} }