mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
UI
rename some signals add some constructors that have no color
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
add_library(UI)
|
||||
add_library(UI STATIC)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core SerialBus)
|
||||
|
||||
|
||||
+1
-1
@@ -23,5 +23,5 @@ json UI_button::to_json(size_t id) const
|
||||
|
||||
void UI_button::click()
|
||||
{
|
||||
emit on_click();
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,5 +17,5 @@ class UI_button : public UI_item
|
||||
void click() override;
|
||||
|
||||
signals:
|
||||
void on_click();
|
||||
void clicked();
|
||||
};
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ void UI_combobox::set_selected(size_t selected)
|
||||
return;
|
||||
m_selected = selected;
|
||||
emit value_changed();
|
||||
emit on_change(selected_text());
|
||||
emit changed(selected_text());
|
||||
}
|
||||
|
||||
void UI_combobox::set_selected(std::string selected)
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ class UI_combobox : public UI_x_boxes
|
||||
void from_json(const json &j) override;
|
||||
json to_json(size_t id) const override;
|
||||
signals:
|
||||
void on_change(std::string selected);
|
||||
void changed(std::string selected);
|
||||
|
||||
private:
|
||||
size_t m_selected;
|
||||
|
||||
@@ -6,12 +6,22 @@ UI_dial::UI_dial(std::string text, std::string unit, Color fg_color, Color bg_co
|
||||
{
|
||||
}
|
||||
|
||||
UI_dial::UI_dial(std::string text, std::string unit, double min, double max, double value, QObject *parent)
|
||||
: UI_dial(text, unit, Color::Default, Color::Default, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_dial::UI_dial(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent)
|
||||
: UI_dial(text, "", fg_color, bg_color, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_dial::UI_dial(std::string text, double min, double max, double value, QObject *parent)
|
||||
: UI_dial(text, "", Color::Default, Color::Default, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_dial::UI_dial(const json &j, QObject *parent) : UI_item(UI_DIAL_TYPE, parent)
|
||||
{
|
||||
from_json(j);
|
||||
|
||||
@@ -9,8 +9,10 @@ class UI_dial : public UI_item
|
||||
public:
|
||||
UI_dial(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent = nullptr);
|
||||
UI_dial(std::string text, std::string unit, double min, double max, double value, QObject *parent = nullptr);
|
||||
UI_dial(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent = nullptr);
|
||||
UI_dial(std::string text, double min, double max, double value, QObject *parent = nullptr);
|
||||
UI_dial(const json &j, QObject *parent = nullptr);
|
||||
|
||||
void set_value(double value) override;
|
||||
|
||||
@@ -44,6 +44,12 @@ void UI_item::set_text(std::string text)
|
||||
}
|
||||
}
|
||||
|
||||
void UI_item::append_text(std::string text)
|
||||
{
|
||||
m_text.append(text);
|
||||
emit value_changed();
|
||||
}
|
||||
|
||||
std::string UI_item::text() const
|
||||
{
|
||||
return m_text;
|
||||
|
||||
@@ -26,6 +26,7 @@ class UI_item : public QObject
|
||||
bool is_type(json j);
|
||||
|
||||
virtual void set_text(std::string text);
|
||||
void append_text(std::string text);
|
||||
std::string text() const;
|
||||
|
||||
void set_text_size(uint8_t text_size);
|
||||
|
||||
+2
-1
@@ -14,9 +14,10 @@ UI_led::UI_led(const json &j, QObject *parent) : UI_item(UI_LED_TYPE, parent)
|
||||
from_json(j);
|
||||
}
|
||||
|
||||
void UI_led::set_led(bool state, Color on, Color off)
|
||||
bool UI_led::set_led(bool state, Color on, Color off)
|
||||
{
|
||||
set_bg_color(state ? on : off);
|
||||
return state;
|
||||
}
|
||||
|
||||
void UI_led::from_json(const json &j)
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class UI_led : public UI_item
|
||||
UI_led(std::string text, Color fg_color, Color bg_color, QObject *parent = nullptr);
|
||||
UI_led(const json &j, QObject *parent = nullptr);
|
||||
|
||||
void set_led(bool state, Color on, Color off);
|
||||
bool set_led(bool state, Color on, Color off);
|
||||
|
||||
void from_json(const json &j) override;
|
||||
json to_json(size_t id) const override;
|
||||
|
||||
@@ -7,12 +7,22 @@ UI_slider::UI_slider(std::string text, std::string unit, Color fg_color, Color b
|
||||
{
|
||||
}
|
||||
|
||||
UI_slider::UI_slider(std::string text, std::string unit, double min, double max, double value, QObject *parent)
|
||||
: UI_slider(text, unit, Color::Default, Color::Default, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_slider::UI_slider(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent)
|
||||
: UI_slider(text, "", fg_color, bg_color, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_slider::UI_slider(std::string text, double min, double max, double value, QObject *parent)
|
||||
: UI_slider(text, "", Color::Default, Color::Default, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_slider::UI_slider(const json &j, QObject *parent) : UI_item(UI_SLIDER_TYPE, parent)
|
||||
{
|
||||
from_json(j);
|
||||
|
||||
@@ -9,8 +9,10 @@ class UI_slider : public UI_item
|
||||
public:
|
||||
UI_slider(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent = nullptr);
|
||||
UI_slider(std::string text, std::string unit, double min, double max, double value, QObject *parent = nullptr);
|
||||
UI_slider(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent = nullptr);
|
||||
UI_slider(std::string text, double min, double max, double value, QObject *parent = nullptr);
|
||||
UI_slider(const json &j, QObject *parent = nullptr);
|
||||
|
||||
void set_value(double value) override;
|
||||
|
||||
@@ -7,12 +7,22 @@ UI_thermo::UI_thermo(std::string text, std::string unit, Color fg_color, Color b
|
||||
{
|
||||
}
|
||||
|
||||
UI_thermo::UI_thermo(std::string text, std::string unit, double min, double max, double value, QObject *parent)
|
||||
: UI_thermo(text, unit, Color::Default, Color::Default, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_thermo::UI_thermo(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent)
|
||||
: UI_thermo(text, "", fg_color, bg_color, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_thermo::UI_thermo(std::string text, double min, double max, double value, QObject *parent)
|
||||
: UI_thermo(text, "", Color::Default, Color::Default, min, max, value, parent)
|
||||
{
|
||||
}
|
||||
|
||||
UI_thermo::UI_thermo(const json &j, QObject *parent) : UI_item(UI_THERMO_TYPE, parent)
|
||||
{
|
||||
from_json(j);
|
||||
|
||||
@@ -10,8 +10,10 @@ class UI_thermo : public UI_item
|
||||
public:
|
||||
UI_thermo(std::string text, std::string unit, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent = nullptr);
|
||||
UI_thermo(std::string text, std::string unit, double min, double max, double value, QObject *parent = nullptr);
|
||||
UI_thermo(std::string text, Color fg_color, Color bg_color, double min, double max, double value,
|
||||
QObject *parent = nullptr);
|
||||
UI_thermo(std::string text, double min, double max, double value, QObject *parent = nullptr);
|
||||
UI_thermo(const json &j, QObject *parent = nullptr);
|
||||
|
||||
void set_value(double value) override;
|
||||
|
||||
Reference in New Issue
Block a user