| 257 | |
| 258 | |
| 259 | void UBApplicationController::adjustPreviousViews(int pActiveSceneIndex, std::shared_ptr<UBDocumentProxy> pActiveDocument) |
| 260 | { |
| 261 | int viewIndex = pActiveSceneIndex; |
| 262 | |
| 263 | foreach(UBBoardView* previousView, mPreviousViews) |
| 264 | { |
| 265 | if (viewIndex > 0) |
| 266 | { |
| 267 | viewIndex--; |
| 268 | |
| 269 | std::shared_ptr<UBGraphicsScene> scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pActiveDocument, viewIndex); |
| 270 | |
| 271 | if (scene) |
| 272 | { |
| 273 | previousView->setScene(scene.get()); |
| 274 | |
| 275 | qreal ratio = ((qreal)previousView->geometry().width()) / ((qreal)previousView->geometry().height()); |
| 276 | QRectF sceneRect = scene->normalizedSceneRect(ratio); |
| 277 | qreal scaleRatio = previousView->geometry().width() / sceneRect.width(); |
| 278 | |
| 279 | previousView->resetTransform(); |
| 280 | |
| 281 | previousView->scale(scaleRatio, scaleRatio); |
| 282 | |
| 283 | previousView->centerOn(sceneRect.center()); |
| 284 | } |
| 285 | } |
| 286 | else |
| 287 | { |
| 288 | previousView->setScene(mBlackScene.get()); |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | |
| 294 | void UBApplicationController::blackout() |