Showing the changes to interface/src/Application.cpp (1 of 204 files). Show all
Unified · Split
| @@ -154,6 +154,7 @@ · 153 unmodified lines | |||
| 154 | #include "ui/LoginDialog.h" | 154 | #include "ui/LoginDialog.h" |
| 155 | #include "ui/overlays/Cube3DOverlay.h" | 155 | #include "ui/overlays/Cube3DOverlay.h" |
| 156 | #include "ui/Snapshot.h" | 156 | #include "ui/Snapshot.h" |
| 157 | #include "ui/SnapshotAnimated.h" | ||
| 157 | #include "ui/StandAloneJSConsole.h" | 158 | #include "ui/StandAloneJSConsole.h" |
| 158 | #include "ui/Stats.h" | 159 | #include "ui/Stats.h" |
| 159 | #include "ui/UpdateDialog.h" | 160 | #include "ui/UpdateDialog.h" |
| @@ -5592,23 +5593,31 @@ void Application::toggleLogDialog() { · 5432 unmodified lines | |||
| 5592 | } | 5593 | } |
| 5593 | } | 5594 | } |
| 5594 | 5595 | ||
| 5595 | void Application::takeSnapshot(bool notify, float aspectRatio) { | 5596 | |
| 5596 | postLambdaEvent([notify, aspectRatio, this] { | 5597 | void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio) { |
| 5598 | postLambdaEvent([notify, includeAnimated, aspectRatio, this] { | ||
| 5597 | QMediaPlayer* player = new QMediaPlayer(); | 5599 | QMediaPlayer* player = new QMediaPlayer(); |
| 5598 | QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); | 5600 | QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); |
| 5599 | player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); | 5601 | player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); |
| 5600 | player->play(); | 5602 | player->play(); |
| 5601 | 5603 | ||
| 5604 | // Get a screenshot and save it | ||
| 5602 | QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio)); | 5605 | QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio)); |
| 5603 | 5606 | ||
| 5604 | emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify); | 5607 | // If we're not doing an animated snapshot as well... |
| 5608 | if (!includeAnimated || !(SnapshotAnimated::alsoTakeAnimatedSnapshot.get())) { | ||
| 5609 | // Tell the dependency manager that the capture of the still snapshot has taken place. | ||
| 5610 | emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, "", notify); | ||
| 5611 | } else { | ||
| 5612 | // Get an animated GIF snapshot and save it | ||
| 5613 | SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, qApp, DependencyManager::get<WindowScriptingInterface>()); | ||
| 5614 | } | ||
| 5605 | }); | 5615 | }); |
| 5606 | } | 5616 | } |
| 5607 | 5617 | void Application::shareSnapshot(const QString& path, const QUrl& href) { | |
| 5608 | void Application::shareSnapshot(const QString& path) { | 5618 | postLambdaEvent([path, href] { |
| 5609 | postLambdaEvent([path] { | ||
| 5610 | // not much to do here, everything is done in snapshot code... | 5619 | // not much to do here, everything is done in snapshot code... |
| 5611 | Snapshot::uploadSnapshot(path); | 5620 | Snapshot::uploadSnapshot(path, href); |
| 5612 | }); | 5621 | }); |
| 5613 | } | 5622 | } |
| 5614 | 5623 | ||