1
0
mirror of synced 2025-01-29 19:17:28 +01:00

impr: Add setting to disable resource usage display in footer

This commit is contained in:
WerWolv 2023-12-05 17:09:42 +01:00
parent 2b22a15e8c
commit a1ef567ecd
3 changed files with 16 additions and 1 deletions

View File

@ -18,6 +18,7 @@
"hex.windows.provider.process_memory.utils.inject_dll.success": "Successfully injected DLL '{0}'!",
"hex.windows.provider.process_memory.utils.inject_dll.failure": "Failed to inject DLL '{0}'!",
"hex.builtin.setting.general.context_menu_entry": "Windows context menu entry",
"hex.builtin.setting.interface.show_resource_usage": "Show resource usage in footer",
"hex.windows.view.tty_console.auto_scroll": "Auto scroll",
"hex.windows.view.tty_console.baud": "Baud rate",
"hex.windows.view.tty_console.clear": "Clear",

View File

@ -62,6 +62,8 @@ namespace hex::plugin::windows {
widget.load(hasImHexContextMenuEntry());
});
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window", "hex.builtin.setting.interface.show_resource_usage", true);
}
}

View File

@ -9,12 +9,21 @@
#include <hex/ui/imgui_imhex_extensions.h>
#include <fonts/fontawesome_font.h>
#include <hex/api/event_manager.hpp>
namespace hex::plugin::windows {
void addFooterItems() {
static bool showResourceUsage = true;
EventManager::subscribe<EventSettingsChanged>([]{
showResourceUsage = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.show_resource_usage", true);
});
ContentRegistry::Interface::addFooterItem([] {
if (!showResourceUsage)
return;
static float cpuUsage = 0.0F;
if (ImGuiExt::HasSecondPassed()) {
@ -65,6 +74,9 @@ namespace hex::plugin::windows {
});
ContentRegistry::Interface::addFooterItem([] {
if (!showResourceUsage)
return;
static MEMORYSTATUSEX memInfo;
static PROCESS_MEMORY_COUNTERS_EX pmc;
@ -81,4 +93,4 @@ namespace hex::plugin::windows {
});
}
}
}