mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
fix spelling mistake
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user