mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
UI
move every from_json over to use at
This commit is contained in:
+3
-3
@@ -30,9 +30,9 @@ void UI_dial::from_json(const json& j)
|
|||||||
{
|
{
|
||||||
UI_item::from_json(j);
|
UI_item::from_json(j);
|
||||||
|
|
||||||
this->m_min = j["min"];
|
this->m_min = j.at("min");
|
||||||
this->m_max = j["max"];
|
this->m_max = j.at("max");
|
||||||
this->m_value = j["value"];
|
this->m_value = j.at("value");
|
||||||
}
|
}
|
||||||
|
|
||||||
json UI_dial::to_json() const
|
json UI_dial::to_json() const
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ void UI_slider::from_json(const json& j)
|
|||||||
{
|
{
|
||||||
UI_item::from_json(j);
|
UI_item::from_json(j);
|
||||||
|
|
||||||
this->m_min = j["min"];
|
this->m_min = j.at("min");
|
||||||
this->m_max = j["max"];
|
this->m_max = j.at("max");
|
||||||
this->m_value = j["value"];
|
this->m_value = j.at("value");
|
||||||
}
|
}
|
||||||
|
|
||||||
json UI_slider::to_json() const
|
json UI_slider::to_json() const
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ std::string UI_textbox::hint() const
|
|||||||
void UI_textbox::from_json(const json& j)
|
void UI_textbox::from_json(const json& j)
|
||||||
{
|
{
|
||||||
UI_item::from_json(j);
|
UI_item::from_json(j);
|
||||||
m_hint = j["hint"];
|
m_hint = j.at("hint");
|
||||||
}
|
}
|
||||||
|
|
||||||
json UI_textbox::to_json() const
|
json UI_textbox::to_json() const
|
||||||
|
|||||||
@@ -74,15 +74,14 @@ void UI_thermo::from_json(const json& j)
|
|||||||
{
|
{
|
||||||
UI_item::from_json(j);
|
UI_item::from_json(j);
|
||||||
|
|
||||||
this->m_min = j["min"];
|
this->m_min = j.at("min");
|
||||||
this->m_max = j["max"];
|
this->m_max = j.at("max");
|
||||||
this->m_value = j["value"];
|
this->m_value = j.at("value");
|
||||||
this->m_color_map.clear();
|
this->m_color_map.clear();
|
||||||
for (auto& i : j["color_map"])
|
for (auto& i : j["color_map"])
|
||||||
{
|
{
|
||||||
double k = i["key"];
|
double k = i.at("key");
|
||||||
std::string c;
|
std::string c = i.at("value");
|
||||||
i["value"].get_to(c);
|
|
||||||
this->m_color_map[k] = Color(c);
|
this->m_color_map[k] = Color(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user