Move to Qt

Move to QTimer
Remove unused submodules
This commit is contained in:
2024-09-12 17:07:06 +02:00
parent 9eef1fc3ff
commit 734a8dfca2
7 changed files with 8 additions and 18 deletions
+1 -2
View File
@@ -40,8 +40,7 @@ target_include_directories(server
target_link_libraries(server PRIVATE
Qt::WebSockets
UI
Timer
magic_enum::magic_enum
spdlog
UI
)
+4 -3
View File
@@ -1,8 +1,9 @@
#include "simulator_base.hpp"
Simulator_base::Simulator_base(std::string name, std::chrono::milliseconds interval, QObject* parrent)
: QObject(parrent), m_name(name), m_timer([this] { timer(); }), m_interval(interval)
: QObject(parrent), m_name(name), m_timer(new QTimer(this)), m_interval(interval)
{
connect(m_timer, &QTimer::timeout, this, [this]{timer();});
}
std::string Simulator_base::name() const
@@ -59,14 +60,14 @@ UI_item *Simulator_base::get_UI_item(std::string id) const
void Simulator_base::run()
{
// Start the timer
m_timer.setInterval(m_interval);
m_timer->start(m_interval);
run_at_startup();
}
void Simulator_base::stop()
{
// Stop the simulator
m_timer.stop();
m_timer->stop();
}
void Simulator_base::shutdown()
+2 -2
View File
@@ -2,7 +2,7 @@
#include "UI.hpp"
#include "spdlog/spdlog.h"
#include "timer.hpp"
#include <QTimer>
class Simulator_base : public QObject
{
@@ -89,6 +89,6 @@ class Simulator_base : public QObject
std::string m_name;
std::vector<UI_item *> m_UI_items;
std::map<std::string, UI_item *> m_UI_items_map;
Timer m_timer;
QTimer* m_timer;
std::chrono::milliseconds m_interval;
};