Move to id is size_t

This commit is contained in:
2024-10-10 19:47:18 +02:00
parent d02b31ab25
commit 95a21250a6
27 changed files with 132 additions and 148 deletions
+10 -10
View File
@@ -30,9 +30,9 @@ json Simulators::command_parser(json command)
switch (cmd)
{
case Command::get_UI_element:
spdlog::info("Command {}: {}", type, std::string(command.at("id")));
spdlog::info("Command {}: {}", type, (size_t)command.at("id"));
j["response"]["type"] = type;
j["response"]["UI_item"] = invoke_active_simulator()->get_UI_item(command.at("id"))->to_json();
j["response"]["UI_item"] = invoke_active_simulator()->get_UI_item(command.at("id"))->to_json(command.at("id"));
break;
case Command::get_UI_elements:
spdlog::info("Command {}", type);
@@ -81,26 +81,26 @@ void Simulators::event_handler(json event)
switch (e)
{
case Event::clicked: {
spdlog::debug("Event {}: {}", type, std::string(event.at("id")));
invoke_active_simulator()->get_UI_item(std::string(event.at("id")))->click();
spdlog::debug("Event {}: {}", type, (size_t)event.at("id"));
invoke_active_simulator()->get_UI_item(event.at("id"))->click();
break;
}
case Event::value_changed: {
spdlog::debug("Event {}: {} {}", type, std::string(event.at("id")), (double)(event["value"]));
invoke_active_simulator()->get_UI_item(std::string(event.at("id")))->set_value((double)event.at("value"));
spdlog::debug("Event {}: {} {}", type, (size_t)event.at("id"), (double)(event["value"]));
invoke_active_simulator()->get_UI_item(event.at("id"))->set_value((double)event.at("value"));
break;
}
case Event::text_changed: {
spdlog::debug("Event {}: {} {}", type, std::string(event.at("id")), std::string(event.at("text")));
spdlog::debug("Event {}: {} {}", type, (size_t)event.at("id"), std::string(event.at("text")));
invoke_active_simulator()
->get_UI_item(std::string(event.at("id")))
->get_UI_item(event.at("id"))
->set_text(std::string(event.at("text")));
break;
}
case Event::selected: {
spdlog::debug("Event {}: {} {}", type, std::string(event.at("id")), std::string(event.at("selected")));
spdlog::debug("Event {}: {} {}", type, (size_t)event.at("id"), std::string(event.at("selected")));
invoke_active_simulator()
->get_UI_item(std::string(event.at("id")))
->get_UI_item(event.at("id"))
->set_selected(std::string(event.at("selected")));
break;
}