Snapshot of Snapshot-Discovery to master
Showing the changes to interface/src/Application.cpp (1 of 43 files). Show all
Unified · Split
| @@ -2296,7 +2296,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 2295 unmodified lines | |||
| 2296 | } else if (isOption && !isShifted && !isMeta) { | 2296 | } else if (isOption && !isShifted && !isMeta) { |
| 2297 | Menu::getInstance()->triggerOption(MenuOption::ScriptEditor); | 2297 | Menu::getInstance()->triggerOption(MenuOption::ScriptEditor); |
| 2298 | } else if (!isOption && !isShifted && isMeta) { | 2298 | } else if (!isOption && !isShifted && isMeta) { |
| 2299 | takeSnapshot(); | 2299 | takeSnapshot(true); |
| 2300 | } | 2300 | } |
| 2301 | break; | 2301 | break; |
| 2302 | 2302 | ||
| @@ -4913,6 +4913,7 @@ bool Application::canAcceptURL(const QString& urlString) const { · 2610 unmodified lines | |||
| 4913 | bool Application::acceptURL(const QString& urlString, bool defaultUpload) { | 4913 | bool Application::acceptURL(const QString& urlString, bool defaultUpload) { |
| 4914 | if (urlString.startsWith(HIFI_URL_SCHEME)) { | 4914 | if (urlString.startsWith(HIFI_URL_SCHEME)) { |
| 4915 | // this is a hifi URL - have the AddressManager handle it | 4915 | // this is a hifi URL - have the AddressManager handle it |
| 4916 | emit receivedHifiSchemeURL(urlString); | ||
| 4916 | QMetaObject::invokeMethod(DependencyManager::get<AddressManager>().data(), "handleLookupString", | 4917 | QMetaObject::invokeMethod(DependencyManager::get<AddressManager>().data(), "handleLookupString", |
| 4917 | Qt::AutoConnection, Q_ARG(const QString&, urlString)); | 4918 | Qt::AutoConnection, Q_ARG(const QString&, urlString)); |
| 4918 | return true; | 4919 | return true; |
| @@ -5189,15 +5190,24 @@ void Application::toggleLogDialog() { · 270 unmodified lines | |||
| 5189 | } | 5190 | } |
| 5190 | } | 5191 | } |
| 5191 | 5192 | ||
| 5192 | void Application::takeSnapshot() { | 5193 | void Application::takeSnapshot(bool notify, float aspectRatio) { |
| 5193 | QMediaPlayer* player = new QMediaPlayer(); | 5194 | postLambdaEvent([notify, aspectRatio, this] { |
| 5194 | QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); | 5195 | QMediaPlayer* player = new QMediaPlayer(); |
| 5195 | player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); | 5196 | QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); |
| 5196 | player->play(); | 5197 | player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); |
| 5198 | player->play(); | ||
| 5197 | 5199 | ||
| 5198 | QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot()); | 5200 | QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio)); |
| 5199 | 5201 | ||
| 5200 | emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path); | 5202 | emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify); |
| 5203 | }); | ||
| 5204 | } | ||
| 5205 | |||
| 5206 | void Application::shareSnapshot(const QString& path) { | ||
| 5207 | postLambdaEvent([path] { | ||
| 5208 | // not much to do here, everything is done in snapshot code... | ||
| 5209 | Snapshot::uploadSnapshot(path); | ||
| 5210 | }); | ||
| 5201 | } | 5211 | } |
| 5202 | 5212 | ||
| 5203 | float Application::getRenderResolutionScale() const { | 5213 | float Application::getRenderResolutionScale() const { |