fix spelling mistake

This commit is contained in:
2024-12-30 12:08:13 +01:00
parent 88eeb7e6ca
commit b8aa9449ac
27 changed files with 83 additions and 79 deletions
+2 -1
View File
@@ -5,7 +5,7 @@ include(FetchContent)
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
FetchContent_MakeAvailable(json)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core SerialBus)
set_target_properties(
UI
@@ -62,4 +62,5 @@ target_link_libraries(UI
Color
nlohmann_json::nlohmann_json
Qt::Core
Qt::SerialBus
)
+3 -3
View File
@@ -1,11 +1,11 @@
#include "UI_button.hpp"
UI_button::UI_button(std::string text, Color fg_color, Color bg_color, QObject *parrent)
: UI_item(UI_BUTTON_TYPE, text, 12, fg_color, bg_color, parrent)
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)
{
}
UI_button::UI_button(const json &j, QObject *parrent) : UI_item(UI_BUTTON_TYPE, parrent)
UI_button::UI_button(const json &j, QObject *parent) : UI_item(UI_BUTTON_TYPE, parent)
{
from_json(j);
}
+2 -2
View File
@@ -8,8 +8,8 @@ class UI_button : public UI_item
{
Q_OBJECT
public:
UI_button(std::string text, Color fg_color, Color bg_color, QObject *parrent = nullptr);
UI_button(const json &j, QObject *parrent = nullptr);
UI_button(std::string text, Color fg_color, Color bg_color, QObject *parent = nullptr);
UI_button(const json &j, QObject *parent = nullptr);
void from_json(const json &j) override;
json to_json(size_t id) const override;
+4 -4
View File
@@ -1,16 +1,16 @@
#include "UI_checkbox.hpp"
UI_checkbox::UI_checkbox(QObject *parrent) : UI_item(UI_CHECKBOX_TYPE, parrent), m_selected()
UI_checkbox::UI_checkbox(QObject *parent) : UI_item(UI_CHECKBOX_TYPE, parent), m_selected()
{
}
UI_checkbox::UI_checkbox(std::string text, Color fg_color, Color bg_color, QObject *parrent)
: UI_item(UI_CHECKBOX_TYPE, text, 0, fg_color, bg_color, parrent), m_selected(false)
UI_checkbox::UI_checkbox(std::string text, Color fg_color, Color bg_color, QObject *parent)
: UI_item(UI_CHECKBOX_TYPE, text, 0, fg_color, bg_color, parent), m_selected(false)
{
}
UI_checkbox::UI_checkbox(const json &j, QObject *parrent) : UI_item(UI_CHECKBOX_TYPE, parrent), m_selected()
UI_checkbox::UI_checkbox(const json &j, QObject *parent) : UI_item(UI_CHECKBOX_TYPE, parent), m_selected()
{
from_json(j);
}
+3 -3
View File
@@ -8,10 +8,10 @@ class UI_checkbox : public UI_item
{
Q_OBJECT
public:
UI_checkbox(QObject *parrent = nullptr);
UI_checkbox(QObject *parent = nullptr);
UI_checkbox(std::string text, Color fg_color, Color bg_color,
QObject *parrent = nullptr);
UI_checkbox(const json &j, QObject *parrent = nullptr);
QObject *parent = nullptr);
UI_checkbox(const json &j, QObject *parent = nullptr);
void toggle_selected();
bool selected() const;
+2 -2
View File
@@ -1,6 +1,6 @@
#include "UI_combobox.hpp"
UI_combobox::UI_combobox(QObject *parrent) : UI_x_boxes(UI_COMBOBOX_TYPE, parrent)
UI_combobox::UI_combobox(QObject *parent) : UI_x_boxes(UI_COMBOBOX_TYPE, parent)
{
}
@@ -10,7 +10,7 @@ UI_combobox::UI_combobox(Color fg_color, Color bg_color,
{
}
UI_combobox::UI_combobox(const json &j, QObject *parrent) : UI_x_boxes(UI_COMBOBOX_TYPE, parrent)
UI_combobox::UI_combobox(const json &j, QObject *parent) : UI_x_boxes(UI_COMBOBOX_TYPE, parent)
{
from_json(j);
}
+6 -6
View File
@@ -1,20 +1,20 @@
#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 *parrent)
: UI_item(UI_DIAL_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value), m_unit(unit)
QObject *parent)
: UI_item(UI_DIAL_TYPE, text, 12, fg_color, bg_color, parent), m_min(min), m_max(max), m_value(value), m_unit(unit)
{
}
UI_dial::UI_dial(std::string text, Color fg_color, Color bg_color, double min, double max,
double value, QObject *parrent)
: UI_dial(text, "", fg_color, bg_color, min, max, value, parrent)
double value, QObject *parent)
: UI_dial(text, "", fg_color, bg_color, min, max, value, parent)
{
}
UI_dial::UI_dial(const json &j, QObject *parrent)
: UI_item(UI_DIAL_TYPE, parrent)
UI_dial::UI_dial(const json &j, QObject *parent)
: UI_item(UI_DIAL_TYPE, parent)
{
from_json(j);
}
+3 -3
View File
@@ -8,10 +8,10 @@ class UI_dial : public UI_item
Q_OBJECT
public:
UI_dial(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent = nullptr);
QObject *parent = nullptr);
UI_dial(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent = nullptr);
UI_dial(const json &j, QObject *parrent = nullptr);
QObject *parent = nullptr);
UI_dial(const json &j, QObject *parent = nullptr);
void set_value(double value) override;
double value() const;
+10 -8
View File
@@ -1,19 +1,19 @@
#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 *parrent)
: QObject(parrent), m_id((size_t)-1), m_type(type), m_text(text), m_text_size(text_size), m_fg_color(fg_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),
m_bg_color(bg_color), enabled(true), visible(true)
{
}
UI_item::UI_item(std::string type, QObject *parrent)
: QObject(parrent), m_id((size_t)-1), m_type(type), m_text(""), m_text_size(12), m_fg_color(Color::Black),
UI_item::UI_item(std::string type, QObject *parent)
: QObject(parent), m_id((size_t)-1), m_type(type), m_text(""), m_text_size(12), m_fg_color(Color::Black),
m_bg_color(Color::White), enabled(true), visible(true)
{
}
UI_item::UI_item(const json &j, QObject *parrent) : QObject(parrent)
UI_item::UI_item(const json &j, QObject *parent) : QObject(parent)
{
from_json(j);
}
@@ -162,7 +162,9 @@ void UI_item::set_value(double value)
UNUSED(value);
};
void UI_item::can_send(can_message_t msg)
void UI_item::can_send(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload)
{
UNUSED(msg);
};
UNUSED(id);
UNUSED(dlc);
UNUSED(payload);
};
+5 -4
View File
@@ -7,6 +7,7 @@
#include <thread>
#include <QObject>
#include <QCanBusFrame>
using json = nlohmann::json;
#define UNUSED(x) (void)(x)
@@ -15,10 +16,10 @@ class UI_item : public QObject
{
Q_OBJECT
public:
explicit UI_item(std::string type, QObject *parrent = nullptr);
explicit UI_item(std::string type, QObject *parent = nullptr);
explicit UI_item(std::string type, std::string text, uint8_t text_size, Color fg_color,
Color bg_color, QObject *parrent = nullptr);
explicit UI_item(const json &j, QObject *parrent = nullptr);
Color bg_color, QObject *parent = nullptr);
explicit UI_item(const json &j, QObject *parent = nullptr);
~UI_item();
std::string type() const;
@@ -49,7 +50,7 @@ class UI_item : public QObject
virtual void click();
virtual void set_selected(std::string selected);
virtual void set_value(double value);
virtual void can_send(can_message_t msg);
virtual void can_send(uint32_t id, uint8_t dlc, std::array<uint8_t, 8> payload);
signals:
void value_changed();
+3 -3
View File
@@ -1,11 +1,11 @@
#include "UI_label.hpp"
UI_label::UI_label(std::string text, Color fg_color, Color bg_color, QObject *parrent)
: UI_item(UI_LABEL_TYPE, text, 12, fg_color, bg_color, parrent)
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)
{
}
UI_label::UI_label(const json &j, QObject *parrent) : UI_item(UI_LABEL_TYPE, parrent)
UI_label::UI_label(const json &j, QObject *parent) : UI_item(UI_LABEL_TYPE, parent)
{
from_json(j);
}
+2 -2
View File
@@ -8,8 +8,8 @@ class UI_label : public UI_item
{
Q_OBJECT
public:
UI_label(std::string text, Color fg_color, Color bg_color, QObject *parrent = nullptr);
UI_label(const json &j, QObject *parrent = nullptr);
UI_label(std::string text, Color fg_color, Color bg_color, QObject *parent = nullptr);
UI_label(const json &j, QObject *parent = nullptr);
void from_json(const json &j) override;
json to_json(size_t id) const override;
+3 -3
View File
@@ -1,11 +1,11 @@
#include "UI_led.hpp"
UI_led::UI_led(std::string text, Color fg_color, Color bg_color, Color led_color, QObject *parrent)
: UI_item(UI_LED_TYPE, text, 12, fg_color, bg_color, parrent), m_led_color(led_color)
UI_led::UI_led(std::string text, Color fg_color, Color bg_color, Color led_color, QObject *parent)
: UI_item(UI_LED_TYPE, text, 12, fg_color, bg_color, parent), m_led_color(led_color)
{
}
UI_led::UI_led(const json &j, QObject *parrent) : UI_item(UI_LED_TYPE, parrent)
UI_led::UI_led(const json &j, QObject *parent) : UI_item(UI_LED_TYPE, parent)
{
from_json(j);
}
+2 -2
View File
@@ -9,8 +9,8 @@ class UI_led : public UI_item
Q_OBJECT
public:
UI_led(std::string text, Color fg_color, Color bg_color, Color led_color,
QObject *parrent = nullptr);
UI_led(const json &j, QObject *parrent = nullptr);
QObject *parent = nullptr);
UI_led(const json &j, QObject *parent = nullptr);
Color led_color() const;
void set_led_color(Color led_color);
+5 -5
View File
@@ -1,19 +1,19 @@
#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 *parrent)
: UI_item(UI_SLIDER_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value), m_unit(unit)
double value, QObject *parent)
: UI_item(UI_SLIDER_TYPE, text, 12, fg_color, bg_color, parent), m_min(min), m_max(max), m_value(value), m_unit(unit)
{
}
UI_slider::UI_slider(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent)
: UI_slider(text, "", fg_color, bg_color, min, max, value, parrent)
QObject *parent)
: UI_slider(text, "", fg_color, bg_color, min, max, value, parent)
{
}
UI_slider::UI_slider(const json &j, QObject *parrent) : UI_item(UI_SLIDER_TYPE, parrent)
UI_slider::UI_slider(const json &j, QObject *parent) : UI_item(UI_SLIDER_TYPE, parent)
{
from_json(j);
}
+3 -3
View File
@@ -8,10 +8,10 @@ class UI_slider : public UI_item
Q_OBJECT
public:
UI_slider(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent = nullptr);
QObject *parent = nullptr);
UI_slider(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent = nullptr);
UI_slider(const json &j, QObject *parrent = nullptr);
QObject *parent = nullptr);
UI_slider(const json &j, QObject *parent = nullptr);
void set_value(double value) override;
double value() const;
+3 -3
View File
@@ -1,11 +1,11 @@
#include "UI_textbox.hpp"
UI_textbox::UI_textbox(std::string hint, Color fg_color, Color bg_color, QObject *parrent)
: UI_item(UI_TEXTBOX_TYPE, "", 0, fg_color, bg_color, parrent), m_hint(hint)
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)
{
}
UI_textbox::UI_textbox(const json &j, QObject *parrent) : UI_item(UI_TEXTBOX_TYPE, parrent)
UI_textbox::UI_textbox(const json &j, QObject *parent) : UI_item(UI_TEXTBOX_TYPE, parent)
{
from_json(j);
}
+2 -2
View File
@@ -8,8 +8,8 @@ class UI_textbox : public UI_item
{
Q_OBJECT
public:
UI_textbox(std::string hint, Color fg_color, Color bg_color, QObject *parrent = nullptr);
UI_textbox(const json &j, QObject *parrent = nullptr);
UI_textbox(std::string hint, Color fg_color, Color bg_color, QObject *parent = nullptr);
UI_textbox(const json &j, QObject *parent = nullptr);
void set_text(std::string text) override;
+5 -5
View File
@@ -1,18 +1,18 @@
#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 *parrent)
: UI_item(UI_THERMO_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value), m_unit(unit)
double value, QObject *parent)
: UI_item(UI_THERMO_TYPE, text, 12, fg_color, bg_color, parent), m_min(min), m_max(max), m_value(value), m_unit(unit)
{
}
UI_thermo::UI_thermo(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent)
: UI_thermo(text, "", fg_color, bg_color, min, max, value, parrent)
QObject *parent)
: UI_thermo(text, "", fg_color, bg_color, min, max, value, parent)
{
}
UI_thermo::UI_thermo(const json &j, QObject *parrent) : UI_item(UI_THERMO_TYPE, parrent)
UI_thermo::UI_thermo(const json &j, QObject *parent) : UI_item(UI_THERMO_TYPE, parent)
{
from_json(j);
}
+3 -3
View File
@@ -9,10 +9,10 @@ class UI_thermo : public UI_item
Q_OBJECT
public:
UI_thermo(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent = nullptr);
QObject *parent = nullptr);
UI_thermo(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent = nullptr);
UI_thermo(const json &j, QObject *parrent = nullptr);
QObject *parent = nullptr);
UI_thermo(const json &j, QObject *parent = nullptr);
void set_value(double value) override;
double value() const;
+3 -3
View File
@@ -1,12 +1,12 @@
#include "UI_x_boxes.hpp"
UI_x_boxes::UI_x_boxes(std::string type, QObject *parrent) : UI_item(type, parrent), m_options()
UI_x_boxes::UI_x_boxes(std::string type, QObject *parent) : UI_item(type, parent), m_options()
{
}
UI_x_boxes::UI_x_boxes(std::string type, std::string text, Color fg_color, Color bg_color,
std::vector<std::string> options, QObject *parrent)
: UI_item(type, text, 12, fg_color, bg_color, parrent), m_options(options)
std::vector<std::string> options, QObject *parent)
: UI_item(type, text, 12, fg_color, bg_color, parent), m_options(options)
{
}
+2 -2
View File
@@ -6,9 +6,9 @@ class UI_x_boxes : public UI_item
{
Q_OBJECT
public:
UI_x_boxes(std::string type, QObject *parrent = nullptr);
UI_x_boxes(std::string type, QObject *parent = nullptr);
UI_x_boxes(std::string type, std::string text, Color fg_color, Color bg_color,
std::vector<std::string> options, QObject *parrent = nullptr);
std::vector<std::string> options, QObject *parent = nullptr);
void from_json(const json &j) override;
json to_json(size_t id) const override;
+2 -2
View File
@@ -1,7 +1,7 @@
#include "simulator_base.hpp"
Simulator_base::Simulator_base(std::string name, std::chrono::milliseconds interval, QObject *parrent)
: QObject(parrent), m_name(name), m_timer(new QTimer(this)), m_interval(interval)
Simulator_base::Simulator_base(std::string name, std::chrono::milliseconds interval, QObject *parent)
: QObject(parent), m_name(name), m_timer(new QTimer(this)), m_interval(interval)
{
connect(m_timer, &QTimer::timeout, this, [this] { timer(); });
m_UI_items.reserve(50);
+1 -1
View File
@@ -15,7 +15,7 @@ class Simulator_base : public QObject
* @param interval The interval of the timer (default is 100ms)
*/
Simulator_base(std::string name, std::chrono::milliseconds interval = std::chrono::milliseconds(100),
QObject *parrent = nullptr);
QObject *parent = nullptr);
/**
* @brief Returns the name of the simulator
+1 -1
View File
@@ -4,7 +4,7 @@
#include <QDebug>
#include <unordered_set>
Simulators::Simulators(uint16_t port, QObject *parrent) : QObject(parrent), m_server(new Websocket(port, this))
Simulators::Simulators(uint16_t port, QObject *parent) : QObject(parent), m_server(new Websocket(port, this))
{
INSERT_SIMULATOR(Test_Sim);
INSERT_SIMULATOR(Can_Debugger);
+2 -2
View File
@@ -1,7 +1,7 @@
#include "test_sim.hpp"
Test_Sim::Test_Sim(QObject* parrent) :
Simulator_base("Test_Sim", std::chrono::milliseconds(1000), parrent),
Test_Sim::Test_Sim(QObject* parent) :
Simulator_base("Test_Sim", std::chrono::milliseconds(1000), parent),
m_button("Off", Color(Color::White), Color(Color::Red)),
m_combobox(Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, 0),
m_label("Label", Color(Color::White), Color(Color::Black)),
+1 -1
View File
@@ -4,7 +4,7 @@
class Test_Sim : public Simulator_base {
Q_OBJECT
public:
Test_Sim(QObject* parrent = nullptr);
Test_Sim(QObject* parent = nullptr);
void timer() override;
void run_at_startup() override;
private: