void Programme::addSubElement( QDomElement &element) { if(element.localName().compare("Icon", Qt::CaseInsensitive)==0) { Icon *cn = Icon::fromElement(element); addIcon(cn); return; } if(element.localName().compare("Category", Qt::CaseInsensitive)==0) { Category *cn = Category::fromElement(element); addCategory(cn); return; } if(element.localName().compare("SubTitle", Qt::CaseInsensitive)==0) { SubTitle *cn = SubTitle::fromElement(element); addSubTitle(cn); return; } if(element.localName().compare("LastChance", Qt::CaseInsensitive)==0) { LastChance *cn = LastChance::fromElement(element); addLastChance(cn); return; } if(element.localName().compare("Audio", Qt::CaseInsensitive)==0) { Audio *cn = Audio::fromElement(element); addAudio(cn); return; } if(element.localName().compare("Subtitles", Qt::CaseInsensitive)==0) { Subtitles *cn = Subtitles::fromElement(element); addSubtitles(cn); return; } if(element.localName().compare("Date", Qt::CaseInsensitive)==0) { Date *cn = Date::fromElement(element); addDate(cn); return; } if(element.localName().compare("PreviouslyShown", Qt::CaseInsensitive)==0) { PreviouslyShown *cn = PreviouslyShown::fromElement(element); addPreviouslyShown(cn); return; } if(element.localName().compare("Country", Qt::CaseInsensitive)==0) { Country *cn = Country::fromElement(element); addCountry(cn); return; } if(element.localName().compare("OrigLanguage", Qt::CaseInsensitive)==0) { OrigLanguage *cn = OrigLanguage::fromElement(element); addOrigLanguage(cn); return; } if(element.localName().compare("StarRating", Qt::CaseInsensitive)==0) { StarRating *cn = StarRating::fromElement(element); addStarRating(cn); return; } if(element.localName().compare("Credits", Qt::CaseInsensitive)==0) { Credits *cn = Credits::fromElement(element); addCredits(cn); return; } if(element.localName().compare("Title", Qt::CaseInsensitive)==0) { Title *cn = Title::fromElement(element); addTitle(cn); return; } if(element.localName().compare("Video", Qt::CaseInsensitive)==0) { Video *cn = Video::fromElement(element); addVideo(cn); return; } if(element.localName().compare("New", Qt::CaseInsensitive)==0) { New *cn = New::fromElement(element); addNew(cn); return; } if(element.localName().compare("Rating", Qt::CaseInsensitive)==0) { Rating *cn = Rating::fromElement(element); addRating(cn); return; } if(element.localName().compare("EpisodeNum", Qt::CaseInsensitive)==0) { EpisodeNum *cn = EpisodeNum::fromElement(element); addEpisodeNum(cn); return; } if(element.localName().compare("Length", Qt::CaseInsensitive)==0) { Length *cn = Length::fromElement(element); addLength(cn); return; } if(element.localName().compare("Url", Qt::CaseInsensitive)==0) { Url *cn = Url::fromElement(element); addUrl(cn); return; } if(element.localName().compare("Review", Qt::CaseInsensitive)==0) { Review *cn = Review::fromElement(element); addReview(cn); return; } if(element.localName().compare("Language", Qt::CaseInsensitive)==0) { Language *cn = Language::fromElement(element); addLanguage(cn); return; } if(element.localName().compare("Premiere", Qt::CaseInsensitive)==0) { Premiere *cn = Premiere::fromElement(element); addPremiere(cn); return; } if(element.localName().compare("Desc", Qt::CaseInsensitive)==0) { Desc *cn = Desc::fromElement(element); addDesc(cn); return; } }
//======================================================== void IndexationMenu(){ int choice , validPath; int const maxSizePath = 100; char *path[maxSizePath]; FileType filetype; FILE *fileTOindex; BaseDesc basedesc; initList(&basedesc); void *desc = NULL; do{ printf("+=========================+\n"); printf("| |\n"); printf("|1. Index a SOUND |\n"); printf("|2. Index an IMAGE |\n"); printf("|3. Index a TEXT |\n"); printf("| |\n"); printf("+=================0.RETURN+\n"); scanf("%d" , &choice); if(choice!=1 && choice!=0 && choice!=2 && choice!=3){ system("clear"); } }while(choice!=1 && choice!=2 && choice!=0); clearBuffer(); do{ printf("Sgronieunieux\n"); fflush(stdout); if(choice==0){ system("clear");mainMenu(); } printf("Add an empty path with \"Enter\" to start Indexation.\n"); printf("Enter your(s) path(s) : \n"); validPath = getKeyboard_String(path,0, maxSizePath); if(fileExists(path)){ fileTOindex=fopen(path,"r"); if(fileTOindex==NULL){ printf("FAIL !\n"); fflush(stdout) ; exit(0);} switch(choice){ case(1): addDesc(&basedesc,createSoundDesc(fileTOindex),SOUND); break; case(2): addDesc(&basedesc,createPictureDesc(fileTOindex),PICTURE); break; case(3): /*desc=createTextDesc(fileTOindex); basedesc=; addDesc(&basedesc,desc,TEXT);*/ break; default: exit(0); break; } fclose(fileTOindex); strcpy(path,""); // Permite to secure the next path to enter by the user printf("Succesfull indexation.\n"); } else{ system("clear"); printf("Error, file don\'t exists\n"); mainMenu(); } } while ( validPath > 0 ); //while !0=NULL or !-1=so littre or !=-2=ERROR mainMenu(); }