diff --git a/es-app/src/PDFViewer.cpp b/es-app/src/PDFViewer.cpp index 34c8d7df3..2e4a0d3c5 100644 --- a/es-app/src/PDFViewer.cpp +++ b/es-app/src/PDFViewer.cpp @@ -12,6 +12,7 @@ #include "Sound.h" #include "utils/FileSystemUtil.h" #include "utils/StringUtil.h" +#include "views/ViewController.h" #include @@ -30,6 +31,8 @@ PDFViewer::PDFViewer() bool PDFViewer::startPDFViewer(FileData* game) { + ViewController::getInstance()->pauseViewVideos(); + #if defined(_WIN64) const std::string convertBinary {"/es-pdf-converter/es-pdf-convert.exe"}; #else @@ -42,6 +45,8 @@ bool PDFViewer::startPDFViewer(FileData* game) #else LOG(LogError) << "Couldn't find PDF conversion binary es-pdf-convert"; #endif + NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND); + ViewController::getInstance()->stopViewVideos(); return false; } @@ -49,6 +54,8 @@ bool PDFViewer::startPDFViewer(FileData* game) if (!Utils::FileSystem::exists(mManualPath)) { LOG(LogError) << "No PDF manual found for game \"" << game->getName() << "\""; + NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND); + ViewController::getInstance()->stopViewVideos(); return false; } @@ -66,6 +73,8 @@ bool PDFViewer::startPDFViewer(FileData* game) if (!getDocumentInfo()) { LOG(LogError) << "PDFViewer: Couldn't load file \"" << mManualPath; + NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND); + ViewController::getInstance()->stopViewVideos(); return false; } @@ -74,6 +83,8 @@ bool PDFViewer::startPDFViewer(FileData* game) for (int i {1}; i <= mPageCount; ++i) { if (mPages.find(i) == mPages.end()) { LOG(LogError) << "Couldn't read information for page " << i << ", invalid PDF file?"; + NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND); + ViewController::getInstance()->stopViewVideos(); return false; } @@ -119,6 +130,8 @@ bool PDFViewer::startPDFViewer(FileData* game) void PDFViewer::stopPDFViewer() { NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND); + ViewController::getInstance()->stopViewVideos(); + mPages.clear(); mPageImage.reset(); } diff --git a/es-app/src/PDFViewer.h b/es-app/src/PDFViewer.h index e6ea09879..3bc2a6ab2 100644 --- a/es-app/src/PDFViewer.h +++ b/es-app/src/PDFViewer.h @@ -17,7 +17,6 @@ class PDFViewer : public Window::PDFViewer { public: PDFViewer(); - ~PDFViewer() { stopPDFViewer(); } bool startPDFViewer(FileData* game) override; void stopPDFViewer() override; diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index bb7135c8f..ca31147a9 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -477,7 +477,7 @@ void Window::render() auto& bottom = mGuiStack.front(); auto& top = mGuiStack.back(); - if (mRenderMediaViewer || mRenderScreensaver) { + if (mRenderMediaViewer || mRenderPDFViewer || mRenderScreensaver) { bottom->cancelAllAnimations(); bottom->stopAllAnimations(); } @@ -485,8 +485,8 @@ void Window::render() // Don't render the system view or gamelist view if the media viewer is active or if the // video or slideshow screensaver is running. The exception is if the fallback screensaver // is active due to a lack of videos or images. - bool renderBottom = true; - if (mRenderMediaViewer) + bool renderBottom {true}; + if (mRenderMediaViewer || mRenderPDFViewer) renderBottom = false; else if (mRenderScreensaver && mScreensaver->isFallbackScreensaver()) renderBottom = true; @@ -653,9 +653,9 @@ void Window::render() unsigned int screensaverTimer { static_cast(Settings::getInstance()->getInt("ScreensaverTimer"))}; if (mTimeSinceLastInput >= screensaverTimer && screensaverTimer != 0) { - // If the media viewer is running or if a menu is open, reset the screensaver timer so - // that the screensaver won't start. - if (mRenderMediaViewer || mGuiStack.front() != mGuiStack.back()) + // If the media viewer or PDF viewer is running, or if a menu is open, then reset the + // screensaver timer so that the screensaver won't start. + if (mRenderMediaViewer || mRenderPDFViewer || mGuiStack.front() != mGuiStack.back()) mTimeSinceLastInput = 0; // If a game has been launched, reset the screensaver timer as we don't want to start // the screensaver in the background when running a game.