This commit is contained in:
2026-02-14 14:31:23 +01:00
parent d82886f3a1
commit 99b2e07890
2 changed files with 9 additions and 5 deletions
+4 -3
View File
@@ -1,7 +1,7 @@
#include "mainwindow.hpp" #include "mainwindow.hpp"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
typedef Simulator_base *(*Get_UI)(Web_socket_wrapper*, QWidget*); typedef Simulator_base *(*Get_UI)(Web_socket_wrapper *, QWidget *);
MainWindow::MainWindow(QUrl ws_url, QWidget *parent) MainWindow::MainWindow(QUrl ws_url, QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow), m_web_socket(new Web_socket_wrapper(ws_url)), : QMainWindow(parent), ui(new Ui::MainWindow), m_web_socket(new Web_socket_wrapper(ws_url)),
@@ -9,7 +9,8 @@ MainWindow::MainWindow(QUrl ws_url, QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
QLibrary lib; QLibrary lib;
QDirIterator it(QCoreApplication::applicationDirPath(), QStringList() << "*.so" << "*.dll", QDir::Files, QDirIterator::Subdirectories); QDirIterator it(QCoreApplication::applicationDirPath(), QStringList() << "*.so" << "*.dll", QDir::Files,
QDirIterator::Subdirectories);
while (it.hasNext()) while (it.hasNext())
{ {
lib.setFileName(it.next()); lib.setFileName(it.next());
@@ -25,7 +26,7 @@ MainWindow::MainWindow(QUrl ws_url, QWidget *parent)
lib.unload(); lib.unload();
} }
// Insert debug sims here // Insert debug sims here
//INSERT_SIMULATOR(SIM_NAME); // INSERT_SIMULATOR(SIM_NAME);
m_error_dialog->set_error("Connection timed out\nCheck if the server is running"); m_error_dialog->set_error("Connection timed out\nCheck if the server is running");
ui->connection->setText("Connected to " + ws_url.toString()); ui->connection->setText("Connected to " + ws_url.toString());
+4 -1
View File
@@ -15,7 +15,10 @@ using json = nlohmann::json;
#define PUSH_UI_ITEM(item) push_ui_item(ui->item) #define PUSH_UI_ITEM(item) push_ui_item(ui->item)
#define EXPORT_UI(client) \ #define EXPORT_UI(client) \
extern "C" Q_DECL_EXPORT Simulator_base* get_ui(Web_socket_wrapper *api, QWidget *parent) { return new client(api, parent); } extern "C" Q_DECL_EXPORT Simulator_base *get_ui(Web_socket_wrapper *api, QWidget *parent) \
{ \
return new client(api, parent); \
}
class Simulator_base : public QMainWindow class Simulator_base : public QMainWindow
{ {