| 141 | } |
| 142 | |
| 143 | void KeyBindings::writeToConfig(Confparse &obvconfig) { |
| 144 | for (auto &keybinding : keybindings) { |
| 145 | std::string line; |
| 146 | for (auto &kbs : keybinding.second) { |
| 147 | std::vector<ImGuiKey> keys = kbs.getModifiers(); |
| 148 | keys.push_back(kbs.getKey()); |
| 149 | |
| 150 | std::string keyNames; |
| 151 | |
| 152 | for (const auto &key: keys) { |
| 153 | std::string keyName = ImGui::GetKeyName(key); |
| 154 | |
| 155 | // Replace some keys with a serialization-compatible variant |
| 156 | auto serializedNameIt = serializeName.find(keyName); |
| 157 | if (serializedNameIt != serializeName.end()) { |
| 158 | keyName = serializedNameIt->second; |
| 159 | } |
| 160 | |
| 161 | if (!keyNames.empty()) { |
| 162 | keyNames += modifierSeparator; |
| 163 | } |
| 164 | keyNames += keyName; |
| 165 | } |
| 166 | |
| 167 | if (!line.empty()) |
| 168 | line += bindingSeparator; |
| 169 | line += keyNames; |
| 170 | } |
| 171 | obvconfig.WriteStr(("KeyBinding" + keybinding.first).c_str(), line.c_str()); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | std::string KeyBindings::getKeyNames(const std::string &bindname) const { |
| 176 | std::string str{}; |
nothing calls this directly
no test coverage detected