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
-6
View File
@@ -1,12 +1,6 @@
[submodule "external/color"]
path = external/color
url = git@github.com:Sani7/cpp_color_lib.git
[submodule "external/timer"]
path = external/timer
url = git@github.com:Sani7/cpp_timer.git
[submodule "external/websocketpp"]
path = external/websocketpp
url = git@github.com:Sani7/websocketpp.git
[submodule "external/spdlog"]
path = external/spdlog
url = git@github.com:gabime/spdlog.git
-2
View File
@@ -1,4 +1,2 @@
add_subdirectory(color)
add_subdirectory(spdlog)
add_subdirectory(timer)
add_subdirectory(websocketpp)
-1
Submodule external/timer deleted from 693d29797d
Submodule external/websocketpp deleted from cbe02ed984
+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;
};