fix bugs discovered by tests
This commit is contained in:
2024-08-27 15:20:13 +02:00
parent d47510f58f
commit 33add7b306
2 changed files with 11 additions and 1 deletions
+9
View File
@@ -52,6 +52,15 @@ std::string UI_combobox::selected_text() const
void UI_combobox::from_json(const json& j) void UI_combobox::from_json(const json& j)
{ {
UI_x_boxes::from_json(j); UI_x_boxes::from_json(j);
std::string selected_str = j.at("selected");
for (size_t i = 0; i < m_options.size(); i++)
{
if (m_options[i] == selected_str)
{
m_selected = i;
break;
}
}
} }
json UI_combobox::to_json() const json UI_combobox::to_json() const
+2 -1
View File
@@ -7,7 +7,8 @@ m_led_color(led_color)
} }
UI_led::UI_led(const json& j) : UI_item(j) UI_led::UI_led(const json& j) :
UI_item(UI_LED_TYPE)
{ {
from_json(j); from_json(j);
} }