feat: add database details section to settings

Shows path to database (click to copy), database size, database log
size, message count.

Also adds a Ctrl+Shift button to wipe the database permanently. This is
performed by clearing the Messages collection and then rebuilding the
database, which brings it down to around 48KB on my machine (even with
many messages).
This commit is contained in:
Dean Sheather
2024-04-11 18:46:26 +10:00
parent 8b7a671e52
commit 715fb7aa5b
7 changed files with 265 additions and 15 deletions
+16
View File
@@ -234,6 +234,22 @@ internal static class ImGuiUtil {
return r;
}
internal static bool CtrlShiftButton(string label, string tooltip = "")
{
var io = ImGui.GetIO();
var ctrlShiftHeld = io.KeyCtrl && io.KeyShift;
if (!ctrlShiftHeld) ImGui.BeginDisabled();
var ret = ImGui.Button(label) && ctrlShiftHeld;
if (!ctrlShiftHeld) ImGui.EndDisabled();
if (!string.IsNullOrEmpty(tooltip) && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) {
ImGui.BeginTooltip();
ImGui.TextUnformatted(tooltip);
ImGui.EndTooltip();
}
return ret;
}
internal static bool TryToImGui(this VirtualKey key, out ImGuiKey result) {
result = key switch {
VirtualKey.NO_KEY => ImGuiKey.None,