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

Function buildSnapshotGroups

app/src/API/Handlers/ProjectHandler.cpp:3753–3774  ·  view source on GitHub ↗

* @brief Builds the groups+datasets array; writes total dataset count to @a totalDatasets. */

Source from the content-addressed store, hash-verified

3751 * @brief Builds the groups+datasets array; writes total dataset count to @a totalDatasets.
3752 */
3753static QJsonArray buildSnapshotGroups(const DataModel::ProjectModel& pm, int& totalDatasets)
3754{
3755 QJsonArray groups;
3756 totalDatasets = 0;
3757 for (const auto& group : pm.groups()) {
3758 QJsonObject g;
3759 g[Keys::GroupId] = group.groupId;
3760 g[Keys::Title] = group.title;
3761 g[QStringLiteral("widget")] = group.widget;
3762 g[QStringLiteral("datasetCount")] = static_cast<int>(group.datasets.size());
3763
3764 QJsonArray ds;
3765 for (const auto& dataset : group.datasets) {
3766 ds.append(buildDatasetObject(dataset, group));
3767 ++totalDatasets;
3768 }
3769 g[QStringLiteral("datasets")] = ds;
3770 g[QStringLiteral("_explanations")] = buildGroupExplanations(group);
3771 groups.append(g);
3772 }
3773 return groups;
3774}
3775
3776/**
3777 * @brief Builds the workspace summary array used by project.snapshot.

Callers 1

projectSnapshotMethod · 0.85

Calls 4

buildDatasetObjectFunction · 0.85
buildGroupExplanationsFunction · 0.85
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected