diff --git a/mainwindow.cpp b/mainwindow.cpp index b414daf..ed86259 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -69,6 +69,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(this, &MainWindow::updateBaudRates, worker, &SerialWorker::updateBaudRates, Qt::QueuedConnection); connect(this, &MainWindow::sendCANFrame, worker, &SerialWorker::sendFrame, Qt::QueuedConnection); connect(worker, &SerialWorker::connectionSuccess, this, &MainWindow::connectionSucceeded, Qt::QueuedConnection); + connect(worker, &SerialWorker::connectionFailure, this, &MainWindow::connectionFailed, Qt::QueuedConnection); + connect(worker, &SerialWorker::deviceInfo, this, &MainWindow::gotDeviceInfo, Qt::QueuedConnection); serialWorkerThread.start(); graphingWindow = NULL; @@ -672,6 +674,18 @@ void MainWindow::connectionSucceeded(int baud0, int baud1) ui->btnConnect->setEnabled(false); } +void MainWindow::connectionFailed() +{ + lbStatusConnected.setText(tr("Failed to connect!")); +} + +void MainWindow::gotDeviceInfo(int build, int swCAN) +{ + QString str = tr("Connected to GVRET ") + QString::number(build); + if (swCAN == 1) str += "(SW)"; + lbStatusConnected.setText(str); +} + void MainWindow::showGraphingWindow() { if (!graphingWindow) graphingWindow = new GraphingWindow(model->getListReference()); diff --git a/mainwindow.h b/mainwindow.h index b277592..7727c4e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -39,10 +39,13 @@ private slots: void showFlowViewWindow(); void showFrameSenderWindow(); void changeBaudRates(); + void connectionFailed(); + void gotDeviceInfo(int, int); + void connectionSucceeded(int, int); public slots: void gotFrame(CANFrame *frame); - void connectionSucceeded(int, int); + signals: void sendSerialPort(QSerialPortInfo *port);