This commit is contained in:
2024-09-12 20:43:12 +02:00
parent 67bcf10b16
commit 756f69e9c7
30 changed files with 98 additions and 95 deletions
+2 -3
View File
@@ -1,12 +1,11 @@
#include "UI_button.hpp"
UI_button::UI_button(std::string id, std::string text, Color fg_color, Color bg_color, QObject* parrent)
UI_button::UI_button(std::string id, std::string text, Color fg_color, Color bg_color, QObject *parrent)
: UI_item(id, UI_BUTTON_TYPE, text, 12, fg_color, bg_color, parrent)
{
}
UI_button::UI_button(const json &j, QObject* parrent) : UI_item(UI_BUTTON_TYPE, parrent)
UI_button::UI_button(const json &j, QObject *parrent) : UI_item(UI_BUTTON_TYPE, parrent)
{
from_json(j);
}
+2 -2
View File
@@ -8,8 +8,8 @@ class UI_button : public UI_item
{
Q_OBJECT
public:
UI_button(std::string id, std::string text, Color fg_color, Color bg_color, QObject* parrent = nullptr);
UI_button(const json &j, QObject* parrent = nullptr);
UI_button(std::string id, std::string text, Color fg_color, Color bg_color, QObject *parrent = nullptr);
UI_button(const json &j, QObject *parrent = nullptr);
void from_json(const json &j) override;
json to_json() const override;
+3 -3
View File
@@ -1,11 +1,11 @@
#include "UI_checkbox.hpp"
UI_checkbox::UI_checkbox(QObject* parrent) : UI_x_boxes(UI_CHECKBOX_TYPE, parrent), m_selected()
UI_checkbox::UI_checkbox(QObject *parrent) : UI_x_boxes(UI_CHECKBOX_TYPE, parrent), m_selected()
{
}
UI_checkbox::UI_checkbox(std::string id, std::string text, Color fg_color, Color bg_color,
std::vector<std::string> options, QObject* parrent)
std::vector<std::string> options, QObject *parrent)
: UI_x_boxes(id, UI_CHECKBOX_TYPE, text, fg_color, bg_color, options, parrent), m_selected()
{
for (size_t i = 0; i < m_options.size(); i++)
@@ -14,7 +14,7 @@ UI_checkbox::UI_checkbox(std::string id, std::string text, Color fg_color, Color
}
}
UI_checkbox::UI_checkbox(const json &j, QObject* parrent) : UI_x_boxes(UI_CHECKBOX_TYPE, parrent), m_selected()
UI_checkbox::UI_checkbox(const json &j, QObject *parrent) : UI_x_boxes(UI_CHECKBOX_TYPE, parrent), m_selected()
{
from_json(j);
}
+4 -3
View File
@@ -9,9 +9,10 @@ class UI_checkbox : public UI_x_boxes
{
Q_OBJECT
public:
UI_checkbox(QObject* parrent = nullptr);
UI_checkbox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, QObject* parrent = nullptr);
UI_checkbox(const json &j, QObject* parrent = nullptr);
UI_checkbox(QObject *parrent = nullptr);
UI_checkbox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options,
QObject *parrent = nullptr);
UI_checkbox(const json &j, QObject *parrent = nullptr);
void toggle_selected(size_t selected);
void toggle_selected(std::string selected);
+3 -3
View File
@@ -1,16 +1,16 @@
#include "UI_combobox.hpp"
UI_combobox::UI_combobox(QObject* parrent) : UI_x_boxes(UI_COMBOBOX_TYPE, parrent)
UI_combobox::UI_combobox(QObject *parrent) : UI_x_boxes(UI_COMBOBOX_TYPE, parrent)
{
}
UI_combobox::UI_combobox(std::string id, std::string text, Color fg_color, Color bg_color,
std::vector<std::string> options, size_t selected, QObject* parrent)
std::vector<std::string> options, size_t selected, QObject *parrent)
: UI_x_boxes(id, UI_COMBOBOX_TYPE, text, fg_color, bg_color, options, parrent), m_selected(selected)
{
}
UI_combobox::UI_combobox(const json &j, QObject* parrent) : UI_x_boxes(UI_COMBOBOX_TYPE, parrent)
UI_combobox::UI_combobox(const json &j, QObject *parrent) : UI_x_boxes(UI_COMBOBOX_TYPE, parrent)
{
from_json(j);
}
+4 -3
View File
@@ -10,10 +10,10 @@ class UI_combobox : public UI_x_boxes
{
Q_OBJECT
public:
UI_combobox(QObject* parrent = nullptr);
UI_combobox(QObject *parrent = nullptr);
UI_combobox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options,
size_t selected = 0, QObject* parrent = nullptr);
UI_combobox(const json &j, QObject* parrent = nullptr);
size_t selected = 0, QObject *parrent = nullptr);
UI_combobox(const json &j, QObject *parrent = nullptr);
void set_selected(size_t selected);
void set_selected(std::string selected) override;
@@ -24,6 +24,7 @@ class UI_combobox : public UI_x_boxes
json to_json() const override;
signals:
void on_change(std::string id, std::string selected);
private:
size_t m_selected;
};
+3 -2
View File
@@ -1,11 +1,12 @@
#include "UI_dial.hpp"
UI_dial::UI_dial(std::string id, std::string text, Color fg_color, Color bg_color, double min, double max, double value, QObject* parrent)
UI_dial::UI_dial(std::string id, std::string text, Color fg_color, Color bg_color, double min, double max, double value,
QObject *parrent)
: UI_item(id, UI_DIAL_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value)
{
}
UI_dial::UI_dial(const json &j, QObject* parrent) : UI_item(UI_DIAL_TYPE, parrent)
UI_dial::UI_dial(const json &j, QObject *parrent) : UI_item(UI_DIAL_TYPE, parrent)
{
from_json(j);
}
+3 -2
View File
@@ -7,8 +7,9 @@ class UI_dial : public UI_item
{
Q_OBJECT
public:
UI_dial(std::string id, 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);
UI_dial(std::string id, 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);
void set_value(double value) override;
double value() const;
+8 -10
View File
@@ -1,21 +1,19 @@
#include "UI_item.hpp"
UI_item::UI_item(std::string id, std::string type, std::string text, uint8_t text_size, Color fg_color, Color bg_color, QObject* parrent)
: QObject(parrent),
m_id(id), 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 id, std::string type, std::string text, uint8_t text_size, Color fg_color, Color bg_color,
QObject *parrent)
: QObject(parrent), m_id(id), 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(""), 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(std::string type, QObject *parrent)
: QObject(parrent), m_id(""), 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 *parrent) : QObject(parrent)
{
from_json(j);
}
+4 -3
View File
@@ -15,9 +15,10 @@ class UI_item : public QObject
{
Q_OBJECT
public:
explicit UI_item(std::string type, QObject* parrent = nullptr);
explicit UI_item(std::string id, 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);
explicit UI_item(std::string type, QObject *parrent = nullptr);
explicit UI_item(std::string id, 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);
~UI_item();
std::string id() const;
+2 -2
View File
@@ -1,11 +1,11 @@
#include "UI_label.hpp"
UI_label::UI_label(std::string id, std::string text, Color fg_color, Color bg_color, QObject* parrent)
UI_label::UI_label(std::string id, std::string text, Color fg_color, Color bg_color, QObject *parrent)
: UI_item(id, UI_LABEL_TYPE, text, 12, fg_color, bg_color, parrent)
{
}
UI_label::UI_label(const json &j, QObject* parrent) : UI_item(UI_LABEL_TYPE, parrent)
UI_label::UI_label(const json &j, QObject *parrent) : UI_item(UI_LABEL_TYPE, parrent)
{
from_json(j);
}
+2 -2
View File
@@ -8,8 +8,8 @@ class UI_label : public UI_item
{
Q_OBJECT
public:
UI_label(std::string id, std::string text, Color fg_color, Color bg_color, QObject* parrent = nullptr);
UI_label(const json &j, QObject* parrent = nullptr);
UI_label(std::string id, std::string text, Color fg_color, Color bg_color, QObject *parrent = nullptr);
UI_label(const json &j, QObject *parrent = nullptr);
void from_json(const json &j) override;
json to_json() const override;
+2 -2
View File
@@ -1,11 +1,11 @@
#include "UI_led.hpp"
UI_led::UI_led(std::string id, std::string text, Color fg_color, Color bg_color, Color led_color, QObject* parrent)
UI_led::UI_led(std::string id, std::string text, Color fg_color, Color bg_color, Color led_color, QObject *parrent)
: UI_item(id, UI_LED_TYPE, text, 12, fg_color, bg_color, parrent), 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 *parrent) : UI_item(UI_LED_TYPE, parrent)
{
from_json(j);
}
+3 -2
View File
@@ -8,8 +8,9 @@ class UI_led : public UI_item
{
Q_OBJECT
public:
UI_led(std::string id, std::string text, Color fg_color, Color bg_color, Color led_color, QObject* parrent = nullptr);
UI_led(const json &j, QObject* parrent = nullptr);
UI_led(std::string id, std::string text, Color fg_color, Color bg_color, Color led_color,
QObject *parrent = nullptr);
UI_led(const json &j, QObject *parrent = nullptr);
Color led_color() const;
void set_led_color(Color led_color);
+2 -3
View File
@@ -1,13 +1,12 @@
#include "UI_slider.hpp"
UI_slider::UI_slider(std::string id, std::string text, Color fg_color, Color bg_color, double min, double max,
double value, QObject* parrent)
double value, QObject *parrent)
: UI_item(id, UI_SLIDER_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value)
{
}
UI_slider::UI_slider(const json &j, QObject* parrent) : UI_item(UI_SLIDER_TYPE, parrent)
UI_slider::UI_slider(const json &j, QObject *parrent) : UI_item(UI_SLIDER_TYPE, parrent)
{
from_json(j);
}
+3 -2
View File
@@ -7,8 +7,9 @@ class UI_slider : public UI_item
{
Q_OBJECT
public:
UI_slider(std::string id, 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);
UI_slider(std::string id, 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);
void set_value(double value) override;
double value() const;
+2 -2
View File
@@ -1,11 +1,11 @@
#include "UI_textbox.hpp"
UI_textbox::UI_textbox(std::string id, std::string hint, Color fg_color, Color bg_color, QObject* parrent)
UI_textbox::UI_textbox(std::string id, std::string hint, Color fg_color, Color bg_color, QObject *parrent)
: UI_item(id, UI_TEXTBOX_TYPE, "", 0, fg_color, bg_color, parrent), 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 *parrent) : UI_item(UI_TEXTBOX_TYPE, parrent)
{
from_json(j);
}
+2 -2
View File
@@ -8,8 +8,8 @@ class UI_textbox : public UI_item
{
Q_OBJECT
public:
UI_textbox(std::string id, std::string hint, Color fg_color, Color bg_color, QObject* parrent = nullptr);
UI_textbox(const json &j, QObject* parrent = nullptr);
UI_textbox(std::string id, std::string hint, Color fg_color, Color bg_color, QObject *parrent = nullptr);
UI_textbox(const json &j, QObject *parrent = nullptr);
void set_text(std::string text) override;
+2 -2
View File
@@ -1,12 +1,12 @@
#include "UI_thermo.hpp"
UI_thermo::UI_thermo(std::string id, std::string text, Color fg_color, Color bg_color, double min, double max,
double value, QObject* parrent)
double value, QObject *parrent)
: UI_item(id, UI_THERMO_TYPE, text, 12, fg_color, bg_color, parrent), m_min(min), m_max(max), m_value(value)
{
}
UI_thermo::UI_thermo(const json &j, QObject* parrent) : UI_item(UI_THERMO_TYPE, parrent)
UI_thermo::UI_thermo(const json &j, QObject *parrent) : UI_item(UI_THERMO_TYPE, parrent)
{
from_json(j);
}
+3 -2
View File
@@ -8,8 +8,9 @@ class UI_thermo : public UI_item
{
Q_OBJECT
public:
UI_thermo(std::string id, 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);
UI_thermo(std::string id, 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);
void set_value(double value) override;
double value() const;
+2 -2
View File
@@ -1,11 +1,11 @@
#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 *parrent) : UI_item(type, parrent), m_options()
{
}
UI_x_boxes::UI_x_boxes(std::string id, 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 *parrent)
: UI_item(id, type, text, 12, fg_color, bg_color, parrent), 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 *parrent = nullptr);
UI_x_boxes(std::string id, 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 *parrent = nullptr);
void from_json(const json &j) override;
json to_json() const override;