mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 06:13:40 +01:00
Extract DeletePlugin from dev, show if outdated or dev
This commit is contained in:
parent
cb1761f998
commit
f1e5a21494
1 changed files with 32 additions and 25 deletions
|
|
@ -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,33 +1454,40 @@ 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();
|
||||||
|
if (ImGuiComponents.IconButton(FontAwesomeIcon.TrashAlt))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
ImGui.SameLine();
|
plugin.DllFile.Delete();
|
||||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.TrashAlt))
|
pluginManager.RemovePlugin(plugin);
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
plugin.DllFile.Delete();
|
|
||||||
pluginManager.RemovePlugin(plugin);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Log.Error(ex, $"Plugin installer threw an error during removal of {plugin.Name}");
|
|
||||||
|
|
||||||
this.errorModalMessage = Locs.ErrorModal_DeleteFail(plugin.Name);
|
|
||||||
this.errorModalDrawing = true;
|
|
||||||
this.errorModalOnNextFrame = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
|
||||||
{
|
|
||||||
ImGui.SetTooltip(Locs.PluginBody_DeleteDevPlugin);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Plugin installer threw an error during removal of {plugin.Name}");
|
||||||
|
|
||||||
|
this.errorModalMessage = Locs.ErrorModal_DeleteFail(plugin.Name);
|
||||||
|
this.errorModalDrawing = true;
|
||||||
|
this.errorModalOnNextFrame = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.IsItemHovered())
|
||||||
|
{
|
||||||
|
ImGui.SetTooltip(Locs.PluginButtonToolTip_DeletePlugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue