void KeyboardInput::cycleValues(int ¤t_value, std::vector<int> value_list, int changevalue) { for (int i = 0; i < value_list.size(); i++) { if (current_value == value_list[i]) { current_value = value_list[changeIndex(i, value_list.size() - 1, changevalue)]; return; } } current_value = value_list[0]; }
void Commentaire::zipXlsx(){ QString fileName = ""; while(fileName == ""){//on boucle dans le cas ou l'utilisateur QString excelFilter = "Fichier Excel (*.xlsx)"; //sert à récupérer le path et le nom du fichier d'ou on veut sauver l'excel généré. fileName = QFileDialog::getSaveFileName(this, "Choisir le nom du fichier","", excelFilter,&excelFilter); fileName.truncate(fileName.indexOf(".xlsx"));//on ne garde que le nom du fichier sans l'extension //car qt ici rajoute a la fin .xlsx, si l'utilisateur //entre "fichier.xlsx", on va se retrouver avec un fichier au nom "fichier.xlsx.xlsx" if(fileName == ""){//si l'utilisateur tente de quitter. int ret = QMessageBox::warning( this,"Attention","Ne pas générer les fichiers?", QMessageBox::Cancel | QMessageBox::Yes); if(ret == QMessageBox::Yes){ return; } } } fileName +=".xlsx"; for(int i=0 ; i <fileName.size();i++){//on doit remplacer dans ce path les "/" par des "\" => "\\" caractére d'échapement if(fileName.at(i) == '/'){//c'est qt qui les mets dans ce sens avec la méthode appicationDirPath() fileName.replace(i,1,"\\"); } } editFile(pathBA+"BA.xlsx",fileName); if(QFile::exists(fileName)){ int ret = QMessageBox::information( this,"Excel Généré!","Votre BA a bien été généré! Voulez-vous l'ouvrir?", QMessageBox::No | QMessageBox::Yes); if(ret == QMessageBox::Yes){ QDesktopServices::openUrl(QUrl::fromLocalFile(fileName)); } emit changeIndex(0); } else{ QMessageBox::critical( this,"Excel non Généré!", "Votre BA n'a pas été généré. Consulter le fichier SYSTEM\\replace.vbs"); } }
//============================================================================== void ChoicePropertyComponent::refresh() { if (isCustomClass) { if (! comboBox.isVisible()) { createComboBox(); comboBox.onChange = [this] { changeIndex(); }; } comboBox.setSelectedId (getIndex() + 1, dontSendNotification); } }
void Windows::goPrec(){ changeIndex(indexPrecedant); }
TB_TeamBody::TB_TeamBody(QWidget *parent, TeamHolder *team, int gen, QAbstractItemModel *pokeModel) : m_dockAdvanced(0), m_team(team), gen(gen), pokeModel(pokeModel), upParent(parent) { QHBoxLayout *hh = new QHBoxLayout(this); hh->setMargin(0); splitter = new QSplitter(); hh->addWidget(splitter); splitter->setChildrenCollapsible(false); QSettings s; QStringList itemList = s.value("show_all_items").toBool() ? ItemInfo::SortedNames(gen) : ItemInfo::SortedUsefulNames(gen); itemsModel = new QStringListModel(itemList, this); QStringList natures; for (int i = 0; i < NatureInfo::NumberOfNatures(); i++) { natures.push_back(NatureInfo::Name(i)); } natureModel = new QStringListModel(natures, this); QWidget *props = new QWidget(); QVBoxLayout *ml = new QVBoxLayout(props); ml->setMargin(0); /* Pokemon buttons */ QHBoxLayout *buttonsl = new QHBoxLayout; buttonsl->setSpacing(1); ml->addLayout(buttonsl); for (int i = 0; i < 6; i++) { const PokeTeam &poke = team->team().poke(i); buttonsl->addWidget(pokeButtons[i] = new TeamPokeButton(i,poke.num(),poke.level(), poke.item())); } /* Body! */ body = new QStackedWidget(); ml->addWidget(body); for (int i = 0; i < 6; i++) { pokeBody[i] = new TB_PokemonBody(&trainerTeam()->team().poke(i), i); } PokeBodyWidget *widget = new PokeBodyWidget(parent,gen,itemsModel,pokeModel, natureModel); pokeBody[0]->setWidget(widget); body->addWidget(widget); connect(widget, SIGNAL(advanceMenuOpen(bool)), SLOT(advancedClicked(bool))); pokeButtons[0]->setChecked(true); for(int i = 0; i < 6; i++) { connect(pokeButtons[i], SIGNAL(clicked()), SLOT(changeIndex())); connect(pokeButtons[i], SIGNAL(changePokemonBase(int,Pokemon::uniqueId)), SLOT(changePokemonBase(int,Pokemon::uniqueId))); connect(pokeButtons[i], SIGNAL(changePokemonOrder(QPair<int,int>)), SLOT(changePokemonOrder(QPair<int,int>))); connect(pokeBody[i], SIGNAL(pokeChanged(Pokemon::uniqueId)), SLOT(updateButton())); connect(pokeBody[i], SIGNAL(itemChanged(int)), SLOT(updateButton())); connect(pokeBody[i], SIGNAL(levelChanged()), SLOT(updateButton())); connect(pokeBody[i], SIGNAL(pokeChanged(Pokemon::uniqueId)),SLOT(indexNumChanged(Pokemon::uniqueId))); } splitter->addWidget(props); restoreAdvancedState(); }
void ResumeConfiguration::goPrec(){ emit changeIndex(this->indexPrecedant); }
void Commentaire::goPrec(){ emit changeIndex(this->indexPrecedant); }
//-------------------------------------------------------------- void testApp::setType(int fid,int type) { changeIndex(fid,type); }
void testApp::setType(int start,int end,int type) { for(; start<=end; start++) { changeIndex(start,type); } }
void ProduitListe::goPrec(){ emit changeIndex(this->indexPrecedant); }
void objReader::loadObj(const std::string &file) { std::string r; std::ifstream f; f.open(file.c_str()); float x, y, z; unsigned int line = 0; while (getline(f, r)) { if (r[0] != '#' && r[0] != '\0' && r[0] != '\n') { //else std::cout<<r<<"\n"; if (r[0] == 'v') { switch (r[1]) { case ' ': // vertex sscanf(r.c_str(), "v %f %f %f", &x, &y, &z); m_vertices.push_back(glm::vec3(x,y,z)); //std::cerr<<"Read vx("<<x<<","<<y<<","<<z<<")\n"; break; case 't': // text coord sscanf(r.c_str(), "vt %f %f", &x, &y); m_texCoord.push_back(glm::vec2(x,y)); break; case 'n': // normal sscanf(r.c_str(), "vn %f %f %f", &x, &y, &z); m_normals.push_back(glm::vec3(x,y,z)); break; default: std::cout<<"Error reading line '"<<r<<"' in file "<<file<<"\n"; break; } } else if (r[0] == 'f') { std::istringstream is(r); std::string ff(""); is>>ff; // read f m_faces.push_back(face()); ff = ""; is>>ff; while(ff.compare("") != 0) { //std::cerr<<"read: "<<ff<<"\n"; size_t count = std::count(ff.begin(), ff.end(), '/'); int v, n, t; switch (count) { case 0: // que des vertex sscanf(ff.c_str(),"%d", &v); changeIndex(v, 0); //std::cerr<<"pushed vx with index "<<v<<"\n"; m_faces.back().vx.push_back(v); break; case 1: // vertex et text coor break; case 2: // vertex, texcoor et normales OU vertex et normals sscanf(ff.c_str(),"%d/%d/%d", &v, &t, &n); changeIndex(v, 0); changeIndex(t, 1); changeIndex(n, 2); m_faces.back().vx.push_back(v); m_faces.back().nr.push_back(n); m_faces.back().tx.push_back(t); break; default: break; } ff = ""; is>>ff; } } else { //std::cout<<"Error in line "<<line<<"'"<<r<<"' for file "<<file<<"...\n"; } }