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

Function resolveOneWorkspaceRefs

app/src/DataModel/ProjectModel.cpp:3709–3732  ·  view source on GitHub ↗

* @brief Walks one workspace's refs against the new group/dataset layout, refreshing * the dataset slot. The group identity is uniqueId-based so it never needs remapping. */

Source from the content-addressed store, hash-verified

3707 * the dataset slot. The group identity is uniqueId-based so it never needs remapping.
3708 */
3709static void resolveOneWorkspaceRefs(DataModel::Workspace& ws,
3710 const std::vector<detail::RefAnchor>& src,
3711 const std::vector<DataModel::Group>& groups)
3712{
3713 Q_ASSERT(src.size() == ws.widgetRefs.size());
3714
3715 for (size_t i = 0; i < ws.widgetRefs.size(); ++i) {
3716 auto& r = ws.widgetRefs[i];
3717 const auto& a = src[i];
3718
3719 if (a.sourceGid < 0 || a.isGroupOrLed)
3720 continue;
3721
3722 auto git = std::find_if(groups.begin(), groups.end(), [uid = r.groupUniqueId](const auto& g) {
3723 return g.uniqueId == uid;
3724 });
3725 if (git == groups.end())
3726 continue;
3727
3728 const int newSlot = slotForAnchor(a, *git);
3729 if (newSlot >= 0)
3730 r.relativeIndex = newSlot;
3731 }
3732}
3733
3734/**
3735 * @brief Moves a group from one position to another, preserving widget settings,

Callers 2

moveGroupMethod · 0.85
moveDatasetMethod · 0.85

Calls 3

slotForAnchorFunction · 0.85
beginMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected