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

Method getGroups

app/src/API/Handlers/WindowHandler.cpp:239–262  ·  view source on GitHub ↗

* @brief Return all groups from the taskbar model. */

Source from the content-addressed store, hash-verified

237 * @brief Return all groups from the taskbar model.
238 */
239API::CommandResponse API::Handlers::WindowHandler::getGroups(const QString& id,
240 const QJsonObject& params)
241{
242 Q_UNUSED(params)
243
244 auto* taskbar = UI::UISessionRegistry::instance().primaryTaskbar();
245 if (!taskbar)
246 return noSession(id);
247
248 const auto model = taskbar->workspaceModel();
249 QJsonArray groups;
250 for (const auto& entry : model) {
251 const auto map = entry.toMap();
252 QJsonObject g;
253 g[QStringLiteral("id")] = map.value(QStringLiteral("id")).toInt();
254 g[QStringLiteral("text")] = map.value(QStringLiteral("text")).toString();
255 g[QStringLiteral("icon")] = map.value(QStringLiteral("icon")).toString();
256 groups.append(g);
257 }
258
259 QJsonObject result;
260 result[QStringLiteral("groups")] = groups;
261 return CommandResponse::makeSuccess(id, result);
262}
263
264//--------------------------------------------------------------------------------------------------
265// Active group setters

Callers

nothing calls this directly

Calls 5

noSessionFunction · 0.85
primaryTaskbarMethod · 0.80
workspaceModelMethod · 0.80
valueMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected