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

Method projectSnapshot

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

* @brief Returns a structured snapshot of the active project (sources, groups, tables, hint). */

Source from the content-addressed store, hash-verified

3879 * @brief Returns a structured snapshot of the active project (sources, groups, tables, hint).
3880 */
3881API::CommandResponse API::Handlers::ProjectHandler::projectSnapshot(const QString& id,
3882 const QJsonObject& params)
3883{
3884 const bool verbose = params.value(QStringLiteral("verbose")).toBool(false);
3885 const auto& pm = DataModel::ProjectModel::instance();
3886
3887 QJsonObject snapshot;
3888 snapshot[Keys::Title] = pm.title();
3889 snapshot[Keys::PointCount] = pm.pointCount();
3890 snapshot[QStringLiteral("filePath")] = pm.jsonFilePath();
3891 snapshot[QStringLiteral("modified")] = pm.modified();
3892 snapshot[QStringLiteral("sources")] = buildSnapshotSources(pm, verbose);
3893
3894 int totalDatasets = 0;
3895 const QJsonArray groups = buildSnapshotGroups(pm, totalDatasets);
3896 snapshot[QStringLiteral("groups")] = groups;
3897 snapshot[QStringLiteral("groupCount")] = groups.size();
3898 snapshot[QStringLiteral("datasetCount")] = totalDatasets;
3899 snapshot[QStringLiteral("workspaces")] = buildSnapshotWorkspaces(pm);
3900 snapshot[QStringLiteral("dataTables")] = buildSnapshotTables(pm);
3901
3902 const int operationMode = static_cast<int>(AppState::instance().operationMode());
3903 snapshot[QStringLiteral("operationMode")] = operationMode;
3904 snapshot[QStringLiteral("_explanations")] =
3905 buildSnapshotExplanations(pm, operationMode, totalDatasets);
3906
3907 QJsonObject result;
3908 result[QStringLiteral("snapshot")] = snapshot;
3909 result[QStringLiteral("hint")] = buildSnapshotHint(totalDatasets);
3910 attachProjectEpoch(result);
3911 return CommandResponse::makeSuccess(id, result);
3912}
3913
3914/**
3915 * @brief Returns datasets in the order FrameBuilder traverses them.

Callers

nothing calls this directly

Calls 13

buildSnapshotSourcesFunction · 0.85
buildSnapshotGroupsFunction · 0.85
buildSnapshotWorkspacesFunction · 0.85
buildSnapshotTablesFunction · 0.85
buildSnapshotHintFunction · 0.85
attachProjectEpochFunction · 0.85
titleMethod · 0.80
pointCountMethod · 0.80
modifiedMethod · 0.80
operationModeMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected