void CodeBlocksImporter::GenerateFromWorkspace(GenericWorkspacePtr genericWorkspace) { GenericProjectDataListType genericProjectDataList; wxCopyFile(wsInfo.GetFullPath(), wsInfo.GetFullPath() + wxT(".backup")); wxXmlDocument codeBlocksProject; if(codeBlocksProject.Load(wsInfo.GetFullPath())) { wxXmlNode* root = codeBlocksProject.GetRoot(); if(root) { wxXmlNode* rootChild = root->GetChildren(); while(rootChild) { if(rootChild->GetName() == wxT("Workspace")) { wxXmlNode* workspaceChild = rootChild->GetChildren(); while(workspaceChild) { if(workspaceChild->GetName() == wxT("Project") && workspaceChild->HasAttribute(wxT("filename"))) { wxString filename = workspaceChild->GetAttribute(wxT("filename")); filename.Replace(wxT("\\"), wxT("/")); wxFileName filenameInfo(filename); GenericProjectDataType genericProjectData; genericProjectData[wxT("projectFullPath")] = wsInfo.GetPath() + wxFileName::GetPathSeparator() + filename; wxString deps = wxT(""); wxXmlNode* projectChild = workspaceChild->GetChildren(); while(projectChild) { if(projectChild->GetName() == wxT("Depends") && projectChild->HasAttribute(wxT("filename"))) { wxString filename = projectChild->GetAttribute(wxT("filename")); wxString projectFullPath = wsInfo.GetPath() + wxFileName::GetPathSeparator() + filename; wxXmlDocument depsProject; if(depsProject.Load(projectFullPath)) { wxXmlNode* rootDeps = depsProject.GetRoot(); if(rootDeps) { wxXmlNode* rootDepsChild = rootDeps->GetChildren(); while(rootDepsChild) { if(rootDepsChild->GetName() == wxT("Project")) { wxXmlNode* projectDepsChild = rootDepsChild->GetChildren(); while(projectDepsChild) { if(projectDepsChild->GetName() == wxT("Option") && projectDepsChild->HasAttribute(wxT("title"))) { wxString title = projectDepsChild->GetAttribute(wxT("title")); deps += title + wxT(";"); } projectDepsChild = projectDepsChild->GetNext(); } } rootDepsChild = rootDepsChild->GetNext(); } } } } projectChild = projectChild->GetNext(); } genericProjectData[wxT("projectDeps")] = deps; genericProjectDataList.push_back(genericProjectData); } workspaceChild = workspaceChild->GetNext(); } } rootChild = rootChild->GetNext(); } } } for(GenericProjectDataType& genericProjectData : genericProjectDataList) { GenerateFromProject(genericWorkspace, genericProjectData); } }
void QDeclarativeTester::save() { QString filename = m_script + QLatin1String(".qml"); QFileInfo filenameInfo(filename); QDir saveDir = filenameInfo.absoluteDir(); saveDir.mkpath(QLatin1String(".")); QFile file(filename); file.open(QIODevice::WriteOnly); QTextStream ts(&file); ts << "import Qt.VisualTest 4.7\n\n"; ts << "VisualTest {\n"; int imgCount = 0; QList<KeyEvent> keyevents = m_savedKeyEvents; QList<MouseEvent> mouseevents = m_savedMouseEvents; for (int ii = 0; ii < m_savedFrameEvents.count(); ++ii) { const FrameEvent &fe = m_savedFrameEvents.at(ii); ts << " Frame {\n"; ts << " msec: " << fe.msec << "\n"; if (!fe.hash.isEmpty()) { ts << " hash: \"" << fe.hash.toHex() << "\"\n"; } else if (!fe.image.isNull()) { QString filename = filenameInfo.baseName() + QLatin1String(".") + QString::number(imgCount) + QLatin1String(".png"); fe.image.save(m_script + QLatin1String(".") + QString::number(imgCount) + QLatin1String(".png")); imgCount++; ts << " image: \"" << filename << "\"\n"; } ts << " }\n"; while (!mouseevents.isEmpty() && mouseevents.first().msec == fe.msec) { MouseEvent me = mouseevents.takeFirst(); ts << " Mouse {\n"; ts << " type: " << me.type << "\n"; ts << " button: " << me.button << "\n"; ts << " buttons: " << me.buttons << "\n"; ts << " x: " << me.pos.x() << "; y: " << me.pos.y() << "\n"; ts << " modifiers: " << me.modifiers << "\n"; if (me.destination == ViewPort) ts << " sendToViewport: true\n"; ts << " }\n"; } while (!keyevents.isEmpty() && keyevents.first().msec == fe.msec) { KeyEvent ke = keyevents.takeFirst(); ts << " Key {\n"; ts << " type: " << ke.type << "\n"; ts << " key: " << ke.key << "\n"; ts << " modifiers: " << ke.modifiers << "\n"; ts << " text: \"" << ke.text.toUtf8().toHex() << "\"\n"; ts << " autorep: " << (ke.autorep?"true":"false") << "\n"; ts << " count: " << ke.count << "\n"; if (ke.destination == ViewPort) ts << " sendToViewport: true\n"; ts << " }\n"; } } ts << "}\n"; file.close(); }