* @brief Adds a new source to the project (GPL: capped to one source). */
| 1515 | * @brief Adds a new source to the project (GPL: capped to one source). |
| 1516 | */ |
| 1517 | void DataModel::ProjectModel::addSource() |
| 1518 | { |
| 1519 | #ifndef BUILD_COMMERCIAL |
| 1520 | if (!m_sources.empty()) { |
| 1521 | if (!m_suppressMessageBoxes) |
| 1522 | Misc::Utilities::showMessageBox( |
| 1523 | tr("Multiple data sources require a Pro license"), |
| 1524 | tr("Serial Studio Pro allows connecting to multiple devices simultaneously. " |
| 1525 | "Please upgrade to unlock this feature."), |
| 1526 | QMessageBox::Information); |
| 1527 | |
| 1528 | return; |
| 1529 | } |
| 1530 | #endif |
| 1531 | |
| 1532 | const int newId = static_cast<int>(m_sources.size()); |
| 1533 | |
| 1534 | DataModel::Source source; |
| 1535 | source.sourceId = newId; |
| 1536 | source.title = tr("Device %1").arg(QChar('A' + newId)); |
| 1537 | source.busType = static_cast<int>(SerialStudio::BusType::UART); |
| 1538 | source.frameStart = m_frameStartSequence; |
| 1539 | source.frameEnd = m_frameEndSequence; |
| 1540 | source.checksumAlgorithm = m_checksumAlgorithm; |
| 1541 | source.frameDetection = static_cast<int>(m_frameDetection); |
| 1542 | source.decoderMethod = static_cast<int>(m_frameDecoder); |
| 1543 | source.hexadecimalDelimiters = m_hexadecimalDelimiters; |
| 1544 | seedDefaultFrameParser(source); |
| 1545 | |
| 1546 | m_sources.push_back(source); |
| 1547 | setModified(true); |
| 1548 | Q_EMIT sourcesChanged(); |
| 1549 | Q_EMIT sourceStructureChanged(); |
| 1550 | Q_EMIT sourceAdded(newId); |
| 1551 | } |
| 1552 | |
| 1553 | /** |
| 1554 | * @brief Deletes the source and reassigns dependent groups to source 0. |
nothing calls this directly
no test coverage detected