Add a network setting

Non-windows setting cannot change
This commit is contained in:
sum2012 2014-05-25 13:19:56 +08:00
parent 9658b3a1b8
commit 9138fec3c1
2 changed files with 42 additions and 0 deletions

View File

@ -339,6 +339,19 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new ItemHeader(s->T("Networking"))); systemSettings->Add(new ItemHeader(s->T("Networking")));
systemSettings->Add(new CheckBox(&g_Config.bEnableWlan, s->T("Enable networking", "Enable networking/wlan (beta)"))); systemSettings->Add(new CheckBox(&g_Config.bEnableWlan, s->T("Enable networking", "Enable networking/wlan (beta)")));
#if defined(_WIN32) || defined(USING_QT_UI)
systemSettings->Add(new Choice(s->T("Change proAdhocServer Address")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress);
systemSettings->Add(new Choice(s->T("Change Mac Address")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeMacAddress);
#else
std::string str1 = s->T("proAdhocServer Address:");
std::string str2 = g_Config.proAdhocServer;
str1.append(str2);
systemSettings->Add(new Choice(str1));
str1 = s->T("Mac Address:");
str2 = g_Config.localMacAddress;
str1.append(str2);
systemSettings->Add(new Choice(str1));
#endif
//#ifndef ANDROID //#ifndef ANDROID
systemSettings->Add(new ItemHeader(s->T("Cheats", "Cheats (experimental, see forums)"))); systemSettings->Add(new ItemHeader(s->T("Cheats", "Cheats (experimental, see forums)")));
@ -497,7 +510,34 @@ UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) {
g_Config.sNickName = name; g_Config.sNickName = name;
} }
#endif #endif
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnChangeproAdhocServerAddress(UI::EventParams &e) {
#if defined(_WIN32) || defined(USING_QT_UI)
const size_t name_len = 256;
char name[name_len];
memset(name, 0, sizeof(name));
if (System_InputBoxGetString("Enter a IP address", g_Config.proAdhocServer.c_str(), name, name_len)) {
g_Config.proAdhocServer = name;
}
#endif
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnChangeMacAddress(UI::EventParams &e) {
#if defined(_WIN32) || defined(USING_QT_UI)
const size_t name_len = 256;
char name[name_len];
memset(name, 0, sizeof(name));
if (System_InputBoxGetString("Enter a Mac address", g_Config.localMacAddress.c_str(), name, name_len)) {
g_Config.localMacAddress = name;
}
#endif
return UI::EVENT_DONE; return UI::EVENT_DONE;
} }

View File

@ -64,6 +64,8 @@ private:
UI::EventReturn OnPostProcShaderChange(UI::EventParams &e); UI::EventReturn OnPostProcShaderChange(UI::EventParams &e);
UI::EventReturn OnDeveloperTools(UI::EventParams &e); UI::EventReturn OnDeveloperTools(UI::EventParams &e);
UI::EventReturn OnChangeNickname(UI::EventParams &e); UI::EventReturn OnChangeNickname(UI::EventParams &e);
UI::EventReturn OnChangeproAdhocServerAddress(UI::EventParams &e);
UI::EventReturn OnChangeMacAddress(UI::EventParams &e);
UI::EventReturn OnClearRecents(UI::EventParams &e); UI::EventReturn OnClearRecents(UI::EventParams &e);
UI::EventReturn OnFullscreenChange(UI::EventParams &e); UI::EventReturn OnFullscreenChange(UI::EventParams &e);
UI::EventReturn OnResolutionChange(UI::EventParams &e); UI::EventReturn OnResolutionChange(UI::EventParams &e);