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

Method setupExternalConnections

app/src/CSV/Export.cpp:291–320  ·  view source on GitHub ↗

* @brief Wires IO and app-state signals that control export behaviour. */

Source from the content-addressed store, hash-verified

289 * @brief Wires IO and app-state signals that control export behaviour.
290 */
291void 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.

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