using System; using System.Linq; using Dalamud.Bindings.ImGui; using Dalamud.Game.Text; using Dalamud.Interface.Components; using Dalamud.Interface.Utility.Raii; using Dalamud.Plugin; using Dalamud.Utility; using Questionable.External; namespace Questionable.Windows.ConfigComponents; internal sealed class NotificationConfigComponent : ConfigComponent { private readonly NotificationMasterIpc _notificationMasterIpc; public NotificationConfigComponent(IDalamudPluginInterface pluginInterface, Configuration configuration, NotificationMasterIpc notificationMasterIpc) : base(pluginInterface, configuration) { _notificationMasterIpc = notificationMasterIpc; } public override void DrawTab() { using ImRaii.IEndObject endObject = ImRaii.TabItem("Notifications###Notifications"); if (!endObject) { return; } bool v = base.Configuration.Notifications.Enabled; if (ImGui.Checkbox("Enable notifications when manual interaction is required", ref v)) { base.Configuration.Notifications.Enabled = v; Save(); } using (ImRaii.Disabled(!base.Configuration.Notifications.Enabled)) { using (ImRaii.PushIndent()) { XivChatType[] array = (from x in Enum.GetValues() where x != XivChatType.StandardEmote select x).ToArray(); int currentItem = Array.IndexOf(array, base.Configuration.Notifications.ChatType); string[] items = array.Select((XivChatType t) => t.GetAttribute()?.FancyName ?? t.ToString()).ToArray(); if (ImGui.Combo("Chat channel", ref currentItem, in items, items.Length)) { base.Configuration.Notifications.ChatType = array[currentItem]; Save(); } ImGui.Separator(); ImGui.Text("NotificationMaster settings"); ImGui.SameLine(); ImGuiComponents.HelpMarker("Requires the plugin 'NotificationMaster' to be installed."); using (ImRaii.Disabled(!_notificationMasterIpc.Enabled)) { bool v2 = base.Configuration.Notifications.ShowTrayMessage; if (ImGui.Checkbox("Show tray notification", ref v2)) { base.Configuration.Notifications.ShowTrayMessage = v2; Save(); } bool v3 = base.Configuration.Notifications.FlashTaskbar; if (ImGui.Checkbox("Flash taskbar icon", ref v3)) { base.Configuration.Notifications.FlashTaskbar = v3; Save(); } } } } } }