Fixes to debug console in connection window

This commit is contained in:
Collin Kidder
2019-03-06 20:20:40 -05:00
parent f23abe170f
commit 591ebe71df
+11 -4
View File
@@ -167,10 +167,13 @@ void ConnectionWindow::consoleEnableChanged(bool checked) {
ui->btnSendText->setEnabled(checked);
ui->lineSend->setEnabled(checked);
QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections();
int selIdx = ui->tableConnections->currentIndex().row();
if (selIdx == -1)
return;
CANConnection* conn_p = connModel->getAtIdx(selIdx);
foreach(CANConnection* conn_p, conns)
{
if (checked) { //enable console
connect(conn_p, SIGNAL(debugOutput(QString)), this, SLOT(getDebugText(QString)));
connect(this, SIGNAL(sendDebugData(QByteArray)), conn_p, SLOT(debugInput(QByteArray)));
@@ -180,7 +183,6 @@ void ConnectionWindow::consoleEnableChanged(bool checked) {
disconnect(this, SIGNAL(sendDebugData(QByteArray)), conn_p, SLOT(debugInput(QByteArray)));
}
}
}
void ConnectionWindow::handleNewConn()
{
@@ -315,6 +317,11 @@ void ConnectionWindow::currentRowChanged(const QModelIndex &current, const QMode
if (numBuses > 1) for (int i = 0; i < numBuses; i++) ui->tabBuses->addTab(QString::number(i+1));
populateBusDetails(0);
if (ui->ckEnableConsole->isChecked())
{
connect(conn_p, SIGNAL(debugOutput(QString)), this, SLOT(getDebugText(QString)));
connect(this, SIGNAL(sendDebugData(QByteArray)), conn_p, SLOT(debugInput(QByteArray)));
}
}
}