feat(ui): add a preview button for the per-tab notification sound
This commit is contained in:
@@ -2,6 +2,7 @@ using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using HellionChat.Code;
|
||||
using HellionChat.Resources;
|
||||
using HellionChat.Util;
|
||||
@@ -175,20 +176,42 @@ internal sealed class Tabs : ISettingsTab
|
||||
using var indent = ImRaii.PushIndent(10.0f);
|
||||
var soundPreview =
|
||||
$"{HellionStrings.Tabs_NotificationSound_Option} {tab.NotificationSoundId}";
|
||||
using var combo = ImRaii.Combo($"##notif-sound-{i}", soundPreview);
|
||||
if (combo.Success)
|
||||
using (var combo = ImRaii.Combo($"##notif-sound-{i}", soundPreview))
|
||||
{
|
||||
for (uint s = 1; s <= 16; s++)
|
||||
if (combo.Success)
|
||||
{
|
||||
if (
|
||||
ImGui.Selectable(
|
||||
$"{HellionStrings.Tabs_NotificationSound_Option} {s}",
|
||||
tab.NotificationSoundId == s
|
||||
for (uint s = 1; s <= 16; s++)
|
||||
{
|
||||
if (
|
||||
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);
|
||||
if (tab.PopOut)
|
||||
|
||||
Reference in New Issue
Block a user