| 388 | } |
| 389 | |
| 390 | void MainWindow::wireRadioModel() |
| 391 | { |
| 392 | // ── Wire up radio model ──────────────────────────────────────────────── |
| 393 | connect(&m_radioModel, &RadioModel::connectionStateChanged, |
| 394 | this, &MainWindow::onConnectionStateChanged); |
| 395 | connect(&m_radioModel, &RadioModel::connectionError, |
| 396 | this, &MainWindow::onConnectionError); |
| 397 | connect(&m_radioModel, &RadioModel::certFingerprintMismatch, |
| 398 | this, &MainWindow::onWanCertFingerprintMismatch); |
| 399 | connect(&m_radioModel, &RadioModel::forcedDisconnectRequested, |
| 400 | this, [this] { |
| 401 | const bool wasWan = m_radioModel.isWan(); |
| 402 | const RadioInfo radioInfo = m_radioModel.lastRadioInfo(); |
| 403 | const WanRadioInfo wanInfo = m_pendingWanRadio; |
| 404 | |
| 405 | m_userDisconnected = true; |
| 406 | m_connPanel->setStatusText("Disconnected by another client"); |
| 407 | setPanadapterConnectionAnimation(false); |
| 408 | showForcedDisconnectDialog(wasWan, radioInfo, wanInfo); |
| 409 | }); |
| 410 | connect(&m_radioModel, &RadioModel::multiFlexConflictDetected, this, [this] { |
| 411 | ConnectedStationsDialog::RadioMeta meta; |
| 412 | meta.model = m_radioModel.model(); |
| 413 | meta.nickname = m_radioModel.nickname(); |
| 414 | meta.callsign = m_radioModel.callsign(); |
| 415 | |
| 416 | QList<ConnectedStationsDialog::Client> sdClients; |
| 417 | const quint32 ours = m_radioModel.ourClientHandle(); |
| 418 | for (auto it = m_radioModel.clientInfoMap().cbegin(); |
| 419 | it != m_radioModel.clientInfoMap().cend(); ++it) { |
| 420 | if (it.key() == ours) |
| 421 | continue; |
| 422 | ConnectedStationsDialog::Client c; |
| 423 | c.handle = it.key(); |
| 424 | c.program = it->program; |
| 425 | c.station = it->station; |
| 426 | sdClients.append(c); |
| 427 | } |
| 428 | |
| 429 | ConnectedStationsDialog* dlg = new ConnectedStationsDialog(meta, sdClients, this); |
| 430 | dlg->setAttribute(Qt::WA_DeleteOnClose); |
| 431 | connect(dlg, &QDialog::accepted, this, [this, dlg] { |
| 432 | const quint32 handle = dlg->selectedHandle(); |
| 433 | if (handle != 0) |
| 434 | m_radioModel.resolveMultiFlexConflict(handle); |
| 435 | else |
| 436 | m_radioModel.cancelMultiFlexConflict(); |
| 437 | }); |
| 438 | connect(dlg, &QDialog::rejected, this, [this] { |
| 439 | m_userDisconnected = true; |
| 440 | m_connPanel->setStatusText("Connection canceled"); |
| 441 | setPanadapterConnectionAnimation(false); |
| 442 | m_radioModel.cancelMultiFlexConflict(); |
| 443 | }); |
| 444 | dlg->show(); |
| 445 | }); |
| 446 | connect(&m_radioModel, &RadioModel::sliceAdded, |
| 447 | this, &MainWindow::onSliceAdded); |
nothing calls this directly
no test coverage detected