diff --git a/Dalamud/Configuration/Internal/DevPluginSettings.cs b/Dalamud/Configuration/Internal/DevPluginSettings.cs index cfe8ba411..63d56fdb6 100644 --- a/Dalamud/Configuration/Internal/DevPluginSettings.cs +++ b/Dalamud/Configuration/Internal/DevPluginSettings.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace Dalamud.Configuration.Internal; @@ -21,4 +22,9 @@ internal sealed class DevPluginSettings /// Gets or sets an ID uniquely identifying this specific instance of a devPlugin. /// public Guid WorkingPluginId { get; set; } = Guid.Empty; + + /// + /// Gets or sets a list of validation problems that have been dismissed by the user. + /// + public List DismissedValidationProblems { get; set; } = new(); } diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 3146935de..5df1694d7 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -2986,23 +2986,53 @@ internal class PluginInstallerWindow : Window, IDisposable } else { - ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange); - using (var tree = ImRaii.TreeNode($"Found {problems.Count} validation issue{(problems.Count > 1 ? "s" : string.Empty)} in this plugin!")) + var numValidProblems = problems.Count( + problem => devPlugin.DismissedValidationProblems.All(name => name != problem.GetType().Name)); + var shouldBother = numValidProblems > 0; + var validationIssuesText = shouldBother ? + $"Found {problems.Count} validation issue{(problems.Count > 1 ? "s" : string.Empty)} in this plugin!" : + $"{problems.Count} dismissed validation issue{(problems.Count > 1 ? "s" : string.Empty)} in this plugin."; + + using var col = ImRaii.PushColor(ImGuiCol.Text, shouldBother ? ImGuiColors.DalamudOrange : ImGuiColors.DalamudGrey); + using var tree = ImRaii.TreeNode($"{validationIssuesText}###validationIssueCollapsible"); + if (tree.Success) { - if (tree.Success) + foreach (var problem in problems) { - foreach (var problem in problems) - { - ImGui.PushStyleColor(ImGuiCol.Text, problem.Severity switch - { - PluginValidator.ValidationSeverity.Fatal => ImGuiColors.DalamudRed, - PluginValidator.ValidationSeverity.Warning => ImGuiColors.DalamudOrange, - PluginValidator.ValidationSeverity.Information => ImGuiColors.TankBlue, - _ => ImGuiColors.DalamudGrey, - }); - - ImGui.PushFont(InterfaceManager.IconFont); + var thisProblemIsDismissed = devPlugin.DismissedValidationProblems.Contains(problem.GetType().Name); + if (!thisProblemIsDismissed) + { + using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudWhite)) + { + if (ImGuiComponents.IconButton( + $"##dismissValidationIssue{problem.GetType().Name}", + FontAwesomeIcon.TimesCircle)) + { + devPlugin.DismissedValidationProblems.Add(problem.GetType().Name); + Service.Get().QueueSave(); + } + + if (ImGui.IsItemHovered()) + { + ImGui.SetTooltip("Dismiss this issue"); + } + } + + ImGui.SameLine(); + } + + var iconColor = problem.Severity switch + { + PluginValidator.ValidationSeverity.Fatal => ImGuiColors.DalamudRed, + PluginValidator.ValidationSeverity.Warning => ImGuiColors.DalamudOrange, + PluginValidator.ValidationSeverity.Information => ImGuiColors.TankBlue, + _ => ImGuiColors.DalamudGrey, + }; + + using (ImRaii.PushColor(ImGuiCol.Text, iconColor)) + using (ImRaii.PushFont(InterfaceManager.IconFont)) + { switch (problem.Severity) { case PluginValidator.ValidationSeverity.Fatal: @@ -3017,16 +3047,16 @@ internal class PluginInstallerWindow : Window, IDisposable default: throw new ArgumentOutOfRangeException(); } + } - ImGui.PopFont(); - ImGui.SameLine(); + ImGui.SameLine(); + + using (ImRaii.PushColor(ImGuiCol.Text, thisProblemIsDismissed ? ImGuiColors.DalamudGrey : ImGuiColors.DalamudWhite)) + { ImGuiHelpers.SafeTextWrapped(problem.GetLocalizedDescription()); - ImGui.PopStyleColor(); } } } - - ImGui.PopStyleColor(); } } } diff --git a/Dalamud/Plugin/Internal/Types/LocalDevPlugin.cs b/Dalamud/Plugin/Internal/Types/LocalDevPlugin.cs index 1f9f503e0..9f7c761de 100644 --- a/Dalamud/Plugin/Internal/Types/LocalDevPlugin.cs +++ b/Dalamud/Plugin/Internal/Types/LocalDevPlugin.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Threading; @@ -99,6 +100,11 @@ internal class LocalDevPlugin : LocalPlugin, IDisposable /// Gets an ID uniquely identifying this specific instance of a devPlugin. /// public Guid DevImposedWorkingPluginId => this.devSettings.WorkingPluginId; + + /// + /// Gets a list of validation problems that have been dismissed by the user. + /// + public List DismissedValidationProblems => this.devSettings.DismissedValidationProblems; /// public new void Dispose()