mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
Move to Qt
Everything seems to be working Only timer is not moved over
This commit is contained in:
+34
-3
@@ -3,14 +3,39 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "websocket.hpp"
|
||||
#include "simulator_base.hpp"
|
||||
|
||||
#define INSERT_SIMULATOR(type) m_simulators.insert(std::make_pair(type().name(), std::make_unique<type>()));
|
||||
|
||||
class Simulators
|
||||
class Simulators : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Simulators();
|
||||
enum class Command
|
||||
{
|
||||
get_UI_element,
|
||||
get_UI_elements,
|
||||
switch_simulator,
|
||||
get_active_simulator_name,
|
||||
get_simulators,
|
||||
end,
|
||||
begin = 0
|
||||
};
|
||||
|
||||
enum class Event
|
||||
{
|
||||
clicked,
|
||||
value_changed,
|
||||
text_changed,
|
||||
selected,
|
||||
ui_changed,
|
||||
end,
|
||||
begin = 0
|
||||
};
|
||||
|
||||
Simulators(uint16_t port, QObject *parent = nullptr);
|
||||
void setup_connections();
|
||||
std::string active_simulator_name() const;
|
||||
void run();
|
||||
void stop();
|
||||
@@ -19,9 +44,15 @@ class Simulators
|
||||
Simulator_base *invoke_active_simulator();
|
||||
json changed_UI_items();
|
||||
|
||||
//parsing of websocket messages
|
||||
QString message_parser(QString message);
|
||||
json command_parser(json command);
|
||||
void event_handler(json event);
|
||||
|
||||
private:
|
||||
Websocket *m_server;
|
||||
std::map<std::string, std::unique_ptr<Simulator_base>> m_simulators;
|
||||
std::string m_current_simulator = "";
|
||||
std::mutex m_mutex;
|
||||
json m_before;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user