feat(PluginInstaller): show changelog in collapsible, even for unupdated plugins

This commit is contained in:
goaaats 2022-02-03 03:08:47 +01:00
parent 0e53619fa4
commit 797bcf7305
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -1409,6 +1409,7 @@ namespace Dalamud.Interface.Internal.Windows
}
ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}");
var hasChangelog = !plugin.Manifest.Changelog.IsNullOrEmpty();
if (this.DrawPluginCollapsingHeader(label, plugin, plugin.Manifest, plugin.Manifest.IsThirdParty, trouble, availablePluginUpdate != default, false, () => this.DrawInstalledPluginContextMenu(plugin), index))
{
@ -1503,33 +1504,46 @@ namespace Dalamud.Interface.Internal.Windows
ImGuiHelpers.ScaledDummy(5);
ImGui.Unindent();
if (hasChangelog)
{
if (ImGui.TreeNode($"Changelog (v{plugin.Manifest.AssemblyVersion})"))
{
this.DrawInstalledPluginChangelog(plugin.Manifest);
}
}
}
if (thisWasUpdated && !plugin.Manifest.Changelog.IsNullOrEmpty())
if (thisWasUpdated && hasChangelog)
{
ImGuiHelpers.ScaledDummy(5);
ImGui.PushStyleColor(ImGuiCol.ChildBg, this.changelogBgColor);
ImGui.PushStyleColor(ImGuiCol.Text, this.changelogTextColor);
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(7, 5));
if (ImGui.BeginChild("##changelog", new Vector2(-1, 100), true, ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoNavInputs | ImGuiWindowFlags.AlwaysAutoResize))
{
ImGui.Text("Changelog:");
ImGuiHelpers.ScaledDummy(2);
ImGui.TextWrapped(plugin.Manifest.Changelog);
}
ImGui.EndChild();
ImGui.PopStyleVar();
ImGui.PopStyleColor(2);
this.DrawInstalledPluginChangelog(plugin.Manifest);
}
ImGui.PopID();
}
private void DrawInstalledPluginChangelog(PluginManifest manifest)
{
ImGuiHelpers.ScaledDummy(5);
ImGui.PushStyleColor(ImGuiCol.ChildBg, this.changelogBgColor);
ImGui.PushStyleColor(ImGuiCol.Text, this.changelogTextColor);
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(7, 5));
if (ImGui.BeginChild("##changelog", new Vector2(-1, 100), true, ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoNavInputs | ImGuiWindowFlags.AlwaysAutoResize))
{
ImGui.Text("Changelog:");
ImGuiHelpers.ScaledDummy(2);
ImGui.TextWrapped(manifest.Changelog);
}
ImGui.EndChild();
ImGui.PopStyleVar();
ImGui.PopStyleColor(2);
}
private void DrawInstalledPluginContextMenu(LocalPlugin plugin)
{
var pluginManager = Service<PluginManager>.Get();