| 165 | |
| 166 | |
| 167 | void UBSceneCache::moveScene(std::shared_ptr<UBDocumentProxy> proxy, int sourceIndex, int targetIndex) |
| 168 | { |
| 169 | UBSceneCacheID keySource(proxy, sourceIndex); |
| 170 | |
| 171 | std::shared_ptr<SceneCacheEntry> entry; |
| 172 | bool hasEntry = mSceneCache.contains(keySource); |
| 173 | |
| 174 | if (hasEntry) |
| 175 | { |
| 176 | entry = mSceneCache.value(keySource); |
| 177 | mCachedKeyFIFO.removeAll(keySource); |
| 178 | } |
| 179 | |
| 180 | if (sourceIndex < targetIndex) |
| 181 | { |
| 182 | for (int i = sourceIndex + 1; i <= targetIndex; i++) |
| 183 | { |
| 184 | internalMoveScene(proxy, i, i - 1); |
| 185 | } |
| 186 | } |
| 187 | else |
| 188 | { |
| 189 | for (int i = sourceIndex - 1; i >= targetIndex; i--) |
| 190 | { |
| 191 | internalMoveScene(proxy, i, i + 1); |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | UBSceneCacheID keyTarget(proxy, targetIndex); |
| 196 | |
| 197 | if (hasEntry) |
| 198 | { |
| 199 | insertEntry(keyTarget, entry); |
| 200 | mCachedKeyFIFO.enqueue(keyTarget); |
| 201 | } |
| 202 | else if (mSceneCache.contains(keyTarget)) |
| 203 | { |
| 204 | entry = mSceneCache.take(keyTarget); |
| 205 | mCachedKeyFIFO.removeAll(keyTarget); |
| 206 | } |
| 207 | |
| 208 | } |
| 209 | |
| 210 | void UBSceneCache::reassignDocProxy(std::shared_ptr<UBDocumentProxy> newDocument, std::shared_ptr<UBDocumentProxy> oldDocument) |
| 211 | { |
no test coverage detected