From ce9c88ad04da4945bedd26628092427b32a046d8 Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Wed, 16 Apr 2025 19:07:48 +0200 Subject: [PATCH] rename ui --- UI/UI.hpp | 15 ------- UI/custom/{UI_can.cpp => ui_can.cpp} | 2 +- UI/custom/{UI_can.hpp => ui_can.hpp} | 4 +- UI/ui.hpp | 15 +++++++ UI/{UI_button.cpp => ui_button.cpp} | 2 +- UI/{UI_button.hpp => ui_button.hpp} | 4 +- UI/{UI_checkbox.cpp => ui_checkbox.cpp} | 2 +- UI/{UI_checkbox.hpp => ui_checkbox.hpp} | 4 +- UI/{UI_combobox.cpp => ui_combobox.cpp} | 2 +- UI/{UI_combobox.hpp => ui_combobox.hpp} | 6 +-- UI/{UI_dial.cpp => ui_dial.cpp} | 2 +- UI/{UI_dial.hpp => ui_dial.hpp} | 4 +- UI/{UI_item.cpp => ui_item.cpp} | 2 +- UI/{UI_item.hpp => ui_item.hpp} | 0 UI/{UI_label.cpp => ui_label.cpp} | 2 +- UI/{UI_label.hpp => ui_label.hpp} | 4 +- UI/{UI_led.cpp => ui_led.cpp} | 2 +- UI/{UI_led.hpp => ui_led.hpp} | 4 +- UI/{UI_plot.cpp => ui_plot.cpp} | 2 +- UI/{UI_plot.hpp => ui_plot.hpp} | 4 +- UI/{UI_slider.cpp => ui_slider.cpp} | 2 +- UI/{UI_slider.hpp => ui_slider.hpp} | 4 +- UI/ui_spinbox.cpp | 55 +++++++++++++++++++++++++ UI/ui_spinbox.hpp | 31 ++++++++++++++ UI/{UI_table.cpp => ui_table.cpp} | 2 +- UI/{UI_table.hpp => ui_table.hpp} | 4 +- UI/{UI_textbox.cpp => ui_textbox.cpp} | 2 +- UI/{UI_textbox.hpp => ui_textbox.hpp} | 4 +- UI/{UI_thermo.cpp => ui_thermo.cpp} | 2 +- UI/{UI_thermo.hpp => ui_thermo.hpp} | 4 +- UI/{UI_x_boxes.cpp => ui_x_boxes.cpp} | 2 +- UI/{UI_x_boxes.hpp => ui_x_boxes.hpp} | 2 +- client/simulator_base.cpp | 26 ++++++------ tests/Test.hpp | 4 +- tests/UI_label.cpp | 2 +- 35 files changed, 157 insertions(+), 71 deletions(-) delete mode 100644 UI/UI.hpp rename UI/custom/{UI_can.cpp => ui_can.cpp} (99%) rename UI/custom/{UI_can.hpp => ui_can.hpp} (93%) create mode 100644 UI/ui.hpp rename UI/{UI_button.cpp => ui_button.cpp} (95%) rename UI/{UI_button.hpp => ui_button.hpp} (84%) rename UI/{UI_checkbox.cpp => ui_checkbox.cpp} (97%) rename UI/{UI_checkbox.hpp => ui_checkbox.hpp} (87%) rename UI/{UI_combobox.cpp => ui_combobox.cpp} (98%) rename UI/{UI_combobox.hpp => ui_combobox.hpp} (87%) rename UI/{UI_dial.cpp => ui_dial.cpp} (98%) rename UI/{UI_dial.hpp => ui_dial.hpp} (93%) rename UI/{UI_item.cpp => ui_item.cpp} (99%) rename UI/{UI_item.hpp => ui_item.hpp} (100%) rename UI/{UI_label.cpp => ui_label.cpp} (94%) rename UI/{UI_label.hpp => ui_label.hpp} (82%) rename UI/{UI_led.cpp => ui_led.cpp} (96%) rename UI/{UI_led.hpp => ui_led.hpp} (86%) rename UI/{UI_plot.cpp => ui_plot.cpp} (98%) rename UI/{UI_plot.hpp => ui_plot.hpp} (93%) rename UI/{UI_slider.cpp => ui_slider.cpp} (98%) rename UI/{UI_slider.hpp => ui_slider.hpp} (93%) create mode 100644 UI/ui_spinbox.cpp create mode 100644 UI/ui_spinbox.hpp rename UI/{UI_table.cpp => ui_table.cpp} (99%) rename UI/{UI_table.hpp => ui_table.hpp} (95%) rename UI/{UI_textbox.cpp => ui_textbox.cpp} (96%) rename UI/{UI_textbox.hpp => ui_textbox.hpp} (87%) rename UI/{UI_thermo.cpp => ui_thermo.cpp} (99%) rename UI/{UI_thermo.hpp => ui_thermo.hpp} (94%) rename UI/{UI_x_boxes.cpp => ui_x_boxes.cpp} (96%) rename UI/{UI_x_boxes.hpp => ui_x_boxes.hpp} (95%) diff --git a/UI/UI.hpp b/UI/UI.hpp deleted file mode 100644 index e933d40..0000000 --- a/UI/UI.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "UI_button.hpp" -#include "UI_checkbox.hpp" -#include "UI_combobox.hpp" -#include "UI_dial.hpp" -#include "UI_label.hpp" -#include "UI_led.hpp" -#include "UI_plot.hpp" -#include "UI_slider.hpp" -#include "UI_table.hpp" -#include "UI_textbox.hpp" -#include "UI_thermo.hpp" - -#include "custom/UI_can.hpp" diff --git a/UI/custom/UI_can.cpp b/UI/custom/ui_can.cpp similarity index 99% rename from UI/custom/UI_can.cpp rename to UI/custom/ui_can.cpp index 8c0950b..135319e 100644 --- a/UI/custom/UI_can.cpp +++ b/UI/custom/ui_can.cpp @@ -1,4 +1,4 @@ -#include "UI_can.hpp" +#include "ui_can.hpp" template T ByteArrayToStdArray(const QByteArray &byteArray) { diff --git a/UI/custom/UI_can.hpp b/UI/custom/ui_can.hpp similarity index 93% rename from UI/custom/UI_can.hpp rename to UI/custom/ui_can.hpp index 77043ea..f191ffb 100644 --- a/UI/custom/UI_can.hpp +++ b/UI/custom/ui_can.hpp @@ -1,9 +1,9 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" #include -#define UI_CAN_TYPE std::string("UI_can") +#define UI_CAN_TYPE std::string("ui_can") class CanFrame { diff --git a/UI/ui.hpp b/UI/ui.hpp new file mode 100644 index 0000000..cee972a --- /dev/null +++ b/UI/ui.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include "ui_button.hpp" +#include "ui_checkbox.hpp" +#include "ui_combobox.hpp" +#include "ui_dial.hpp" +#include "ui_label.hpp" +#include "ui_led.hpp" +#include "ui_plot.hpp" +#include "ui_slider.hpp" +#include "ui_table.hpp" +#include "ui_textbox.hpp" +#include "ui_thermo.hpp" + +#include "custom/ui_can.hpp" diff --git a/UI/UI_button.cpp b/UI/ui_button.cpp similarity index 95% rename from UI/UI_button.cpp rename to UI/ui_button.cpp index 37cde3d..238bb01 100644 --- a/UI/UI_button.cpp +++ b/UI/ui_button.cpp @@ -1,4 +1,4 @@ -#include "UI_button.hpp" +#include "ui_button.hpp" UI_button::UI_button(std::string text, Color fg_color, Color bg_color, QObject *parent) : UI_item(UI_BUTTON_TYPE, text, 12, fg_color, bg_color, parent) diff --git a/UI/UI_button.hpp b/UI/ui_button.hpp similarity index 84% rename from UI/UI_button.hpp rename to UI/ui_button.hpp index 40a1aae..c31a82a 100644 --- a/UI/UI_button.hpp +++ b/UI/ui_button.hpp @@ -1,8 +1,8 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" -#define UI_BUTTON_TYPE std::string("UI_button") +#define UI_BUTTON_TYPE std::string("ui_button") class UI_button : public UI_item { diff --git a/UI/UI_checkbox.cpp b/UI/ui_checkbox.cpp similarity index 97% rename from UI/UI_checkbox.cpp rename to UI/ui_checkbox.cpp index f6b4e04..e2e7dcf 100644 --- a/UI/UI_checkbox.cpp +++ b/UI/ui_checkbox.cpp @@ -1,4 +1,4 @@ -#include "UI_checkbox.hpp" +#include "ui_checkbox.hpp" UI_checkbox::UI_checkbox(QObject *parent) : UI_item(UI_CHECKBOX_TYPE, parent), m_checked() { diff --git a/UI/UI_checkbox.hpp b/UI/ui_checkbox.hpp similarity index 87% rename from UI/UI_checkbox.hpp rename to UI/ui_checkbox.hpp index f18bdd1..a45c64a 100644 --- a/UI/UI_checkbox.hpp +++ b/UI/ui_checkbox.hpp @@ -1,8 +1,8 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" #include -#define UI_CHECKBOX_TYPE std::string("UI_checkbox") +#define UI_CHECKBOX_TYPE std::string("ui_checkbox") class UI_checkbox : public UI_item { diff --git a/UI/UI_combobox.cpp b/UI/ui_combobox.cpp similarity index 98% rename from UI/UI_combobox.cpp rename to UI/ui_combobox.cpp index 3fd2df7..6321a6a 100644 --- a/UI/UI_combobox.cpp +++ b/UI/ui_combobox.cpp @@ -1,4 +1,4 @@ -#include "UI_combobox.hpp" +#include "ui_combobox.hpp" UI_combobox::UI_combobox(QObject *parent) : UI_x_boxes(UI_COMBOBOX_TYPE, parent) { diff --git a/UI/UI_combobox.hpp b/UI/ui_combobox.hpp similarity index 87% rename from UI/UI_combobox.hpp rename to UI/ui_combobox.hpp index 230c702..e4f5ddf 100644 --- a/UI/UI_combobox.hpp +++ b/UI/ui_combobox.hpp @@ -1,10 +1,10 @@ #pragma once -#include "UI_item.hpp" -#include "UI_x_boxes.hpp" +#include "ui_item.hpp" +#include "ui_x_boxes.hpp" #include -#define UI_COMBOBOX_TYPE std::string("UI_combobox") +#define UI_COMBOBOX_TYPE std::string("ui_combobox") class UI_combobox : public UI_x_boxes { diff --git a/UI/UI_dial.cpp b/UI/ui_dial.cpp similarity index 98% rename from UI/UI_dial.cpp rename to UI/ui_dial.cpp index df8276b..6b7b1c0 100644 --- a/UI/UI_dial.cpp +++ b/UI/ui_dial.cpp @@ -1,4 +1,4 @@ -#include "UI_dial.hpp" +#include "ui_dial.hpp" UI_dial::UI_dial(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value, QObject *parent) diff --git a/UI/UI_dial.hpp b/UI/ui_dial.hpp similarity index 93% rename from UI/UI_dial.hpp rename to UI/ui_dial.hpp index 638f561..2eea9cd 100644 --- a/UI/UI_dial.hpp +++ b/UI/ui_dial.hpp @@ -1,7 +1,7 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" -#define UI_DIAL_TYPE std::string("UI_dial") +#define UI_DIAL_TYPE std::string("ui_dial") class UI_dial : public UI_item { diff --git a/UI/UI_item.cpp b/UI/ui_item.cpp similarity index 99% rename from UI/UI_item.cpp rename to UI/ui_item.cpp index d03c7cb..4ea4277 100644 --- a/UI/UI_item.cpp +++ b/UI/ui_item.cpp @@ -1,4 +1,4 @@ -#include "UI_item.hpp" +#include "ui_item.hpp" UI_item::UI_item(std::string type, std::string text, uint8_t text_size, Color fg_color, Color bg_color, QObject *parent) : QObject(parent), m_id((size_t)-1), m_type(type), m_text(text), m_text_size(text_size), m_fg_color(fg_color), diff --git a/UI/UI_item.hpp b/UI/ui_item.hpp similarity index 100% rename from UI/UI_item.hpp rename to UI/ui_item.hpp diff --git a/UI/UI_label.cpp b/UI/ui_label.cpp similarity index 94% rename from UI/UI_label.cpp rename to UI/ui_label.cpp index 92330b1..113fed8 100644 --- a/UI/UI_label.cpp +++ b/UI/ui_label.cpp @@ -1,4 +1,4 @@ -#include "UI_label.hpp" +#include "ui_label.hpp" UI_label::UI_label(std::string text, Color fg_color, Color bg_color, QObject *parent) : UI_item(UI_LABEL_TYPE, text, 12, fg_color, bg_color, parent) diff --git a/UI/UI_label.hpp b/UI/ui_label.hpp similarity index 82% rename from UI/UI_label.hpp rename to UI/ui_label.hpp index 6201962..25182c6 100644 --- a/UI/UI_label.hpp +++ b/UI/ui_label.hpp @@ -1,8 +1,8 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" #include -#define UI_LABEL_TYPE std::string("UI_label") +#define UI_LABEL_TYPE std::string("ui_label") class UI_label : public UI_item { diff --git a/UI/UI_led.cpp b/UI/ui_led.cpp similarity index 96% rename from UI/UI_led.cpp rename to UI/ui_led.cpp index b291dd0..d5d9642 100644 --- a/UI/UI_led.cpp +++ b/UI/ui_led.cpp @@ -1,4 +1,4 @@ -#include "UI_led.hpp" +#include "ui_led.hpp" UI_led::UI_led(QObject *parent) : UI_item(UI_LED_TYPE, "", 12, Color::Default, Color::Default, parent) { diff --git a/UI/UI_led.hpp b/UI/ui_led.hpp similarity index 86% rename from UI/UI_led.hpp rename to UI/ui_led.hpp index b9ac3e2..f6ced7d 100644 --- a/UI/UI_led.hpp +++ b/UI/ui_led.hpp @@ -1,8 +1,8 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" #include -#define UI_LED_TYPE std::string("UI_led") +#define UI_LED_TYPE std::string("ui_led") class UI_led : public UI_item { diff --git a/UI/UI_plot.cpp b/UI/ui_plot.cpp similarity index 98% rename from UI/UI_plot.cpp rename to UI/ui_plot.cpp index 6d4c7b5..cd8c0c8 100644 --- a/UI/UI_plot.cpp +++ b/UI/ui_plot.cpp @@ -1,4 +1,4 @@ -#include "UI_plot.hpp" +#include "ui_plot.hpp" UI_plot::UI_plot(QObject *parent) : UI_item{UI_PLOT_TYPE, parent} { diff --git a/UI/UI_plot.hpp b/UI/ui_plot.hpp similarity index 93% rename from UI/UI_plot.hpp rename to UI/ui_plot.hpp index edec685..b55c58c 100644 --- a/UI/UI_plot.hpp +++ b/UI/ui_plot.hpp @@ -1,8 +1,8 @@ #ifndef UI_PLOT_H #define UI_PLOT_H -#include "UI_item.hpp" -#define UI_PLOT_TYPE std::string("UI_plot") +#include "ui_item.hpp" +#define UI_PLOT_TYPE std::string("ui_plot") class UI_plot : public UI_item { diff --git a/UI/UI_slider.cpp b/UI/ui_slider.cpp similarity index 98% rename from UI/UI_slider.cpp rename to UI/ui_slider.cpp index 39dc89c..b6eb6ec 100644 --- a/UI/UI_slider.cpp +++ b/UI/ui_slider.cpp @@ -1,4 +1,4 @@ -#include "UI_slider.hpp" +#include "ui_slider.hpp" UI_slider::UI_slider(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value, QObject *parent) diff --git a/UI/UI_slider.hpp b/UI/ui_slider.hpp similarity index 93% rename from UI/UI_slider.hpp rename to UI/ui_slider.hpp index f711e94..88bc4cb 100644 --- a/UI/UI_slider.hpp +++ b/UI/ui_slider.hpp @@ -1,7 +1,7 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" -#define UI_SLIDER_TYPE std::string("UI_slider") +#define UI_SLIDER_TYPE std::string("ui_slider") class UI_slider : public UI_item { diff --git a/UI/ui_spinbox.cpp b/UI/ui_spinbox.cpp new file mode 100644 index 0000000..0bedde4 --- /dev/null +++ b/UI/ui_spinbox.cpp @@ -0,0 +1,55 @@ +#include "ui_spinbox.hpp" + +UI_spinbox::UI_spinbox(QObject* parent) : UI_item(UI_SPINBOX_TYPE, parent) +{ +} + +UI_spinbox::UI_spinbox(double min, double max, double value, QObject* parent) : UI_item(UI_SPINBOX_TYPE, parent) +{ + m_min = min; + m_max = max; + m_value = value; +} + +void UI_spinbox::set_value(double value) +{ + if (value < m_min || value > m_max) + return; + if (value == m_value) + return; + + this->m_value = value; + emit ui_changed(); + emit changed(m_value); +} +double UI_spinbox::value() const +{ + return m_value; +} + +double UI_spinbox::min() const +{ + return m_min; +} +double UI_spinbox::max() const +{ + return m_max; +} + +void UI_spinbox::from_json(const json &j) +{ + UI_item::from_json(j); + + this->m_min = j.at("min"); + this->m_max = j.at("max"); + this->m_value = j.at("value"); +} + +json UI_spinbox::to_json(size_t id) const +{ + json j = UI_item::to_json(id); + j["min"] = this->m_min; + j["max"] = this->m_max; + j["value"] = this->m_value; + return j; +} diff --git a/UI/ui_spinbox.hpp b/UI/ui_spinbox.hpp new file mode 100644 index 0000000..8850fbc --- /dev/null +++ b/UI/ui_spinbox.hpp @@ -0,0 +1,31 @@ +#ifndef UI_SPINBOX_HPP +#define UI_SPINBOX_HPP + +#include "ui_item.hpp" + +#define UI_SPINBOX_TYPE std::string("ui_spinbox") + +class UI_spinbox : public UI_item { + Q_OBJECT + public: + explicit UI_spinbox(QObject* parent = nullptr); + UI_spinbox(double min, double max, double value, QObject* parent = nullptr); + + void set_value(double value) override; + double value() const; + + double min() const; + double max() const; + + void from_json(const json &j) override; + json to_json(size_t id) const override; + signals: + void changed(double value); + + private: + double m_min; + double m_max; + double m_value; +}; + +#endif // UI_SPINBOX_HPP diff --git a/UI/UI_table.cpp b/UI/ui_table.cpp similarity index 99% rename from UI/UI_table.cpp rename to UI/ui_table.cpp index d12bdb9..69c2ff2 100644 --- a/UI/UI_table.cpp +++ b/UI/ui_table.cpp @@ -1,4 +1,4 @@ -#include "UI_table.hpp" +#include "ui_table.hpp" UI_table::UI_table(QObject *parent) : UI_item(UI_TABLE_TYPE, parent), m_row_count(0), m_column_count(0) { diff --git a/UI/UI_table.hpp b/UI/ui_table.hpp similarity index 95% rename from UI/UI_table.hpp rename to UI/ui_table.hpp index 97a5b22..7f32386 100644 --- a/UI/UI_table.hpp +++ b/UI/ui_table.hpp @@ -1,8 +1,8 @@ #ifndef UI_TABLE_HPP #define UI_TABLE_HPP -#include "UI_item.hpp" +#include "ui_item.hpp" -#define UI_TABLE_TYPE std::string("UI_table") +#define UI_TABLE_TYPE std::string("ui_table") class UI_table : public UI_item { diff --git a/UI/UI_textbox.cpp b/UI/ui_textbox.cpp similarity index 96% rename from UI/UI_textbox.cpp rename to UI/ui_textbox.cpp index 8d17b9a..9e4e618 100644 --- a/UI/UI_textbox.cpp +++ b/UI/ui_textbox.cpp @@ -1,4 +1,4 @@ -#include "UI_textbox.hpp" +#include "ui_textbox.hpp" UI_textbox::UI_textbox(std::string hint, Color fg_color, Color bg_color, QObject *parent) : UI_item(UI_TEXTBOX_TYPE, "", 0, fg_color, bg_color, parent), m_hint(hint) diff --git a/UI/UI_textbox.hpp b/UI/ui_textbox.hpp similarity index 87% rename from UI/UI_textbox.hpp rename to UI/ui_textbox.hpp index 728e59e..86338d2 100644 --- a/UI/UI_textbox.hpp +++ b/UI/ui_textbox.hpp @@ -1,8 +1,8 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" #include -#define UI_TEXTBOX_TYPE std::string("UI_textbox") +#define UI_TEXTBOX_TYPE std::string("ui_textbox") class UI_textbox : public UI_item { diff --git a/UI/UI_thermo.cpp b/UI/ui_thermo.cpp similarity index 99% rename from UI/UI_thermo.cpp rename to UI/ui_thermo.cpp index 7735b81..902ec0d 100644 --- a/UI/UI_thermo.cpp +++ b/UI/ui_thermo.cpp @@ -1,4 +1,4 @@ -#include "UI_thermo.hpp" +#include "ui_thermo.hpp" UI_thermo::UI_thermo(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value, QObject *parent) diff --git a/UI/UI_thermo.hpp b/UI/ui_thermo.hpp similarity index 94% rename from UI/UI_thermo.hpp rename to UI/ui_thermo.hpp index 27ccdba..1ada877 100644 --- a/UI/UI_thermo.hpp +++ b/UI/ui_thermo.hpp @@ -1,7 +1,7 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" -#define UI_THERMO_TYPE std::string("UI_thermo") +#define UI_THERMO_TYPE std::string("ui_thermo") // TODO: Add color scale class UI_thermo : public UI_item diff --git a/UI/UI_x_boxes.cpp b/UI/ui_x_boxes.cpp similarity index 96% rename from UI/UI_x_boxes.cpp rename to UI/ui_x_boxes.cpp index 29def9e..01d1b09 100644 --- a/UI/UI_x_boxes.cpp +++ b/UI/ui_x_boxes.cpp @@ -1,4 +1,4 @@ -#include "UI_x_boxes.hpp" +#include "ui_x_boxes.hpp" UI_x_boxes::UI_x_boxes(std::string type, QObject *parent) : UI_item(type, parent), m_options() { diff --git a/UI/UI_x_boxes.hpp b/UI/ui_x_boxes.hpp similarity index 95% rename from UI/UI_x_boxes.hpp rename to UI/ui_x_boxes.hpp index a49a850..ac765c5 100644 --- a/UI/UI_x_boxes.hpp +++ b/UI/ui_x_boxes.hpp @@ -1,6 +1,6 @@ #pragma once -#include "UI_item.hpp" +#include "ui_item.hpp" class UI_x_boxes : public UI_item { diff --git a/client/simulator_base.cpp b/client/simulator_base.cpp index 16da477..db87e90 100644 --- a/client/simulator_base.cpp +++ b/client/simulator_base.cpp @@ -97,67 +97,67 @@ void Simulator_base::UI_item_parser(json &input) return; } - if (ui_item["type"] == "UI_button") + if (ui_item["type"] == "ui_button") { process_ui_button(ui_item, widget); continue; } - if (ui_item["type"] == "UI_led") + if (ui_item["type"] == "ui_led") { process_ui_led(ui_item, widget); continue; } - if (ui_item["type"] == "UI_slider") + if (ui_item["type"] == "ui_slider") { process_ui_slider(ui_item, widget); continue; } - if (ui_item["type"] == "UI_dial") + if (ui_item["type"] == "ui_dial") { process_ui_dial(ui_item, widget); continue; } - if (ui_item["type"] == "UI_thermo") + if (ui_item["type"] == "ui_thermo") { process_ui_thermo(ui_item, widget); continue; } - if (ui_item["type"] == "UI_textbox") + if (ui_item["type"] == "ui_textbox") { process_ui_textbox(ui_item, widget); continue; } - if (ui_item["type"] == "UI_label") + if (ui_item["type"] == "ui_label") { process_ui_label(ui_item, widget); continue; } - if (ui_item["type"] == "UI_combobox") + if (ui_item["type"] == "ui_combobox") { process_ui_combobox(ui_item, widget); continue; } - if (ui_item["type"] == "UI_RadioButton") + if (ui_item["type"] == "ui_RadioButton") { process_ui_radiobutton(ui_item, widget); continue; } - if (ui_item["type"] == "UI_checkbox") + if (ui_item["type"] == "ui_checkbox") { process_ui_checkbox(ui_item, widget); continue; } - if (ui_item["type"] == "UI_plot") + if (ui_item["type"] == "ui_plot") { process_ui_plot(ui_item, widget); continue; } - if (ui_item["type"] == "UI_table") + if (ui_item["type"] == "ui_table") { process_ui_table(ui_item, widget); continue; } - if (ui_item["type"] == "UI_can") + if (ui_item["type"] == "ui_can") { process_ui_can(ui_item, widget); continue; diff --git a/tests/Test.hpp b/tests/Test.hpp index 9393577..5be6cc5 100644 --- a/tests/Test.hpp +++ b/tests/Test.hpp @@ -1,5 +1,5 @@ -#include "UI.hpp" +#include "ui.hpp" #include "gtest/gtest.h" #include -#define UNUSED(x) (void)(x) \ No newline at end of file +#define UNUSED(x) (void)(x) diff --git a/tests/UI_label.cpp b/tests/UI_label.cpp index efbb905..d4f013a 100644 --- a/tests/UI_label.cpp +++ b/tests/UI_label.cpp @@ -4,7 +4,7 @@ TEST(UI_label, to_from_json) { UI_label label("label_text", Color(0, 0, 0), Color(255, 255, 255)); json j = label.to_json(0); - EXPECT_EQ(j["type"], "UI_label"); + EXPECT_EQ(j["type"], "ui_label"); EXPECT_EQ(j["id"], 0); EXPECT_EQ(j["text"], "label_text"); EXPECT_EQ(j["text_size"], 12);