void OpenHomeWork::on_pBDeleteHomeWork_clicked() { int x=0; if(!ui->tWSelectSubject->currentIndex().isValid()||!ui->tWSelectSubject->currentIndex().parent().isValid()) { QMessageBox::warning(this,"Error","Select Subject"); x=1; } if(!ui->lWHomeWorks->currentIndex().isValid()) { QMessageBox::warning(this,"Error","Select Paper"); x=1; } if(x==0) {QString creatingPaperPath=basicPath; creatingPaperPath.append("HomeWork/"); creatingPaperPath.append(ui->tWSelectSubject->currentItem()->parent()->text(0)); creatingPaperPath.append("/"); creatingPaperPath.append(ui->tWSelectSubject->currentItem()->text(0)); creatingPaperPath.append("/"); creatingPaperPath.append(ui->lWHomeWorks->currentItem()->text()); creatingPaperPath.append(".xml"); QFile paperfile(creatingPaperPath); if(paperfile.exists()) { paperfile.remove(); } //delete in admin.xml QFile openConfigFile(filepath); if(!openConfigFile.open(QFile::ReadWrite| QIODevice::Text)) { qDebug()<<"error"; } else { QDomDocument document; document.setContent(&openConfigFile); QDomElement root= document.firstChildElement(); QDomNodeList grades = root.elementsByTagName("Grade"); for(int i=0;i<grades.count();i++) { QDomNode itemNode = grades.at(i); if(itemNode.isElement()) { if(itemNode.toElement().attribute("GradeName")==ui->tWSelectSubject->currentItem()->parent()->text(0)) { QDomNodeList subjectList= itemNode.toElement().elementsByTagName("Subject"); for(int j=0;j<subjectList.count();j++) { QDomNode itemNodeSubject = subjectList.at(j); if(itemNodeSubject.toElement().attribute("SubjectName")==ui->tWSelectSubject->currentItem()->text(0)) { QDomNodeList HomeWorkList=itemNodeSubject.toElement().elementsByTagName("HomeWork"); for(int z=0;z<HomeWorkList.count();z++) { QDomNode itemNodeHomeWork= HomeWorkList.at(z); if(itemNodeHomeWork.toElement().attribute("HomeWorkName")==ui->lWHomeWorks->currentItem()->text()) { itemNodeSubject.toElement().removeChild(HomeWorkList.at(z)); QMessageBox::warning(this,"Error","Home Work removed"); } } } } } } } //root.appendChild(Activity); document.appendChild(root); openConfigFile.close(); if(!openConfigFile.open(QFile::ReadWrite|QIODevice::Truncate | QIODevice::Text)) { qDebug()<<"error"; } else { QTextStream stream(&openConfigFile); stream <<document.toString(); openConfigFile.close(); } ui->tWSelectSubject->clear(); ui->lWHomeWorks->clear(); setSubjetToTree(); } } }
int main(int argc, char **argv) { #ifdef WIN32 SetPriorityClass( GetCurrentProcess(), REALTIME_PRIORITY_CLASS ); //! set priority to windows #endif if (argc<2) { cout << "Usage : roadtrac [image file] [titlefile] [annotationfile]" << endl; cout << "exp : roadtrac template.jpg [label.txt] [annotations.txt]" << endl; exit(0); } else { char paperlist[100]; sprintf_s(paperlist,100, "paperlist.%s.txt", argv[1]); ifstream paperfile(paperlist); if (!paperfile) //if doesnt exist { IplImage *templ = cvLoadImage(argv[1]); reg.ExtractRegions(templ); m_tracker.CreateBlobSeq(®); m_tracker.SaveBlobSeq(paperlist); reg.Clear(); m_tracker.Clear(); } m_tracker.LoadBlobSeq(paperlist); if (argv[2]) m_tracker.LoadBlobName(argv[2]); if (argv[3]) m_tracker.LoadBlobLabels(argv[3]); } cap = cvCaptureFromCAM(CAMERAID); cvSetCaptureProperty(cap,CV_CAP_PROP_FRAME_WIDTH, IMG_WIDTH); cvSetCaptureProperty(cap,CV_CAP_PROP_FRAME_HEIGHT, IMG_HEIGHT); if (!cap) return 0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE| GLUT_RGBA | GLUT_DEPTH | GLUT_MULTISAMPLE); glutInitWindowPosition(100, 100); glutInitWindowSize(IMG_WIDTH, IMG_HEIGHT); if (argv[1]) wid = glutCreateWindow(argv[1]); else wid = glutCreateWindow("RoadTrac"); texture = new GLuint[1]; glGenTextures(1, texture); glBindTexture(GL_TEXTURE_2D, texture[0]); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, FRAMESIZE, FRAMESIZE, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, 0); glutReshapeFunc(resize); glutDisplayFunc(display); m_text.t3dInit(DATA_CHARSET); glutIdleFunc(idle); glutKeyboardFunc(keyboard); setprojection(); if (LIGHT) setlight(); glutMainLoop(); close(); return 0; }