mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
More cleanup after making PopupTextInputChoice choose method automatically
This commit is contained in:
@@ -502,6 +502,8 @@ EventReturn PopupTextInputChoice::HandleClick(EventParams &e) {
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
|
||||
System_InputBoxGetString(text_, *value_ , [=](const std::string &enteredValue, int) {
|
||||
*value_ = StripSpaces(enteredValue);
|
||||
EventParams params{};
|
||||
OnChange.Trigger(params);
|
||||
});
|
||||
return EVENT_DONE;
|
||||
}
|
||||
|
||||
@@ -513,6 +513,10 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
#endif
|
||||
case SYSPROP_HAS_BACK_BUTTON:
|
||||
return true;
|
||||
#if PPSSPP_PLATFORM(SWITCH)
|
||||
case SYSPROP_HAS_TEXT_INPUT_DIALOG:
|
||||
return true;
|
||||
#endif
|
||||
case SYSPROP_APP_GOLD:
|
||||
#ifdef GOLD
|
||||
return true;
|
||||
|
||||
@@ -602,12 +602,6 @@ void RemoteISOSettingsScreen::CreateViews() {
|
||||
remoteisoSettings->Add(new CheckBox(&g_Config.bRemoteISOManual, ri->T("Manual Mode Client", "Manually configure client")));
|
||||
|
||||
UI::Choice *remoteServer;
|
||||
#if defined(MOBILE_DEVICE)
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_KEYBOARD)) {
|
||||
remoteServer = new ChoiceWithValueDisplay(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), I18NCat::NONE);
|
||||
remoteServer->OnClick.Handle(this, &RemoteISOSettingsScreen::OnClickRemoteServer);
|
||||
} else
|
||||
#endif
|
||||
remoteServer = new PopupTextInputChoice(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), "", 255, screenManager());
|
||||
remoteisoSettings->Add(remoteServer);
|
||||
remoteServer->SetEnabledPtr(&g_Config.bRemoteISOManual);
|
||||
@@ -616,12 +610,6 @@ void RemoteISOSettingsScreen::CreateViews() {
|
||||
remotePort->SetEnabledPtr(&g_Config.bRemoteISOManual);
|
||||
|
||||
UI::Choice *remoteSubdir;
|
||||
#if defined(MOBILE_DEVICE)
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_KEYBOARD)) {
|
||||
remoteSubdir = new ChoiceWithValueDisplay(&g_Config.sRemoteISOSubdir, ri->T("Remote Subdirectory"), I18NCat::NONE);
|
||||
remoteSubdir->OnClick.Handle(this, &RemoteISOSettingsScreen::OnClickRemoteISOSubdir);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
PopupTextInputChoice *remoteSubdirInput = new PopupTextInputChoice(&g_Config.sRemoteISOSubdir, ri->T("Remote Subdirectory"), "", 255, screenManager());
|
||||
remoteSubdirInput->OnChange.Handle(this, &RemoteISOSettingsScreen::OnChangeRemoteISOSubdir);
|
||||
@@ -640,16 +628,6 @@ void RemoteISOSettingsScreen::CreateViews() {
|
||||
AddStandardBack(root_);
|
||||
}
|
||||
|
||||
UI::EventReturn RemoteISOSettingsScreen::OnClickRemoteServer(UI::EventParams &e) {
|
||||
#if PPSSPP_PLATFORM(WINDOWS) || defined(USING_QT_UI) || defined(__ANDROID__) || PPSSPP_PLATFORM(SWITCH)
|
||||
auto ri = GetI18NCategory(I18NCat::REMOTEISO);
|
||||
System_InputBoxGetString(ri->T("Remote Server"), g_Config.sLastRemoteISOServer, [](const std::string &value, int) {
|
||||
g_Config.sLastRemoteISOServer = value;
|
||||
});
|
||||
#endif
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
static void CleanupRemoteISOSubdir() {
|
||||
// Replace spaces and force forward slashes.
|
||||
// TODO: Maybe we should uri escape this after?
|
||||
@@ -660,18 +638,6 @@ static void CleanupRemoteISOSubdir() {
|
||||
g_Config.sRemoteISOSubdir = "/" + g_Config.sRemoteISOSubdir;
|
||||
}
|
||||
|
||||
UI::EventReturn RemoteISOSettingsScreen::OnClickRemoteISOSubdir(UI::EventParams &e) {
|
||||
#if PPSSPP_PLATFORM(WINDOWS) || defined(USING_QT_UI) || defined(__ANDROID__) || PPSSPP_PLATFORM(SWITCH)
|
||||
auto ri = GetI18NCategory(I18NCat::REMOTEISO);
|
||||
System_InputBoxGetString(ri->T("Remote Subdirectory"), g_Config.sRemoteISOSubdir, [](const std::string &value, int) {
|
||||
g_Config.sRemoteISOSubdir = value;
|
||||
// Apply the cleanup logic, too.
|
||||
CleanupRemoteISOSubdir();
|
||||
});
|
||||
#endif
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn RemoteISOSettingsScreen::OnChangeRemoteISOSubdir(UI::EventParams &e) {
|
||||
CleanupRemoteISOSubdir();
|
||||
return UI::EVENT_DONE;
|
||||
|
||||
@@ -102,10 +102,7 @@ public:
|
||||
|
||||
const char *tag() const override { return "RemoteISOSettings"; }
|
||||
|
||||
UI::EventReturn OnClickRemoteISOSubdir(UI::EventParams &e);
|
||||
UI::EventReturn OnClickRemoteServer(UI::EventParams &e);
|
||||
protected:
|
||||
|
||||
void update() override;
|
||||
void CreateViews() override;
|
||||
|
||||
|
||||
+22
-36
@@ -78,27 +78,31 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() {
|
||||
// Let the subclass create its tabs.
|
||||
CreateTabs();
|
||||
|
||||
#if !defined(MOBILE_DEVICE) || PPSSPP_PLATFORM(ANDROID)
|
||||
// Hide search if screen is too small.
|
||||
int deviceType = System_GetPropertyInt(SYSPROP_DEVICE_TYPE);
|
||||
if ((g_display.dp_xres < g_display.dp_yres || g_display.dp_yres >= 500) && (deviceType != DEVICE_TYPE_VR) && ShowSearchControls()) {
|
||||
auto se = GetI18NCategory(I18NCat::SEARCH);
|
||||
// Search
|
||||
LinearLayout *searchSettings = AddTab("GameSettingsSearch", ms->T("Search"), true);
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_KEYBOARD) || System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
|
||||
// Hide search if screen is too small.
|
||||
int deviceType = System_GetPropertyInt(SYSPROP_DEVICE_TYPE);
|
||||
if ((g_display.dp_xres < g_display.dp_yres || g_display.dp_yres >= 500) && (deviceType != DEVICE_TYPE_VR) && ShowSearchControls()) {
|
||||
auto se = GetI18NCategory(I18NCat::SEARCH);
|
||||
// Search
|
||||
LinearLayout *searchSettings = AddTab("GameSettingsSearch", ms->T("Search"), true);
|
||||
|
||||
searchSettings->Add(new ItemHeader(se->T("Find settings")));
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_KEYBOARD)) {
|
||||
searchSettings->Add(new ChoiceWithValueDisplay(&searchFilter_, se->T("Filter"), I18NCat::NONE))->OnClick.Handle(this, &TabbedUIDialogScreenWithGameBackground::OnChangeSearchFilter);
|
||||
} else {
|
||||
searchSettings->Add(new PopupTextInputChoice(&searchFilter_, se->T("Filter"), "", 64, screenManager()))->OnChange.Handle(this, &TabbedUIDialogScreenWithGameBackground::OnChangeSearchFilter);
|
||||
searchSettings->Add(new ItemHeader(se->T("Find settings")));
|
||||
searchSettings->Add(new PopupTextInputChoice(&searchFilter_, se->T("Filter"), "", 64, screenManager()))->OnChange.Add([=](UI::EventParams &e) {
|
||||
NativeMessageReceived("gameSettings_search", StripSpaces(searchFilter_).c_str());
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
|
||||
clearSearchChoice_ = searchSettings->Add(new Choice(se->T("Clear filter")));
|
||||
clearSearchChoice_->OnClick.Add([=](UI::EventParams &e) {
|
||||
NativeMessageReceived("gameSettings_search", "");
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
|
||||
noSearchResults_ = searchSettings->Add(new TextView(se->T("No settings matched '%1'"), new LinearLayoutParams(Margins(20, 5))));
|
||||
|
||||
ApplySearchFilter();
|
||||
}
|
||||
clearSearchChoice_ = searchSettings->Add(new Choice(se->T("Clear filter")));
|
||||
clearSearchChoice_->OnClick.Handle(this, &TabbedUIDialogScreenWithGameBackground::OnClearSearchFilter);
|
||||
noSearchResults_ = searchSettings->Add(new TextView(se->T("No settings matched '%1'"), new LinearLayoutParams(Margins(20, 5))));
|
||||
|
||||
ApplySearchFilter();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TabbedUIDialogScreenWithGameBackground::sendMessage(const char *message, const char *value) {
|
||||
@@ -153,21 +157,3 @@ void TabbedUIDialogScreenWithGameBackground::ApplySearchFilter() {
|
||||
noSearchResults_->SetVisibility(matches ? UI::V_GONE : UI::V_VISIBLE);
|
||||
clearSearchChoice_->SetVisibility(searchFilter_.empty() ? UI::V_GONE : UI::V_VISIBLE);
|
||||
}
|
||||
|
||||
UI::EventReturn TabbedUIDialogScreenWithGameBackground::OnChangeSearchFilter(UI::EventParams &e) {
|
||||
#if PPSSPP_PLATFORM(WINDOWS) || defined(USING_QT_UI) || defined(__ANDROID__) || PPSSPP_PLATFORM(SWITCH)
|
||||
auto se = GetI18NCategory(I18NCat::SEARCH);
|
||||
System_InputBoxGetString(se->T("Search term"), searchFilter_, [](const std::string &value, int) {
|
||||
NativeMessageReceived("gameSettings_search", StripSpaces(value).c_str());
|
||||
});
|
||||
#else
|
||||
if (!System_GetPropertyBool(SYSPROP_HAS_KEYBOARD))
|
||||
NativeMessageReceived("gameSettings_search", StripSpaces(searchFilter_).c_str());
|
||||
#endif
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn TabbedUIDialogScreenWithGameBackground::OnClearSearchFilter(UI::EventParams &e) {
|
||||
NativeMessageReceived("gameSettings_search", "");
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ protected:
|
||||
|
||||
void RecreateViews() override;
|
||||
|
||||
UI::EventReturn OnChangeSearchFilter(UI::EventParams &e);
|
||||
UI::EventReturn OnClearSearchFilter(UI::EventParams &e);
|
||||
SettingInfoMessage *settingInfo_ = nullptr;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user