void testStringView() { testEmpty(); testLazyDog(); std::cout << "Test \"" << PRETTY_FUNCTION << "\" passed.\n" << std::flush; std::cerr << std::flush; }
int main(void) { testEmpty(); testOne(); testManyPancakes(); testTooManyPancakes(); return 0; }
VOID TestDequeCode( PVMDIR_TEST_STATE pState ) { DWORD dwError = 0; PDEQUE pDeque = NULL; printf("Testing deque code ..."); dwError = dequeCreate(&pDeque); TestAssertEquals(dwError, ERROR_SUCCESS); testEmpty(pState, pDeque); testQueue(pState, pDeque); testStack(pState, pDeque); testEmpty(pState, pDeque); dequeFree(pDeque); printf(" PASSED\n"); }
void run () override { testTrivial (); testNearTrivial (); testPrimitives (); testEmpty (); testEscaping (); testArray (); testLongArray (); testEmbeddedArraySimple (); testObject (); testComplexObject (); testJson(); }
int main() { int rv = 0; rv += testEmpty(); rv += testAccess(); rv += testWrite(); rv += testFind(); rv += testVoid(); rv += testRFind(); rv += testCompressWhitespace(); if (0 == rv) { fprintf(stderr, "PASS: StringAPI tests\n"); } return rv; }
void runTests(struct Set *set) { testEmpty(); testSize(); testFullAndGrow(); }
//slot appelé en cliquant sur le bouton ok de la premiere fenêtre // qui a pour fonction d'ouvrir la seconde fenêtre void FunctionForm::openConnectionForm(){ resize(800,500); //which function has been choosen? functionChosen = choix->currentText(); //destroyers of the previous widgets choix->~QComboBox(); Yes->~QPushButton(); Cancel->~QPushButton(); buttonLayout->~QHBoxLayout(); //which number is the function choosen in the tab? for (int i=0; i< (int)ConnectionSettings::tabFunction.size() ; i++ ){ if(functionChosen == ConnectionSettings::tabFunction[i]->getNameFunction()){ indexFctChosen = i; } } //in case there is no argument to launch the function if(ConnectionSettings::tabFunction[indexFctChosen]->getNbArgument()=="0"){ this->launchCompute(); }else{ //for each argument of the chosen function, create fields as per the argument type for(int i=0 ; i< ConnectionSettings::tabFunction[indexFctChosen]->getNbArgument().toInt() ; i++){ switch(ConnectionSettings::argTypeList.indexOf(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType())) { case 0 : //"Text" { //qline edit : champ texte simple tabLineEdit.push_back(new QLineEdit); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 1: //"Integer" { //qspinbox : fenetre ou on ne peut mettre qu'un entier tabLineEdit.push_back(new QSpinBox); reinterpret_cast<QSpinBox*>(tabLineEdit[i])->setMaximum(10000); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 2: //"Real" { //qspinbox : fenetre ou on ne peut mettre qu'un réel tabLineEdit.push_back(new QDoubleSpinBox); reinterpret_cast<QDoubleSpinBox*>(tabLineEdit[i])->setDecimals(15); reinterpret_cast<QDoubleSpinBox*>(tabLineEdit[i])->setRange(-10000,10000); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 3: //"Boolean" { //Qcombobox :liste de choix : vrai ou faux tabLineEdit.push_back(new QComboBox); reinterpret_cast<QComboBox*> (tabLineEdit[i])->addItem("true"); reinterpret_cast<QComboBox*> (tabLineEdit[i])->addItem("false"); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 4: //"Process Sequence" { //qline edit : simple champ texte //structure : le séparateur est l'espace tabLineEdit.push_back(new QLineEdit); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 5: //"Process Set" { //qline edit : simple champ texte //structure : le séparateur est l'espace tabLineEdit.push_back(new QLineEdit); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 6: //"File .ph" { //champ texte + bouton parcourir (juste fichier .ph) //le bouton alimente le champ texte tabLineEdit.push_back(new QLineEdit); tabButtonFilePH.push_back(new QPushButton("Browse")); connect(tabButtonFilePH[indexFilePH], SIGNAL(clicked()), this, SLOT(getNamePH())); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any Prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); tabQHBox[i]->addWidget(tabButtonFilePH[indexFilePH]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); tabButtonFilePH[indexFilePH]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); indexFilePH+=1; break;} case 7: //"File" { //champ texte + bouton parcourir (tt type de fichier) //le bouton alimente le champ texte tabLineEdit.push_back(new QLineEdit); tabButtonFile.push_back(new QPushButton("Browse")); connect(tabButtonFile[indexFile], SIGNAL(clicked()), this, SLOT(getName())); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); tabQHBox[i]->addWidget(tabButtonFile[indexFile]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); tabButtonFile[indexFile]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); indexFile+=1; break;} case 8: //"Folder" //champ texte + bouton parcourir (juste des dossiers) //le bouton alimente le champ texte { tabLineEdit.push_back(new QLineEdit); tabButtonDirec.push_back(new QPushButton("Browse")); connect(tabButtonDirec[indexDirec], SIGNAL(clicked()), this, SLOT(getDirectoryName())); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); tabQHBox[i]->addWidget(tabButtonDirec[indexDirec]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); tabButtonDirec[indexDirec]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); indexDirec+=1; break;} case 9: //"Choice" { //Qcombo box : liste de choix alimentée par l'utilisateur averti (info ds xmlComputationSettings.xml) tabLineEdit.push_back(new QComboBox); for(int m=0; m<(int)ConnectionSettings::tabChoix[indexFctChosen]->at(i)->size() ; m++){ reinterpret_cast<QComboBox*>(tabLineEdit[i])->addItem(ConnectionSettings::tabChoix[indexFctChosen]->at(i)->at(m)->getChoixNom()); } tabQFormLayout.push_back(new QFormLayout); tabQFormLayout[i]->addRow("Choice : ", tabLineEdit[i]); tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 10: //"File not existing" { //champ texte + bouton parcourir (juste des dossiers) //le bouton alimente le champ texte //l'utilisateur n'a plus qu'à mettre un nom de fichier (celui qu'il veut créer) tabLineEdit.push_back(new QLineEdit); tabButtonFileNotExisting.push_back(new QPushButton("Browse")); connect(tabButtonFileNotExisting[indexFileNotExisting], SIGNAL(clicked()), this, SLOT(getDirectoryNameFileNotExisting())); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); tabQHBox[i]->addWidget(tabButtonFileNotExisting[indexFileNotExisting]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); tabButtonFileNotExisting[indexFileNotExisting]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); indexFileNotExisting+=1; break;} case 11: //"Argument" { //qline edit : champ texte alimenté par l'utilisateur avertit (fichier xmlComputationSetting.xml) //champ grisé : modification interdite tabLineEdit.push_back(new QLineEdit); reinterpret_cast<QLineEdit*>(tabLineEdit[i])->setText(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()); tabLineEdit[i]->setEnabled(false); tabQFormLayout.push_back(new QFormLayout); tabQFormLayout[i]->addRow("Argument : ", tabLineEdit[i]); tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 12: //"Current File" { //qline edit : champ texte alimenté par le fichier ouvert //champ grisé : modification interdite tabLineEdit.push_back(new QLineEdit); reinterpret_cast<QLineEdit*>(tabLineEdit[i])->setText(MainWindow::mwThis->pathCurrentWindow()); tabLineEdit[i]->setEnabled(false); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefix : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} } totalLayout->addWidget(tabGroupBox[i]); } //creation des boutons Ok = new QPushButton("&Ok"); back = new QPushButton("&Back"); buttonLayout2 = new QHBoxLayout; buttonLayout2->addWidget(Ok); buttonLayout2->addWidget(back); totalLayout->addLayout(buttonLayout2); connect(Ok, SIGNAL(clicked()), this, SLOT(testEmpty())); connect(back, SIGNAL(clicked()), this, SLOT(fctBack())); } }
void FunctionForm::openConnectionForm(){ resize(800,500); //which function has been choosen? functionChosen = choix->currentText(); //destroyers of the previous widgets choix->~QComboBox(); Yes->~QPushButton(); Cancel->~QPushButton(); buttonLayout->~QHBoxLayout(); //which number is the function choosen in the tab? for (int i=0; i< (int)ConnectionSettings::tabFunction.size() ; i++ ){ if(functionChosen == ConnectionSettings::tabFunction[i]->getNameFunction()){ indexFctChosen = i; } } //in case there is no argument to launch the function if(ConnectionSettings::tabFunction[indexFctChosen]->getNbArgument()=="0"){ this->launchCompute(); }else{ //for each argument of the chosen function, create fields as per the argument type for(int i=0 ; i< ConnectionSettings::tabFunction[indexFctChosen]->getNbArgument().toInt() ; i++){ switch(ConnectionSettings::argTypeList.indexOf(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType())) { case 0 : //"Text" { tabLineEdit.push_back(new QLineEdit); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 1: //"Integer" { tabLineEdit.push_back(new QSpinBox); reinterpret_cast<QSpinBox*>(tabLineEdit[i])->setMaximum(10000); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 2: //"Real" { tabLineEdit.push_back(new QDoubleSpinBox); reinterpret_cast<QDoubleSpinBox*>(tabLineEdit[i])->setDecimals(15); reinterpret_cast<QDoubleSpinBox*>(tabLineEdit[i])->setRange(-10000,10000); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 3: //"Boolean" { tabLineEdit.push_back(new QComboBox); reinterpret_cast<QComboBox*> (tabLineEdit[i])->addItem("true"); reinterpret_cast<QComboBox*> (tabLineEdit[i])->addItem("false"); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 4: //"Process List" { tabLineEdit.push_back(new QLineEdit); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 5: //"Process Group" { tabLineEdit.push_back(new QLineEdit); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 6: //"File .ph" { tabLineEdit.push_back(new QLineEdit); tabButtonFilePH.push_back(new QPushButton("Browse")); connect(tabButtonFilePH[indexFilePH], SIGNAL(clicked()), this, SLOT(getNamePH())); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any Prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); tabQHBox[i]->addWidget(tabButtonFilePH[indexFilePH]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); tabButtonFilePH[indexFilePH]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); indexFilePH+=1; break;} case 7: //"File" { tabLineEdit.push_back(new QLineEdit); tabButtonFile.push_back(new QPushButton("Browse")); connect(tabButtonFile[indexFile], SIGNAL(clicked()), this, SLOT(getName())); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); tabQHBox[i]->addWidget(tabButtonFile[indexFile]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); tabButtonFile[indexFile]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); indexFile+=1; break;} case 8: //"Folder" { tabLineEdit.push_back(new QLineEdit); tabButtonDirec.push_back(new QPushButton("Browse")); connect(tabButtonDirec[indexDirec], SIGNAL(clicked()), this, SLOT(getDirectoryName())); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); tabQHBox[i]->addWidget(tabButtonDirec[indexDirec]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); tabButtonDirec[indexDirec]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); indexDirec+=1; break;} case 9: //"Choice" { tabLineEdit.push_back(new QComboBox); for(int m=0; m<(int)ConnectionSettings::tabChoix[indexFctChosen]->at(i)->size() ; m++){ reinterpret_cast<QComboBox*>(tabLineEdit[i])->addItem(ConnectionSettings::tabChoix[indexFctChosen]->at(i)->at(m)->getChoixNom()); } tabQFormLayout.push_back(new QFormLayout); tabQFormLayout[i]->addRow("Choice : ", tabLineEdit[i]); tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 10: //"File not existing" { tabLineEdit.push_back(new QLineEdit); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 11: //"Argument" { tabLineEdit.push_back(new QLineEdit); reinterpret_cast<QLineEdit*>(tabLineEdit[i])->setText(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()); tabLineEdit[i]->setEnabled(false); tabQFormLayout.push_back(new QFormLayout); tabQFormLayout[i]->addRow("Argument : ", tabLineEdit[i]); tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} case 12: //"Current File" { tabLineEdit.push_back(new QLineEdit); reinterpret_cast<QLineEdit*>(tabLineEdit[i])->setText(MainWindow::mwThis->pathCurrentWindow()); tabLineEdit[i]->setEnabled(false); tabQFormLayout.push_back(new QFormLayout); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf()==""){ tabQFormLayout[i]->addRow("Without any prefix", tabLineEdit[i]); }else{ tabQFormLayout[i]->addRow("Prefixe : "+ ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgSuf(), tabLineEdit[i]); } tabQcheckBox.push_back(new QCheckBox("Taken into account")); tabQHBox.push_back(new QHBoxLayout); tabQHBox[i]->addWidget(tabQcheckBox[i]); tabQHBox[i]->addLayout(tabQFormLayout[i]); if(ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgFac()=="0"){ //if argument is not fac tabQcheckBox[i]->setChecked(true); tabQcheckBox[i]->setEnabled(false); }else{ tabLineEdit[i]->setEnabled(false); } connect(this->tabQcheckBox[i], SIGNAL(stateChanged(int)), this, SLOT(enableForm(int))); tabGroupBox.push_back(new QGroupBox("Argument "+ QString::number(i+1)+ +" : (Type : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgType() +") Caption : " + ConnectionSettings::tabArgument[indexFctChosen]->at(i)->getArgOutline())); tabGroupBox[i]->setLayout(tabQHBox[i]); break;} } totalLayout->addWidget(tabGroupBox[i]); } Ok = new QPushButton("&Ok"); back = new QPushButton("&Back"); buttonLayout2 = new QHBoxLayout; buttonLayout2->addWidget(Ok); buttonLayout2->addWidget(back); totalLayout->addLayout(buttonLayout2); connect(Ok, SIGNAL(clicked()), this, SLOT(testEmpty())); connect(back, SIGNAL(clicked()), this, SLOT(fctBack())); } }