From d0346d8c28e712fe31a740a3676ed31e75ce5f67 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 1 Aug 2023 21:40:16 +0200 Subject: [PATCH] Added GuiTextEditPopup support to GuiApplicationUpdater --- es-app/src/guis/GuiApplicationUpdater.cpp | 54 +++++++++++++---------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/es-app/src/guis/GuiApplicationUpdater.cpp b/es-app/src/guis/GuiApplicationUpdater.cpp index 0c46065b9..cddf9db0c 100644 --- a/es-app/src/guis/GuiApplicationUpdater.cpp +++ b/es-app/src/guis/GuiApplicationUpdater.cpp @@ -11,6 +11,7 @@ #include "EmulationStation.h" #include "guis/GuiTextEditKeyboardPopup.h" +#include "guis/GuiTextEditPopup.h" #include "utils/PlatformUtil.h" #include @@ -124,38 +125,45 @@ GuiApplicationUpdater::GuiApplicationUpdater() std::string currentDownloadDirectory { Utils::FileSystem::getParent(mDownloadPackageFilename)}; #endif - mWindow->pushGui(new GuiTextEditKeyboardPopup( - getHelpStyle(), 0.0f, "ENTER DOWNLOAD DIRECTORY", currentDownloadDirectory, - [this, currentDownloadDirectory](std::string newDownloadDirectory) { - if (currentDownloadDirectory != newDownloadDirectory) { - newDownloadDirectory.erase( - // Remove trailing / and \ characters. - std::find_if(newDownloadDirectory.rbegin(), - newDownloadDirectory.rend(), - [](char c) { return c != '/' && c != '\\'; }) - .base(), - newDownloadDirectory.end()); + auto directoryFunc = [this, + currentDownloadDirectory](std::string newDownloadDirectory) { + if (currentDownloadDirectory != newDownloadDirectory) { + newDownloadDirectory.erase( + // Remove trailing / and \ characters. + std::find_if(newDownloadDirectory.rbegin(), newDownloadDirectory.rend(), + [](char c) { return c != '/' && c != '\\'; }) + .base(), + newDownloadDirectory.end()); #if defined(_WIN64) - newDownloadDirectory = - Utils::String::replace(newDownloadDirectory, "/", "\\"); + newDownloadDirectory = + Utils::String::replace(newDownloadDirectory, "/", "\\"); #else newDownloadDirectory = Utils::String::replace(newDownloadDirectory, "\\", "/"); #endif - Settings::getInstance()->setString( - "ApplicationUpdaterDownloadDirectory", - Utils::String::trim(newDownloadDirectory)); - Settings::getInstance()->saveFile(); - setDownloadPath(); + Settings::getInstance()->setString( + "ApplicationUpdaterDownloadDirectory", + Utils::String::trim(newDownloadDirectory)); + Settings::getInstance()->saveFile(); + setDownloadPath(); #if defined(_WIN64) - mProcessStep2->setValue(Utils::String::replace( - Utils::FileSystem::getParent(mDownloadPackageFilename), "/", "\\")); + mProcessStep2->setValue(Utils::String::replace( + Utils::FileSystem::getParent(mDownloadPackageFilename), "/", "\\")); #else mProcessStep2->setValue( Utils::FileSystem::getParent(mDownloadPackageFilename)); #endif - } - }, - false)); + } + }; + if (Settings::getInstance()->getBool("VirtualKeyboard")) { + mWindow->pushGui(new GuiTextEditKeyboardPopup( + getHelpStyle(), 0.0f, "ENTER DOWNLOAD DIRECTORY", currentDownloadDirectory, + directoryFunc, false)); + } + else { + mWindow->pushGui( + new GuiTextEditPopup(getHelpStyle(), "ENTER DOWNLOAD DIRECTORY", + currentDownloadDirectory, directoryFunc, false)); + } }); buttons.push_back(mButton2); }