rename the value changed signal to ui_changed
This commit is contained in:
2026-02-14 14:31:06 +01:00
parent 24f7aa981e
commit 59c2303ce0
12 changed files with 38 additions and 38 deletions
+2 -2
View File
@@ -17,14 +17,14 @@ UI_checkbox::UI_checkbox(const json &j, QObject *parent) : UI_item(UI_CHECKBOX_T
void UI_checkbox::click() void UI_checkbox::click()
{ {
m_checked = !m_checked; m_checked = !m_checked;
emit value_changed(); emit ui_changed();
emit on_change(m_checked); emit on_change(m_checked);
} }
void UI_checkbox::set_state(bool state) void UI_checkbox::set_state(bool state)
{ {
m_checked = state; m_checked = state;
emit value_changed(); emit ui_changed();
emit on_change(m_checked); emit on_change(m_checked);
} }
+1 -1
View File
@@ -20,7 +20,7 @@ void UI_combobox::set_selected(size_t selected)
if (selected == m_selected) if (selected == m_selected)
return; return;
m_selected = selected; m_selected = selected;
emit value_changed(); emit ui_changed();
emit changed(selected_text()); emit changed(selected_text());
} }
+1 -1
View File
@@ -35,7 +35,7 @@ void UI_dial::set_value(double value)
return; return;
this->m_value = value; this->m_value = value;
emit value_changed(); emit ui_changed();
} }
double UI_dial::value() const double UI_dial::value() const
+7 -7
View File
@@ -40,14 +40,14 @@ void UI_item::set_text(std::string text)
if (this->m_text != text) if (this->m_text != text)
{ {
this->m_text = text; this->m_text = text;
emit value_changed(); emit ui_changed();
} }
} }
void UI_item::append_text(std::string text) void UI_item::append_text(std::string text)
{ {
m_text.append(text); m_text.append(text);
emit value_changed(); emit ui_changed();
} }
std::string UI_item::text() const std::string UI_item::text() const
@@ -60,7 +60,7 @@ void UI_item::set_text_size(uint8_t text_size)
if (this->m_text_size != text_size) if (this->m_text_size != text_size)
{ {
this->m_text_size = text_size; this->m_text_size = text_size;
emit value_changed(); emit ui_changed();
} }
} }
@@ -74,7 +74,7 @@ void UI_item::set_fg_color(Color fg_color)
if (this->m_fg_color != fg_color) if (this->m_fg_color != fg_color)
{ {
this->m_fg_color = fg_color; this->m_fg_color = fg_color;
emit value_changed(); emit ui_changed();
} }
} }
@@ -88,7 +88,7 @@ void UI_item::set_bg_color(Color bg_color)
if (this->m_bg_color != bg_color) if (this->m_bg_color != bg_color)
{ {
this->m_bg_color = bg_color; this->m_bg_color = bg_color;
emit value_changed(); emit ui_changed();
} }
} }
@@ -102,7 +102,7 @@ void UI_item::set_enabled(bool enabled)
if (this->enabled != enabled) if (this->enabled != enabled)
{ {
this->enabled = enabled; this->enabled = enabled;
emit value_changed(); emit ui_changed();
} }
} }
@@ -116,7 +116,7 @@ void UI_item::set_visible(bool visible)
if (this->visible != visible) if (this->visible != visible)
{ {
this->visible = visible; this->visible = visible;
emit value_changed(); emit ui_changed();
} }
} }
+1 -1
View File
@@ -55,7 +55,7 @@ class UI_item : public QObject
virtual void can_clear(); virtual void can_clear();
signals: signals:
void value_changed(); void ui_changed();
protected: protected:
size_t m_id; size_t m_id;
+5 -5
View File
@@ -19,7 +19,7 @@ void UI_plot::set_x_label(std::string name)
{ {
m_x_label = name; m_x_label = name;
emit value_changed(); emit ui_changed();
} }
std::string UI_plot::x_label() const std::string UI_plot::x_label() const
@@ -31,7 +31,7 @@ void UI_plot::set_y_label(std::string name)
{ {
m_y_label = name; m_y_label = name;
emit value_changed(); emit ui_changed();
} }
std::string UI_plot::y_label() const std::string UI_plot::y_label() const
@@ -44,7 +44,7 @@ void UI_plot::add_value(double y)
m_x_vals.push_back((double)m_x_vals.size()); m_x_vals.push_back((double)m_x_vals.size());
m_y_vals.push_back(y); m_y_vals.push_back(y);
emit value_changed(); emit ui_changed();
} }
void UI_plot::add_value(double x, double y) void UI_plot::add_value(double x, double y)
@@ -52,7 +52,7 @@ void UI_plot::add_value(double x, double y)
m_x_vals.push_back(x); m_x_vals.push_back(x);
m_y_vals.push_back(y); m_y_vals.push_back(y);
emit value_changed(); emit ui_changed();
} }
void UI_plot::clean_vals() void UI_plot::clean_vals()
@@ -60,7 +60,7 @@ void UI_plot::clean_vals()
m_x_vals.clear(); m_x_vals.clear();
m_y_vals.clear(); m_y_vals.clear();
emit value_changed(); emit ui_changed();
} }
void UI_plot::from_json(const json &j) void UI_plot::from_json(const json &j)
+1 -1
View File
@@ -36,7 +36,7 @@ void UI_slider::set_value(double value)
return; return;
this->m_value = value; this->m_value = value;
emit value_changed(); emit ui_changed();
emit changed(m_value); emit changed(m_value);
} }
+6 -6
View File
@@ -22,7 +22,7 @@ void UI_table::set_row_count(size_t count)
m_valid.resize(m_column_count * m_row_count); m_valid.resize(m_column_count * m_row_count);
} }
emit value_changed(); emit ui_changed();
} }
size_t UI_table::row_count() const size_t UI_table::row_count() const
@@ -39,7 +39,7 @@ void UI_table::set_column_count(size_t count)
m_valid.resize(m_column_count * m_row_count); m_valid.resize(m_column_count * m_row_count);
} }
emit value_changed(); emit ui_changed();
} }
size_t UI_table::column_count() const size_t UI_table::column_count() const
@@ -61,7 +61,7 @@ void UI_table::set_row_label(size_t index, std::string label)
m_row_labels[index] = label; m_row_labels[index] = label;
emit value_changed(); emit ui_changed();
} }
std::string UI_table::row_label(size_t index) const std::string UI_table::row_label(size_t index) const
@@ -83,7 +83,7 @@ void UI_table::set_column_label(size_t index, std::string label)
m_column_labels[index] = label; m_column_labels[index] = label;
emit value_changed(); emit ui_changed();
} }
std::string UI_table::column_label(size_t index) const std::string UI_table::column_label(size_t index) const
@@ -115,7 +115,7 @@ void UI_table::insert_item(size_t row, size_t column, std::string text)
m_table.at(index) = text; m_table.at(index) = text;
m_valid.at(index) = true; m_valid.at(index) = true;
emit value_changed(); emit ui_changed();
} }
void UI_table::empty_item(size_t row, size_t column) void UI_table::empty_item(size_t row, size_t column)
@@ -125,7 +125,7 @@ void UI_table::empty_item(size_t row, size_t column)
m_table[index] = ""; m_table[index] = "";
m_valid[index] = false; m_valid[index] = false;
emit value_changed(); emit ui_changed();
} }
void UI_table::from_json(const json &j) void UI_table::from_json(const json &j)
+2 -2
View File
@@ -15,14 +15,14 @@ void UI_textbox::set_text(std::string text)
if (text == m_text) if (text == m_text)
return; return;
m_text = text; m_text = text;
emit value_changed(); emit ui_changed();
emit on_change(m_text); emit on_change(m_text);
} }
void UI_textbox::set_hint(std::string hint) void UI_textbox::set_hint(std::string hint)
{ {
m_hint = hint; m_hint = hint;
emit value_changed(); emit ui_changed();
} }
std::string UI_textbox::hint() const std::string UI_textbox::hint() const
+7 -7
View File
@@ -36,7 +36,7 @@ void UI_thermo::set_value(double value)
return; return;
this->m_value = value; this->m_value = value;
emit value_changed(); emit ui_changed();
} }
double UI_thermo::value() const double UI_thermo::value() const
@@ -57,13 +57,13 @@ double UI_thermo::max() const
void UI_thermo::set_start_color(Color color) void UI_thermo::set_start_color(Color color)
{ {
this->m_color_map[0] = color; this->m_color_map[0] = color;
emit value_changed(); emit ui_changed();
} }
void UI_thermo::set_end_color(Color color) void UI_thermo::set_end_color(Color color)
{ {
this->m_color_map[1] = color; this->m_color_map[1] = color;
emit value_changed(); emit ui_changed();
} }
void UI_thermo::add_color_stop(double value, Color color) void UI_thermo::add_color_stop(double value, Color color)
@@ -72,7 +72,7 @@ void UI_thermo::add_color_stop(double value, Color color)
return; return;
this->m_color_map[value] = color; this->m_color_map[value] = color;
emit value_changed(); emit ui_changed();
} }
void UI_thermo::add_color_stop_normalized(double value, Color color) void UI_thermo::add_color_stop_normalized(double value, Color color)
@@ -82,7 +82,7 @@ void UI_thermo::add_color_stop_normalized(double value, Color color)
double normalized = (value - m_min) / (m_max - m_min); double normalized = (value - m_min) / (m_max - m_min);
this->m_color_map[normalized] = color; this->m_color_map[normalized] = color;
emit value_changed(); emit ui_changed();
} }
void UI_thermo::remove_color_stop(double value) void UI_thermo::remove_color_stop(double value)
@@ -91,7 +91,7 @@ void UI_thermo::remove_color_stop(double value)
return; return;
this->m_color_map.erase(value); this->m_color_map.erase(value);
emit value_changed(); emit ui_changed();
} }
void UI_thermo::remove_color_stop_normalized(double value) void UI_thermo::remove_color_stop_normalized(double value)
@@ -101,7 +101,7 @@ void UI_thermo::remove_color_stop_normalized(double value)
double normalized = (value - m_min) / (m_max - m_min); double normalized = (value - m_min) / (m_max - m_min);
this->m_color_map.erase(normalized); this->m_color_map.erase(normalized);
emit value_changed(); emit ui_changed();
} }
void UI_thermo::from_json(const json &j) void UI_thermo::from_json(const json &j)
+4 -4
View File
@@ -27,7 +27,7 @@ void UI_can::add_send_message(QCanBusFrame msg)
CanFrame frame(msg.frameId(), (uint8_t)msg.payload().size(), CanFrame frame(msg.frameId(), (uint8_t)msg.payload().size(),
ByteArrayToStdArray<std::array<uint8_t, 8>>(msg.payload())); ByteArrayToStdArray<std::array<uint8_t, 8>>(msg.payload()));
m_can_send_messages.push_back(frame); m_can_send_messages.push_back(frame);
emit value_changed(); emit ui_changed();
} }
void UI_can::add_received_message(QCanBusFrame msg) void UI_can::add_received_message(QCanBusFrame msg)
@@ -35,19 +35,19 @@ void UI_can::add_received_message(QCanBusFrame msg)
CanFrame frame(msg.frameId(), (uint8_t)msg.payload().size(), CanFrame frame(msg.frameId(), (uint8_t)msg.payload().size(),
ByteArrayToStdArray<std::array<uint8_t, 8>>(msg.payload())); ByteArrayToStdArray<std::array<uint8_t, 8>>(msg.payload()));
m_can_received_messages.push_back(frame); m_can_received_messages.push_back(frame);
emit value_changed(); emit ui_changed();
} }
void UI_can::clear_send_buffer() void UI_can::clear_send_buffer()
{ {
m_can_send_messages.clear(); m_can_send_messages.clear();
emit value_changed(); emit ui_changed();
} }
void UI_can::clear_receive_buffer() void UI_can::clear_receive_buffer()
{ {
m_can_received_messages.clear(); m_can_received_messages.clear();
emit value_changed(); emit ui_changed();
} }
void UI_can::can_clear() void UI_can::can_clear()
+1 -1
View File
@@ -18,7 +18,7 @@ std::string Simulator_base::name() const
void Simulator_base::push_ui_item(UI_item *item) void Simulator_base::push_ui_item(UI_item *item)
{ {
// Add a UI item to the simulator // Add a UI item to the simulator
connect(item, &UI_item::value_changed, this, [this] { emit sim_changed(); }); connect(item, &UI_item::ui_changed, this, [this] { emit sim_changed(); });
m_UI_items.push_back(item); m_UI_items.push_back(item);
} }