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

Function accumulateFolderEnabled

app/src/DataModel/ProjectEditor.cpp:219–239  ·  view source on GitHub ↗

* @brief Marks every group folder that owns at least one group, and every one that owns at least * one ENABLED group, by walking each group's ancestor-folder chain. Feeds derived folder * dimming in the tree (a folder shows disabled only when all its groups are disabled). */

Source from the content-addressed store, hash-verified

217 * dimming in the tree (a folder shows disabled only when all its groups are disabled).
218 */
219static void accumulateFolderEnabled(const std::vector<DataModel::GroupFolder>& folders,
220 const std::vector<DataModel::Group>& groups,
221 QHash<int, bool>& hasGroup,
222 QHash<int, bool>& hasEnabled)
223{
224 QHash<int, int> parentOf;
225 for (const auto& f : folders)
226 parentOf.insert(f.folderId, f.parentFolderId);
227
228 const int kMax = static_cast<int>(folders.size());
229 for (const auto& g : groups) {
230 int cur = g.parentFolderId;
231 for (int i = 0; i <= kMax && cur != -1; ++i) {
232 hasGroup[cur] = true;
233 if (g.enabled)
234 hasEnabled[cur] = true;
235
236 cur = parentOf.value(cur, -1);
237 }
238 }
239}
240
241/**
242 * @brief Returns the QML icon path for a SerialStudio::BusType integer.

Callers 1

Calls 2

sizeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected