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

Function enableTileWidgetOption

app/src/AI/ToolDispatcher.cpp:1604–1628  ·  view source on GitHub ↗

* @brief Enables the dataset option a widget type requires, recording the API step. */

Source from the content-addressed store, hash-verified

1602 * @brief Enables the dataset option a widget type requires, recording the API step.
1603 */
1604static QJsonObject enableTileWidgetOption(const QString& optionSlug,
1605 const QJsonObject& dataset,
1606 int groupId,
1607 QJsonArray& steps)
1608{
1609 QStringList slugs;
1610 for (const auto& value : dataset.value(QStringLiteral("enabledOptionsSlugs")).toArray())
1611 slugs.append(value.toString());
1612
1613 if (!slugs.contains(optionSlug))
1614 slugs.append(optionSlug);
1615
1616 QJsonObject optArgs;
1617 optArgs[QStringLiteral("groupId")] = dataset.value(QStringLiteral("groupId")).toInt(groupId);
1618 optArgs[Keys::DatasetId] = dataset.value(Keys::DatasetId).toInt();
1619 optArgs[QStringLiteral("options")] = QJsonArray::fromStringList(slugs);
1620
1621 const auto optReply = runCommand(QStringLiteral("project.dataset.setOptions"), optArgs);
1622 steps.append(QJsonObject{
1623 { QStringLiteral("command"), QStringLiteral("project.dataset.setOptions")},
1624 { QStringLiteral("ok"), optReply.value(QStringLiteral("ok")).toBool()},
1625 {QStringLiteral("arguments"), optArgs}
1626 });
1627 return optReply;
1628}
1629
1630/**
1631 * @brief Patches dataset min/max ranges from the optional `ranges` request payload.

Callers 1

executeAddTileFunction · 0.85

Calls 4

runCommandFunction · 0.85
valueMethod · 0.45
appendMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected