History

Fix snapshots freezing Interface when no snap directory defined

sabrina-shanman committed 7 years ago

Commit ef1ff211 parent 9261df51 file · +16 −14Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+16−14
@@ -8456,28 +8456,30 @@ bool Application::takeSnapshotOperators(std::queue<SnapshotOperator>& snapshotOp · 8455 unmodified lines
8456 8456
8457void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) {8457void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) {
8458 addSnapshotOperator(std::make_tuple([notify, includeAnimated, aspectRatio, filename](const QImage& snapshot) {8458 addSnapshotOperator(std::make_tuple([notify, includeAnimated, aspectRatio, filename](const QImage& snapshot) {
8459 QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());8459 qApp->postLambdaEvent([snapshot, notify, includeAnimated, aspectRatio, filename] {
8460 8460 QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8461 // If we're not doing an animated snapshot as well...8461
8462 if (!includeAnimated) {8462 // If we're not doing an animated snapshot as well...
8463 if (!path.isEmpty()) {8463 if (!includeAnimated) {
8464 // Tell the dependency manager that the capture of the still snapshot has taken place.8464 if (!path.isEmpty()) {
8465 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);8465 // Tell the dependency manager that the capture of the still snapshot has taken place.
8466 }8466 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
8467 } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {8467 }
8468 qApp->postLambdaEvent([path, aspectRatio] {8468 } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {
8469 // Get an animated GIF snapshot and save it8469 // Get an animated GIF snapshot and save it
8470 SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, DependencyManager::get<WindowScriptingInterface>());8470 SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, DependencyManager::get<WindowScriptingInterface>());
8471 });8471 }
8472 }8472 });
8473 }, aspectRatio, true));8473 }, aspectRatio, true));
8474}8474}
8475 8475
8476void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {8476void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {
8477 addSnapshotOperator(std::make_tuple([notify, filename](const QImage& snapshot) {8477 addSnapshotOperator(std::make_tuple([notify, filename](const QImage& snapshot) {
8478 QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());8478 qApp->postLambdaEvent([snapshot, notify, filename] {
8479 QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8479 8480
8480 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);8481 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
8482 });
8481 }, 0.0f, false));8483 }, 0.0f, false));
8482}8484}
8483 8485