mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Client
This commit is contained in:
+16
-13
@@ -1,16 +1,23 @@
|
||||
#pragma once
|
||||
#include "nlohmann/json.hpp"
|
||||
#include <QMainWindow>
|
||||
#include <map>
|
||||
|
||||
using json = nlohmann::json;
|
||||
#include "messages.qpb.h"
|
||||
|
||||
#define INSERT_SIMULATOR(type) \
|
||||
m_sims.insert(std::make_pair(type().sim_name(), std::make_unique<type>(m_web_socket.get(), this)))
|
||||
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(QMessageBox);
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(Web_socket_wrapper);
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(UI_base);
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(QTimer);
|
||||
namespace RemoteUiService
|
||||
{
|
||||
class Client;
|
||||
}
|
||||
|
||||
namespace Health
|
||||
{
|
||||
class Client;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -32,6 +39,8 @@ class MainWindow : public QMainWindow
|
||||
explicit MainWindow(QUrl ws_url, QString sim, QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
signals:
|
||||
void on_show_event();
|
||||
private:
|
||||
/**
|
||||
* @brief Handle the show event
|
||||
@@ -59,7 +68,7 @@ class MainWindow : public QMainWindow
|
||||
*
|
||||
* @param sims The JSON array of simulator names
|
||||
*/
|
||||
void pase_sim_names(json &sims);
|
||||
void pase_sim_names(Simulators_m &sims);
|
||||
/**
|
||||
* @brief Open the simulator window using the selected simulator
|
||||
*/
|
||||
@@ -78,18 +87,12 @@ class MainWindow : public QMainWindow
|
||||
*/
|
||||
void open_sim(QString sim_name);
|
||||
|
||||
/**
|
||||
* @brief Handle command callbacks from the server
|
||||
*
|
||||
* @param j The JSON command
|
||||
*/
|
||||
void on_cmd_cb(json &j);
|
||||
|
||||
bool m_default_sim = false;
|
||||
QString m_selected_sim_name;
|
||||
QMainWindow *m_selected_sim;
|
||||
QMessageBox *m_error;
|
||||
Ui::MainWindow *ui;
|
||||
std::unique_ptr<Web_socket_wrapper> m_web_socket;
|
||||
std::unique_ptr<RemoteUiService::Client> m_remote_ui_client;
|
||||
std::map<QString, std::unique_ptr<UI_base>> m_sims;
|
||||
QTimer *m_ping;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user