Extract DeletePlugin from dev, show if outdated or dev

This commit is contained in:
Raymond 2021-09-20 16:32:47 -04:00
parent cb1761f998
commit f1e5a21494

View file

@ -1201,6 +1201,7 @@ namespace Dalamud.Interface.Internal.Windows
// Controls // Controls
this.DrawPluginControlButton(plugin); this.DrawPluginControlButton(plugin);
this.DrawDevPluginButtons(plugin); this.DrawDevPluginButtons(plugin);
this.DrawDeletePluginButton(plugin);
this.DrawVisitRepoUrlButton(plugin.Manifest.RepoUrl); this.DrawVisitRepoUrlButton(plugin.Manifest.RepoUrl);
if (availablePluginUpdate != default) if (availablePluginUpdate != default)
@ -1411,7 +1412,6 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawDevPluginButtons(LocalPlugin localPlugin) private void DrawDevPluginButtons(LocalPlugin localPlugin)
{ {
var configuration = Service<DalamudConfiguration>.Get(); var configuration = Service<DalamudConfiguration>.Get();
var pluginManager = Service<PluginManager>.Get();
if (localPlugin is LocalDevPlugin plugin) if (localPlugin is LocalDevPlugin plugin)
{ {
@ -1454,10 +1454,19 @@ namespace Dalamud.Interface.Internal.Windows
{ {
ImGui.SetTooltip(Locs.PluginButtonToolTip_AutomaticReloading); ImGui.SetTooltip(Locs.PluginButtonToolTip_AutomaticReloading);
} }
}
}
// Delete private void DrawDeletePluginButton(LocalPlugin plugin)
if (plugin.State == PluginState.Unloaded)
{ {
var unloaded = plugin.State == PluginState.Unloaded;
var showButton = unloaded && (plugin.IsDev || plugin.IsOutdated);
if (!showButton)
return;
var pluginManager = Service<PluginManager>.Get();
ImGui.SameLine(); ImGui.SameLine();
if (ImGuiComponents.IconButton(FontAwesomeIcon.TrashAlt)) if (ImGuiComponents.IconButton(FontAwesomeIcon.TrashAlt))
{ {
@ -1478,9 +1487,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
{ {
ImGui.SetTooltip(Locs.PluginBody_DeleteDevPlugin); ImGui.SetTooltip(Locs.PluginButtonToolTip_DeletePlugin);
}
}
} }
} }