Added GuiTextEditPopup support to GuiApplicationUpdater

This commit is contained in:
Leon Styhre 2023-08-01 21:40:16 +02:00
parent e1e8420306
commit d0346d8c28

View file

@ -11,6 +11,7 @@
#include "EmulationStation.h" #include "EmulationStation.h"
#include "guis/GuiTextEditKeyboardPopup.h" #include "guis/GuiTextEditKeyboardPopup.h"
#include "guis/GuiTextEditPopup.h"
#include "utils/PlatformUtil.h" #include "utils/PlatformUtil.h"
#include <SDL2/SDL_timer.h> #include <SDL2/SDL_timer.h>
@ -124,14 +125,12 @@ GuiApplicationUpdater::GuiApplicationUpdater()
std::string currentDownloadDirectory { std::string currentDownloadDirectory {
Utils::FileSystem::getParent(mDownloadPackageFilename)}; Utils::FileSystem::getParent(mDownloadPackageFilename)};
#endif #endif
mWindow->pushGui(new GuiTextEditKeyboardPopup( auto directoryFunc = [this,
getHelpStyle(), 0.0f, "ENTER DOWNLOAD DIRECTORY", currentDownloadDirectory, currentDownloadDirectory](std::string newDownloadDirectory) {
[this, currentDownloadDirectory](std::string newDownloadDirectory) {
if (currentDownloadDirectory != newDownloadDirectory) { if (currentDownloadDirectory != newDownloadDirectory) {
newDownloadDirectory.erase( newDownloadDirectory.erase(
// Remove trailing / and \ characters. // Remove trailing / and \ characters.
std::find_if(newDownloadDirectory.rbegin(), std::find_if(newDownloadDirectory.rbegin(), newDownloadDirectory.rend(),
newDownloadDirectory.rend(),
[](char c) { return c != '/' && c != '\\'; }) [](char c) { return c != '/' && c != '\\'; })
.base(), .base(),
newDownloadDirectory.end()); newDownloadDirectory.end());
@ -154,8 +153,17 @@ GuiApplicationUpdater::GuiApplicationUpdater()
Utils::FileSystem::getParent(mDownloadPackageFilename)); Utils::FileSystem::getParent(mDownloadPackageFilename));
#endif #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); buttons.push_back(mButton2);
} }