From 7cb93ec14d5a0dfa764b58fd50fa95be2ef7de58 Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Sat, 18 Oct 2025 11:20:51 +0200 Subject: [PATCH] change Event can_clear to clear make this a bit more general, that it can be used for more then only can --- UI/ui_can.cpp | 2 +- UI/ui_can.hpp | 2 +- UI/ui_item.cpp | 2 +- UI/ui_item.hpp | 2 +- client/simulator_base.cpp | 2 +- client/web_socket_wrapper.cpp | 2 +- client/web_socket_wrapper.hpp | 2 +- server/message_parser.cpp | 4 ++-- server/simulators.hpp | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/UI/ui_can.cpp b/UI/ui_can.cpp index c902358..d25c49d 100644 --- a/UI/ui_can.cpp +++ b/UI/ui_can.cpp @@ -50,7 +50,7 @@ void UI_can::clear_receive_buffer() emit ui_changed(); } -void UI_can::can_clear() +void UI_can::clear() { clear_send_buffer(); clear_receive_buffer(); diff --git a/UI/ui_can.hpp b/UI/ui_can.hpp index 92de899..52e019f 100644 --- a/UI/ui_can.hpp +++ b/UI/ui_can.hpp @@ -31,7 +31,7 @@ class UI_can : public UI_item json to_json(size_t id) const override; void can_send(uint32_t id, uint8_t dlc, std::array payload) override; - void can_clear() override; + void clear() override; signals: void send(QCanBusFrame msg); diff --git a/UI/ui_item.cpp b/UI/ui_item.cpp index 841d444..980a746 100644 --- a/UI/ui_item.cpp +++ b/UI/ui_item.cpp @@ -168,7 +168,7 @@ void UI_item::can_send(uint32_t id, uint8_t dlc, std::array payload) UNUSED(payload); }; -void UI_item::can_clear() +void UI_item::clear() { } diff --git a/UI/ui_item.hpp b/UI/ui_item.hpp index 070f6d4..5b87ad6 100644 --- a/UI/ui_item.hpp +++ b/UI/ui_item.hpp @@ -46,7 +46,7 @@ class UI_item : public QObject virtual void set_selected(size_t selected); virtual void set_value(double value); virtual void can_send(uint32_t id, uint8_t dlc, std::array payload); - virtual void can_clear(); + virtual void clear(); signals: void ui_changed(); diff --git a/client/simulator_base.cpp b/client/simulator_base.cpp index 4f9f88a..d9d9fec 100644 --- a/client/simulator_base.cpp +++ b/client/simulator_base.cpp @@ -1059,5 +1059,5 @@ void Simulator_base::setup_can_ui(QWidget *item, size_t index) m_web_socket->send_event(Web_socket_wrapper::Event::can_send, index, id, dlc, payload); }); connect(can, &Can_Transceive::can_clear, this, - [=, this] { m_web_socket->send_event(Web_socket_wrapper::Event::can_clear, index); }); + [=, this] { m_web_socket->send_event(Web_socket_wrapper::Event::clear, index); }); } diff --git a/client/web_socket_wrapper.cpp b/client/web_socket_wrapper.cpp index 13a6fe2..244512f 100644 --- a/client/web_socket_wrapper.cpp +++ b/client/web_socket_wrapper.cpp @@ -77,7 +77,7 @@ void Web_socket_wrapper::send_event(Event e, size_t id) switch (e) { case Event::clicked: - case Event::can_clear: + case Event::clear: j["event"]["id"] = id; m_web_socket->sendTextMessage(QString(j.dump().data())); break; diff --git a/client/web_socket_wrapper.hpp b/client/web_socket_wrapper.hpp index de420d4..9870d02 100644 --- a/client/web_socket_wrapper.hpp +++ b/client/web_socket_wrapper.hpp @@ -27,7 +27,7 @@ class Web_socket_wrapper : public QObject text_changed, selected, can_send, - can_clear, + clear, ui_changed, end, begin = 0 diff --git a/server/message_parser.cpp b/server/message_parser.cpp index fd2f101..6777af3 100644 --- a/server/message_parser.cpp +++ b/server/message_parser.cpp @@ -120,9 +120,9 @@ void Simulators::event_handler(json event) (std::array)event.at("payload")); break; } - case Event::can_clear: { + case Event::clear: { SPDLOG_DEBUG("Event {}: {}", type, (size_t)event.at("id")); - invoke_active_simulator()->get_UI_item(event.at("id"))->can_clear(); + invoke_active_simulator()->get_UI_item(event.at("id"))->clear(); break; } default: { diff --git a/server/simulators.hpp b/server/simulators.hpp index f103806..99939fb 100644 --- a/server/simulators.hpp +++ b/server/simulators.hpp @@ -39,7 +39,7 @@ class Simulators : public QObject text_changed, selected, can_send, - can_clear, + clear, ui_changed, end, begin = 0