feat: integrate keybinding customization UI into Settings window

- Extended KeybindingManager enum with TOGGLE_GUILD_ROSTER (O) and
  TOGGLE_DUNGEON_FINDER (J) to replace hard-coded key checks
- Added Controls tab in Settings UI for rebinding all 10 customizable actions
- Implemented real-time key capture and binding with visual feedback
- Integrated keybinding persistence with main settings.cfg file
- Replaced hard-coded O key (Guild Roster) and I key (Dungeon Finder) checks
  with KeybindingManager::isActionPressed() calls
- Added Reset to Defaults button for restoring original keybindings
This commit is contained in:
Kelsi 2026-03-11 06:51:48 -07:00
parent e6741f815a
commit f7a79b436e
4 changed files with 130 additions and 4 deletions

View file

@ -24,6 +24,8 @@ void KeybindingManager::initializeDefaults() {
bindings_[static_cast<int>(Action::TOGGLE_MINIMAP)] = ImGuiKey_M;
bindings_[static_cast<int>(Action::TOGGLE_SETTINGS)] = ImGuiKey_Escape;
bindings_[static_cast<int>(Action::TOGGLE_CHAT)] = ImGuiKey_Enter;
bindings_[static_cast<int>(Action::TOGGLE_GUILD_ROSTER)] = ImGuiKey_O;
bindings_[static_cast<int>(Action::TOGGLE_DUNGEON_FINDER)] = ImGuiKey_J; // Originally I, reassigned to avoid conflict
}
bool KeybindingManager::isActionPressed(Action action, bool repeat) {
@ -57,6 +59,8 @@ const char* KeybindingManager::getActionName(Action action) {
case Action::TOGGLE_MINIMAP: return "Minimap";
case Action::TOGGLE_SETTINGS: return "Settings";
case Action::TOGGLE_CHAT: return "Chat";
case Action::TOGGLE_GUILD_ROSTER: return "Guild Roster / Social";
case Action::TOGGLE_DUNGEON_FINDER: return "Dungeon Finder";
case Action::ACTION_COUNT: break;
}
return "Unknown";
@ -114,6 +118,8 @@ void KeybindingManager::loadFromConfigFile(const std::string& filePath) {
else if (action == "toggle_minimap") actionIdx = static_cast<int>(Action::TOGGLE_MINIMAP);
else if (action == "toggle_settings") actionIdx = static_cast<int>(Action::TOGGLE_SETTINGS);
else if (action == "toggle_chat") actionIdx = static_cast<int>(Action::TOGGLE_CHAT);
else if (action == "toggle_guild_roster") actionIdx = static_cast<int>(Action::TOGGLE_GUILD_ROSTER);
else if (action == "toggle_dungeon_finder") actionIdx = static_cast<int>(Action::TOGGLE_DUNGEON_FINDER);
if (actionIdx < 0) continue;
@ -198,6 +204,8 @@ void KeybindingManager::saveToConfigFile(const std::string& filePath) const {
{Action::TOGGLE_MINIMAP, "toggle_minimap"},
{Action::TOGGLE_SETTINGS, "toggle_settings"},
{Action::TOGGLE_CHAT, "toggle_chat"},
{Action::TOGGLE_GUILD_ROSTER, "toggle_guild_roster"},
{Action::TOGGLE_DUNGEON_FINDER, "toggle_dungeon_finder"},
};
for (const auto& [action, nameStr] : actionMap) {