feat(ui): add a preview button for the per-tab notification sound
This commit is contained in:
@@ -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_Description => Get(nameof(Tabs_NotificationSound_Description));
|
||||
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
|
||||
internal static string ChatLog_ScrollToBottom_Tooltip => Get(nameof(ChatLog_ScrollToBottom_Tooltip));
|
||||
|
||||
@@ -1073,6 +1073,9 @@
|
||||
<data name="Tabs_NotificationSound_Option" xml:space="preserve">
|
||||
<value>Sound</value>
|
||||
</data>
|
||||
<data name="Tabs_NotificationSound_Preview" xml:space="preserve">
|
||||
<value>Preview the selected sound</value>
|
||||
</data>
|
||||
|
||||
<!-- Scroll-to-bottom and item/flag linking -->
|
||||
<data name="ChatLog_ScrollToBottom_Tooltip" xml:space="preserve">
|
||||
|
||||
@@ -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