Fixes to debug console in connection window
This commit is contained in:
@@ -167,18 +167,20 @@ void ConnectionWindow::consoleEnableChanged(bool checked) {
|
|||||||
ui->btnSendText->setEnabled(checked);
|
ui->btnSendText->setEnabled(checked);
|
||||||
ui->lineSend->setEnabled(checked);
|
ui->lineSend->setEnabled(checked);
|
||||||
|
|
||||||
QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections();
|
int selIdx = ui->tableConnections->currentIndex().row();
|
||||||
|
|
||||||
foreach(CANConnection* conn_p, conns)
|
if (selIdx == -1)
|
||||||
{
|
return;
|
||||||
if (checked) { //enable console
|
|
||||||
connect(conn_p, SIGNAL(debugOutput(QString)), this, SLOT(getDebugText(QString)));
|
CANConnection* conn_p = connModel->getAtIdx(selIdx);
|
||||||
connect(this, SIGNAL(sendDebugData(QByteArray)), conn_p, SLOT(debugInput(QByteArray)));
|
|
||||||
}
|
if (checked) { //enable console
|
||||||
else { //turn it off
|
connect(conn_p, SIGNAL(debugOutput(QString)), this, SLOT(getDebugText(QString)));
|
||||||
disconnect(conn_p, SIGNAL(debugOutput(QString)), nullptr, nullptr);
|
connect(this, SIGNAL(sendDebugData(QByteArray)), conn_p, SLOT(debugInput(QByteArray)));
|
||||||
disconnect(this, SIGNAL(sendDebugData(QByteArray)), conn_p, SLOT(debugInput(QByteArray)));
|
}
|
||||||
}
|
else { //turn it off
|
||||||
|
disconnect(conn_p, SIGNAL(debugOutput(QString)), nullptr, nullptr);
|
||||||
|
disconnect(this, SIGNAL(sendDebugData(QByteArray)), conn_p, SLOT(debugInput(QByteArray)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,6 +317,11 @@ void ConnectionWindow::currentRowChanged(const QModelIndex ¤t, const QMode
|
|||||||
if (numBuses > 1) for (int i = 0; i < numBuses; i++) ui->tabBuses->addTab(QString::number(i+1));
|
if (numBuses > 1) for (int i = 0; i < numBuses; i++) ui->tabBuses->addTab(QString::number(i+1));
|
||||||
|
|
||||||
populateBusDetails(0);
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user