mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Move to Qt
Everything seems to be working Only timer is not moved over
This commit is contained in:
+11
-4
@@ -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)
|
||||
: UI_item(id, UI_THERMO_TYPE, text, 12, fg_color, bg_color), m_min(min), m_max(max), m_value(value)
|
||||
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) : UI_item(UI_THERMO_TYPE)
|
||||
UI_thermo::UI_thermo(const json &j, QObject* parrent) : UI_item(UI_THERMO_TYPE, parrent)
|
||||
{
|
||||
from_json(j);
|
||||
}
|
||||
@@ -19,6 +19,7 @@ void UI_thermo::set_value(double value)
|
||||
return;
|
||||
|
||||
this->m_value = value;
|
||||
emit value_changed();
|
||||
}
|
||||
|
||||
double UI_thermo::value() const
|
||||
@@ -39,11 +40,13 @@ double UI_thermo::max() const
|
||||
void UI_thermo::set_start_color(Color color)
|
||||
{
|
||||
this->m_color_map[0] = color;
|
||||
emit value_changed();
|
||||
}
|
||||
|
||||
void UI_thermo::set_end_color(Color color)
|
||||
{
|
||||
this->m_color_map[1] = color;
|
||||
emit value_changed();
|
||||
}
|
||||
|
||||
void UI_thermo::add_color_stop(double value, Color color)
|
||||
@@ -52,6 +55,7 @@ void UI_thermo::add_color_stop(double value, Color color)
|
||||
return;
|
||||
|
||||
this->m_color_map[value] = color;
|
||||
emit value_changed();
|
||||
}
|
||||
|
||||
void UI_thermo::add_color_stop_normalized(double value, Color color)
|
||||
@@ -61,6 +65,7 @@ void UI_thermo::add_color_stop_normalized(double value, Color color)
|
||||
|
||||
double normalized = (value - m_min) / (m_max - m_min);
|
||||
this->m_color_map[normalized] = color;
|
||||
emit value_changed();
|
||||
}
|
||||
|
||||
void UI_thermo::remove_color_stop(double value)
|
||||
@@ -69,6 +74,7 @@ void UI_thermo::remove_color_stop(double value)
|
||||
return;
|
||||
|
||||
this->m_color_map.erase(value);
|
||||
emit value_changed();
|
||||
}
|
||||
|
||||
void UI_thermo::remove_color_stop_normalized(double value)
|
||||
@@ -78,6 +84,7 @@ void UI_thermo::remove_color_stop_normalized(double value)
|
||||
|
||||
double normalized = (value - m_min) / (m_max - m_min);
|
||||
this->m_color_map.erase(normalized);
|
||||
emit value_changed();
|
||||
}
|
||||
|
||||
void UI_thermo::from_json(const json &j)
|
||||
@@ -111,4 +118,4 @@ json UI_thermo::to_json() const
|
||||
j["color_map"].push_back(item);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user