MCPcopy Create free account
hub / github.com/OpenBoardView/OpenBoardView / writeToConfig

Method writeToConfig

src/openboardview/UI/Keyboard/KeyBindings.cpp:143–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void 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
175std::string KeyBindings::getKeyNames(const std::string &bindname) const {
176 std::string str{};

Callers

nothing calls this directly

Calls 3

getModifiersMethod · 0.80
getKeyMethod · 0.80
WriteStrMethod · 0.80

Tested by

no test coverage detected