mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Added up and down button navigation to switch between the media viewer and the PDF viewer
This commit is contained in:
parent
1888ec55f5
commit
a964d89b80
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
MediaViewer::MediaViewer()
|
MediaViewer::MediaViewer()
|
||||||
: mRenderer {Renderer::getInstance()}
|
: mRenderer {Renderer::getInstance()}
|
||||||
|
, mGame {nullptr}
|
||||||
{
|
{
|
||||||
Window::getInstance()->setMediaViewer(this);
|
Window::getInstance()->setMediaViewer(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
PDFViewer::PDFViewer()
|
PDFViewer::PDFViewer()
|
||||||
: mRenderer {Renderer::getInstance()}
|
: mRenderer {Renderer::getInstance()}
|
||||||
|
, mGame {nullptr}
|
||||||
{
|
{
|
||||||
Window::getInstance()->setPDFViewer(this);
|
Window::getInstance()->setPDFViewer(this);
|
||||||
mTexture = TextureResource::get("");
|
mTexture = TextureResource::get("");
|
||||||
|
@ -50,10 +51,11 @@ bool PDFViewer::startPDFViewer(FileData* game)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mManualPath = game->getManualPath();
|
mGame = game;
|
||||||
|
mManualPath = mGame->getManualPath();
|
||||||
|
|
||||||
if (!Utils::FileSystem::exists(mManualPath)) {
|
if (!Utils::FileSystem::exists(mManualPath)) {
|
||||||
LOG(LogError) << "No PDF manual found for game \"" << game->getName() << "\"";
|
LOG(LogError) << "No PDF manual found for game \"" << mGame->getName() << "\"";
|
||||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||||
ViewController::getInstance()->stopViewVideos();
|
ViewController::getInstance()->stopViewVideos();
|
||||||
return false;
|
return false;
|
||||||
|
@ -136,6 +138,12 @@ void PDFViewer::stopPDFViewer()
|
||||||
mPageImage.reset();
|
mPageImage.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PDFViewer::launchMediaViewer()
|
||||||
|
{
|
||||||
|
Window::getInstance()->stopPDFViewer();
|
||||||
|
Window::getInstance()->startMediaViewer(mGame);
|
||||||
|
}
|
||||||
|
|
||||||
bool PDFViewer::getDocumentInfo()
|
bool PDFViewer::getDocumentInfo()
|
||||||
{
|
{
|
||||||
std::string commandOutput;
|
std::string commandOutput;
|
||||||
|
|
|
@ -20,6 +20,7 @@ public:
|
||||||
|
|
||||||
bool startPDFViewer(FileData* game) override;
|
bool startPDFViewer(FileData* game) override;
|
||||||
void stopPDFViewer() override;
|
void stopPDFViewer() override;
|
||||||
|
void launchMediaViewer() override;
|
||||||
|
|
||||||
bool getDocumentInfo();
|
bool getDocumentInfo();
|
||||||
void convertPage(int pageNum);
|
void convertPage(int pageNum);
|
||||||
|
@ -43,6 +44,7 @@ private:
|
||||||
std::shared_ptr<TextureResource> mTexture;
|
std::shared_ptr<TextureResource> mTexture;
|
||||||
std::unique_ptr<ImageComponent> mPageImage;
|
std::unique_ptr<ImageComponent> mPageImage;
|
||||||
std::map<int, PageEntry> mPages;
|
std::map<int, PageEntry> mPages;
|
||||||
|
FileData* mGame;
|
||||||
|
|
||||||
std::string mESConvertPath;
|
std::string mESConvertPath;
|
||||||
std::string mManualPath;
|
std::string mManualPath;
|
||||||
|
|
|
@ -221,7 +221,7 @@ void Window::input(InputConfig* config, Input input)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMediaViewer && mRenderMediaViewer) {
|
if (mMediaViewer && mRenderMediaViewer) {
|
||||||
if (config->isMappedLike("y", input) && input.value != 0) {
|
if (config->isMappedLike("up", input) && input.value != 0) {
|
||||||
mMediaViewer->launchPDFViewer();
|
mMediaViewer->launchPDFViewer();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,11 @@ void Window::input(InputConfig* config, Input input)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mPDFViewer && mRenderPDFViewer) {
|
if (mPDFViewer && mRenderPDFViewer) {
|
||||||
if (config->isMappedLike("right", input) && input.value != 0)
|
if (config->isMappedLike("down", input) && input.value != 0) {
|
||||||
|
mPDFViewer->launchMediaViewer();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (config->isMappedLike("right", input) && input.value != 0)
|
||||||
mPDFViewer->showNextPage();
|
mPDFViewer->showNextPage();
|
||||||
else if (config->isMappedLike("left", input) && input.value != 0)
|
else if (config->isMappedLike("left", input) && input.value != 0)
|
||||||
mPDFViewer->showPreviousPage();
|
mPDFViewer->showPreviousPage();
|
||||||
|
|
|
@ -70,6 +70,7 @@ public:
|
||||||
public:
|
public:
|
||||||
virtual bool startPDFViewer(FileData* game) = 0;
|
virtual bool startPDFViewer(FileData* game) = 0;
|
||||||
virtual void stopPDFViewer() = 0;
|
virtual void stopPDFViewer() = 0;
|
||||||
|
virtual void launchMediaViewer() = 0;
|
||||||
|
|
||||||
virtual void showNextPage() = 0;
|
virtual void showNextPage() = 0;
|
||||||
virtual void showPreviousPage() = 0;
|
virtual void showPreviousPage() = 0;
|
||||||
|
|
Loading…
Reference in a new issue