void dlgConfig::Show() { m_ChkCtrlGetListOnStart->SetValue(cfg_file->get_list_on_start); m_ChkCtrlShowBlockedServers->SetValue(cfg_file->show_blocked_servers); // Load wad path list m_LstCtrlWadDirectories->Clear(); wxStringTokenizer wadlist(cfg_file->wad_paths, _T(PATH_DELIMITER)); while (wadlist.HasMoreTokens()) { wxString path = wadlist.GetNextToken(); #ifdef __WXMSW__ path.Replace(_T("\\\\"),_T("\\"), true); #else path.Replace(_T("////"),_T("//"), true); #endif m_LstCtrlWadDirectories->AppendString(path); } m_DirCtrlChooseOdamexPath->SetPath(cfg_file->odamex_directory); wxString MasterTimeout, ServerTimeout, RetryCount, ExtraCmdLineArgs; ConfigInfo.Read(wxT(MASTERTIMEOUT), &MasterTimeout, wxT("500")); ConfigInfo.Read(wxT(SERVERTIMEOUT), &ServerTimeout, wxT("1000")); ConfigInfo.Read(wxT(RETRYCOUNT), &RetryCount, wxT("2")); ConfigInfo.Read(wxT(EXTRACMDLINEARGS), &ExtraCmdLineArgs, wxT("")); m_SpnCtrlMasterTimeout->SetValue(MasterTimeout); m_SpnCtrlServerTimeout->SetValue(ServerTimeout); m_SpnCtrlRetry->SetValue(RetryCount); m_TxtCtrlExtraCmdLineArgs->SetValue(ExtraCmdLineArgs); wxInt32 PQGood, PQPlayable, PQLaggy; ConfigInfo.Read(wxT("IconPingQualityGood"), &PQGood, 150); ConfigInfo.Read(wxT("IconPingQualityPlayable"), &PQPlayable, 300); ConfigInfo.Read(wxT("IconPingQualityLaggy"), &PQLaggy, 350); m_SpnCtrlPQGood->SetValue(PQGood); m_SpnCtrlPQPlayable->SetValue(PQPlayable); m_SpnCtrlPQLaggy->SetValue(PQLaggy); UserChangedSetting = false; ShowModal(); }
// Get the environment variables void dlgConfig::OnGetEnvClick(wxCommandEvent &event) { wxString doomwaddir = _T(""); wxString env_paths[NUM_ENVVARS]; wxInt32 i = 0; // create a small list of paths for (i = 0; i < NUM_ENVVARS; i++) { // only add paths if the variable exists and path isn't blank if (wxGetEnv(env_vars[i], &env_paths[i])) if (!env_paths[i].IsEmpty()) doomwaddir += env_paths[i] + _T(PATH_DELIMITER); } wxInt32 path_count = 0; wxStringTokenizer wadlist(doomwaddir, _T(PATH_DELIMITER)); while (wadlist.HasMoreTokens()) { wxString path = wadlist.GetNextToken(); // make sure the path doesn't already exist in the list box if (m_LstCtrlWadDirectories->FindString(path) == wxNOT_FOUND) { m_LstCtrlWadDirectories->Append(path); path_count++; } } if (path_count) { wxMessageBox(_T("Environment variables import successful!")); UserChangedSetting = 1; } else wxMessageBox(_T("Environment variables contains paths that have been already imported.")); }
void dlgConfig::Show() { m_ChkCtrlGetListOnStart->SetValue(cfg_file->get_list_on_start); m_ChkCtrlShowBlockedServers->SetValue(cfg_file->show_blocked_servers); // Load wad path list m_LstCtrlWadDirectories->Clear(); wxStringTokenizer wadlist(cfg_file->wad_paths, _T(PATH_DELIMITER)); while (wadlist.HasMoreTokens()) { wxString path = wadlist.GetNextToken(); #ifdef __WXMSW__ path.Replace(_T("\\\\"),_T("\\"), true); #else path.Replace(_T("////"),_T("//"), true); #endif m_LstCtrlWadDirectories->AppendString(path); } m_DirCtrlChooseOdamexPath->SetPath(cfg_file->odamex_directory); wxString MasterTimeout, ServerTimeout, ExtraCmdLineArgs; ConfigInfo.Read(wxT(MASTERTIMEOUT), &MasterTimeout, wxT("500")); ConfigInfo.Read(wxT(SERVERTIMEOUT), &ServerTimeout, wxT("500")); ConfigInfo.Read(wxT(EXTRACMDLINEARGS), &ExtraCmdLineArgs, wxT("")); m_TxtCtrlMasterTimeout->SetValue(MasterTimeout); m_TxtCtrlServerTimeout->SetValue(ServerTimeout); m_TxtCtrlExtraCmdLineArgs->SetValue(ExtraCmdLineArgs); UserChangedSetting = 0; ShowModal(); }