impr: Add setting to disable resource usage display in footer
This commit is contained in:
parent
2b22a15e8c
commit
a1ef567ecd
@ -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",
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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 {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user