mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Rename all member functions from p_ to m_
This commit is contained in:
+28
-28
@@ -1,12 +1,12 @@
|
||||
#include "UI_item.hpp"
|
||||
|
||||
UI_item::UI_item(std::string id, std::string type, std::string text, uint8_t text_size, Color fg_color, Color bg_color)
|
||||
: p_id(id), p_type(type), p_text(text), p_text_size(text_size), p_fg_color(fg_color), p_bg_color(bg_color)
|
||||
: m_id(id), m_type(type), m_text(text), m_text_size(text_size), m_fg_color(fg_color), m_bg_color(bg_color)
|
||||
{
|
||||
}
|
||||
|
||||
UI_item::UI_item(std::string type)
|
||||
: p_id(""), p_type(type), p_text(""), p_text_size(12), p_fg_color(Color::Black), p_bg_color(Color::White)
|
||||
: m_id(""), m_type(type), m_text(""), m_text_size(12), m_fg_color(Color::Black), m_bg_color(Color::White)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ UI_item::UI_item(const json& j)
|
||||
|
||||
std::string UI_item::id() const
|
||||
{
|
||||
return p_id;
|
||||
return m_id;
|
||||
}
|
||||
|
||||
std::string UI_item::type() const
|
||||
{
|
||||
return p_type;
|
||||
return m_type;
|
||||
}
|
||||
|
||||
bool UI_item::is_type(json j)
|
||||
@@ -31,59 +31,59 @@ bool UI_item::is_type(json j)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return j.at("type") == p_type;
|
||||
return j.at("type") == m_type;
|
||||
}
|
||||
|
||||
void UI_item::set_text(std::string text)
|
||||
{
|
||||
if (this->p_text != text)
|
||||
if (this->m_text != text)
|
||||
{
|
||||
this->p_text = text;
|
||||
this->m_text = text;
|
||||
}
|
||||
}
|
||||
|
||||
std::string UI_item::text() const
|
||||
{
|
||||
return p_text;
|
||||
return m_text;
|
||||
}
|
||||
|
||||
void UI_item::set_text_size(uint8_t text_size)
|
||||
{
|
||||
if (this->p_text_size != text_size)
|
||||
if (this->m_text_size != text_size)
|
||||
{
|
||||
this->p_text_size = text_size;
|
||||
this->m_text_size = text_size;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t UI_item::text_size() const
|
||||
{
|
||||
return p_text_size;
|
||||
return m_text_size;
|
||||
}
|
||||
|
||||
void UI_item::set_fg_color(Color fg_color)
|
||||
{
|
||||
if (this->p_fg_color != fg_color)
|
||||
if (this->m_fg_color != fg_color)
|
||||
{
|
||||
this->p_fg_color = fg_color;
|
||||
this->m_fg_color = fg_color;
|
||||
}
|
||||
}
|
||||
|
||||
Color UI_item::fg_color() const
|
||||
{
|
||||
return p_fg_color;
|
||||
return m_fg_color;
|
||||
}
|
||||
|
||||
void UI_item::set_bg_color(Color bg_color)
|
||||
{
|
||||
if (this->p_bg_color != bg_color)
|
||||
if (this->m_bg_color != bg_color)
|
||||
{
|
||||
this->p_bg_color = bg_color;
|
||||
this->m_bg_color = bg_color;
|
||||
}
|
||||
}
|
||||
|
||||
Color UI_item::bg_color() const
|
||||
{
|
||||
return p_bg_color;
|
||||
return m_bg_color;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,25 +91,25 @@ void UI_item::from_json(const json& j)
|
||||
{
|
||||
if (!is_type(j))
|
||||
return;
|
||||
j.at("id").get_to(p_id);
|
||||
j.at("text").get_to(p_text);
|
||||
j.at("text_size").get_to(p_text_size);
|
||||
j.at("id").get_to(m_id);
|
||||
j.at("text").get_to(m_text);
|
||||
j.at("text_size").get_to(m_text_size);
|
||||
std::string color;
|
||||
j.at("fg_color").get_to(color);
|
||||
p_fg_color = Color(color);
|
||||
m_fg_color = Color(color);
|
||||
color.clear();
|
||||
j.at("bg_color").get_to(color);
|
||||
p_bg_color = Color(color);
|
||||
m_bg_color = Color(color);
|
||||
}
|
||||
|
||||
json UI_item::to_json() const
|
||||
{
|
||||
json j;
|
||||
j["id"] = p_id;
|
||||
j["type"] = p_type;
|
||||
j["text"] = p_text;
|
||||
j["text_size"] = p_text_size;
|
||||
j["fg_color"] = p_fg_color.to_hex();
|
||||
j["bg_color"] = p_bg_color.to_hex();
|
||||
j["id"] = m_id;
|
||||
j["type"] = m_type;
|
||||
j["text"] = m_text;
|
||||
j["text_size"] = m_text_size;
|
||||
j["fg_color"] = m_fg_color.to_hex();
|
||||
j["bg_color"] = m_bg_color.to_hex();
|
||||
return j;
|
||||
}
|
||||
Reference in New Issue
Block a user