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

Method list

app/src/API/Handlers/WorkspacesHandler.cpp:719–743  ·  view source on GitHub ↗

* @brief Returns the workspace list with id, title, icon, and widget count. */

Source from the content-addressed store, hash-verified

717 * @brief Returns the workspace list with id, title, icon, and widget count.
718 */
719API::CommandResponse API::Handlers::WorkspacesHandler::list(const QString& id,
720 const QJsonObject& params)
721{
722 Q_UNUSED(params)
723
724 const auto& pm = DataModel::ProjectModel::instance();
725 const auto& workspaces = pm.activeWorkspaces();
726
727 QJsonArray arr;
728 for (const auto& ws : workspaces) {
729 QJsonObject entry;
730 entry[QStringLiteral("id")] = ws.workspaceId;
731 entry[QStringLiteral("title")] = ws.title;
732 entry[QStringLiteral("icon")] = SerialStudio::normalizeIconPath(ws.icon);
733 entry[QStringLiteral("description")] = ws.description;
734 entry[QStringLiteral("widgetCount")] = static_cast<int>(ws.widgetRefs.size());
735 arr.append(entry);
736 }
737
738 QJsonObject result;
739 result[QStringLiteral("workspaces")] = arr;
740 result[QStringLiteral("count")] = static_cast<int>(workspaces.size());
741 result[QStringLiteral("customizeEnabled")] = pm.customizeWorkspaces();
742 return CommandResponse::makeSuccess(id, result);
743}
744
745/**
746 * @brief Returns widget refs for a single workspace.

Callers

nothing calls this directly

Calls 3

customizeWorkspacesMethod · 0.80
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected