* @brief Updates the source with the given @p sourceId. */
| 1629 | * @brief Updates the source with the given @p sourceId. |
| 1630 | */ |
| 1631 | void 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. |
no test coverage detected