ProjectVersion(std::string iProjectName, std::string iMajor, std::string iMinor, std::string iPatch) { setProjectName(iProjectName); setMajorStr(iMajor); setMinorStr(iMinor); setPatchStr(iPatch); }
void JsonProjectPage::initializePage() { JsonWizard *wiz = qobject_cast<JsonWizard *>(wizard()); QTC_ASSERT(wiz, return); setPath(wiz->stringValue(QLatin1String("InitialPath"))); setProjectName(uniqueProjectName(path())); }
/******************* FUNCTION *********************/ CMRCmdOptions::CMRCmdOptions ( int width, int height, int iterations ) { //default values this->iniDic = NULL; this->width = width; this->height = height; this->iterations = iterations; this->dumpUsedDic = NULL; //setup arg parsor setProjectName ("CartesinMeshRuntime"); setProjectVersion ("0.0.0"); setProjectBugAddress("*****@*****.**"); setProjectDescr ("Runtime to quicly build parallel (MPI/Threads) stencil numerical simulations."); setProjectArgUsage ("[-w WIDTH] [-h HEIGHT] [-i ITERATIONS] [-c FILE] [-?]"); //declare options declareOption('w', "width" , "WIDTH" , "Define the mesh width."); declareOption('h', "height" , "HEIGHT" , "Define the mesh height."); declareOption('i', "iterations", "ITERATIONS", "Define the number of iterations to compute."); declareOption('c', "config" , "FILE" , "Define the configuration file to load."); declareOption('d', "dumpconfig", "FILE" , "Dump the config in FILE at execution end."); }
void NetworkManager::tick() { int dataTotal = 0; while (true) { if(!openProject_.empty()){ application_->openProject(openProject_.c_str()); openProject_.clear(); } int dataSent0 = serverDataSent(); int dataReceived0 = serverDataReceived(); NetworkEvent event; serverTick(&event); int dataSent1 = serverDataSent(); int dataReceived1 = serverDataReceived(); if (event.eventCode == eDataReceived) { const std::vector<char>& data = event.data; LuaDebugging::studioCommand(data); switch (data[0]) { case gptMakeDir: createFolder(data); break; case gptWriteFile: createFile(data); break; case gptPlay:{ const char* absfilename = g_pathForFile("../luafiles.txt"); FILE* fos = fopen(absfilename, "wb"); fwrite(&data[0], data.size(), 1, fos); fclose(fos); play(data); } break; case gptStop: stop(); break; case gptGetFileList: sendFileList(); break; case gptSetProjectName: setProjectName(data); break; case gptDeleteFile: deleteFile(data); break; case gptSetProperties:{ const char* absfilename = g_pathForFile("../properties.bin"); FILE* fos = fopen(absfilename, "wb"); fwrite(&data[0], data.size(), 1, fos); fclose(fos); setProperties(data); } break; } } int dataDelta = (dataSent1 - dataSent0) + (dataReceived1 - dataReceived0); dataTotal += dataDelta; if (dataDelta == 0 || dataTotal > 1024) break; } }
void TupProject::fromXml(const QString &xml) { QDomDocument document; if (!document.setContent(xml)) return; QDomElement root = document.documentElement(); QDomNode n = root.firstChild(); int i = 0; while (!n.isNull()) { QDomElement e = n.toElement(); if (!e.isNull()) { if (e.tagName() == "project") { setProjectName(e.attribute("name", projectName())); QDomNode n1 = e.firstChild(); e = n1.toElement(); if (e.tagName() == "meta") { QDomNode n1 = e.firstChild(); while (!n1.isNull()) { QDomElement e1 = n1.toElement(); if (e1.tagName() == "author") { if (e1.firstChild().isText()) setAuthor(e1.text()); } else if (e1.tagName() == "bgcolor") { if (e1.text().isEmpty()) setBgColor(QColor("#ffffff")); else setBgColor(QColor(e1.text())); } else if (e1.tagName() == "description") { if (e1.firstChild().isText()) setDescription(e1.text()); } else if (e1.tagName() == "dimension") { if (e1.firstChild().isText()) { QStringList list = e1.text().split(","); int x = list.at(0).toInt(); int y = list.at(1).toInt(); QSize size(x,y); setDimension(size); } } else if (e1.tagName() == "fps") { if (e1.firstChild().isText()) setFPS(e1.text().toInt()); } n1 = n1.nextSibling(); } } } } n = n.nextSibling(); i++; } }
/** * Create a Version class object * * @param name of the project */ ProjectVersion(std::string iProjectName, int iMajor, int iMinor, int iPatch) { setProjectName(iProjectName); setMajor(iMajor); setMinor(iMinor); setPatch(iPatch); }
void ApplicationManager::openProject(const char* project) { //setting project name setProjectName(project); playFiles("../properties.bin","../luafiles.txt"); }
void ApplicationManager::openProject(const char* project){ //setting project name setProjectName(project); //setting properties const char* propfilename = g_pathForFile("../properties.bin"); FILE* fis_prop = fopen(propfilename, "rb"); const char* luafilename = g_pathForFile("../luafiles.txt"); FILE* fis_lua = fopen(luafilename, "rb"); if(fis_prop != NULL && fis_lua != NULL){ fseek(fis_prop, 0, SEEK_END); int len = ftell(fis_prop); fseek(fis_prop, 0, SEEK_SET); std::vector<char> buf_prop(len); fread(&buf_prop[0], 1, len, fis_prop); fclose(fis_prop); ProjectProperties properties; ByteBuffer buffer(&buf_prop[0], buf_prop.size()); char chr; buffer >> chr; buffer >> properties.scaleMode; buffer >> properties.logicalWidth; buffer >> properties.logicalHeight; int scaleCount; buffer >> scaleCount; properties.imageScales.resize(scaleCount); for (int i = 0; i < scaleCount; ++i) { buffer >> properties.imageScales[i].first; buffer >> properties.imageScales[i].second; } buffer >> properties.orientation; buffer >> properties.fps; buffer >> properties.retinaDisplay; buffer >> properties.autorotation; buffer >> properties.mouseToTouch; buffer >> properties.touchToMouse; buffer >> properties.mouseTouchOrder; setProjectProperties(properties); //loading lua files std::vector<std::string> luafiles; const char* luafilename = g_pathForFile("../luafiles.txt"); FILE* fis_lua = fopen(luafilename, "rb"); fseek(fis_lua, 0, SEEK_END); len = ftell(fis_lua); fseek(fis_lua, 0, SEEK_SET); std::vector<char> buf_lua(len); fread(&buf_lua[0], 1, len, fis_lua); fclose(fis_lua); ByteBuffer buffer2(&buf_lua[0], buf_lua.size()); buffer2 >> chr; while (buffer2.eob() == false) { std::string str; buffer2 >> str; luafiles.push_back(str); } play(luafiles); }