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

Method updateSource

app/src/DataModel/ProjectModel.cpp:1631–1656  ·  view source on GitHub ↗

* @brief Updates the source with the given @p sourceId. */

Source from the content-addressed store, hash-verified

1629 * @brief Updates the source with the given @p sourceId.
1630 */
1631void DataModel::ProjectModel::updateSource(int sourceId,
1632 const DataModel::Source& source,
1633 const bool rebuildTree)
1634{
1635 if (sourceId < 0 || sourceId >= static_cast<int>(m_sources.size()))
1636 return;
1637
1638 m_sources[sourceId] = source;
1639 m_sources[sourceId].sourceId = sourceId;
1640
1641 if (sourceId == 0) {
1642 m_frameStartSequence = source.frameStart;
1643 m_frameEndSequence = source.frameEnd;
1644 m_checksumAlgorithm = source.checksumAlgorithm;
1645 m_hexadecimalDelimiters = source.hexadecimalDelimiters;
1646 m_frameDetection = static_cast<SerialStudio::FrameDetection>(source.frameDetection);
1647 m_frameDecoder = static_cast<SerialStudio::DecoderMethod>(source.decoderMethod);
1648 Q_EMIT frameDetectionChanged();
1649 }
1650
1651 setModified(true);
1652 if (rebuildTree)
1653 Q_EMIT sourcesChanged();
1654
1655 Q_EMIT sourceChanged(sourceId);
1656}
1657
1658/**
1659 * @brief Updates the title of the source with the given @p sourceId.

Callers 10

frameParserConfigureMethod · 0.80
setDecoderIndexMethod · 0.80
setDetectionIndexMethod · 0.80
setChecksumIndexMethod · 0.80
setFrameStartMethod · 0.80
setFrameEndMethod · 0.80
setHexDelimitersMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected