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

Function resolveSavedWindowId

app/src/UI/WindowManager.cpp:119–137  ·  view source on GitHub ↗

* @brief Resolves a serialized geometry/order entry to the current session's * windowId, preferring the stable key over the legacy integer. */

Source from the content-addressed store, hash-verified

117 * windowId, preferring the stable key over the legacy integer.
118 */
119[[nodiscard]] static int resolveSavedWindowId(const QJsonObject& entry,
120 const QHash<StableKey, int>& lookup,
121 const QMap<int, QQuickItem*>& liveWindows)
122{
123 const StableKey key = readStableKey(entry);
124 if (key.isValid()) {
125 const auto it = lookup.constFind(key);
126 if (it != lookup.cend())
127 return it.value();
128
129 return -1;
130 }
131
132 const int legacyId = entry.value("id").toInt(-1);
133 if (legacyId >= 0 && liveWindows.contains(legacyId))
134 return legacyId;
135
136 return -1;
137}
138
139/**
140 * @brief Returns the (widgetType, relativeIndex) identity for the given live

Callers 3

resolveSavedOrderMethod · 0.85
applySavedGeometriesMethod · 0.85

Calls 5

readStableKeyFunction · 0.85
cendMethod · 0.80
isValidMethod · 0.45
valueMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected