Merge pull request #8501 from howard-stearns/pr-review-comments-3

Pr review comments 3
This commit is contained in:
Howard Stearns 2016-08-22 12:52:40 -07:00 committed by GitHub
commit f9d8ccaeac
4 changed files with 15 additions and 21 deletions

View file

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

View file

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

View file

@ -162,11 +162,6 @@
// this means you may or may not be logged in, but can't share // this means you may or may not be logged in, but can't share
// because you are not in a public place. // because you are not in a public place.
document.getElementById("sharing").innerHTML = "<p class='prompt'>Snapshots can be shared when they're taken in shareable places."; document.getElementById("sharing").innerHTML = "<p class='prompt'>Snapshots can be shared when they're taken in shareable places.";
} else if (!shareMsg.isLoggedIn) {
// this means you are in a public place, but can't share because
// you need to login. Soon we will just bring up the share dialog
// in this case (and maybe set a boolean here to inform the html)
document.getElementById("sharing").innerHTML = "<p class='prompt'>Snapshots can be shared when you're logged in.";
} }
} }
window.onload = function () { window.onload = function () {

View file

@ -55,7 +55,7 @@ function confirmShare(data) {
Settings.setValue('openFeedAfterShare', true) Settings.setValue('openFeedAfterShare', true)
break; break;
default: default:
dialog.webEventReceived.disconnect(onMessage); // I'm not certain that this is necessary. If it is, what do we do on normal close? dialog.webEventReceived.disconnect(onMessage);
dialog.close(); dialog.close();
isLoggedIn = Account.isLoggedIn(); isLoggedIn = Account.isLoggedIn();
message.forEach(function (submessage) { message.forEach(function (submessage) {
@ -139,7 +139,6 @@ function resetButtons(path, notify) {
{ localPath: path }, { localPath: path },
{ {
canShare: Boolean(location.placename), canShare: Boolean(location.placename),
isLoggedIn: true, // Just have the dialog act as though we are. To be removed at both ends later.
openFeedAfterShare: shouldOpenFeedAfterShare() openFeedAfterShare: shouldOpenFeedAfterShare()
} }
]); ]);