| 275 | } |
| 276 | |
| 277 | Input::BindCategory::BindCategory(String categoryId, Json const& categoryConfig) { |
| 278 | id = categoryId; |
| 279 | config = categoryConfig; |
| 280 | name = config.getString("name", id); |
| 281 | |
| 282 | ConfigurationPtr userConfig = Root::singletonPtr()->configuration(); |
| 283 | auto userBindings = userConfig->get(InputBindingConfigRoot); |
| 284 | |
| 285 | for (auto& pair : config.getObject("binds", {})) { |
| 286 | String const& bindId = pair.first; |
| 287 | Json const& bindConfig = pair.second; |
| 288 | if (!bindConfig.isType(Json::Type::Object)) |
| 289 | continue; |
| 290 | |
| 291 | BindEntry& entry = entries.try_emplace(bindId, bindId, bindConfig, *this).first->second; |
| 292 | |
| 293 | if (userBindings.isType(Json::Type::Object)) { |
| 294 | for (auto& jBind : userBindings.queryArray(strf("{}.{}", id, bindId), {})) { |
| 295 | try |
| 296 | { entry.customBinds.emplace_back(bindFromJson(jBind)); } |
| 297 | catch (JsonException const& e) |
| 298 | { Logger::error("Binds: Error loading user bind in {}.{}: {}", id, bindId, e.what()); } |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | if (entry.customBinds.empty()) |
| 303 | entry.customBinds = entry.defaultBinds; |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | List<Input::BindEntry*> Input::filterBindEntries(List<Input::BindRef> const& binds, KeyMod mods) const { |
| 308 | uint8_t maxPriority = 0; |
nothing calls this directly
no test coverage detected