mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-29 11:59:21 +01:00
feat: move plugin update into separate function, add update button to applicable available plugin
This commit is contained in:
parent
83edcc583f
commit
12adc4099f
2 changed files with 92 additions and 66 deletions
|
|
@ -591,8 +591,9 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
label += Locs.PluginTitleMod_UnloadError;
|
||||
}
|
||||
|
||||
var availablePluginUpdate = this.pluginListUpdatable.FirstOrDefault(up => up.InstalledPlugin == plugin);
|
||||
// Update available
|
||||
if (this.pluginListUpdatable.FirstOrDefault(up => up.InstalledPlugin == plugin) != default)
|
||||
if (availablePluginUpdate != default)
|
||||
{
|
||||
label += Locs.PluginTitleMod_HasUpdate;
|
||||
}
|
||||
|
|
@ -676,6 +677,9 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
this.DrawDevPluginButtons(plugin);
|
||||
this.DrawVisitRepoUrlButton(plugin.Manifest.RepoUrl);
|
||||
|
||||
if (availablePluginUpdate != default)
|
||||
this.DrawUpdateSinglePluginButton(plugin, availablePluginUpdate);
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{plugin.Manifest.AssemblyVersion}");
|
||||
|
||||
|
|
@ -776,6 +780,19 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawUpdateSinglePluginButton(LocalPlugin plugin, AvailablePluginUpdate update)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Download))
|
||||
{
|
||||
this.dalamud.PluginManager.UpdateSinglePlugin(update, false);
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip(Locs.PluginButtonToolTip_UpdateSingle(update.UpdateManifest.AssemblyVersion.ToString()));
|
||||
}
|
||||
|
||||
private void DrawOpenPluginSettingsButton(LocalPlugin plugin)
|
||||
{
|
||||
if (plugin.DalamudInterface?.UiBuilder?.HasConfigUi ?? false)
|
||||
|
|
@ -1130,6 +1147,8 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
|
||||
public static string PluginButtonToolTip_VisitPluginUrl => Loc.Localize("InstallerVisitPluginUrl", "Visit plugin URL");
|
||||
|
||||
public static string PluginButtonToolTip_UpdateSingle(string version) => Loc.Localize("InstallerUpdateSingle", "Update to {0}").Format(version);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Footer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue