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:
@@ -2,6 +2,7 @@
|
||||
#include "simulator_base.hpp"
|
||||
|
||||
class Can_Debugger : public Simulator_base {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Can_Debugger();
|
||||
void timer() override;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "test_sim.hpp"
|
||||
#include <iostream>
|
||||
|
||||
Test_Sim::Test_Sim() :
|
||||
Simulator_base("Test_Sim", std::chrono::milliseconds(1000)),
|
||||
m_button("button", "Off", Color(Color::White), Color(Color::Red), [this](std::string id) { button_clicked(id); }),
|
||||
m_combobox("combobox", "Combobox", Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, 0, [](std::string id, std::string selected) { spdlog::info("Combobox {} selected {}", id, selected); }),
|
||||
Test_Sim::Test_Sim(QObject* parrent) :
|
||||
Simulator_base("Test_Sim", std::chrono::milliseconds(1000), parrent),
|
||||
m_button("button", "Off", Color(Color::White), Color(Color::Red)),
|
||||
m_combobox("combobox", "Combobox", Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, 0),
|
||||
m_label("label", "Label", Color(Color::White), Color(Color::Black)),
|
||||
m_checkbox("checkbox", "Checkbox", Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}, [](std::string id, std::vector<std::string> selected) { spdlog::info("Checkbox {} selected {}", id, (selected.size() > 0 ? selected[0] : "")); }),
|
||||
m_slider("slider", "Slider", Color(Color::White), Color(Color::Black), 0, 100, 0, [this](std::string id, double value) { slider_changed(id, value); }),
|
||||
m_checkbox("checkbox", "Checkbox", Color(Color::White), Color(Color::Black), {"Option 1", "Option 2", "Option 3"}),
|
||||
m_slider("slider", "Slider", Color(Color::White), Color(Color::Black), 0, 100, 0),
|
||||
m_dial("dial", "Dial", Color(Color::White), Color(Color::Black), 0, 100, 0),
|
||||
m_thermo("thermo", "Thermo", Color(Color::White), Color(Color::Black), 0, 100, 0),
|
||||
m_led("led", "Led", Color(Color::White), Color(Color::Black), Color(Color::Red))
|
||||
@@ -27,6 +27,9 @@ m_led("led", "Led", Color(Color::White), Color(Color::Black), Color(Color::Red))
|
||||
this->add_UI_item(&this->m_dial);
|
||||
this->add_UI_item(&this->m_thermo);
|
||||
this->add_UI_item(&this->m_led);
|
||||
|
||||
QObject::connect(&m_button, &UI_button::on_click, [this](std::string id) { button_clicked(id); });
|
||||
QObject::connect(&m_slider, &UI_slider::on_change, [this](std::string id, double value) { slider_changed(id, value); });
|
||||
}
|
||||
|
||||
void Test_Sim::timer()
|
||||
@@ -69,4 +72,4 @@ void Test_Sim::slider_changed(std::string id, double value)
|
||||
this->m_thermo.set_value(value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#include "simulator_base.hpp"
|
||||
|
||||
class Test_Sim : public Simulator_base {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Test_Sim();
|
||||
Test_Sim(QObject* parrent = nullptr);
|
||||
void timer() override;
|
||||
void run_at_startup() override;
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user