mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Move to Qt
Move to QTimer Remove unused submodules
This commit is contained in:
@@ -40,8 +40,7 @@ target_include_directories(server
|
||||
|
||||
target_link_libraries(server PRIVATE
|
||||
Qt::WebSockets
|
||||
UI
|
||||
Timer
|
||||
magic_enum::magic_enum
|
||||
spdlog
|
||||
UI
|
||||
)
|
||||
|
||||
@@ -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,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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user