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_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
|
||||||
FetchContent_MakeAvailable(json)
|
FetchContent_MakeAvailable(json)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core)
|
find_package(Qt6 REQUIRED COMPONENTS Core SerialBus)
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
UI
|
UI
|
||||||
@@ -62,4 +62,5 @@ target_link_libraries(UI
|
|||||||
Color
|
Color
|
||||||
nlohmann_json::nlohmann_json
|
nlohmann_json::nlohmann_json
|
||||||
Qt::Core
|
Qt::Core
|
||||||
|
Qt::SerialBus
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "UI_button.hpp"
|
#include "UI_button.hpp"
|
||||||
|
|
||||||
UI_button::UI_button(std::string text, Color fg_color, Color bg_color, QObject *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, parrent)
|
: 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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ class UI_button : public UI_item
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UI_button(std::string text, Color fg_color, Color bg_color, QObject *parrent = nullptr);
|
UI_button(std::string text, Color fg_color, Color bg_color, QObject *parent = nullptr);
|
||||||
UI_button(const json &j, QObject *parrent = nullptr);
|
UI_button(const json &j, QObject *parent = nullptr);
|
||||||
|
|
||||||
void from_json(const json &j) override;
|
void from_json(const json &j) override;
|
||||||
json to_json(size_t id) const override;
|
json to_json(size_t id) const override;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
#include "UI_checkbox.hpp"
|
#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_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, parrent), m_selected(false)
|
: 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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ class UI_checkbox : public UI_item
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UI_checkbox(QObject *parrent = nullptr);
|
UI_checkbox(QObject *parent = nullptr);
|
||||||
UI_checkbox(std::string text, Color fg_color, Color bg_color,
|
UI_checkbox(std::string text, Color fg_color, Color bg_color,
|
||||||
QObject *parrent = nullptr);
|
QObject *parent = nullptr);
|
||||||
UI_checkbox(const json &j, QObject *parrent = nullptr);
|
UI_checkbox(const json &j, QObject *parent = nullptr);
|
||||||
|
|
||||||
void toggle_selected();
|
void toggle_selected();
|
||||||
bool selected() const;
|
bool selected() const;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "UI_combobox.hpp"
|
#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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -1,20 +1,20 @@
|
|||||||
#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,
|
UI_dial::UI_dial(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
|
||||||
QObject *parrent)
|
QObject *parent)
|
||||||
: UI_item(UI_DIAL_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value), m_unit(unit)
|
: 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,
|
UI_dial::UI_dial(std::string text, Color fg_color, Color bg_color, double min, double max,
|
||||||
double value, QObject *parrent)
|
double value, QObject *parent)
|
||||||
: UI_dial(text, "", fg_color, bg_color, min, max, value, parrent)
|
: UI_dial(text, "", fg_color, bg_color, min, max, value, parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_dial::UI_dial(const json &j, QObject *parrent)
|
UI_dial::UI_dial(const json &j, QObject *parent)
|
||||||
: UI_item(UI_DIAL_TYPE, parrent)
|
: UI_item(UI_DIAL_TYPE, parent)
|
||||||
{
|
{
|
||||||
from_json(j);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -8,10 +8,10 @@ class UI_dial : public UI_item
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UI_dial(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
|
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,
|
UI_dial(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||||
QObject *parrent = nullptr);
|
QObject *parent = nullptr);
|
||||||
UI_dial(const json &j, QObject *parrent = nullptr);
|
UI_dial(const json &j, QObject *parent = nullptr);
|
||||||
|
|
||||||
void set_value(double value) override;
|
void set_value(double value) override;
|
||||||
double value() const;
|
double value() const;
|
||||||
|
|||||||
+9
-7
@@ -1,19 +1,19 @@
|
|||||||
#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,
|
UI_item::UI_item(std::string type, std::string text, uint8_t text_size, Color fg_color, Color bg_color,
|
||||||
QObject *parrent)
|
QObject *parent)
|
||||||
: 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), 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)
|
m_bg_color(bg_color), enabled(true), visible(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_item::UI_item(std::string type, QObject *parrent)
|
UI_item::UI_item(std::string type, QObject *parent)
|
||||||
: QObject(parrent), m_id((size_t)-1), m_type(type), m_text(""), m_text_size(12), m_fg_color(Color::Black),
|
: 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)
|
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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,9 @@ void UI_item::set_value(double value)
|
|||||||
UNUSED(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 <thread>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QCanBusFrame>
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
@@ -15,10 +16,10 @@ class UI_item : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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,
|
explicit UI_item(std::string type, std::string text, uint8_t text_size, Color fg_color,
|
||||||
Color bg_color, QObject *parrent = nullptr);
|
Color bg_color, QObject *parent = nullptr);
|
||||||
explicit UI_item(const json &j, QObject *parrent = nullptr);
|
explicit UI_item(const json &j, QObject *parent = nullptr);
|
||||||
~UI_item();
|
~UI_item();
|
||||||
|
|
||||||
std::string type() const;
|
std::string type() const;
|
||||||
@@ -49,7 +50,7 @@ class UI_item : public QObject
|
|||||||
virtual void click();
|
virtual void click();
|
||||||
virtual void set_selected(std::string selected);
|
virtual void set_selected(std::string selected);
|
||||||
virtual void set_value(double value);
|
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:
|
signals:
|
||||||
void value_changed();
|
void value_changed();
|
||||||
|
|||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
#include "UI_label.hpp"
|
#include "UI_label.hpp"
|
||||||
|
|
||||||
UI_label::UI_label(std::string text, Color fg_color, Color bg_color, QObject *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, parrent)
|
: 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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -8,8 +8,8 @@ class UI_label : public UI_item
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UI_label(std::string text, Color fg_color, Color bg_color, QObject *parrent = nullptr);
|
UI_label(std::string text, Color fg_color, Color bg_color, QObject *parent = nullptr);
|
||||||
UI_label(const json &j, QObject *parrent = nullptr);
|
UI_label(const json &j, QObject *parent = nullptr);
|
||||||
|
|
||||||
void from_json(const json &j) override;
|
void from_json(const json &j) override;
|
||||||
json to_json(size_t id) const override;
|
json to_json(size_t id) const override;
|
||||||
|
|||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
#include "UI_led.hpp"
|
#include "UI_led.hpp"
|
||||||
|
|
||||||
UI_led::UI_led(std::string text, Color fg_color, Color bg_color, Color led_color, QObject *parrent)
|
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, parrent), m_led_color(led_color)
|
: 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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -9,8 +9,8 @@ class UI_led : public UI_item
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UI_led(std::string text, Color fg_color, Color bg_color, Color led_color,
|
UI_led(std::string text, Color fg_color, Color bg_color, Color led_color,
|
||||||
QObject *parrent = nullptr);
|
QObject *parent = nullptr);
|
||||||
UI_led(const json &j, QObject *parrent = nullptr);
|
UI_led(const json &j, QObject *parent = nullptr);
|
||||||
|
|
||||||
Color led_color() const;
|
Color led_color() const;
|
||||||
void set_led_color(Color led_color);
|
void set_led_color(Color led_color);
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
#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,
|
UI_slider::UI_slider(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max,
|
||||||
double value, QObject *parrent)
|
double value, QObject *parent)
|
||||||
: UI_item(UI_SLIDER_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value), m_unit(unit)
|
: 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,
|
UI_slider::UI_slider(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||||
QObject *parrent)
|
QObject *parent)
|
||||||
: UI_slider(text, "", fg_color, bg_color, min, max, value, parrent)
|
: 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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ class UI_slider : public UI_item
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UI_slider(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
|
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,
|
UI_slider(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||||
QObject *parrent = nullptr);
|
QObject *parent = nullptr);
|
||||||
UI_slider(const json &j, QObject *parrent = nullptr);
|
UI_slider(const json &j, QObject *parent = nullptr);
|
||||||
|
|
||||||
void set_value(double value) override;
|
void set_value(double value) override;
|
||||||
double value() const;
|
double value() const;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "UI_textbox.hpp"
|
#include "UI_textbox.hpp"
|
||||||
|
|
||||||
UI_textbox::UI_textbox(std::string hint, Color fg_color, Color bg_color, QObject *parrent)
|
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, parrent), m_hint(hint)
|
: 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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ class UI_textbox : public UI_item
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UI_textbox(std::string hint, Color fg_color, Color bg_color, QObject *parrent = nullptr);
|
UI_textbox(std::string hint, Color fg_color, Color bg_color, QObject *parent = nullptr);
|
||||||
UI_textbox(const json &j, QObject *parrent = nullptr);
|
UI_textbox(const json &j, QObject *parent = nullptr);
|
||||||
|
|
||||||
void set_text(std::string text) override;
|
void set_text(std::string text) override;
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
#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,
|
UI_thermo::UI_thermo(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max,
|
||||||
double value, QObject *parrent)
|
double value, QObject *parent)
|
||||||
: UI_item(UI_THERMO_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value), m_unit(unit)
|
: 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,
|
UI_thermo::UI_thermo(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||||
QObject *parrent)
|
QObject *parent)
|
||||||
: UI_thermo(text, "", fg_color, bg_color, min, max, value, parrent)
|
: 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);
|
from_json(j);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ class UI_thermo : public UI_item
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UI_thermo(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
|
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,
|
UI_thermo(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||||
QObject *parrent = nullptr);
|
QObject *parent = nullptr);
|
||||||
UI_thermo(const json &j, QObject *parrent = nullptr);
|
UI_thermo(const json &j, QObject *parent = nullptr);
|
||||||
|
|
||||||
void set_value(double value) override;
|
void set_value(double value) override;
|
||||||
double value() const;
|
double value() const;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#include "UI_x_boxes.hpp"
|
#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,
|
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)
|
std::vector<std::string> options, QObject *parent)
|
||||||
: UI_item(type, text, 12, fg_color, bg_color, parrent), m_options(options)
|
: 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
|
Q_OBJECT
|
||||||
public:
|
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,
|
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;
|
void from_json(const json &j) override;
|
||||||
json to_json(size_t id) const override;
|
json to_json(size_t id) const override;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "simulator_base.hpp"
|
#include "simulator_base.hpp"
|
||||||
|
|
||||||
Simulator_base::Simulator_base(std::string name, std::chrono::milliseconds interval, QObject *parrent)
|
Simulator_base::Simulator_base(std::string name, std::chrono::milliseconds interval, QObject *parent)
|
||||||
: QObject(parrent), m_name(name), m_timer(new QTimer(this)), m_interval(interval)
|
: QObject(parent), m_name(name), m_timer(new QTimer(this)), m_interval(interval)
|
||||||
{
|
{
|
||||||
connect(m_timer, &QTimer::timeout, this, [this] { timer(); });
|
connect(m_timer, &QTimer::timeout, this, [this] { timer(); });
|
||||||
m_UI_items.reserve(50);
|
m_UI_items.reserve(50);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class Simulator_base : public QObject
|
|||||||
* @param interval The interval of the timer (default is 100ms)
|
* @param interval The interval of the timer (default is 100ms)
|
||||||
*/
|
*/
|
||||||
Simulator_base(std::string name, std::chrono::milliseconds interval = std::chrono::milliseconds(100),
|
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
|
* @brief Returns the name of the simulator
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <unordered_set>
|
#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(Test_Sim);
|
||||||
INSERT_SIMULATOR(Can_Debugger);
|
INSERT_SIMULATOR(Can_Debugger);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "test_sim.hpp"
|
#include "test_sim.hpp"
|
||||||
|
|
||||||
Test_Sim::Test_Sim(QObject* parrent) :
|
Test_Sim::Test_Sim(QObject* parent) :
|
||||||
Simulator_base("Test_Sim", std::chrono::milliseconds(1000), parrent),
|
Simulator_base("Test_Sim", std::chrono::milliseconds(1000), parent),
|
||||||
m_button("Off", Color(Color::White), Color(Color::Red)),
|
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_combobox(Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, 0),
|
||||||
m_label("Label", Color(Color::White), Color(Color::Black)),
|
m_label("Label", Color(Color::White), Color(Color::Black)),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
class Test_Sim : public Simulator_base {
|
class Test_Sim : public Simulator_base {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Test_Sim(QObject* parrent = nullptr);
|
Test_Sim(QObject* parent = nullptr);
|
||||||
void timer() override;
|
void timer() override;
|
||||||
void run_at_startup() override;
|
void run_at_startup() override;
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user