- Timestamp:
- 08/04/10 10:31:13 (14 years ago)
- Location:
- trunk/yao/src/interface
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yao/src/interface/src/MainWindow.cpp
r393 r397 14 14 #include<iostream> 15 15 16 //using namespace antlr;17 16 using namespace std; 18 17 //using namespace antlr; … … 37 36 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_constantWindow(NULL), m_hatnameWindow(NULL), m_contextWindow(NULL), m_trajectoryWindow(NULL), m_spaceWindow(NULL), m_operaWindow(NULL), m_netwardWindow(NULL), m_modulWindow(NULL), m_ctinWindow(NULL), m_orderWindow(NULL), m_insertFCTWindow(NULL), m_newProjectWindow(NULL), m_newProjectName(""), theConstantTablePt(theConstantTable) 38 37 { 39 38 40 39 setWindowTitle(" Visual YAO "); //Gives a title to the mainwindow. 41 40 pt_espace = new QWorkspace; //Crée un espace de travail. Ici, ça serait notre zone centrale … … 86 85 void MainWindow::setTitle() { 87 86 88 QWidget::setWindowTitle( "Projet: " + QString(getProjectName().c_str()));87 QWidget::setWindowTitle(tr("%1[*] %2").arg("Projet:").arg(QString(getProjectName().c_str()))); 89 88 90 89 } … … 101 100 menuFichier->addSeparator(); 102 101 menuFichier->addAction(actionSaveProject); 103 menuFichier->addAction(action EnregistrerSousProjet);102 menuFichier->addAction(actionSaveAsProject); 104 103 menuFichier->addSeparator(); 105 104 menuFichier->addAction(actionSortieProjet); … … 166 165 actionSaveProject->setEnabled(false); // Option désactivée par défaut. 167 166 actionSaveProject->setStatusTip("Pour sauvegarder le projet en cours"); 168 actionEnregistrerSousProjet = new QAction(tr("Enregistrer sous"), this); 169 actionEnregistrerSousProjet->setIcon(QIcon("Images/icons/saveas.png")); 170 actionEnregistrerSousProjet->setEnabled(false); // Option désactivée par défaut. 171 actionEnregistrerSousProjet->setStatusTip("En le projet sous un autre nom"); 167 168 actionSaveAsProject = new QAction(tr("Enregistrer sous"), this); 169 actionSaveAsProject->setIcon(QIcon("Images/icons/saveas.png")); 170 actionSaveAsProject->setEnabled(false); // Option désactivée par défaut. 171 actionSaveAsProject->setStatusTip("En le projet sous un autre nom"); 172 connect(actionSaveAsProject, SIGNAL(triggered()), this, SLOT(saveAs())); 172 173 actionImprimerProjet = new QAction(tr("Imprimer"), this); 173 174 actionImprimerProjet->setStatusTip("Options d'impression"); … … 318 319 connect(m_constantWindow, SIGNAL(rowIsDeleted(QString )), this, SLOT(hatUpdate(QString ))); 319 320 connect(m_constantWindow, SIGNAL(rowIsAdded()), this, SLOT(contextUpdate())); 321 connect(m_constantWindow, SIGNAL(rowIsAdded()), this, SLOT(mainWindowIsModified())); 320 322 connect(m_constantWindow, SIGNAL(windowIsClosed(int )), this, SLOT(initializeWindow(int )));// The signal is in the ConstantWindow.hpp file. 321 323 … … 425 427 426 428 connect(m_ctinWindow, SIGNAL(ctinWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 427 428 429 } 429 430 … … 507 508 } 508 509 510 /**************************************** Implementation of the method mainWindowIsModified() (SLOT) ************************************************/ 511 void MainWindow::mainWindowIsModified() { 512 513 setWindowModified(true); 514 actionSaveProject->setEnabled(true); 515 actionSaveAsProject->setEnabled(true); 516 517 } 518 519 /**************************************** Implementation of the method saveAs() (SLOT) *******************************************************/ 520 void MainWindow::saveAs() { 521 522 523 m_newProjectWindow = new NewProjectWindow ; 524 m_newProjectWindow->setWindowTitle("testhj"); 525 m_newProjectName = m_newProjectWindow->getProjectName(); 526 m_projectPath = m_newProjectWindow->getProjectPath(); 527 theHeaderList.push_back(m_newProjectWindow->getProjectName() + ".h"); 528 fv->appelActualiser(); //Permet de mettre à jour automatiquement la liste des fichiers visibles dans filesviewer. 529 //connect(m_newProjectWindow, SIGNAL(newProjectIsCreated()), this, SLOT(activateToolBarButtons())); 530 activateToolBarButtons(); 531 emit WindowTitleChanged(); 532 emit newProjectIsCreated(); 533 534 //QFileDialog *dialog = new QFileDialog(this); //Crée une boite de dialogue 535 //dialog->setFileMode(QFileDialog::Directory); 536 //QString cheminFichier = dialog->getExistingDirectory(this, tr("Enregistrement d'un projet."), "."); 537 //m_newProjectName = cheminFichier.toStdString(); 538 //generateDFile(cheminFichier.toStdString()+ "/"); 539 //cout << cheminFichier.toStdString() << endl; 540 541 } 509 542 /**************************************** Implementation of the method nouveauProjet (SLOT) *******************************************************/ 510 543 void MainWindow::openProject() { // Affiche la fenetre nouveau projet lorsqu'elle est appelée. … … 515 548 516 549 QProcess builder; 517 550 QString test(""); 518 551 builder.setProcessChannelMode(QProcess::MergedChannels); 519 552 builder.start("Yao9Generator " + cheminFichier);//, QStringList() … … 521 554 qDebug() << "Make failed:" << builder.errorString(); 522 555 else { 523 QString test(builder.readAll());556 test = builder.readAll(); 524 557 istringstream iss(test.toStdString()); 525 FilePath mot;526 FilePath name; 527 while ( getline(iss, mot, '\n' ) )558 FilePath aString, name, aType, boot, offset, step, size; 559 560 while ( getline(iss, aString, '\n' ) ) 528 561 { 529 if ( mot.getExtension() == ".def1")562 if (aString.getExtension() == ".def1") 530 563 { 531 //cout << mot.getTitle() << endl;532 name = mot;564 //cout << aString.getTitle() << endl; 565 name = aString; 533 566 } 534 if ( mot.getExtension() == ".def2" && name.getExtension() == ".def1")567 if (aString.getExtension() == ".def2" && name.getExtension() == ".def1") 535 568 { 536 Constant aConstant(name.getTitle(), mot.getTitle());569 Constant aConstant(name.getTitle(), aString.getTitle()); 537 570 theConstantTable.push_back(aConstant); 538 571 } 539 if ( mot.getExtension() == ".h")572 if (aString.getExtension() == ".h") 540 573 { 541 cout << mot << endl; 542 theHeaderList.push_back(mot); 543 544 } //theConstantTable.push_back(mot.getTitle()); 574 // cout << aString << endl; 575 theHeaderList.push_back(aString); 576 } 577 if (aString.getExtension() == ".traj1"){ 578 name = aString.getTitle(); 579 // cout << name << endl; 580 } 581 if (aString.getExtension() == ".traj2"){ 582 aType = aString.getTitle(); 583 // cout << aType << endl; 584 } 585 if (aString.getExtension() == ".traj3") { 586 boot = aString.getTitle(); 587 // cout << boot << endl; 588 } 589 if (aString.getExtension() == ".traj4"){ 590 offset = aString.getTitle(); 591 // cout << offset << endl; 592 } 593 if (aString.getExtension() == ".traj5"){ 594 step = aString.getTitle(); 595 // cout << step << endl; 596 } 597 if (aString.getExtension() == ".traj6") 598 { 599 size = aString.getTitle(); 600 // cout << size << endl; 601 Trajectory localTrajectory(name, m_trajectoryWindow->toInt(boot), m_trajectoryWindow->toDouble(size), m_trajectoryWindow->toDouble(step), m_trajectoryWindow->toInt(offset), 'M');//Trajectory object. 602 theTrajectoryTable.push_back(localTrajectory); //Trajectory vector (contents many objects) 603 604 } //theConstantTable.push_back(aString.getTitle()); 605 if (aString.getExtension() == ".sp1") 606 name = aString.getTitle(); 607 //if (aString.getExtension() == ".sp2") 545 608 546 609 } 547 activateToolBarButtons(); 548 549 } 610 611 } 612 if (!cheminFichier.isEmpty() && !test.isEmpty()) { 613 activateToolBarButtons(); 614 //actionSaveProject->setEnabled(true); 615 actionSaveAsProject->setEnabled(true); 616 } 550 617 551 618 } … … 642 709 } 643 710 644 /********************************************* Implementation of the method set WindowTitle(const QString &title) ***********************************/711 /********************************************* Implementation of the method setActiveProject(const bool aBool) ***********************************/ 645 712 void MainWindow::setActiveProject(const bool aBool) { 646 713 … … 648 715 } 649 716 650 /********************************************* Implementation of the method setWindowTitle(const QString &title) ***********************************/717 /********************************************* Implementation of the method isActiveProject() ***********************************/ 651 718 bool MainWindow::isActiveProject() { 652 719 … … 655 722 656 723 /**************************************** Implementation of the method generateDFile() (SLOT) ****************************************************/ 657 void MainWindow::generateDFile() { 658 724 void MainWindow::generateDFile(string destination) { 725 726 date = new QDateEdit; 727 date->setDate(QDate::currentDate()); 728 729 659 730 try 660 731 { 661 662 732 filename = getProjectName(); 663 filepath = "projects/"+ filename + "/" + filename + ".d"; //"projects/test/test.d";733 filepath = destination + filename + "/" + filename + ".d"; //"projects/test/test.d"; 664 734 ofstream description(filepath.c_str(), ios::out | ios::binary | ios::trunc); 665 735 666 736 if(!description.is_open()) 667 737 throw ofstream::failure("couldn't create " + filename); 738 description << "#-------------------------------------------------------------------------------------------------" << endl; 739 description << "#---Fichier de description généré par visual Yao le " << date->date().toString().toStdString() << endl; 740 description << "#-------------------------------------------------------------------------------------------------" << endl; 741 668 742 if (!theConstantTable.empty()) { 669 description << " //DEFVAL name value-------------------------------------------------------" << endl;743 description << "#DEFVAL name value -------------------------------------------------------------------------------" << endl; 670 744 for (Table<Constant>::iterator it = theConstantTable.begin(); it != theConstantTable.end(); it++) 671 745 description << "defval " << it->getName() << " " << it->getText() << endl; … … 673 747 } 674 748 if (!theHeaderList.empty()) { 675 description << " //HATNAME--------------------------------------------------------------------------" << endl;749 description << "#HATNAME fileList --------------------------------------------------------------------------------" << endl; 676 750 for(vector <string>::iterator it = theHeaderList.begin(); it != theHeaderList.end(); it++) 677 751 description << "hat_name \"" << it->c_str() << "\"" << endl; … … 684 758 //} 685 759 if (!theTrajectoryTable.empty()) { 686 description << " //TRAJECTOIRES name type uptime offtime dtime steptime-------------" << endl;760 description << "#TRAJECTOIRES name type uptime offtime dtime steptime ------------------------------------------" << endl; 687 761 for (Table<Trajectory>::iterator it = theTrajectoryTable.begin(); it != theTrajectoryTable.end(); it++) 688 762 description << "traj " << it->getName() << " " << it->getType() << " " << it->getBoot() << " " << it->getOffset() << " " << it->getStep() << " " << it->getSize()<< " " << endl; … … 690 764 } 691 765 if(!theSpaceTable.empty()){ 692 description << " //SPACE name type dim1 [[dim2]---[dim3]] traj------------------" << endl;766 description << "#SPACE name type dim1 [[dim2]---[dim3]] traj ---------------------------------------------------" << endl; 693 767 for (Table<Space>::iterator it = theSpaceTable.begin(); it != theSpaceTable.end(); it++) 694 768 description << "space " << it->getProperty(0) << " " << it->getProperty(1) << " " << it->getProperty(2) << endl; … … 696 770 } 697 771 if(!theOperaTable.empty()) { 698 description << " //OPERATOR---------------------------------------------" << endl;772 description << "#OPERATOR name type shape parent --------------------------------------------------------------" << endl; 699 773 for (Table <Operator>::iterator it = theOperaTable.begin(); it != theOperaTable.end(); it++) 700 774 description << "opera " << it->getProperty(0) << " " << it->getProperty(1) << " " << it->getProperty(2) << endl; 701 775 } 702 776 if (!theNeuronTable.empty()) { 703 description << " //NETWARD ---------------------------------------------------------------------------" << endl;777 description << "#NETWARD name indegree outdegree --------------------------------------------------------------" << endl; 704 778 for (Table<Neuron>::iterator it = theNeuronTable.begin(); it != theNeuronTable.end(); it++) 705 779 description << "netward " << it->getName() << " " << it->getInDegree() << " " << it->getOutDegree() << endl; … … 707 781 } 708 782 if (!theModulTable.empty()){ 709 description << " //MODUL --------------------------------------------------------------------------" << endl;783 description << "#MODUL name parent ( modulAttribute )* --------------------------------------------------------" << endl; 710 784 for (Table<Modul>::iterator it = theModulTable.begin(); it != theModulTable.end(); it++) 711 785 description << "modul " << it->getName() << " " << it->getSpaceOrOperator() << " " << "input "<< it->getInput() << " " << "output "<< it->getOutput() << " " << "target " << it->getTarget()<< endl; 712 786 description << endl; 713 description << "//CONNECTIONS----------------------------------------------------------------------" << endl;714 }787 } 788 description << "#CONNECTIONS name range[0] FROM! name range[1] range_i ( range_jkt )? -------------------------" << endl; 715 789 /* for (QStringList::iterator it = m_ctinWindow->getDataCtin().begin(); it != m_ctinWindow->getDataCtin().end(); it++) 716 790 description << "ctin " << it->toStdString() << endl; */ 717 791 if (!theFunctionTable.empty()) { 718 description << "//USER FUNCTIONS----------------------------------------------------------------" << endl; 719 792 description << "#USER FUNCTIONS ( ARG )? name ----------------------------------------------------------------" << endl; 720 793 for (Table<Function>::iterator it = theFunctionTable.begin(); it != theFunctionTable.end(); it++) { 721 722 794 string aString = it->isParameterized()? "arg" : " "; 723 795 description << "insert_fct " << aString << " " << it->getName() << endl; 724 796 } 725 description << endl; 726 } 727 /* for (QStringList::iterator it = m_insertFCTWindow->getDataFCT().begin(); it != m_insertFCTWindow->getDataFCT().end(); it++) 797 //description << endl; 798 } 799 800 /* for (QStringList::iterator it = m_insertFCTWindow->getDataFCT().begin(); it != m_insertFCTWindow->getDataFCT().end(); it++) 728 801 description << "insert_fct " << it->toStdString() << endl; 729 802 description << endl; … … 907 980 //delete actionImporterProjet; 908 981 delete actionSaveProject; 909 delete action EnregistrerSousProjet;982 delete actionSaveAsProject; 910 983 delete actionImprimerProjet; 911 984 delete actionSortieProjet; -
trunk/yao/src/interface/src/TrajectoryWindow.cpp
r388 r397 204 204 } 205 205 206 if (upTime >= stepTime) { 207 QMessageBox::about(this, tr("Erreur de saisie!"), tr("Le pas de temps (steptime) doit-etre superieur a l'initialisation (uptime).")); 208 return; 209 210 } 206 211 207 212 208 int boot = toInt(upTime); … … 236 232 return; 237 233 } 234 235 if (upTime >= stepTime) { 236 QMessageBox::about(this, tr("Erreur de saisie!"), tr("Le pas de temps (steptime) doit-etre superieur a l'initialisation (uptime).")); 237 return; 238 239 } 240 238 241 Trajectory localTrajectory(trajName.toStdString(), boot, size, step, offset, 'M');//Trajectory object. 239 242 localTrajectoryTable->push_back(localTrajectory); //Trajectory vector (contents many objects) … … 255 258 QMessageBox::critical(this, "Erreur", "Erreur dans la méthode addTrajRow()"); 256 259 return; 257 258 259 } 260 /* 261 Constant *c; //Nous créons d'abord un pointeur de constante. 262 263 c = localConstantTable->find(upTime.toStdString()); //Ensuite on passe au pointeur le resultat de la recherche de la chaine en utilisant find. 264 265 if (c != NULL) 266 { //C'est alors une constante. 267 string upTimeValue = localConstantTable->find(upTime.toStdString())->getText(); //"getText()" returns the constant value. 268 upTime = QString(upTimeValue.c_str()); 269 boot = toInt(upTimeValue); 270 if (size < boot) 271 { 272 QMessageBox::critical(this, "Erreur", "Le pas de temps de la trajectoire (steptime) doit-être supérieur au pas de temps (uptime)."); 273 return; // Arrêt de la méthode 274 } 275 if (boot < 0) 276 { 277 QMessageBox::critical(this, "Erreur", "Le pas de temps (uptime) doit-être supérieur ou égal à 0"); 278 return; // Arrêt de la méthode 279 } 280 281 if (size < 0) 282 { 283 284 QMessageBox::critical(this, "Erreur", "Le pas de temps de la trajectoire (size) doit-être supérieur à 0."); 285 return; // Arrêt de la méthode 286 } 287 //else 288 289 if (size < boot) 290 { 291 QMessageBox::critical(this, "Erreur", "Le pas de temps de la trajectoire (size) doit-être supérieur au pas de temps (uptime)."); 292 return; // Arrêt de la méthode 293 } 294 295 if (offset < 0) 296 { 297 298 QMessageBox::critical(this, "Erreur", "Le decalage (offtime) doit-être >= 0.0"); 299 return; // Arrêt de la méthode 300 } 301 302 if (step < 0) 303 { 304 305 QMessageBox::critical(this, "Erreur", "La position (Dtime ou step) doit-être >= 0.0"); 306 return; // Arrêt de la méthode 307 } 308 } 309 310 Constant *c2; //Nous créons d'abord un pointeur de constante. 311 312 c2 = localConstantTable->find(dTime.toStdString()); //Ensuite on passe au pointeur le resultat de la recherche de la chaine en utilisant find. 313 314 if (c2 != NULL) 315 { //C'est alors une constante. 316 string dTimeValue = localConstantTable->find(dTime.toStdString())->getText(); //"getText()" returns the constant value. 317 dTime = QString(dTimeValue.c_str()); 318 step = toDouble(dTimeValue); 319 if (size < boot) 320 { 321 QMessageBox::critical(this, "Erreur", "Le pas de temps de la trajectoire (steptime) doit-être supérieur au pas de temps (uptime)."); 322 return; // Arrêt de la méthode 323 } 324 if (boot < 0) 325 { 326 QMessageBox::critical(this, "Erreur", "Le pas de temps (uptime) doit-être supérieur ou égal à 0"); 327 return; // Arrêt de la méthode 328 } 329 330 if (size < 0) 331 { 332 333 QMessageBox::critical(this, "Erreur", "Le pas de temps de la trajectoire (size) doit-être supérieur à 0."); 334 return; // Arrêt de la méthode 335 } 336 337 if (size < boot) 338 { 339 QMessageBox::critical(this, "Erreur", "Le pas de temps de la trajectoire (size) doit-être supérieur au pas de temps (uptime)."); 340 return; // Arrêt de la méthode 341 } 342 343 if (offset < 0) 344 { 345 346 QMessageBox::critical(this, "Erreur", "Le decalage (offtime) doit-être >= 0.0"); 347 return; // Arrêt de la méthode 348 } 349 350 if (step < 0) 351 { 352 353 QMessageBox::critical(this, "Erreur", "La position (Dtime ou step) doit-être >= 0.0"); 354 return; // Arrêt de la méthode 355 } 356 357 } 358 359 if (boot < 0) 360 { 361 QMessageBox::critical(this, "Erreur", "Le pas de temps (uptime) doit-être supérieur ou égal à 0"); 362 return; // Arrêt de la méthode 363 } 364 365 if (size < 0) 366 { 367 368 QMessageBox::critical(this, "Erreur", "Le pas de temps de la trajectoire (size, appelé aussi steptime) doit-être supérieur à 0."); 369 return; // Arrêt de la méthode 370 } 371 372 if (size < boot) 373 { 374 QMessageBox::critical(this, "Erreur", "Le pas de temps de la trajectoire (size, appelé aussi steptime) doit-être supérieur au pas de temps (uptime)."); 375 return; // Arrêt de la méthode 376 } 377 378 if (offset < 0) 379 { 380 381 QMessageBox::critical(this, "Erreur", "Le decalage (offtime) doit-être >= 0.0"); 382 return; // Arrêt de la méthode 383 } 384 385 if (step < 0) { 386 387 QMessageBox::critical(this, "Erreur", "La position (Dtime ou step) doit-être >= 0.0"); 388 return; // Arrêt de la méthode 389 } 390 391 392 for(int i = 0; i<trajName.size(); i++) 393 //if (m_trajNameLineTraj->text().isEmpty()) 394 if(!((trajName.at(i) >= QChar('a')&& trajName.at(i) <= QChar('z')) || (trajName.at(i) >= QChar('A')&& trajName.at(i) <= QChar('Z')) 395 || (trajName.at(i) >= QChar('0')&& trajName.at(i) <= QChar('9')) || (trajName.at(i) == QChar('_')))) { 396 397 QMessageBox::critical(this, "Erreur", "Veuillez entrer le nom de la trajectoire correcte."); 398 399 return; // Arrêt de la méthode 400 } 401 else 402 if((trajName.at(0) >= QChar('0') && trajName.at(0) <= QChar('9'))) { 403 404 QMessageBox::critical(this, "Erreur", "Le premier caractÚre du nom de la trajectoire ne doit pas être un chiffre!"); 405 return; // Arrêt de la méthode 406 } 407 408 409 for(int j = 0; j<typeTraj.size(); j++) 410 if(!((typeTraj.at(j) >= QChar('a')&& typeTraj.at(j) <= QChar('z')) || (typeTraj.at(j) >= QChar('A')&& typeTraj.at(j) <= QChar('Z')) 411 || (typeTraj.at(j) >= QChar('0')&& typeTraj.at(j) <= QChar('9')) || (typeTraj.at(j) == QChar('_')))) { 412 413 QMessageBox::critical(this, "Erreur", "Veuillez entrer un type correcte."); 414 415 return; // Arrêt de la méthode 416 } 417 418 for(int k = 0; k < upTime.size(); k++) 419 if(!((upTime.at(k) >= QChar('0')&& upTime.at(k) <= QChar('9')) || (upTime.at(k) == QChar('+')) || (upTime.at(k) == QChar('-')) 420 || (upTime.at(k) == QChar('E')) || (upTime.at(k) == QChar('e')))) { 421 422 QMessageBox::critical(this, "Erreur", "uptime doit-être une valeur entiÚre."); 423 424 return; // Arrêt de la méthode 425 } 426 427 for(int i1 = 0; i1<offTime.size(); i1++) 428 if(!((offTime.at(i1) >= QChar('0')&& offTime.at(i1) <= QChar('9')) || (offTime.at(i1) == QChar('+')) || (offTime.at(i1) == QChar('-')) 429 || (offTime.at(i1) == QChar('E')) || (offTime.at(i1) == QChar('e')) || (offTime.at(i1) == QChar('.')))) { 430 QMessageBox::critical(this, "Erreur", "Offtime doit-être une valeur entiÚre."); 431 432 return; // Arrêt de la méthode 433 434 } 435 436 for(int k1 = 0; k1<dTime.size(); k1++) 437 if(!((dTime.at(k1) >= QChar('1')&& dTime.at(k1) <= QChar('9')) || (dTime.at(k1) == QChar('+')) || (dTime.at(k1) == QChar('-')) 438 || (dTime.at(k1) == QChar('E')) || (dTime.at(k1) == QChar('e'))) && (dTime.at(k1) >= QChar('10')&& dTime.at(k1) <= QChar('10000'))) { 439 440 QMessageBox::critical(this, "Erreur", "Dtime doit-être une valeur réelle."); 441 442 return; // Arrêt de la méthode 443 } 444 445 446 if (m_trajNameLine->text().isEmpty()) { 447 448 QMessageBox::critical(this, "Erreur", "La syntaxe du nom de la Trajectoire n'est pas correcte! Le champ ne doit pas être vide."); 449 450 return; // Arrêt de la méthode 451 } 452 else 453 if (m_ligneTypeTraj->text().isEmpty()) { 454 455 QMessageBox::critical(this, "Erreur", "Veuillez definir un Type à la Trajectoire SVP!"); 456 return; // Arrêt de la méthode 457 } 458 else 459 if ((m_comboNbuptimeTraj->currentText().isEmpty())||(m_comboOfftimeTraj->currentText().isEmpty())||(m_comboDtimeTraj->currentText().isEmpty())) { 460 QMessageBox::critical(this, "Erreur", "Veuillez remplir les champs vides!"); 461 return; // Arrêt de la méthode 462 } 463 else { 464 try { 465 Trajectory localTrajectory(trajName.toStdString(), boot, size, step, offset, 'M');//Trajectory object. 466 localTrajectoryTable->push_back(localTrajectory); //Trajectory vector (contents many objects) 467 int row = m_trajModel->rowCount(); //To get all time the last line number. 468 m_trajModel->setItem(row, 0, new QStandardItem(trajName)); 469 m_trajModel->setItem(row, 1, new QStandardItem(typeTraj)); 470 m_trajModel->setItem(row, 2, new QStandardItem(upTime)); 471 m_trajModel->setItem(row, 3, new QStandardItem(offTime)); 472 m_trajModel->setItem(row, 4, new QStandardItem(dTime)); 473 m_trajModel->setItem(row, 5, new QStandardItem(stepTime)); 474 475 if(!isTrajectoryTableEmpty()) emit trajRowIsAdded(true); 476 } 477 catch(std::runtime_error) { 478 479 QMessageBox::critical(this, "Erreur", "theBoot doit être supérieur à theSize"); 480 return; 481 482 } 483 catch(...) { 484 485 cout << "Erreur dans la méthode addTrajRow." << endl; 486 } 487 } 488 */ 260 261 } 489 262 if(!isTrajectoryTableEmpty()) m_trajDelButton->setEnabled(true); 490 263 initialiserChamps(); -
trunk/yao/src/interface/src/include/MainWindow.hpp
r393 r397 6 6 #include <cstdlib> 7 7 #include <sstream> 8 #include <QDateEdit> 8 9 9 10 #include <iostream> … … 102 103 void cacherBarreOutils(); 103 104 void desactivateToolBarButtons(); 104 void generateDFile( );105 void generateDFile(std::string destination = "projects/"); 105 106 void montrerActionCompilation(); 106 107 void montrerActionGenererD(); … … 138 139 void hatUpdate(QString choix ); 139 140 void contextUpdate(); 141 void mainWindowIsModified(); 142 void saveAs(); 140 143 141 144 signals : 142 145 void modified(); 143 146 void newProjectIsCreated(); 144 147 void newProjectIsCreated(QString chaine); … … 168 171 QAction *actionImporterProjet; 169 172 QAction *actionSaveProject; 170 QAction *action EnregistrerSousProjet;173 QAction *actionSaveAsProject; 171 174 QAction *actionImprimerProjet; 172 175 QAction *actionSortieProjet; … … 232 235 233 236 NewProjectWindow *m_newProjectWindow; 237 NewProjectWindow *m_newProjectWindow2; 234 238 235 239 FilesViewer *fv; … … 264 268 yao::Table <yao::Function> theFunctionTable; 265 269 bool m_activeProject; 270 271 QDateEdit *date; 266 272 267 273 }; -
trunk/yao/src/interface/src/ui_/newprojectwindow.ui
r363 r397 12 12 </property> 13 13 <property name="windowTitle"> 14 <string>Création d'un nouveau projet.</string>14 <string>Création/Sauvegarde d'un nouveau projet.</string> 15 15 </property> 16 16 <widget class="QFrame" name="frame_3"> -
trunk/yao/src/interface/ui_newprojectwindow.h
r392 r397 1 1 /******************************************************************************** 2 ** Form generated from reading uifile 'newprojectwindow.ui'2 ** Form generated from reading UI file 'newprojectwindow.ui' 3 3 ** 4 ** Created: Sun Aug 1 00:02:5820105 ** by: Qt User Interface Compiler version 4. 4.34 ** Created: Tue Aug 3 14:31:25 2010 5 ** by: Qt User Interface Compiler version 4.6.3 6 6 ** 7 ** WARNING! All changes made in this file will be lost when recompiling uifile!7 ** WARNING! All changes made in this file will be lost when recompiling UI file! 8 8 ********************************************************************************/ 9 9 … … 18 18 #include <QtGui/QFrame> 19 19 #include <QtGui/QHBoxLayout> 20 #include <QtGui/QHeaderView> 20 21 #include <QtGui/QLabel> 21 22 #include <QtGui/QLineEdit> … … 59 60 void setupUi(QDialog *NewProjectWindow) 60 61 { 61 if (NewProjectWindow->objectName().isEmpty())62 NewProjectWindow->setObjectName(QString::fromUtf8("NewProjectWindow"));63 NewProjectWindow->resize(666, 391);64 frame_3 = new QFrame(NewProjectWindow);65 frame_3->setObjectName(QString::fromUtf8("frame_3"));66 frame_3->setGeometry(QRect(10, 10, 651, 371));67 frame_3->setFrameShape(QFrame::StyledPanel);68 frame_3->setFrameShadow(QFrame::Raised);69 frame_2 = new QFrame(frame_3);70 frame_2->setObjectName(QString::fromUtf8("frame_2"));71 frame_2->setGeometry(QRect(10, 10, 631, 91));72 frame_2->setFrameShape(QFrame::StyledPanel);73 frame_2->setFrameShadow(QFrame::Raised);74 layoutWidget = new QWidget(frame_2);75 layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));76 layoutWidget->setGeometry(QRect(10, 10, 611, 68));77 horizontalLayout_3 = new QHBoxLayout(layoutWidget);78 horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3"));79 horizontalLayout_3->setContentsMargins(0, 0, 0, 0);80 verticalLayout = new QVBoxLayout();81 verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));82 m_newProjectNameLabel = new QLabel(layoutWidget);83 m_newProjectNameLabel->setObjectName(QString::fromUtf8("m_newProjectNameLabel"));84 85 verticalLayout->addWidget(m_newProjectNameLabel);86 87 m_newProjectPathLabel = new QLabel(layoutWidget);88 m_newProjectPathLabel->setObjectName(QString::fromUtf8("m_newProjectPathLabel"));89 90 verticalLayout->addWidget(m_newProjectPathLabel);91 92 93 horizontalLayout_3->addLayout(verticalLayout);94 95 verticalLayout_2 = new QVBoxLayout();96 verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));97 horizontalLayout_2 = new QHBoxLayout();98 horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));99 m_lineDirName = new QLineEdit(layoutWidget);100 m_lineDirName->setObjectName(QString::fromUtf8("m_lineDirName"));101 102 horizontalLayout_2->addWidget(m_lineDirName);103 104 horizontalSpacer = new QSpacerItem(300, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);105 106 horizontalLayout_2->addItem(horizontalSpacer);107 108 109 verticalLayout_2->addLayout(horizontalLayout_2);110 111 horizontalLayout = new QHBoxLayout();112 horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));113 m_linePath = new QLineEdit(layoutWidget);114 m_linePath->setObjectName(QString::fromUtf8("m_linePath"));115 116 horizontalLayout->addWidget(m_linePath);117 118 m_newProjectPathButton = new QPushButton(layoutWidget);119 m_newProjectPathButton->setObjectName(QString::fromUtf8("m_newProjectPathButton"));120 m_newProjectPathButton->setIconSize(QSize(24, 15));121 122 horizontalLayout->addWidget(m_newProjectPathButton);123 124 125 verticalLayout_2->addLayout(horizontalLayout);126 127 128 horizontalLayout_3->addLayout(verticalLayout_2);129 130 frame = new QFrame(frame_3);131 frame->setObjectName(QString::fromUtf8("frame"));132 frame->setGeometry(QRect(10, 110, 631, 171));133 frame->setFrameShape(QFrame::StyledPanel);134 frame->setFrameShadow(QFrame::Raised);135 layoutWidget1 = new QWidget(frame);136 layoutWidget1->setObjectName(QString::fromUtf8("layoutWidget1"));137 layoutWidget1->setGeometry(QRect(20, 10, 601, 141));138 horizontalLayout_4 = new QHBoxLayout(layoutWidget1);139 horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));140 horizontalLayout_4->setContentsMargins(0, 0, 0, 0);141 m_labelProjetDescription = new QLabel(layoutWidget1);142 m_labelProjetDescription->setObjectName(QString::fromUtf8("m_labelProjetDescription"));143 144 horizontalLayout_4->addWidget(m_labelProjetDescription);145 146 ligneInfos = new QTextEdit(layoutWidget1);147 ligneInfos->setObjectName(QString::fromUtf8("ligneInfos"));148 149 horizontalLayout_4->addWidget(ligneInfos);150 151 layoutWidget2 = new QWidget(frame_3);152 layoutWidget2->setObjectName(QString::fromUtf8("layoutWidget2"));153 layoutWidget2->setGeometry(QRect(10, 330, 631, 29));154 horizontalLayout_6 = new QHBoxLayout(layoutWidget2);155 horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6"));156 horizontalLayout_6->setContentsMargins(0, 0, 0, 0);157 m_newProjectHelpButton = new QPushButton(layoutWidget2);158 m_newProjectHelpButton->setObjectName(QString::fromUtf8("m_newProjectHelpButton"));159 m_newProjectHelpButton->setAutoDefault(false);160 161 horizontalLayout_6->addWidget(m_newProjectHelpButton);162 163 horizontalSpacer_2 = new QSpacerItem(298, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);164 165 horizontalLayout_6->addItem(horizontalSpacer_2);166 167 m_newProjectCreateButton = new QPushButton(layoutWidget2);168 m_newProjectCreateButton->setObjectName(QString::fromUtf8("m_newProjectCreateButton"));169 m_newProjectCreateButton->setAutoDefault(false);170 m_newProjectCreateButton->setDefault(true);171 172 horizontalLayout_6->addWidget(m_newProjectCreateButton);173 174 m_newProjectQuitButton = new QPushButton(layoutWidget2);175 m_newProjectQuitButton->setObjectName(QString::fromUtf8("m_newProjectQuitButton"));176 m_newProjectQuitButton->setAutoDefault(false);177 178 horizontalLayout_6->addWidget(m_newProjectQuitButton);179 180 QWidget::setTabOrder(m_lineDirName, m_linePath);181 QWidget::setTabOrder(m_linePath, m_newProjectPathButton);182 QWidget::setTabOrder(m_newProjectPathButton, m_newProjectCreateButton);183 QWidget::setTabOrder(m_newProjectCreateButton, m_newProjectHelpButton);184 QWidget::setTabOrder(m_newProjectHelpButton, ligneInfos);185 QWidget::setTabOrder(ligneInfos, m_newProjectQuitButton);186 187 retranslateUi(NewProjectWindow);188 189 QMetaObject::connectSlotsByName(NewProjectWindow);62 if (NewProjectWindow->objectName().isEmpty()) 63 NewProjectWindow->setObjectName(QString::fromUtf8("NewProjectWindow")); 64 NewProjectWindow->resize(666, 391); 65 frame_3 = new QFrame(NewProjectWindow); 66 frame_3->setObjectName(QString::fromUtf8("frame_3")); 67 frame_3->setGeometry(QRect(10, 10, 651, 371)); 68 frame_3->setFrameShape(QFrame::StyledPanel); 69 frame_3->setFrameShadow(QFrame::Raised); 70 frame_2 = new QFrame(frame_3); 71 frame_2->setObjectName(QString::fromUtf8("frame_2")); 72 frame_2->setGeometry(QRect(10, 10, 631, 91)); 73 frame_2->setFrameShape(QFrame::StyledPanel); 74 frame_2->setFrameShadow(QFrame::Raised); 75 layoutWidget = new QWidget(frame_2); 76 layoutWidget->setObjectName(QString::fromUtf8("layoutWidget")); 77 layoutWidget->setGeometry(QRect(10, 10, 611, 68)); 78 horizontalLayout_3 = new QHBoxLayout(layoutWidget); 79 horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); 80 horizontalLayout_3->setContentsMargins(0, 0, 0, 0); 81 verticalLayout = new QVBoxLayout(); 82 verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); 83 m_newProjectNameLabel = new QLabel(layoutWidget); 84 m_newProjectNameLabel->setObjectName(QString::fromUtf8("m_newProjectNameLabel")); 85 86 verticalLayout->addWidget(m_newProjectNameLabel); 87 88 m_newProjectPathLabel = new QLabel(layoutWidget); 89 m_newProjectPathLabel->setObjectName(QString::fromUtf8("m_newProjectPathLabel")); 90 91 verticalLayout->addWidget(m_newProjectPathLabel); 92 93 94 horizontalLayout_3->addLayout(verticalLayout); 95 96 verticalLayout_2 = new QVBoxLayout(); 97 verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); 98 horizontalLayout_2 = new QHBoxLayout(); 99 horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); 100 m_lineDirName = new QLineEdit(layoutWidget); 101 m_lineDirName->setObjectName(QString::fromUtf8("m_lineDirName")); 102 103 horizontalLayout_2->addWidget(m_lineDirName); 104 105 horizontalSpacer = new QSpacerItem(300, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 106 107 horizontalLayout_2->addItem(horizontalSpacer); 108 109 110 verticalLayout_2->addLayout(horizontalLayout_2); 111 112 horizontalLayout = new QHBoxLayout(); 113 horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); 114 m_linePath = new QLineEdit(layoutWidget); 115 m_linePath->setObjectName(QString::fromUtf8("m_linePath")); 116 117 horizontalLayout->addWidget(m_linePath); 118 119 m_newProjectPathButton = new QPushButton(layoutWidget); 120 m_newProjectPathButton->setObjectName(QString::fromUtf8("m_newProjectPathButton")); 121 m_newProjectPathButton->setIconSize(QSize(24, 15)); 122 123 horizontalLayout->addWidget(m_newProjectPathButton); 124 125 126 verticalLayout_2->addLayout(horizontalLayout); 127 128 129 horizontalLayout_3->addLayout(verticalLayout_2); 130 131 frame = new QFrame(frame_3); 132 frame->setObjectName(QString::fromUtf8("frame")); 133 frame->setGeometry(QRect(10, 110, 631, 171)); 134 frame->setFrameShape(QFrame::StyledPanel); 135 frame->setFrameShadow(QFrame::Raised); 136 layoutWidget1 = new QWidget(frame); 137 layoutWidget1->setObjectName(QString::fromUtf8("layoutWidget1")); 138 layoutWidget1->setGeometry(QRect(20, 10, 601, 141)); 139 horizontalLayout_4 = new QHBoxLayout(layoutWidget1); 140 horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4")); 141 horizontalLayout_4->setContentsMargins(0, 0, 0, 0); 142 m_labelProjetDescription = new QLabel(layoutWidget1); 143 m_labelProjetDescription->setObjectName(QString::fromUtf8("m_labelProjetDescription")); 144 145 horizontalLayout_4->addWidget(m_labelProjetDescription); 146 147 ligneInfos = new QTextEdit(layoutWidget1); 148 ligneInfos->setObjectName(QString::fromUtf8("ligneInfos")); 149 150 horizontalLayout_4->addWidget(ligneInfos); 151 152 layoutWidget2 = new QWidget(frame_3); 153 layoutWidget2->setObjectName(QString::fromUtf8("layoutWidget2")); 154 layoutWidget2->setGeometry(QRect(10, 330, 631, 29)); 155 horizontalLayout_6 = new QHBoxLayout(layoutWidget2); 156 horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6")); 157 horizontalLayout_6->setContentsMargins(0, 0, 0, 0); 158 m_newProjectHelpButton = new QPushButton(layoutWidget2); 159 m_newProjectHelpButton->setObjectName(QString::fromUtf8("m_newProjectHelpButton")); 160 m_newProjectHelpButton->setAutoDefault(false); 161 162 horizontalLayout_6->addWidget(m_newProjectHelpButton); 163 164 horizontalSpacer_2 = new QSpacerItem(298, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 165 166 horizontalLayout_6->addItem(horizontalSpacer_2); 167 168 m_newProjectCreateButton = new QPushButton(layoutWidget2); 169 m_newProjectCreateButton->setObjectName(QString::fromUtf8("m_newProjectCreateButton")); 170 m_newProjectCreateButton->setAutoDefault(false); 171 m_newProjectCreateButton->setDefault(true); 172 173 horizontalLayout_6->addWidget(m_newProjectCreateButton); 174 175 m_newProjectQuitButton = new QPushButton(layoutWidget2); 176 m_newProjectQuitButton->setObjectName(QString::fromUtf8("m_newProjectQuitButton")); 177 m_newProjectQuitButton->setAutoDefault(false); 178 179 horizontalLayout_6->addWidget(m_newProjectQuitButton); 180 181 QWidget::setTabOrder(m_lineDirName, m_linePath); 182 QWidget::setTabOrder(m_linePath, m_newProjectPathButton); 183 QWidget::setTabOrder(m_newProjectPathButton, m_newProjectCreateButton); 184 QWidget::setTabOrder(m_newProjectCreateButton, m_newProjectHelpButton); 185 QWidget::setTabOrder(m_newProjectHelpButton, ligneInfos); 186 QWidget::setTabOrder(ligneInfos, m_newProjectQuitButton); 187 188 retranslateUi(NewProjectWindow); 189 190 QMetaObject::connectSlotsByName(NewProjectWindow); 190 191 } // setupUi 191 192 192 193 void retranslateUi(QDialog *NewProjectWindow) 193 194 { 194 NewProjectWindow->setWindowTitle(QApplication::translate("NewProjectWindow", "Cr\303\251ation d'un nouveau projet.", 0, QApplication::UnicodeUTF8)); 195 m_newProjectNameLabel->setText(QApplication::translate("NewProjectWindow", "Nom du projet: ", 0, QApplication::UnicodeUTF8)); 196 m_newProjectPathLabel->setText(QApplication::translate("NewProjectWindow", "Chemin d'acc\303\250s: ", 0, QApplication::UnicodeUTF8)); 197 m_newProjectPathButton->setText(QString()); 198 m_labelProjetDescription->setText(QApplication::translate("NewProjectWindow", "Br\303\250ve description du projet", 0, QApplication::UnicodeUTF8)); 199 m_newProjectHelpButton->setText(QApplication::translate("NewProjectWindow", "&Aide", 0, QApplication::UnicodeUTF8)); 200 m_newProjectCreateButton->setText(QApplication::translate("NewProjectWindow", "&Cr\303\251er", 0, QApplication::UnicodeUTF8)); 201 m_newProjectQuitButton->setText(QApplication::translate("NewProjectWindow", "A&nnuler", 0, QApplication::UnicodeUTF8)); 202 Q_UNUSED(NewProjectWindow); 195 NewProjectWindow->setWindowTitle(QApplication::translate("NewProjectWindow", "Cr\303\251ation/Sauvegarde d'un nouveau projet.", 0, QApplication::UnicodeUTF8)); 196 m_newProjectNameLabel->setText(QApplication::translate("NewProjectWindow", "Nom du projet: ", 0, QApplication::UnicodeUTF8)); 197 m_newProjectPathLabel->setText(QApplication::translate("NewProjectWindow", "Chemin d'acc\303\250s: ", 0, QApplication::UnicodeUTF8)); 198 m_newProjectPathButton->setText(QString()); 199 m_labelProjetDescription->setText(QApplication::translate("NewProjectWindow", "Br\303\250ve description du projet", 0, QApplication::UnicodeUTF8)); 200 m_newProjectHelpButton->setText(QApplication::translate("NewProjectWindow", "&Aide", 0, QApplication::UnicodeUTF8)); 201 m_newProjectCreateButton->setText(QApplication::translate("NewProjectWindow", "&Cr\303\251er", 0, QApplication::UnicodeUTF8)); 202 m_newProjectQuitButton->setText(QApplication::translate("NewProjectWindow", "A&nnuler", 0, QApplication::UnicodeUTF8)); 203 203 } // retranslateUi 204 204
Note: See TracChangeset
for help on using the changeset viewer.