move thread safety into Application from caller

This commit is contained in:
howard-stearns 2016-08-22 12:49:51 -07:00
parent ba72dc6375
commit d0b58d8f8e
2 changed files with 14 additions and 14 deletions

View file

@ -5171,19 +5171,23 @@ void Application::toggleLogDialog() {
}
void Application::takeSnapshot(bool notify, float aspectRatio) {
QMediaPlayer* player = new QMediaPlayer();
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
player->play();
postLambdaEvent([notify, aspectRatio, this] {
QMediaPlayer* player = new QMediaPlayer();
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
player->play();
QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);
emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);
});
}
void Application::shareSnapshot(const QString& path) {
// not much to do here, everything is done in snapshot code...
Snapshot::uploadSnapshot(path);
postLambdaEvent([path] {
// not much to do here, everything is done in snapshot code...
Snapshot::uploadSnapshot(path);
});
}
float Application::getRenderResolutionScale() const {

View file

@ -205,13 +205,9 @@ void WindowScriptingInterface::copyToClipboard(const QString& text) {
}
void WindowScriptingInterface::takeSnapshot(bool notify, float aspectRatio) {
qApp->postLambdaEvent([notify, aspectRatio] {
qApp->takeSnapshot(notify, aspectRatio);
});
qApp->takeSnapshot(notify, aspectRatio);
}
void WindowScriptingInterface::shareSnapshot(const QString& path) {
qApp->postLambdaEvent([path] {
qApp->shareSnapshot(path);
});
qApp->shareSnapshot(path);
}