From 219da3227e5384d1ea8da1f32b47554354df35a8 Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Fri, 22 Nov 2024 22:35:46 +0100 Subject: [PATCH] sims remove deprecated functions --- Qt/simulators/sim-test.cpp | 61 +------------------------------------- Qt/simulators/sim-test.h | 15 ---------- 2 files changed, 1 insertion(+), 75 deletions(-) diff --git a/Qt/simulators/sim-test.cpp b/Qt/simulators/sim-test.cpp index 867ccf8..be0a15d 100644 --- a/Qt/simulators/sim-test.cpp +++ b/Qt/simulators/sim-test.cpp @@ -16,74 +16,15 @@ Test_Sim::Test_Sim(Web_socket_wrapper* web_socket, QWidget* parent) : push_ui_item(ui->dial); push_ui_item(ui->thermo); push_ui_item(ui->led); - - setup_buttons(); - setup_comboboxes(); - setup_sliders(); - setup_dials(); } Test_Sim::~Test_Sim() { delete ui; } -void Test_Sim::setup_buttons(void) -{ - for (size_t i = 0; i < ui_lookup.size(); i++) - { - QPushButton* button = qobject_cast(ui_lookup.at(i)); - if (button == nullptr) - continue; - - connect(button, &QPushButton::clicked, this, [=, this] { - button_update(i); - }); - } -} - -void Test_Sim::setup_sliders(void) -{ - for (size_t i = 0; i < ui_lookup.size(); i++) - { - QwtSlider* slider = qobject_cast(ui_lookup.at(i)); - if (slider == nullptr) - continue; - - connect(slider, &QwtSlider::sliderMoved, this, [=, this]{ - //value_lookup_e lookup_v = thermo_to_value_lookup(lookup); - //value_lookup[lookup_v]->setText(format_value(lookup_v, thermo_lookup[lookup]->value())); - slider_update(i); - }); - } -} - -void Test_Sim::setup_comboboxes(void) -{ - for (size_t i = 0; i < ui_lookup.size(); i++) - { - QComboBox* combobox = qobject_cast(ui_lookup.at(i)); - if (combobox == nullptr) - continue; - - connect(combobox, &QComboBox::currentIndexChanged, this, [=, this]{combobox_update(i);}); - } -} - -void Test_Sim::setup_dials(void) -{ - for (size_t i = 0; i < ui_lookup.size(); i++) - { - QwtDial* dial = qobject_cast(ui_lookup.at(i)); - if (dial == nullptr) - continue; - - create_dial_needle(dial); - } -} - QLabel* Test_Sim::id_to_label(size_t id) { - QWidget* widget = ui_lookup.at(id); + QWidget* widget = id_to_ui(id); if (widget == ui->slider) return ui->slider_label; if (widget == ui->thermo) diff --git a/Qt/simulators/sim-test.h b/Qt/simulators/sim-test.h index 1fc0dd2..4a79d9d 100644 --- a/Qt/simulators/sim-test.h +++ b/Qt/simulators/sim-test.h @@ -13,24 +13,9 @@ class Test_Sim : public SimulatorBase { Q_OBJECT public: - ITERABLE_ENUM_BEGIN(ui_lookup_e) - button, - led, - label, - slider, - dial, - thermo, - combobox - ITERABLE_ENUM_END; - explicit Test_Sim(Web_socket_wrapper* web_socket, QWidget* parent = nullptr); ~Test_Sim(); - void setup_buttons(void); - void setup_sliders(void); - void setup_comboboxes(void); - void setup_dials(void); - QLabel* id_to_label(size_t name) override; private: