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

Function resolveOrCreateTileWorkspace

app/src/AI/ToolDispatcher.cpp:1539–1565  ·  view source on GitHub ↗

* @brief Resolves a workspace from args, optionally creating one when allowed. */

Source from the content-addressed store, hash-verified

1537 * @brief Resolves a workspace from args, optionally creating one when allowed.
1538 */
1539static QJsonObject resolveOrCreateTileWorkspace(const QJsonObject& args, QJsonArray& steps)
1540{
1541 QJsonObject wsArgs;
1542 if (args.contains(QStringLiteral("workspaceId")))
1543 wsArgs[QStringLiteral("workspaceId")] = args.value(QStringLiteral("workspaceId")).toInt();
1544
1545 if (!args.value(QStringLiteral("workspace")).toString().isEmpty())
1546 wsArgs[QStringLiteral("title")] = args.value(QStringLiteral("workspace")).toString();
1547
1548 auto wsReply = resolveWorkspace(wsArgs);
1549 if (wsReply.value(QStringLiteral("ok")).toBool())
1550 return wsReply;
1551
1552 const auto workspaceTitle = args.value(QStringLiteral("workspace")).toString();
1553 if (workspaceTitle.isEmpty() || !args.value(QStringLiteral("createWorkspace")).toBool(false))
1554 return wsReply;
1555
1556 const auto addWsReply = createTileWorkspace(workspaceTitle, steps);
1557 if (!addWsReply.value(QStringLiteral("ok")).toBool())
1558 return attachRepairHint(addWsReply, QStringLiteral("project.workspace.add"));
1559
1560 QJsonObject created = addWsReply.value(QStringLiteral("result")).toObject();
1561 created[QStringLiteral("widgetCount")] = 0;
1562 wsReply[QStringLiteral("ok")] = true;
1563 wsReply[QStringLiteral("workspace")] = created;
1564 return wsReply;
1565}
1566
1567/**
1568 * @brief Resolves an optional dataset reference for the tile, updating group args in place.

Callers 1

executeAddTileFunction · 0.85

Calls 6

resolveWorkspaceFunction · 0.85
createTileWorkspaceFunction · 0.85
attachRepairHintFunction · 0.85
isEmptyMethod · 0.80
containsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected