void PHPProjectSettingsDlg::Save() { PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(m_projectName); CHECK_PTR_RET(pProject); PHPProjectSettingsData& data = pProject->GetSettings(); // General settings data.SetRunAs(m_choicebook1->GetSelection() == 0 ? PHPProjectSettingsData::kRunAsCLI : PHPProjectSettingsData::kRunAsWebsite); data.SetPhpExe(m_filePickerPHPExe->GetPath()); data.SetIndexFile(m_filePickerIndex->GetPath()); data.SetArgs(m_textCtrlProgramArgs->GetValue()); data.SetWorkingDirectory(m_dirPickerWorkingDirectory->GetPath()); data.SetIncludePath(m_textCtrlPHPIncludePath->GetValue()); data.SetPauseWhenExeTerminates(m_checkBoxPauseWhenExecutionEnds->IsChecked()); data.SetPhpIniFile(m_filePickerPhpIni->GetPath()); data.SetProjectURL(m_textCtrlWebSiteURL->GetValue()); data.SetUseSystemBrowser(m_checkBoxSystemBrowser->IsChecked()); // Code Completion settings data.SetCcIncludePath(m_textCtrlCCIncludePath->GetValue()); // Save the file mapping JSONElement::wxStringMap_t mapping; int itemCount = m_dvListCtrlFileMapping->GetItemCount(); for(int i = 0; i < itemCount; ++i) { wxVariant source, target; m_dvListCtrlFileMapping->GetValue(source, i, 0); m_dvListCtrlFileMapping->GetValue(target, i, 1); mapping.insert(std::make_pair(source.GetString(), target.GetString())); } data.SetFileMapping(mapping); wxString fileExts = m_pgPropFileTypes->GetValue().GetString(); fileExts.Replace(",", ";"); pProject->SetImportFileSpec(fileExts); wxString excludeDirs = m_pgPropExcludeFolders->GetValue().GetString(); excludeDirs.Replace(",", ";"); pProject->SetExcludeFolders(excludeDirs); // Save the project content pProject->Save(); SetDirty(false); }
JSONElement::wxStringMap_t JSONElement::toStringMap() const { JSONElement::wxStringMap_t res; if(!_json) { return res; } if(_json->type != cJSON_Array) { return res; } for(int i = 0; i < arraySize(); ++i) { wxString key = arrayItem(i).namedObject("key").toString(); wxString val = arrayItem(i).namedObject("value").toString(); res.insert(std::make_pair(key, val)); } return res; }