Improve cleanup.

This commit is contained in:
Ottermandias 2025-02-03 17:43:44 +01:00
parent ec09a7eb0e
commit 4cc5041f0a
2 changed files with 154 additions and 49 deletions

View file

@ -797,7 +797,6 @@ public class SettingsTab : ITab, IUiService
ImGui.Separator();
DrawCleanupButtons();
ImGui.NewLine();
}
private void DrawCrashHandler()
@ -991,24 +990,39 @@ public class SettingsTab : ITab, IUiService
private void DrawCleanupButtons()
{
var enabled = _config.DeleteModModifier.IsActive();
if (_cleanupService.Progress is not 0.0 and not 1.0)
{
ImUtf8.ProgressBar((float)_cleanupService.Progress, new Vector2(200 * ImUtf8.GlobalScale, ImGui.GetFrameHeight()),
$"{_cleanupService.Progress * 100}%");
ImGui.SameLine();
if (ImUtf8.Button("Cancel##FileCleanup"u8))
_cleanupService.Cancel();
}
else
{
ImGui.NewLine();
}
if (ImUtf8.ButtonEx("Clear Unused Local Mod Data Files"u8,
"Delete all local mod data files that do not correspond to currently installed mods."u8, default, !enabled))
"Delete all local mod data files that do not correspond to currently installed mods."u8, default,
!enabled || _cleanupService.IsRunning))
_cleanupService.CleanUnusedLocalData();
if (!enabled)
ImUtf8.HoverTooltip($"Hold {_config.DeleteModModifier} while clicking to delete files.");
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {_config.DeleteModModifier} while clicking to delete files.");
if (ImUtf8.ButtonEx("Clear Backup Files"u8,
"Delete all backups of .json configuration files in your configuration folder and all backups of mod group files in your mod directory."u8,
default, !enabled))
default, !enabled || _cleanupService.IsRunning))
_cleanupService.CleanBackupFiles();
if (!enabled)
ImUtf8.HoverTooltip($"Hold {_config.DeleteModModifier} while clicking to delete files.");
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {_config.DeleteModModifier} while clicking to delete files.");
if (ImUtf8.ButtonEx("Clear All Unused Settings"u8,
"Remove all mod settings in all of your collections that do not correspond to currently installed mods."u8, default, !enabled))
"Remove all mod settings in all of your collections that do not correspond to currently installed mods."u8, default,
!enabled || _cleanupService.IsRunning))
_cleanupService.CleanupAllUnusedSettings();
if (!enabled)
ImUtf8.HoverTooltip($"Hold {_config.DeleteModModifier} while clicking to remove settings.");
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {_config.DeleteModModifier} while clicking to remove settings.");
}
/// <summary> Draw a checkbox that toggles the dalamud setting to wait for plugins on open. </summary>