* @brief Wires IO and app-state signals that control export behaviour. */
| 289 | * @brief Wires IO and app-state signals that control export behaviour. |
| 290 | */ |
| 291 | void CSV::Export::setupExternalConnections() |
| 292 | { |
| 293 | connect( |
| 294 | &IO::ConnectionManager::instance(), &IO::ConnectionManager::connectedChanged, this, [this] { |
| 295 | if (IO::ConnectionManager::instance().isConnected()) { |
| 296 | auto* worker = static_cast<ExportWorker*>(m_worker); |
| 297 | DataModel::Frame frame; |
| 298 | if (AppState::instance().operationMode() == SerialStudio::ProjectFile) |
| 299 | frame = DataModel::FrameBuilder::instance().frame(); |
| 300 | |
| 301 | QMetaObject::invokeMethod( |
| 302 | worker, |
| 303 | [worker, frame = std::move(frame)] { worker->setTemplateFrame(frame); }, |
| 304 | Qt::QueuedConnection); |
| 305 | } |
| 306 | |
| 307 | else { |
| 308 | closeFile(); |
| 309 | } |
| 310 | }); |
| 311 | connect(&IO::ConnectionManager::instance(), &IO::ConnectionManager::pausedChanged, this, [this] { |
| 312 | if (IO::ConnectionManager::instance().paused()) |
| 313 | closeFile(); |
| 314 | }); |
| 315 | |
| 316 | connect(&AppState::instance(), &AppState::operationModeChanged, this, [this] { |
| 317 | if (AppState::instance().operationMode() == SerialStudio::ConsoleOnly && exportEnabled()) |
| 318 | setExportEnabled(false); |
| 319 | }); |
| 320 | } |
| 321 | |
| 322 | /** |
| 323 | * @brief Toggles whether export-enabled changes get written to QSettings. |
nothing calls this directly
no test coverage detected