* @brief Configures signal/slot connections with the modules this exporter depends on. */
| 548 | * @brief Configures signal/slot connections with the modules this exporter depends on. |
| 549 | */ |
| 550 | void MDF4::Export::setupExternalConnections() |
| 551 | { |
| 552 | #ifdef BUILD_COMMERCIAL |
| 553 | connect( |
| 554 | &IO::ConnectionManager::instance(), &IO::ConnectionManager::connectedChanged, this, [this] { |
| 555 | if (IO::ConnectionManager::instance().isConnected()) { |
| 556 | auto* worker = static_cast<ExportWorker*>(m_worker); |
| 557 | DataModel::Frame frame; |
| 558 | if (AppState::instance().operationMode() == SerialStudio::ProjectFile) |
| 559 | frame = DataModel::FrameBuilder::instance().frame(); |
| 560 | |
| 561 | QMetaObject::invokeMethod( |
| 562 | worker, |
| 563 | [worker, frame = std::move(frame)] { worker->setTemplateFrame(frame); }, |
| 564 | Qt::QueuedConnection); |
| 565 | } |
| 566 | |
| 567 | else { |
| 568 | closeFile(); |
| 569 | } |
| 570 | }); |
| 571 | connect(&IO::ConnectionManager::instance(), &IO::ConnectionManager::pausedChanged, this, [this] { |
| 572 | if (IO::ConnectionManager::instance().paused()) |
| 573 | closeFile(); |
| 574 | }); |
| 575 | |
| 576 | connect(&AppState::instance(), &AppState::operationModeChanged, this, [this] { |
| 577 | if (AppState::instance().operationMode() == SerialStudio::ConsoleOnly && exportEnabled()) |
| 578 | setExportEnabled(false); |
| 579 | }); |
| 580 | #endif |
| 581 | } |
| 582 | |
| 583 | /** |
| 584 | * @brief Toggles whether export-enabled changes get written to QSettings. |
nothing calls this directly
no test coverage detected