feat(ui): add a preview button for the per-tab notification sound

This commit is contained in:
2026-05-21 19:01:45 +02:00
parent aaeca76bfd
commit 969d5e6aa6
3 changed files with 36 additions and 9 deletions
+1
View File
@@ -462,6 +462,7 @@ internal class HellionStrings
internal static string Tabs_NotificationSound_Enable_Name => Get(nameof(Tabs_NotificationSound_Enable_Name)); internal static string Tabs_NotificationSound_Enable_Name => Get(nameof(Tabs_NotificationSound_Enable_Name));
internal static string Tabs_NotificationSound_Description => Get(nameof(Tabs_NotificationSound_Description)); internal static string Tabs_NotificationSound_Description => Get(nameof(Tabs_NotificationSound_Description));
internal static string Tabs_NotificationSound_Option => Get(nameof(Tabs_NotificationSound_Option)); internal static string Tabs_NotificationSound_Option => Get(nameof(Tabs_NotificationSound_Option));
internal static string Tabs_NotificationSound_Preview => Get(nameof(Tabs_NotificationSound_Preview));
// Scroll-to-bottom and item/flag linking // Scroll-to-bottom and item/flag linking
internal static string ChatLog_ScrollToBottom_Tooltip => Get(nameof(ChatLog_ScrollToBottom_Tooltip)); internal static string ChatLog_ScrollToBottom_Tooltip => Get(nameof(ChatLog_ScrollToBottom_Tooltip));
@@ -1073,6 +1073,9 @@
<data name="Tabs_NotificationSound_Option" xml:space="preserve"> <data name="Tabs_NotificationSound_Option" xml:space="preserve">
<value>Sound</value> <value>Sound</value>
</data> </data>
<data name="Tabs_NotificationSound_Preview" xml:space="preserve">
<value>Preview the selected sound</value>
</data>
<!-- Scroll-to-bottom and item/flag linking --> <!-- Scroll-to-bottom and item/flag linking -->
<data name="ChatLog_ScrollToBottom_Tooltip" xml:space="preserve"> <data name="ChatLog_ScrollToBottom_Tooltip" xml:space="preserve">
+32 -9
View File
@@ -2,6 +2,7 @@ using Dalamud.Bindings.ImGui;
using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Client.UI;
using HellionChat.Code; using HellionChat.Code;
using HellionChat.Resources; using HellionChat.Resources;
using HellionChat.Util; using HellionChat.Util;
@@ -175,20 +176,42 @@ internal sealed class Tabs : ISettingsTab
using var indent = ImRaii.PushIndent(10.0f); using var indent = ImRaii.PushIndent(10.0f);
var soundPreview = var soundPreview =
$"{HellionStrings.Tabs_NotificationSound_Option} {tab.NotificationSoundId}"; $"{HellionStrings.Tabs_NotificationSound_Option} {tab.NotificationSoundId}";
using var combo = ImRaii.Combo($"##notif-sound-{i}", soundPreview); using (var combo = ImRaii.Combo($"##notif-sound-{i}", soundPreview))
if (combo.Success)
{ {
for (uint s = 1; s <= 16; s++) if (combo.Success)
{ {
if ( for (uint s = 1; s <= 16; s++)
ImGui.Selectable( {
$"{HellionStrings.Tabs_NotificationSound_Option} {s}", if (
tab.NotificationSoundId == s ImGui.Selectable(
$"{HellionStrings.Tabs_NotificationSound_Option} {s}",
tab.NotificationSoundId == s
)
) )
) tab.NotificationSoundId = s;
tab.NotificationSoundId = s; }
} }
} }
// Let the user hear the currently selected sound without waiting
// for a real message to arrive in this tab.
ImGui.SameLine();
if (
ImGuiUtil.IconButton(
FontAwesomeIcon.Play,
tooltip: HellionStrings.Tabs_NotificationSound_Preview
)
)
{
var previewId = tab.NotificationSoundId;
Plugin.Framework.RunOnFrameworkThread(() =>
{
unsafe
{
UIGlobals.PlaySoundEffect(previewId);
}
});
}
} }
ImGui.Checkbox(Language.Options_Tabs_PopOut, ref tab.PopOut); ImGui.Checkbox(Language.Options_Tabs_PopOut, ref tab.PopOut);
if (tab.PopOut) if (tab.PopOut)