mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
test sim
add dial and thermo
This commit is contained in:
+43
-2
@@ -10,7 +10,13 @@ Test_Sim::Test_Sim(Web_socket_wrapper* web_socket, QWidget* parent) :
|
||||
{button_lookup_e::button, ui->button}
|
||||
};
|
||||
slider_lookup = {
|
||||
{slider_lookup_e::slider, ui->Slider}
|
||||
{slider_lookup_e::slider, ui->slider}
|
||||
};
|
||||
dial_lookup = {
|
||||
{dial_lookup_e::dial, ui->dial}
|
||||
};
|
||||
thermo_lookup = {
|
||||
{thermo_lookup_e::thermo, ui->thermo}
|
||||
};
|
||||
led_lookup = {
|
||||
{led_lookup_e::led, ui->led}
|
||||
@@ -26,6 +32,7 @@ Test_Sim::Test_Sim(Web_socket_wrapper* web_socket, QWidget* parent) :
|
||||
setup_buttons();
|
||||
setup_comboboxes();
|
||||
setup_sliders();
|
||||
setup_dials();
|
||||
}
|
||||
|
||||
Test_Sim::~Test_Sim() {
|
||||
@@ -74,6 +81,14 @@ void Test_Sim::setup_comboboxes(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Test_Sim::setup_dials(void)
|
||||
{
|
||||
for (Iterable<dial_lookup_e> lookup; lookup < dial_lookup_e::end; lookup++)
|
||||
{
|
||||
create_dial_needle(dial_lookup[lookup]);
|
||||
}
|
||||
}
|
||||
|
||||
void Test_Sim::button_update(button_lookup_e lookup)
|
||||
{
|
||||
m_web_socket->send_event(Web_socket_wrapper::Event::clicked, QString(magic_enum::enum_name(lookup).data()));
|
||||
@@ -135,7 +150,7 @@ QwtSlider* Test_Sim::id_to_slider(QString name)
|
||||
slider_lookup_e lookup = magic_enum::enum_cast<slider_lookup_e>(name.toStdString()).value_or(slider_lookup_e::end);
|
||||
if (lookup == slider_lookup_e::end)
|
||||
{
|
||||
QD << "thermo lookup == end, instead of " << name;
|
||||
QD << "slider lookup == end, instead of " << name;
|
||||
emit quit();
|
||||
return nullptr;
|
||||
}
|
||||
@@ -160,6 +175,32 @@ QString Test_Sim::format_slider_value(QString name, double val)
|
||||
return "";
|
||||
}
|
||||
|
||||
QwtDial* Test_Sim::id_to_dial(QString name)
|
||||
{
|
||||
dial_lookup_e lookup = magic_enum::enum_cast<dial_lookup_e>(name.toStdString()).value_or(dial_lookup_e::end);
|
||||
if (lookup == dial_lookup_e::end)
|
||||
{
|
||||
QD << "dial lookup == end, instead of " << name;
|
||||
emit quit();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return dial_lookup[lookup];
|
||||
}
|
||||
|
||||
QwtThermo* Test_Sim::id_to_thermo(QString name)
|
||||
{
|
||||
thermo_lookup_e lookup = magic_enum::enum_cast<thermo_lookup_e>(name.toStdString()).value_or(thermo_lookup_e::end);
|
||||
if (lookup == thermo_lookup_e::end)
|
||||
{
|
||||
QD << "thermo lookup == end, instead of " << name;
|
||||
emit quit();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return thermo_lookup[lookup];
|
||||
}
|
||||
|
||||
QComboBox* Test_Sim::id_to_combobox(QString name)
|
||||
{
|
||||
combobox_lookup_e lookup = magic_enum::enum_cast<combobox_lookup_e>(name.toStdString()).value_or(combobox_lookup_e::end);
|
||||
|
||||
Reference in New Issue
Block a user