mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Update UI
This commit is contained in:
+38
-14
@@ -1,12 +1,47 @@
|
||||
#include "ui_led.hpp"
|
||||
|
||||
UI_led::UI_led(QObject *parent) : UI_item(UI_enum::ui_led, "", Color::Default, Color::Default, parent)
|
||||
UI_led::UI_led(QObject *parent) : UI_item(UI_typeGadget::UI_type::ui_led, parent)
|
||||
{
|
||||
m_ui_item.setLabel(UI_label_m());
|
||||
}
|
||||
|
||||
UI_led::UI_led(std::string text, Color fg_color, Color bg_color, QObject *parent)
|
||||
: UI_item(UI_enum::ui_led, text, fg_color, bg_color, parent)
|
||||
UI_led::UI_led(QString text, Color fg_color, Color bg_color, QObject *parent)
|
||||
: UI_item(UI_typeGadget::UI_type::ui_led, parent)
|
||||
{
|
||||
m_ui_item.setLabel(UI_label_m());
|
||||
m_ui_item.label().setText(text);
|
||||
m_ui_item.label().mutColor().setFgColor(fg_color.color());
|
||||
m_ui_item.label().mutColor().setBgColor(bg_color.color());
|
||||
}
|
||||
|
||||
void UI_led::set_text(QString text)
|
||||
{
|
||||
m_ui_item.label().setText(text);
|
||||
}
|
||||
|
||||
QString UI_led::text() const
|
||||
{
|
||||
return m_ui_item.label().text();
|
||||
}
|
||||
|
||||
void UI_led::set_fg_color(Color color)
|
||||
{
|
||||
m_ui_item.label().mutColor().setFgColor(color.color());
|
||||
}
|
||||
|
||||
Color UI_led::fg_color() const
|
||||
{
|
||||
return Color(m_ui_item.label().color().fgColor());
|
||||
}
|
||||
|
||||
void UI_led::set_bg_color(Color color)
|
||||
{
|
||||
m_ui_item.label().mutColor().setBgColor(color.color());
|
||||
}
|
||||
|
||||
Color UI_led::bg_color() const
|
||||
{
|
||||
return Color(m_ui_item.label().color().bgColor());
|
||||
}
|
||||
|
||||
bool UI_led::set_led(bool state, Color on, Color off)
|
||||
@@ -14,14 +49,3 @@ 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)
|
||||
{
|
||||
UI_item::from_json(j);
|
||||
}
|
||||
|
||||
json UI_led::to_json(size_t id) const
|
||||
{
|
||||
json j = UI_item::to_json(id);
|
||||
return j;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user