mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Added GuiTextEditPopup support to GuiApplicationUpdater
This commit is contained in:
parent
e1e8420306
commit
d0346d8c28
|
@ -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,38 +125,45 @@ 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(), newDownloadDirectory.rend(),
|
||||||
std::find_if(newDownloadDirectory.rbegin(),
|
[](char c) { return c != '/' && c != '\\'; })
|
||||||
newDownloadDirectory.rend(),
|
.base(),
|
||||||
[](char c) { return c != '/' && c != '\\'; })
|
newDownloadDirectory.end());
|
||||||
.base(),
|
|
||||||
newDownloadDirectory.end());
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
newDownloadDirectory =
|
newDownloadDirectory =
|
||||||
Utils::String::replace(newDownloadDirectory, "/", "\\");
|
Utils::String::replace(newDownloadDirectory, "/", "\\");
|
||||||
#else
|
#else
|
||||||
newDownloadDirectory = Utils::String::replace(newDownloadDirectory, "\\", "/");
|
newDownloadDirectory = Utils::String::replace(newDownloadDirectory, "\\", "/");
|
||||||
#endif
|
#endif
|
||||||
Settings::getInstance()->setString(
|
Settings::getInstance()->setString(
|
||||||
"ApplicationUpdaterDownloadDirectory",
|
"ApplicationUpdaterDownloadDirectory",
|
||||||
Utils::String::trim(newDownloadDirectory));
|
Utils::String::trim(newDownloadDirectory));
|
||||||
Settings::getInstance()->saveFile();
|
Settings::getInstance()->saveFile();
|
||||||
setDownloadPath();
|
setDownloadPath();
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
mProcessStep2->setValue(Utils::String::replace(
|
mProcessStep2->setValue(Utils::String::replace(
|
||||||
Utils::FileSystem::getParent(mDownloadPackageFilename), "/", "\\"));
|
Utils::FileSystem::getParent(mDownloadPackageFilename), "/", "\\"));
|
||||||
#else
|
#else
|
||||||
mProcessStep2->setValue(
|
mProcessStep2->setValue(
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue