Rearrange signals

qcpfix
Phil Taylor 2023-02-20 11:48:53 +00:00
rodzic c8b97e8952
commit e49eb2878e
1 zmienionych plików z 10 dodań i 11 usunięć

Wyświetl plik

@ -25,15 +25,15 @@ cwSender::~cwSender()
qDebug(logCW()) << "Running CW Sender destructor."; qDebug(logCW()) << "Running CW Sender destructor.";
if (toneThread != Q_NULLPTR) { if (toneThread != Q_NULLPTR) {
for (auto conn: connections)
{
disconnect(conn);
}
toneThread->quit(); toneThread->quit();
toneThread->wait(); toneThread->wait();
toneThread = Q_NULLPTR; toneThread = Q_NULLPTR;
tone = Q_NULLPTR; tone = Q_NULLPTR;
/* Finally disconnect all connections */ /* Finally disconnect all connections */
for (auto conn: connections)
{
disconnect(conn);
}
connections.clear(); connections.clear();
} }
@ -272,9 +272,8 @@ void cwSender::on_sidetoneEnableChk_clicked(bool clicked)
tone->moveToThread(toneThread); tone->moveToThread(toneThread);
toneThread->start(); toneThread->start();
connect(toneThread, &QThread::finished, connections.append(connect(toneThread, &QThread::finished,
[=]() { tone->deleteLater(); }); [=]() { tone->deleteLater(); }));
connections.append(connect(this, &cwSender::sendCW, connections.append(connect(this, &cwSender::sendCW,
[=](const QString& text) { tone->send(text); ui->sidetoneEnableChk->setEnabled(false); })); [=](const QString& text) { tone->send(text); ui->sidetoneEnableChk->setEnabled(false); }));
connections.append(connect(this, &cwSender::setKeySpeed, connections.append(connect(this, &cwSender::setKeySpeed,
@ -292,15 +291,15 @@ void cwSender::on_sidetoneEnableChk_clicked(bool clicked)
} else if (!clicked && toneThread != Q_NULLPTR) { } else if (!clicked && toneThread != Q_NULLPTR) {
/* disconnect all connections */ /* disconnect all connections */
toneThread->quit();
toneThread->wait();
toneThread = Q_NULLPTR;
tone = Q_NULLPTR;
for (auto conn: connections) for (auto conn: connections)
{ {
disconnect(conn); disconnect(conn);
} }
connections.clear(); connections.clear();
toneThread->quit();
toneThread->wait();
toneThread = Q_NULLPTR;
tone = Q_NULLPTR;
} }
} }