mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
pi: add "updateable plugins" page, open kind, make auto-updates go there by default
This commit is contained in:
parent
c155be7db6
commit
3509a0bdca
4 changed files with 106 additions and 55 deletions
|
|
@ -15,6 +15,11 @@ public enum PluginInstallerOpenKind
|
||||||
/// </summary>
|
/// </summary>
|
||||||
InstalledPlugins,
|
InstalledPlugins,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Open to the "Can be updated" page.
|
||||||
|
/// </summary>
|
||||||
|
UpdateablePlugins,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Open to the "Changelogs" page.
|
/// Open to the "Changelogs" page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ internal class PluginCategoryManager
|
||||||
new(12, "special.dalamud", () => Locs.Category_Dalamud),
|
new(12, "special.dalamud", () => Locs.Category_Dalamud),
|
||||||
new(13, "special.plugins", () => Locs.Category_Plugins),
|
new(13, "special.plugins", () => Locs.Category_Plugins),
|
||||||
new(14, "special.profiles", () => Locs.Category_PluginProfiles),
|
new(14, "special.profiles", () => Locs.Category_PluginProfiles),
|
||||||
|
new(15, "special.updateable", () => Locs.Category_UpdateablePlugins),
|
||||||
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),
|
||||||
|
|
@ -43,7 +44,7 @@ internal class PluginCategoryManager
|
||||||
private GroupInfo[] groupList =
|
private GroupInfo[] groupList =
|
||||||
{
|
{
|
||||||
new(GroupKind.DevTools, () => Locs.Group_DevTools, 10, 11),
|
new(GroupKind.DevTools, () => Locs.Group_DevTools, 10, 11),
|
||||||
new(GroupKind.Installed, () => Locs.Group_Installed, 0, 1, 14),
|
new(GroupKind.Installed, () => Locs.Group_Installed, 0, 1, 15, 14),
|
||||||
new(GroupKind.Available, () => Locs.Group_Available, 0),
|
new(GroupKind.Available, () => Locs.Group_Available, 0),
|
||||||
new(GroupKind.Changelog, () => Locs.Group_Changelog, 0, 12, 13),
|
new(GroupKind.Changelog, () => Locs.Group_Changelog, 0, 12, 13),
|
||||||
|
|
||||||
|
|
@ -432,6 +433,8 @@ internal class PluginCategoryManager
|
||||||
|
|
||||||
public static string Category_PluginProfiles => Loc.Localize("InstallerCategoryPluginProfiles", "Plugin Collections");
|
public static string Category_PluginProfiles => Loc.Localize("InstallerCategoryPluginProfiles", "Plugin Collections");
|
||||||
|
|
||||||
|
public static string Category_UpdateablePlugins => Loc.Localize("InstallerCategoryCanBeUpdated", "Can be updated");
|
||||||
|
|
||||||
public static string Category_Other => Loc.Localize("InstallerCategoryOther", "Other");
|
public static string Category_Other => Loc.Localize("InstallerCategoryOther", "Other");
|
||||||
|
|
||||||
public static string Category_Jobs => Loc.Localize("InstallerCategoryJobs", "Jobs");
|
public static string Category_Jobs => Loc.Localize("InstallerCategoryJobs", "Jobs");
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,14 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
IsTesting = 1 << 6,
|
IsTesting = 1 << 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private enum InstalledPluginListFilter
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Testing,
|
||||||
|
Updateable,
|
||||||
|
Dev,
|
||||||
|
}
|
||||||
|
|
||||||
private bool AnyOperationInProgress => this.installStatus == OperationStatus.InProgress ||
|
private bool AnyOperationInProgress => this.installStatus == OperationStatus.InProgress ||
|
||||||
this.updateStatus == OperationStatus.InProgress ||
|
this.updateStatus == OperationStatus.InProgress ||
|
||||||
this.enableDisableStatus == OperationStatus.InProgress;
|
this.enableDisableStatus == OperationStatus.InProgress;
|
||||||
|
|
@ -430,6 +438,12 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
// All category
|
// All category
|
||||||
this.categoryManager.CurrentCategoryIdx = 0;
|
this.categoryManager.CurrentCategoryIdx = 0;
|
||||||
break;
|
break;
|
||||||
|
case PluginInstallerOpenKind.UpdateablePlugins:
|
||||||
|
// Installed group
|
||||||
|
this.categoryManager.CurrentGroupIdx = 1;
|
||||||
|
// Updateable category
|
||||||
|
this.categoryManager.CurrentCategoryIdx = 15;
|
||||||
|
break;
|
||||||
case PluginInstallerOpenKind.Changelogs:
|
case PluginInstallerOpenKind.Changelogs:
|
||||||
// Changelog group
|
// Changelog group
|
||||||
this.categoryManager.CurrentGroupIdx = 3;
|
this.categoryManager.CurrentGroupIdx = 3;
|
||||||
|
|
@ -1215,7 +1229,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
|
|
||||||
if (proxy.LocalPlugin != null)
|
if (proxy.LocalPlugin != null)
|
||||||
{
|
{
|
||||||
this.DrawInstalledPlugin(proxy.LocalPlugin, i++, proxy.RemoteManifest, true);
|
var update = this.pluginListUpdatable.FirstOrDefault(up => up.InstalledPlugin == proxy.LocalPlugin);
|
||||||
|
this.DrawInstalledPlugin(proxy.LocalPlugin, i++, proxy.RemoteManifest, update);
|
||||||
}
|
}
|
||||||
else if (proxy.RemoteManifest != null)
|
else if (proxy.RemoteManifest != null)
|
||||||
{
|
{
|
||||||
|
|
@ -1226,7 +1241,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawInstalledPluginList(bool filterTesting)
|
private void DrawInstalledPluginList(InstalledPluginListFilter filter)
|
||||||
{
|
{
|
||||||
var pluginList = this.pluginListInstalled;
|
var pluginList = this.pluginListInstalled;
|
||||||
var manager = Service<PluginManager>.Get();
|
var manager = Service<PluginManager>.Get();
|
||||||
|
|
@ -1247,47 +1262,57 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var drewAny = false;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
foreach (var plugin in filteredList)
|
foreach (var plugin in filteredList)
|
||||||
{
|
{
|
||||||
if (filterTesting && !manager.HasTestingOptIn(plugin.Manifest))
|
if (filter == InstalledPluginListFilter.Testing && !manager.HasTestingOptIn(plugin.Manifest))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Find the applicable remote manifest
|
// Find applicable update and manifest, if we have them
|
||||||
var remoteManifest = this.pluginListAvailable
|
AvailablePluginUpdate? update = null;
|
||||||
.FirstOrDefault(rm => rm.InternalName == plugin.Manifest.InternalName &&
|
RemotePluginManifest? remoteManifest = null;
|
||||||
rm.RepoUrl == plugin.Manifest.RepoUrl);
|
|
||||||
|
|
||||||
this.DrawInstalledPlugin(plugin, i++, remoteManifest);
|
if (filter != InstalledPluginListFilter.Dev)
|
||||||
}
|
{
|
||||||
}
|
update = this.pluginListUpdatable.FirstOrDefault(up => up.InstalledPlugin == plugin);
|
||||||
|
if (filter == InstalledPluginListFilter.Updateable && update == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
private void DrawInstalledDevPluginList()
|
// Find the applicable remote manifest
|
||||||
{
|
remoteManifest = this.pluginListAvailable
|
||||||
var pluginList = this.pluginListInstalled
|
.FirstOrDefault(rm => rm.InternalName == plugin.Manifest.InternalName &&
|
||||||
.Where(plugin => plugin.IsDev)
|
rm.RepoUrl == plugin.Manifest.RepoUrl);
|
||||||
.ToList();
|
}
|
||||||
|
else if (!plugin.IsDev)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (pluginList.Count == 0)
|
this.DrawInstalledPlugin(plugin, i++, remoteManifest, update);
|
||||||
{
|
drewAny = true;
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoInstalled);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var filteredList = pluginList
|
if (!drewAny)
|
||||||
.Where(plugin => !this.IsManifestFiltered(plugin.Manifest))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
if (filteredList.Count == 0)
|
|
||||||
{
|
{
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching);
|
var text = filter switch
|
||||||
return;
|
{
|
||||||
}
|
InstalledPluginListFilter.None => Locs.TabBody_NoPluginsInstalled,
|
||||||
|
InstalledPluginListFilter.Testing => Locs.TabBody_NoPluginsTesting,
|
||||||
|
InstalledPluginListFilter.Updateable => Locs.TabBody_NoPluginsUpdateable,
|
||||||
|
InstalledPluginListFilter.Dev => Locs.TabBody_NoPluginsDev,
|
||||||
|
_ => throw new ArgumentException(null, nameof(filter)),
|
||||||
|
};
|
||||||
|
|
||||||
var i = 0;
|
ImGuiHelpers.ScaledDummy(60);
|
||||||
foreach (var plugin in filteredList)
|
|
||||||
{
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey))
|
||||||
this.DrawInstalledPlugin(plugin, i++, null);
|
{
|
||||||
|
foreach (var line in text.Split('\n'))
|
||||||
|
{
|
||||||
|
ImGuiHelpers.CenteredText(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1462,7 +1487,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
switch (this.categoryManager.CurrentCategoryIdx)
|
switch (this.categoryManager.CurrentCategoryIdx)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
this.DrawInstalledDevPluginList();
|
this.DrawInstalledPluginList(InstalledPluginListFilter.Dev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -1470,7 +1495,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// umm, there's nothing else, keep handled set and just skip drawing...
|
ImGui.TextUnformatted("You found a mysterious category. Please keep it to yourself.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1479,16 +1504,24 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
switch (this.categoryManager.CurrentCategoryIdx)
|
switch (this.categoryManager.CurrentCategoryIdx)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
this.DrawInstalledPluginList(false);
|
this.DrawInstalledPluginList(InstalledPluginListFilter.None);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
this.DrawInstalledPluginList(true);
|
this.DrawInstalledPluginList(InstalledPluginListFilter.Testing);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
this.DrawInstalledPluginList(InstalledPluginListFilter.Updateable);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
this.profileManagerWidget.Draw();
|
this.profileManagerWidget.Draw();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ImGui.TextUnformatted("You found a secret category. Please feel a sense of pride and accomplishment.");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -2325,7 +2358,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginManifest? remoteManifest, bool showInstalled = false)
|
private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginManifest? remoteManifest, AvailablePluginUpdate? availablePluginUpdate, bool showInstalled = false)
|
||||||
{
|
{
|
||||||
var configuration = Service<DalamudConfiguration>.Get();
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
var commandManager = Service<CommandManager>.Get();
|
var commandManager = Service<CommandManager>.Get();
|
||||||
|
|
@ -2384,8 +2417,6 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
trouble = true;
|
trouble = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var availablePluginUpdate = this.pluginListUpdatable.FirstOrDefault(up => up.InstalledPlugin == plugin);
|
|
||||||
|
|
||||||
// Dev plugins can never update
|
// Dev plugins can never update
|
||||||
if (plugin.IsDev)
|
if (plugin.IsDev)
|
||||||
availablePluginUpdate = null;
|
availablePluginUpdate = null;
|
||||||
|
|
@ -3685,6 +3716,15 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
|
|
||||||
public static string TabBody_SafeMode => Loc.Localize("InstallerSafeMode", "Dalamud is running in Plugin Safe Mode, restart to activate plugins.");
|
public static string TabBody_SafeMode => Loc.Localize("InstallerSafeMode", "Dalamud is running in Plugin Safe Mode, restart to activate plugins.");
|
||||||
|
|
||||||
|
public static string TabBody_NoPluginsTesting => Loc.Localize("InstallerNoPluginsTesting", "You aren't testing any plugins at the moment!\nYou can opt in to testing versions in the plugin context menu.");
|
||||||
|
|
||||||
|
public static string TabBody_NoPluginsInstalled =>
|
||||||
|
string.Format(Loc.Localize("InstallerNoPluginsInstalled", "You don't have any plugins installed yet!\nYou can install them from the \"{0}\" tab."), PluginCategoryManager.Locs.Category_All);
|
||||||
|
|
||||||
|
public static string TabBody_NoPluginsUpdateable => Loc.Localize("InstallerNoPluginsUpdate", "No plugins have updates available at the moment.");
|
||||||
|
|
||||||
|
public static string TabBody_NoPluginsDev => Loc.Localize("InstallerNoPluginsDev", "You don't have any dev plugins. Add them some the settings.");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Search text
|
#region Search text
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,17 @@ internal class AutoUpdateManager : IServiceType
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void DrawOpenInstallerNotificationButton(bool primary, IActiveNotification notification)
|
||||||
|
{
|
||||||
|
if (primary ?
|
||||||
|
DalamudComponents.PrimaryButton(Locs.NotificationButtonOpenPluginInstaller) :
|
||||||
|
DalamudComponents.SecondaryButton(Locs.NotificationButtonOpenPluginInstaller))
|
||||||
|
{
|
||||||
|
Service<DalamudInterface>.Get().OpenPluginInstallerTo(PluginInstallerOpenKind.UpdateablePlugins);
|
||||||
|
notification.DismissNow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnUpdate(IFramework framework)
|
private void OnUpdate(IFramework framework)
|
||||||
{
|
{
|
||||||
if (this.loginTime == null)
|
if (this.loginTime == null)
|
||||||
|
|
@ -293,11 +304,7 @@ internal class AutoUpdateManager : IServiceType
|
||||||
notification.DrawActions += _ =>
|
notification.DrawActions += _ =>
|
||||||
{
|
{
|
||||||
ImGuiHelpers.ScaledDummy(2);
|
ImGuiHelpers.ScaledDummy(2);
|
||||||
if (DalamudComponents.PrimaryButton(Locs.NotificationButtonOpenPluginInstaller))
|
DrawOpenInstallerNotificationButton(true, notification);
|
||||||
{
|
|
||||||
Service<DalamudInterface>.Get().OpenPluginInstaller();
|
|
||||||
notification.DismissNow();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update the notification to show the final state
|
// Update the notification to show the final state
|
||||||
|
|
@ -356,11 +363,7 @@ internal class AutoUpdateManager : IServiceType
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (DalamudComponents.SecondaryButton(Locs.NotificationButtonOpenPluginInstaller))
|
DrawOpenInstallerNotificationButton(false, notification);
|
||||||
{
|
|
||||||
Service<DalamudInterface>.Get().OpenPluginInstaller();
|
|
||||||
notification.DismissNow();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue