Merge pull request #754 from Aireil/add_categories

This commit is contained in:
goaaats 2022-02-04 12:00:51 +01:00 committed by GitHub
commit 2a15da93d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 9 deletions

View file

@ -22,6 +22,8 @@ namespace Dalamud.Interface.Internal
new(0, "special.all", () => Locs.Category_All), new(0, "special.all", () => Locs.Category_All),
new(10, "special.devInstalled", () => Locs.Category_DevInstalled), new(10, "special.devInstalled", () => Locs.Category_DevInstalled),
new(11, "special.devIconTester", () => Locs.Category_IconTester), new(11, "special.devIconTester", () => Locs.Category_IconTester),
new(12, "special.dalamud", () => Locs.Category_Dalamud),
new(13, "special.plugins", () => Locs.Category_Plugins),
new(FirstTagBasedCategoryId + 0, "other", () => Locs.Category_Other), new(FirstTagBasedCategoryId + 0, "other", () => Locs.Category_Other),
new(FirstTagBasedCategoryId + 1, "jobs", () => Locs.Category_Jobs), new(FirstTagBasedCategoryId + 1, "jobs", () => Locs.Category_Jobs),
new(FirstTagBasedCategoryId + 2, "ui", () => Locs.Category_UI), new(FirstTagBasedCategoryId + 2, "ui", () => Locs.Category_UI),
@ -39,7 +41,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), new(GroupKind.Changelog, () => Locs.Group_Changelog, 0, 12, 13),
// order important, used for drawing, keep in sync with defaults for currentGroupIdx // order important, used for drawing, keep in sync with defaults for currentGroupIdx
}; };
@ -408,6 +410,10 @@ namespace Dalamud.Interface.Internal
public static string Category_Utility => Loc.Localize("InstallerCategoryUtility", "Utility"); public static string Category_Utility => Loc.Localize("InstallerCategoryUtility", "Utility");
public static string Category_Plugins => Loc.Localize("InstallerCategoryPlugins", "Plugins");
public static string Category_Dalamud => Loc.Localize("InstallerCategoryDalamud", "Dalamud");
#endregion #endregion
} }
} }

View file

@ -513,7 +513,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
} }
*/ */
private void DrawChangelogList() private void DrawChangelogList(bool displayDalamud, bool displayPlugins)
{ {
if (this.pluginListInstalled.Count == 0) if (this.pluginListInstalled.Count == 0)
{ {
@ -537,12 +537,26 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
return (IChangelogEntry)changelog; return (IChangelogEntry)changelog;
}); });
var changelogs = (this.dalamudChangelogManager.Changelogs != null IEnumerable<IChangelogEntry> changelogs = null;
? pluginChangelogs if (displayDalamud && displayPlugins && this.dalamudChangelogManager.Changelogs != null)
.Concat(this.dalamudChangelogManager.Changelogs.Select(x => new DalamudChangelogEntry(x, this.imageCache.CorePluginIcon))) {
: pluginChangelogs).OrderByDescending(x => x.Date).ToList(); changelogs = pluginChangelogs
.Concat(this.dalamudChangelogManager.Changelogs.Select(
x => new DalamudChangelogEntry(x, this.imageCache.CorePluginIcon)));
}
else if (displayDalamud && this.dalamudChangelogManager.Changelogs != null)
{
changelogs = this.dalamudChangelogManager.Changelogs.Select(
x => new DalamudChangelogEntry(x, this.imageCache.CorePluginIcon));
}
else if (displayPlugins)
{
changelogs = pluginChangelogs;
}
if (!changelogs.Any()) var sortedChangelogs = changelogs?.OrderByDescending(x => x.Date).ToList();
if (sortedChangelogs == null || !sortedChangelogs.Any())
{ {
ImGui.TextColored( ImGui.TextColored(
ImGuiColors.DalamudGrey2, ImGuiColors.DalamudGrey2,
@ -553,7 +567,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
return; return;
} }
foreach (var logEntry in changelogs) foreach (var logEntry in sortedChangelogs)
{ {
this.DrawChangelog(logEntry); this.DrawChangelog(logEntry);
} }
@ -801,7 +815,21 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
this.DrawInstalledPluginList(); this.DrawInstalledPluginList();
break; break;
case PluginCategoryManager.GroupKind.Changelog: case PluginCategoryManager.GroupKind.Changelog:
this.DrawChangelogList(); switch (this.categoryManager.CurrentCategoryIdx)
{
case 0:
this.DrawChangelogList(true, true);
break;
case 1:
this.DrawChangelogList(true, false);
break;
case 2:
this.DrawChangelogList(false, true);
break;
}
break; break;
default: default:
this.DrawAvailablePluginList(); this.DrawAvailablePluginList();