mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
feat(PluginInstaller): add Changelog tab
This commit is contained in:
parent
4ae560c1b2
commit
b8cf9c4c46
2 changed files with 113 additions and 22 deletions
|
|
@ -39,6 +39,7 @@ namespace Dalamud.Interface.Internal
|
||||||
new(GroupKind.DevTools, () => Locs.Group_DevTools, 10, 11),
|
new(GroupKind.DevTools, () => Locs.Group_DevTools, 10, 11),
|
||||||
new(GroupKind.Installed, () => Locs.Group_Installed, 0),
|
new(GroupKind.Installed, () => Locs.Group_Installed, 0),
|
||||||
new(GroupKind.Available, () => Locs.Group_Available, 0),
|
new(GroupKind.Available, () => Locs.Group_Available, 0),
|
||||||
|
new(GroupKind.Changelog, () => Locs.Group_Changelog, 0),
|
||||||
|
|
||||||
// order important, used for drawing, keep in sync with defaults for currentGroupIdx
|
// order important, used for drawing, keep in sync with defaults for currentGroupIdx
|
||||||
};
|
};
|
||||||
|
|
@ -69,6 +70,11 @@ namespace Dalamud.Interface.Internal
|
||||||
/// UI group: plugins that can be installed.
|
/// UI group: plugins that can be installed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Available,
|
Available,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UI group: changelog of plugins.
|
||||||
|
/// </summary>
|
||||||
|
Changelog,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -374,6 +380,8 @@ namespace Dalamud.Interface.Internal
|
||||||
|
|
||||||
public static string Group_Available => Loc.Localize("InstallerAllPlugins", "All Plugins");
|
public static string Group_Available => Loc.Localize("InstallerAllPlugins", "All Plugins");
|
||||||
|
|
||||||
|
public static string Group_Changelog => Loc.Localize("InstallerChangelog", "Changelog");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Categories
|
#region Categories
|
||||||
|
|
|
||||||
|
|
@ -510,6 +510,37 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
private void DrawChangelogList()
|
||||||
|
{
|
||||||
|
if (this.pluginListInstalled.Count == 0)
|
||||||
|
{
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoInstalled);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var filteredList = this.pluginListInstalled
|
||||||
|
.Where(plugin => !this.IsManifestFiltered(plugin.Manifest)
|
||||||
|
&& !plugin.Manifest.Changelog.IsNullOrEmpty())
|
||||||
|
.OrderByDescending(plugin => plugin.Manifest.LastUpdate)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (!filteredList.Any())
|
||||||
|
{
|
||||||
|
ImGui.TextColored(
|
||||||
|
ImGuiColors.DalamudGrey2,
|
||||||
|
this.pluginListInstalled.Any(plugin => !plugin.Manifest.Changelog.IsNullOrEmpty())
|
||||||
|
? Locs.TabBody_SearchNoMatching
|
||||||
|
: Locs.TabBody_ChangelogNone);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var plugin in filteredList)
|
||||||
|
{
|
||||||
|
this.DrawChangelog(plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawAvailablePluginList()
|
private void DrawAvailablePluginList()
|
||||||
{
|
{
|
||||||
var pluginList = this.pluginListAvailable;
|
var pluginList = this.pluginListAvailable;
|
||||||
|
|
@ -728,31 +759,35 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupInfo.GroupKind == PluginCategoryManager.GroupKind.DevTools)
|
switch (groupInfo.GroupKind)
|
||||||
{
|
{
|
||||||
// this one is never sorted and remains in hardcoded order from group ctor
|
case PluginCategoryManager.GroupKind.DevTools:
|
||||||
switch (this.categoryManager.CurrentCategoryIdx)
|
// this one is never sorted and remains in hardcoded order from group ctor
|
||||||
{
|
switch (this.categoryManager.CurrentCategoryIdx)
|
||||||
case 0:
|
{
|
||||||
this.DrawInstalledDevPluginList();
|
case 0:
|
||||||
break;
|
this.DrawInstalledDevPluginList();
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
this.DrawImageTester();
|
this.DrawImageTester();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// umm, there's nothing else, keep handled set and just skip drawing...
|
// umm, there's nothing else, keep handled set and just skip drawing...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (groupInfo.GroupKind == PluginCategoryManager.GroupKind.Installed)
|
break;
|
||||||
{
|
case PluginCategoryManager.GroupKind.Installed:
|
||||||
this.DrawInstalledPluginList();
|
this.DrawInstalledPluginList();
|
||||||
}
|
break;
|
||||||
else
|
case PluginCategoryManager.GroupKind.Changelog:
|
||||||
{
|
this.DrawChangelogList();
|
||||||
this.DrawAvailablePluginList();
|
break;
|
||||||
|
default:
|
||||||
|
this.DrawAvailablePluginList();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar();
|
||||||
|
|
@ -1167,6 +1202,52 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
return isOpen;
|
return isOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawChangelog(LocalPlugin plugin)
|
||||||
|
{
|
||||||
|
ImGui.Separator();
|
||||||
|
|
||||||
|
var startCursor = ImGui.GetCursorPos();
|
||||||
|
|
||||||
|
var iconTex = this.imageCache.DefaultIcon;
|
||||||
|
var hasIcon = this.imageCache.TryGetIcon(plugin, plugin.Manifest, plugin.Manifest.IsThirdParty, out var cachedIconTex);
|
||||||
|
if (hasIcon && cachedIconTex != null)
|
||||||
|
{
|
||||||
|
iconTex = cachedIconTex;
|
||||||
|
}
|
||||||
|
|
||||||
|
var iconSize = ImGuiHelpers.ScaledVector2(64, 64);
|
||||||
|
|
||||||
|
ImGui.Image(iconTex.ImGuiHandle, iconSize);
|
||||||
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
var cursor = ImGui.GetCursorPos();
|
||||||
|
ImGui.Text(plugin.Name);
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
var version = plugin.AssemblyName?.Version;
|
||||||
|
version ??= plugin.Manifest.Testing
|
||||||
|
? plugin.Manifest.TestingAssemblyVersion
|
||||||
|
: plugin.Manifest.AssemblyVersion;
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{version}");
|
||||||
|
|
||||||
|
cursor.Y += ImGui.GetTextLineHeightWithSpacing();
|
||||||
|
ImGui.SetCursorPos(cursor);
|
||||||
|
|
||||||
|
ImGui.TextWrapped(plugin.Manifest.Changelog);
|
||||||
|
|
||||||
|
var endCursor = ImGui.GetCursorPos();
|
||||||
|
|
||||||
|
var sectionSize = Math.Max(
|
||||||
|
66 * ImGuiHelpers.GlobalScale, // min size due to icons
|
||||||
|
endCursor.Y - startCursor.Y);
|
||||||
|
|
||||||
|
startCursor.Y += sectionSize;
|
||||||
|
ImGui.SetCursorPos(startCursor);
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawAvailablePlugin(RemotePluginManifest manifest, int index)
|
private void DrawAvailablePlugin(RemotePluginManifest manifest, int index)
|
||||||
{
|
{
|
||||||
var configuration = Service<DalamudConfiguration>.Get();
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
|
|
@ -2126,6 +2207,8 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
public static string TabBody_SearchNoInstalled => Loc.Localize("InstallerNoInstalled", "No plugins are currently installed. You can install them from the \"All Plugins\" tab.");
|
public static string TabBody_SearchNoInstalled => Loc.Localize("InstallerNoInstalled", "No plugins are currently installed. You can install them from the \"All Plugins\" tab.");
|
||||||
|
|
||||||
|
public static string TabBody_ChangelogNone => Loc.Localize("InstallerNoChangelog", "None of your installed plugins have a changelog.");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Plugin title text
|
#region Plugin title text
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue