MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setupExternalConnections

Method setupExternalConnections

app/src/MDF4/Export.cpp:550–581  ·  view source on GitHub ↗

* @brief Configures signal/slot connections with the modules this exporter depends on. */

Source from the content-addressed store, hash-verified

548 * @brief Configures signal/slot connections with the modules this exporter depends on.
549 */
550void 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.

Callers

nothing calls this directly

Calls 5

operationModeMethod · 0.80
frameMethod · 0.80
isConnectedMethod · 0.45
setTemplateFrameMethod · 0.45
pausedMethod · 0.45

Tested by

no test coverage detected