mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
cmd line args
add args for server host + port
This commit is contained in:
+21
-1
@@ -5,7 +5,27 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
QCommandLineParser parser;
|
||||||
|
parser.setApplicationDescription("sim-us client");
|
||||||
|
parser.addHelpOption();
|
||||||
|
|
||||||
|
QCommandLineOption hostOption(QStringList() << "s"
|
||||||
|
<< "server",
|
||||||
|
QCoreApplication::translate("main", "sim-us server host [default: localhost]."),
|
||||||
|
QCoreApplication::translate("main", "host"), QLatin1String("localhost"));
|
||||||
|
parser.addOption(hostOption);
|
||||||
|
|
||||||
|
QCommandLineOption portOption(QStringList() << "p"
|
||||||
|
<< "port",
|
||||||
|
QCoreApplication::translate("main", "Port for echoserver [default: 9002]."),
|
||||||
|
QCoreApplication::translate("main", "port"), QLatin1String("9002"));
|
||||||
|
parser.addOption(portOption);
|
||||||
|
|
||||||
|
parser.process(a);
|
||||||
|
|
||||||
|
QString host = parser.value(hostOption);
|
||||||
|
uint16_t port = parser.value(portOption).toUShort();
|
||||||
|
MainWindow w(host, port);
|
||||||
w.show();
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -6,10 +6,10 @@
|
|||||||
#include "sim-cvs_i10.h"
|
#include "sim-cvs_i10.h"
|
||||||
#include "sim-test.h"
|
#include "sim-test.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QString host, uint16_t port, QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
m_web_socket(new Web_socket_wrapper(QUrl("ws://localhost:9002"), this)),
|
m_web_socket(new Web_socket_wrapper(QUrl("ws://" + host + ":" + QString::number(port)), this)),
|
||||||
m_error_dialog(new NetworkError(this)),
|
m_error_dialog(new NetworkError(this)),
|
||||||
m_sims{{"Can_Debugger", new Can_Debugger(m_web_socket, this)},
|
m_sims{{"Can_Debugger", new Can_Debugger(m_web_socket, this)},
|
||||||
{"Scope_Mux_Tester", new Scope_Mux_Tester(m_web_socket, this)},
|
{"Scope_Mux_Tester", new Scope_Mux_Tester(m_web_socket, this)},
|
||||||
@@ -20,7 +20,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
this->setWindowTitle("Simulator Selector");
|
this->setWindowTitle("Simulator Selector");
|
||||||
|
|
||||||
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");
|
||||||
|
|
||||||
//Default sim
|
//Default sim
|
||||||
//defaultSim("CVS_I10");
|
//defaultSim("CVS_I10");
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = nullptr);
|
explicit MainWindow(QString host, uint16_t port, QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
void defaultSim(QString name);
|
void defaultSim(QString name);
|
||||||
|
|||||||
Reference in New Issue
Block a user