| 318 | } |
| 319 | |
| 320 | static QString mapIdToLocale(const TransformSetting &setting) |
| 321 | { |
| 322 | static const std::unordered_map<std::string_view, std::string_view> |
| 323 | idMap = { |
| 324 | {"alignment", |
| 325 | "AdvSceneSwitcher.setting.transform.alignment"}, |
| 326 | {"bottom", |
| 327 | "AdvSceneSwitcher.setting.transform.cropBottom"}, |
| 328 | {"left", "AdvSceneSwitcher.setting.transform.cropLeft"}, |
| 329 | {"right", |
| 330 | "AdvSceneSwitcher.setting.transform.cropRight"}, |
| 331 | {"top", "AdvSceneSwitcher.setting.transform.cropTop"}, |
| 332 | {"bounds_alignment", |
| 333 | "AdvSceneSwitcher.setting.transform.boundingBoxAlign"}, |
| 334 | {"bounds_type", |
| 335 | "AdvSceneSwitcher.setting.transform.boundingBoxType"}, |
| 336 | {"rot", "AdvSceneSwitcher.setting.transform.rotation"}, |
| 337 | {"height", "AdvSceneSwitcher.setting.transform.height"}, |
| 338 | {"width", "AdvSceneSwitcher.setting.transform.width"}, |
| 339 | {"x", "x"}, |
| 340 | {"y", "y"}, |
| 341 | }; |
| 342 | |
| 343 | static const std::unordered_map<std::string_view, std::string_view> |
| 344 | nestedIdMap = { |
| 345 | {"bounds", |
| 346 | "AdvSceneSwitcher.setting.transform.boundingBoxSize"}, |
| 347 | {"pos", "AdvSceneSwitcher.setting.transform.position"}, |
| 348 | {"scale", "AdvSceneSwitcher.setting.transform.scale"}, |
| 349 | {"size", "AdvSceneSwitcher.setting.transform.size"}, |
| 350 | }; |
| 351 | |
| 352 | auto idNameIt = idMap.find(setting.GetID()); |
| 353 | QString name = idNameIt == idMap.end() |
| 354 | ? QString::fromStdString(setting.GetID()) |
| 355 | : obs_module_text(idNameIt->second.data()); |
| 356 | |
| 357 | if (!setting.GetNestedID().empty()) { |
| 358 | auto idNameIt = nestedIdMap.find(setting.GetNestedID()); |
| 359 | const auto nestedName = |
| 360 | idNameIt == nestedIdMap.end() |
| 361 | ? QString::fromStdString(setting.GetID()) |
| 362 | : obs_module_text(idNameIt->second.data()); |
| 363 | name = "[" + nestedName + "] " + name; |
| 364 | } |
| 365 | return name; |
| 366 | } |
| 367 | |
| 368 | void TransformSettingSelection::Populate(obs_scene_item *source) |
| 369 | { |
no test coverage detected