diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-12-12 12:13:12 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-12-12 12:13:12 +0100 |
commit | 52571310d06e2c20d2959c7f6ca2d9e6a1cf281c (patch) | |
tree | 1ec3ac1e4008d11853c7c1db0b2f80b8f6561af7 | |
parent | 28cd1a0d195637f8f55faf711a66a3e0249843dc (diff) |
allow manual serial port specification
-rw-r--r-- | confui/confui.pro | 3 | ||||
-rw-r--r-- | confui/main.cpp | 7 | ||||
-rw-r--r-- | confui/main.h | 7 | ||||
-rw-r--r-- | confui/mainwindow.cpp | 7 |
4 files changed, 19 insertions, 5 deletions
diff --git a/confui/confui.pro b/confui/confui.pro index 7dcd66c..237f22d 100644 --- a/confui/confui.pro +++ b/confui/confui.pro @@ -26,7 +26,8 @@ HEADERS += \ ../shared/bin.h \ ../shared/protocol.h \ ../shared/serial_parse.h \ - ../shared/consts.h + ../shared/consts.h \ + main.h CONFIG += c++17 CONFIG += force_debug_info diff --git a/confui/main.cpp b/confui/main.cpp index 6c3ab56..52c54d8 100644 --- a/confui/main.cpp +++ b/confui/main.cpp @@ -1,10 +1,9 @@ +#include "main.h" #include "mainwindow.h" -#include <QApplication> - int main(int argc, char *argv[]) { - QApplication a(argc, argv); + g_cd_app = new QApplication(argc, argv); CDMainWindow w; w.show(); - return a.exec(); + return g_cd_app->exec(); } diff --git a/confui/main.h b/confui/main.h new file mode 100644 index 0000000..10e9da6 --- /dev/null +++ b/confui/main.h @@ -0,0 +1,7 @@ +#pragma once + +#include <QApplication> + +extern QApplication* g_cd_app; +int main(int argc, char *argv[]); + diff --git a/confui/mainwindow.cpp b/confui/mainwindow.cpp index b0a1857..1fd34c4 100644 --- a/confui/mainwindow.cpp +++ b/confui/mainwindow.cpp @@ -1,14 +1,17 @@ #include <QGridLayout> #include <QMenuBar> #include <QTabWidget> +#include <iostream> #include "mainwindow.h" #include "ui_tab_automations.h" #include "ui_tab_node_overview.h" #include "serial.h" +#include "main.h" CDMeshConnector *g_cd_mesh_connector = nullptr; CDSerialConnector *g_cd_serial = nullptr; +QApplication* g_cd_app = nullptr; CDMainWindow::~CDMainWindow() { delete this->mesh_connector; } @@ -28,6 +31,10 @@ CDMainWindow::CDMainWindow(QWidget *parent) : QMainWindow(parent) { tab_bar_widget->addTab(this->node_overview_tab, "node overview"); tab_bar_widget->addTab(this->automations_tab, "automations"); + // manually connect to serial port + if (g_cd_app->arguments().length() > 1 && g_cd_app->arguments().at(1).length() > 0) + g_cd_serial->connect(g_cd_app->arguments().at(1).toStdString()); + setMenuBar(menu_bar); setCentralWidget(tab_bar_widget); update(); |