mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
pi: allow "dismissing" validation problems
This commit is contained in:
parent
4a6faed2e2
commit
b2df6e2a2b
3 changed files with 61 additions and 19 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Dalamud.Configuration.Internal;
|
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.
|
/// Gets or sets an ID uniquely identifying this specific instance of a devPlugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid WorkingPluginId { get; set; } = Guid.Empty;
|
public Guid WorkingPluginId { get; set; } = Guid.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a list of validation problems that have been dismissed by the user.
|
||||||
|
/// </summary>
|
||||||
|
public List<string> DismissedValidationProblems { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2986,23 +2986,53 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange);
|
var numValidProblems = problems.Count(
|
||||||
using (var tree = ImRaii.TreeNode($"Found {problems.Count} validation issue{(problems.Count > 1 ? "s" : string.Empty)} in this plugin!"))
|
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)
|
var thisProblemIsDismissed = devPlugin.DismissedValidationProblems.Contains(problem.GetType().Name);
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
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<DalamudConfiguration>.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)
|
switch (problem.Severity)
|
||||||
{
|
{
|
||||||
case PluginValidator.ValidationSeverity.Fatal:
|
case PluginValidator.ValidationSeverity.Fatal:
|
||||||
|
|
@ -3017,16 +3047,16 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.PopFont();
|
ImGui.SameLine();
|
||||||
ImGui.SameLine();
|
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, thisProblemIsDismissed ? ImGuiColors.DalamudGrey : ImGuiColors.DalamudWhite))
|
||||||
|
{
|
||||||
ImGuiHelpers.SafeTextWrapped(problem.GetLocalizedDescription());
|
ImGuiHelpers.SafeTextWrapped(problem.GetLocalizedDescription());
|
||||||
ImGui.PopStyleColor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
@ -99,6 +100,11 @@ internal class LocalDevPlugin : LocalPlugin, IDisposable
|
||||||
/// Gets an ID uniquely identifying this specific instance of a devPlugin.
|
/// Gets an ID uniquely identifying this specific instance of a devPlugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid DevImposedWorkingPluginId => this.devSettings.WorkingPluginId;
|
public Guid DevImposedWorkingPluginId => this.devSettings.WorkingPluginId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a list of validation problems that have been dismissed by the user.
|
||||||
|
/// </summary>
|
||||||
|
public List<string> DismissedValidationProblems => this.devSettings.DismissedValidationProblems;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public new void Dispose()
|
public new void Dispose()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue