| 233 | } |
| 234 | |
| 235 | void Input::BindEntry::updated() { |
| 236 | auto config = Root::singleton().configuration(); |
| 237 | |
| 238 | JsonArray array; |
| 239 | for (auto const& bind : customBinds) |
| 240 | array.emplace_back(bindToJson(bind)); |
| 241 | |
| 242 | if (!config->get(InputBindingConfigRoot).isType(Json::Type::Object)) |
| 243 | config->set(InputBindingConfigRoot, JsonObject()); |
| 244 | |
| 245 | String path = strf("{}.{}", InputBindingConfigRoot, category->id); |
| 246 | if (!config->getPath(path).isType(Json::Type::Object)) { |
| 247 | config->setPath(path, JsonObject{ |
| 248 | { id, std::move(array) } |
| 249 | }); |
| 250 | } |
| 251 | else { |
| 252 | path = strf("{}.{}", path, id); |
| 253 | config->setPath(path, array); |
| 254 | } |
| 255 | |
| 256 | Input::singleton().rebuildMappings(); |
| 257 | } |
| 258 | |
| 259 | Input::BindRef::BindRef(BindEntry& bindEntry, KeyBind& keyBind) { |
| 260 | entry = &bindEntry; |
no test coverage detected