Make remoteiso_subdir and server editable on Android. Fixes #10142. Really need a better mechanism for these fields.

This commit is contained in:
Henrik Rydgård 2017-11-16 13:33:10 +01:00
parent 53a351c29d
commit 3222af5f7a
4 changed files with 32 additions and 2 deletions

View File

@ -1108,6 +1108,7 @@ UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) {
g_Config.sNickName = StripSpaces(name);
}
#elif defined(__ANDROID__)
// TODO: The return value is handled in NativeApp::inputbox_completed. This is horrific.
System_SendMessage("inputbox", ("nickname:" + g_Config.sNickName).c_str());
#endif
return UI::EVENT_DONE;

View File

@ -874,8 +874,12 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
std::string setString = inputboxValue.size() > 1 ? inputboxValue[1] : "";
if (inputboxValue[0] == "IP")
g_Config.proAdhocServer = setString;
if (inputboxValue[0] == "nickname")
else if (inputboxValue[0] == "nickname")
g_Config.sNickName = setString;
else if (inputboxValue[0] == "remoteiso_subdir")
g_Config.sRemoteISOSubdir = setString;
else if (inputboxValue[0] == "remoteiso_server")
g_Config.sLastRemoteISOServer = setString;
inputboxValue.clear();
}
if (msg == "bgImage_updated") {

View File

@ -675,13 +675,25 @@ void RemoteISOSettingsScreen::CreateViews() {
remoteisoSettings->Add(new ItemHeader(ri->T("Remote disc streaming")));
remoteisoSettings->Add(new CheckBox(&g_Config.bRemoteISOManual, ri->T("Manual Mode Client", "Manual Mode Client")));
#if !defined(MOBILE_DEVICE)
PopupTextInputChoice *remoteServer = remoteisoSettings->Add(new PopupTextInputChoice(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), "", 255, screenManager()));
#else
ChoiceWithValueDisplay *remoteServer = new ChoiceWithValueDisplay(&g_Config.sLastRemoteISOServer, ri->T("Remote Server"), nullptr);
remoteisoSettings->Add(remoteServer);
remoteServer->OnClick.Handle(this, &RemoteISOSettingsScreen::OnClickRemoteServer);
#endif
remoteServer->SetEnabledPtr(&g_Config.bRemoteISOManual);
PopupSliderChoice *remotePort = remoteisoSettings->Add(new PopupSliderChoice(&g_Config.iLastRemoteISOPort, 0, 65535, ri->T("Remote Port", "Remote Port"), 100, screenManager()));
remotePort->SetEnabledPtr(&g_Config.bRemoteISOManual);
#if !defined(MOBILE_DEVICE)
PopupTextInputChoice *remoteSubdir = remoteisoSettings->Add(new PopupTextInputChoice(&g_Config.sRemoteISOSubdir, ri->T("Remote Subdirectory"), "", 255, screenManager()));
remoteSubdir->SetEnabledPtr(&g_Config.bRemoteISOManual);
remoteSubdir->OnChange.Handle(this, &RemoteISOSettingsScreen::OnChangeRemoteISOSubdir);
#else
ChoiceWithValueDisplay *remoteSubdir = remoteisoSettings->Add(
new ChoiceWithValueDisplay(&g_Config.sRemoteISOSubdir, ri->T("Remote Subdirectory"), nullptr));
remoteSubdir->OnClick.Handle(this, &RemoteISOSettingsScreen::OnClickRemoteISOSubdir);
#endif
remoteSubdir->SetEnabledPtr(&g_Config.bRemoteISOManual);
PopupSliderChoice *portChoice = new PopupSliderChoice(&g_Config.iRemoteISOPort, 0, 65535, ri->T("Local Server Port", "Local Server Port"), 100, screenManager());
remoteisoSettings->Add(portChoice);
@ -693,6 +705,16 @@ void RemoteISOSettingsScreen::CreateViews() {
AddStandardBack(root_);
}
UI::EventReturn RemoteISOSettingsScreen::OnClickRemoteServer(UI::EventParams &e) {
System_SendMessage("inputbox", ("remoteiso_server:" + g_Config.sLastRemoteISOServer).c_str());
return UI::EVENT_DONE;
}
UI::EventReturn RemoteISOSettingsScreen::OnClickRemoteISOSubdir(UI::EventParams &e) {
System_SendMessage("inputbox", ("remoteiso_subdir:" + g_Config.sRemoteISOSubdir).c_str());
return UI::EVENT_DONE;
}
UI::EventReturn RemoteISOSettingsScreen::OnChangeRemoteISOSubdir(UI::EventParams &e) {
//Conform to HTTP standards
ReplaceAll(g_Config.sRemoteISOSubdir, " ", "%20");

View File

@ -89,7 +89,10 @@ class RemoteISOSettingsScreen : public UIDialogScreenWithBackground {
public:
RemoteISOSettingsScreen();
UI::EventReturn OnClickRemoteISOSubdir(UI::EventParams &e);
UI::EventReturn OnClickRemoteServer(UI::EventParams &e);
protected:
void update() override;
void CreateViews() override;