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

Method setupExternalConnections

app/src/DataModel/ProjectModel.cpp:2034–2076  ·  view source on GitHub ↗

* @brief Wires Dashboard, ConnectionManager, and AppState signals to this model. */

Source from the content-addressed store, hash-verified

2032 * @brief Wires Dashboard, ConnectionManager, and AppState signals to this model.
2033 */
2034void DataModel::ProjectModel::setupExternalConnections()
2035{
2036 connect(&UI::Dashboard::instance(), &UI::Dashboard::pointsChanged, this, [this]() {
2037 const auto opMode = AppState::instance().operationMode();
2038 if (opMode != SerialStudio::ProjectFile || m_filePath.isEmpty())
2039 return;
2040
2041 const int points = UI::Dashboard::instance().points();
2042 if (m_pointCount == points)
2043 return;
2044
2045 m_pointCount = points;
2046
2047 if (!writeProjectFile(m_filePath))
2048 return;
2049
2050 Q_EMIT pointCountChanged();
2051 });
2052
2053 connect(&UI::Dashboard::instance(), &UI::Dashboard::widgetCountChanged, this, [this] {
2054 if (AppState::instance().operationMode() != SerialStudio::QuickPlot)
2055 return;
2056
2057 m_sessionWorkspaces = buildAutoWorkspaces();
2058 Q_EMIT activeWorkspacesChanged();
2059 });
2060
2061 connect(&AppState::instance(), &AppState::operationModeChanged, this, [this] {
2062 const auto opMode = AppState::instance().operationMode();
2063 if (opMode == SerialStudio::ProjectFile)
2064 m_sessionWorkspaces.clear();
2065 else
2066 m_sessionWorkspaces = buildAutoWorkspaces();
2067
2068 Q_EMIT activeWorkspacesChanged();
2069 });
2070
2071 connect(
2072 &IO::ConnectionManager::instance(), &IO::ConnectionManager::connectedChanged, this, [this] {
2073 if (!IO::ConnectionManager::instance().isConnected())
2074 clearTransientState();
2075 });
2076}
2077
2078//--------------------------------------------------------------------------------------------------
2079// Document initialisation

Callers

nothing calls this directly

Calls 5

operationModeMethod · 0.80
isEmptyMethod · 0.80
pointsMethod · 0.45
clearMethod · 0.45
isConnectedMethod · 0.45

Tested by

no test coverage detected