- Timestamp:
- 06/18/10 14:02:48 (14 years ago)
- Location:
- trunk/yao/src/interface/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yao/src/interface/src/MainWindow.cpp
r348 r349 34 34 */ 35 35 36 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_ ConstantCopy(NULL), m_hatCopy(NULL), m_ContextCopy(NULL), m_trajCopy(NULL), m_spaceCopy(NULL), m_operaCopy(NULL), m_netwardCopy(NULL), m_modulCopy(NULL), m_ctinCopy(NULL), m_orderCopy(NULL), m_insertFCTCopy(NULL), newProjectWindow(NULL) {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), newProjectWindow(NULL) { 37 37 38 38 setWindowTitle(" Visual YAO "); //Gives a title to the mainwindow. … … 263 263 connect(m_spaceButton, SIGNAL(clicked()), this, SLOT(changeColorSpaceButton())); 264 264 m_operaButton = new QPushButton(tr("Operator"), this); 265 m_operaCopy = new OperaWindow(&theSpaceTable, &theTrajectoryTable, &theConstantTable); //mwc.getOpera(); 266 espace->addWindow(m_operaCopy); 267 m_operaCopy->hide(); 268 connect(m_operaButton, SIGNAL(clicked()), m_operaCopy, SLOT(show())); 265 connect(m_operaButton, SIGNAL(clicked()), this, SLOT(createOperaWindow())); 269 266 connect(m_operaButton, SIGNAL(clicked()), this, SLOT(changeColorOperaButton())); 270 267 271 268 m_netwardButton = new QPushButton(tr("Netward"), this); 272 m_netwardCopy = new NetwardWindow; //mwc.getNetward(); 273 espace->addWindow(m_netwardCopy); 274 m_netwardCopy->hide(); 275 connect(m_netwardButton, SIGNAL(clicked()), m_netwardCopy, SLOT(show())); 269 connect(m_netwardButton, SIGNAL(clicked()), this, SLOT(createNetwardWindow())); 276 270 connect(m_netwardButton, SIGNAL(clicked()), this, SLOT(changeColorNetwardButton())); 277 271 … … 280 274 connect(m_modulButton, SIGNAL(clicked()), this, SLOT(changeColorModulButton())); 281 275 m_ctinButton = new QPushButton(tr("Connection"), this); 282 m_ctin Copy= new ConnectionWindow; //mwc.getCtin();283 espace->addWindow(m_ctin Copy);284 m_ctin Copy->hide();285 connect(m_ctinButton, SIGNAL(clicked()), m_ctin Copy, SLOT(show()));276 m_ctinWindow = new ConnectionWindow; //mwc.getCtin(); 277 espace->addWindow(m_ctinWindow); 278 m_ctinWindow->hide(); 279 connect(m_ctinButton, SIGNAL(clicked()), m_ctinWindow, SLOT(show())); 286 280 connect(m_ctinButton, SIGNAL(clicked()), this, SLOT(changeColorCtinButton())); 287 281 m_orderButton = new QPushButton(tr("Order"), this); 288 m_order Copy= new OrderWindow; //mwc.getOrder();289 espace->addWindow(m_order Copy);290 m_order Copy->hide();291 connect(m_orderButton, SIGNAL(clicked()), m_order Copy, SLOT(show()));282 m_orderWindow = new OrderWindow; //mwc.getOrder(); 283 espace->addWindow(m_orderWindow); 284 m_orderWindow->hide(); 285 connect(m_orderButton, SIGNAL(clicked()), m_orderWindow, SLOT(show())); 292 286 connect(m_orderButton, SIGNAL(clicked()), this, SLOT(changeColorOrderButton())); 293 287 294 288 m_insertFCTButton = new QPushButton(tr("Insert_fct"), this); 295 m_insertFCT Copy= new InsertFCTWindow; //mwc.getInsertFCT();296 espace->addWindow(m_insertFCT Copy);297 m_insertFCT Copy->hide();298 connect(m_insertFCTButton, SIGNAL(clicked()), m_insertFCT Copy, SLOT(show()));289 m_insertFCTWindow = new InsertFCTWindow; //mwc.getInsertFCT(); 290 espace->addWindow(m_insertFCTWindow); 291 m_insertFCTWindow->hide(); 292 connect(m_insertFCTButton, SIGNAL(clicked()), m_insertFCTWindow, SLOT(show())); 299 293 connect(m_insertFCTButton, SIGNAL(clicked()), this, SLOT(changeColorInsertFCTButton())); 300 294 … … 304 298 void MainWindow::createDefvalWindow() { 305 299 306 if (m_ ConstantCopy== NULL) { //to test if the object is already created.307 308 m_ ConstantCopy= new ConstantWindow(&theConstantTable, &theHeaderList, &the_mwc); //Then create the object and initialize it.309 espace->addWindow(m_ ConstantCopy)->move(0, 0); //Put the object in the workspace (here, espace is the QWorkspace's object.)310 m_ ConstantCopy->show();// shows the object.300 if (m_constantWindow == NULL) { //to test if the object is already created. 301 302 m_constantWindow = new ConstantWindow(&theConstantTable, &theHeaderList, &the_mwc); //Then create the object and initialize it. 303 espace->addWindow(m_constantWindow)->move(0, 0); //Put the object in the workspace (here, espace is the QWorkspace's object.) 304 m_constantWindow->show();// shows the object. 311 305 } 312 306 313 connect(m_ ConstantCopy, SIGNAL(rowIsAdded()), this, SLOT(hatUpdate()));314 connect(m_ ConstantCopy, SIGNAL(rowIsDeleted(QString )), this, SLOT(hatUpdate(QString )));315 connect(m_ ConstantCopy, SIGNAL(windowIsClosed(int )), this, SLOT(initializeWindow(int )));// The signal is in the ConstantWindow.hpp file.307 connect(m_constantWindow, SIGNAL(rowIsAdded()), this, SLOT(hatUpdate())); 308 connect(m_constantWindow, SIGNAL(rowIsDeleted(QString )), this, SLOT(hatUpdate(QString ))); 309 connect(m_constantWindow, SIGNAL(windowIsClosed(int )), this, SLOT(initializeWindow(int )));// The signal is in the ConstantWindow.hpp file. 316 310 317 311 } … … 319 313 void MainWindow::createHatNameWindow() { 320 314 321 if (m_hat Copy== NULL) { //to test if the object is already created.322 323 m_hat Copy= new HatNameWindow(&theHeaderList, &theConstantTable); //Then create the object and initialize it.324 espace->addWindow(m_hat Copy)->move(350, 0); //Put the object in the workspace (here, espace is the QWorkspace's object.)325 m_hat Copy->show();// shows the object.315 if (m_hatnameWindow == NULL) { //to test if the object is already created. 316 317 m_hatnameWindow = new HatNameWindow(&theHeaderList, &theConstantTable); //Then create the object and initialize it. 318 espace->addWindow(m_hatnameWindow)->move(350, 0); //Put the object in the workspace (here, espace is the QWorkspace's object.) 319 m_hatnameWindow->show();// shows the object. 326 320 } 327 321 328 connect(m_hat Copy, SIGNAL(hatWindowIsClosed(int)), this, SLOT(initializeWindow(int)));// The signal is in the HatNameWindow.hpp file.322 connect(m_hatnameWindow, SIGNAL(hatWindowIsClosed(int)), this, SLOT(initializeWindow(int)));// The signal is in the HatNameWindow.hpp file. 329 323 } 330 324 /********************************************* Implementation of the method createContextWindow() *************************************************/ 331 325 void MainWindow::createContextWindow() { 332 326 333 if (m_ ContextCopy== NULL) { //to test if the object is already created.334 335 m_ ContextCopy= new ContextWindow(&theContext, &theConstantTable, &the_mwc); //mwc.getContext();336 espace->addWindow(m_ ContextCopy)->move(5, 0);337 m_ ContextCopy->show();327 if (m_contextWindow == NULL) { //to test if the object is already created. 328 329 m_contextWindow = new ContextWindow(&theContext, &theConstantTable, &the_mwc); //mwc.getContext(); 330 espace->addWindow(m_contextWindow)->move(5, 0); 331 m_contextWindow->show(); 338 332 } 339 333 340 connect(m_ ContextCopy, SIGNAL(contextWindowIsClosed(int)), this, SLOT(initializeWindow(int)));334 connect(m_contextWindow, SIGNAL(contextWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 341 335 } 342 336 /********************************************* Implementation of the method createTrajectoryWindow() ************************************************/ 343 337 void MainWindow::createTrajectoryWindow() { 344 338 345 if (m_traj Copy== NULL) { //to test if the object is already created.346 347 m_traj Copy= new TrajectoryWindow(&theTrajectoryTable, &theConstantTable); //mwc.getTraj();348 espace->addWindow(m_traj Copy)->move(30, 10);349 m_traj Copy->show();350 351 //m_traj Copy= NULL;339 if (m_trajectoryWindow == NULL) { //to test if the object is already created. 340 341 m_trajectoryWindow = new TrajectoryWindow(&theTrajectoryTable, &theConstantTable); //mwc.getTraj(); 342 espace->addWindow(m_trajectoryWindow)->move(30, 10); 343 m_trajectoryWindow->show(); 344 345 //m_trajectoryWindow = NULL; 352 346 } 353 347 354 connect(m_traj Copy, SIGNAL(trajectoryWindowIsClosed(int)), this, SLOT(initializeWindow(int)));348 connect(m_trajectoryWindow, SIGNAL(trajectoryWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 355 349 } 356 350 /********************************************* Implementation of the method createSpaceWindow() ************************************************/ 357 351 void MainWindow::createSpaceWindow() { 358 352 359 if (m_space Copy== NULL) { //to test if the object is already created.360 361 m_space Copy= new SpaceWindow(&theSpaceTable, &theTrajectoryTable, &theConstantTable); //mwc.getSpace();362 espace->addWindow(m_space Copy)->move(30, 20);363 m_space Copy->show();353 if (m_spaceWindow == NULL) { //to test if the object is already created. 354 355 m_spaceWindow = new SpaceWindow(&theSpaceTable, &theTrajectoryTable, &theConstantTable); //mwc.getSpace(); 356 espace->addWindow(m_spaceWindow)->move(30, 20); 357 m_spaceWindow->show(); 364 358 } 365 359 366 connect(m_spaceCopy, SIGNAL(spaceWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 360 connect(m_spaceWindow, SIGNAL(spaceWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 361 } 362 363 /********************************************* Implementation of the method createOperaWindow() ************************************************/ 364 void MainWindow::createOperaWindow() { 365 366 if (m_operaWindow == NULL) { //to test if the object is already created. 367 m_operaWindow = new OperaWindow(&theSpaceTable, &theTrajectoryTable, &theConstantTable); //mwc.getOpera(); 368 espace->addWindow(m_operaWindow); 369 m_operaWindow->show(); 370 } 371 372 //connect(m_operaButton, SIGNAL(clicked()), m_operaWindow, SLOT(show())); 373 } 374 375 /********************************************* Implementation of the method createNetwardWindow() ************************************************/ 376 void MainWindow::createNetwardWindow() { 377 378 if (m_netwardWindow == NULL) { //to test if the object is already created. 379 m_netwardWindow = new NetwardWindow; //mwc.getNetward(); 380 espace->addWindow(m_netwardWindow); 381 m_netwardWindow->show(); 382 } 383 //connect(m_netwardButton, SIGNAL(clicked()), m_netwardWindow, SLOT(show())); 384 //connect(m_netwardButton, SIGNAL(clicked()), this, SLOT(changeColorNetwardButton())); 385 367 386 } 368 387 /********************************************* Implementation of the method createModulWindow() ************************************************/ 369 388 void MainWindow::createModulWindow() { 370 389 371 if (m_modul Copy== NULL) { //to test if the object is already created.390 if (m_modulWindow == NULL) { //to test if the object is already created. 372 391 //ModulWindow::ModulWindow(Table <Modul> *aModulTable, Table <Space> *aSpaceTable, Table <Operator> *anOperatorTable, QWidget *parent) 373 //connect(m_modulButton, SIGNAL(clicked()), m_modul Copy, SLOT(show()));392 //connect(m_modulButton, SIGNAL(clicked()), m_modulWindow, SLOT(show())); 374 393 375 m_modul Copy= new ModulWindow(&theModulTable, &theSpaceTable, &theOperaTable, &theConstantTable, &the_mwc); //mwc.getModul();376 espace->addWindow(m_modul Copy);377 espace->addWindow(m_modul Copy)->move(30, 20);378 m_modul Copy->show();394 m_modulWindow = new ModulWindow(&theModulTable, &theSpaceTable, &theOperaTable, &theConstantTable, &the_mwc); //mwc.getModul(); 395 espace->addWindow(m_modulWindow); 396 espace->addWindow(m_modulWindow)->move(30, 20); 397 m_modulWindow->show(); 379 398 } 380 399 381 connect(m_modul Copy, SIGNAL(modulWindowIsClosed(int)), this, SLOT(initializeWindow(int)));400 connect(m_modulWindow, SIGNAL(modulWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 382 401 383 402 } … … 395 414 396 415 case 1: { 397 m_ ConstantCopy= NULL;416 m_constantWindow = NULL; 398 417 break; 399 418 } 400 419 case 2: { 401 m_hat Copy= NULL;420 m_hatnameWindow = NULL; 402 421 break; 403 422 } 404 423 case 3: { 405 m_ ContextCopy= NULL;424 m_contextWindow = NULL; 406 425 break; 407 426 } 408 427 case 4: { 409 m_traj Copy= NULL;428 m_trajectoryWindow = NULL; 410 429 break; 411 430 } 412 431 case 5: { 413 m_space Copy= NULL;432 m_spaceWindow = NULL; 414 433 break; 415 434 } 416 435 case 6: { 417 m_opera Copy= NULL;436 m_operaWindow = NULL; 418 437 } break; 419 438 case 7: { 420 m_netward Copy= NULL;439 m_netwardWindow = NULL; 421 440 break; 422 441 } 423 442 case 8: { 424 m_modul Copy= NULL;443 m_modulWindow = NULL; 425 444 break; 426 445 } 427 446 case 9: { 428 m_ctin Copy= NULL;447 m_ctinWindow = NULL; 429 448 break; 430 449 } 431 450 case 10: { 432 m_order Copy= NULL;451 m_orderWindow = NULL; 433 452 break; 434 453 } 435 454 case 11: { 436 m_insertFCT Copy= NULL;455 m_insertFCTWindow = NULL; 437 456 break; 438 457 } 439 default: m_ ConstantCopy = NULL; m_hatCopy = NULL; m_ContextCopy = NULL; m_trajCopy = NULL; m_spaceCopy = NULL;m_spaceCopy = NULL; m_operaCopy = NULL; m_netwardCopy = NULL; m_modulCopy = NULL; m_ctinCopy = NULL; m_orderCopy = NULL; m_insertFCTCopy= NULL;458 default: m_constantWindow = NULL; m_hatnameWindow = NULL; m_contextWindow = NULL; m_trajectoryWindow = NULL; m_spaceWindow = NULL;m_spaceWindow = NULL; m_operaWindow = NULL; m_netwardWindow = NULL; m_modulWindow = NULL; m_ctinWindow = NULL; m_orderWindow = NULL; m_insertFCTWindow = NULL; 440 459 } 441 460 … … 488 507 //for (Table<Constant>::iterator it = translator.theConstantTable.begin(); it != translator.theConstantTable.end(); it++) 489 508 // cout << "defval " << it->getName() << " " << it->getText() << endl; 490 //cout << &m_ ConstantCopy<< endl;491 //if (m_ ConstantCopy!= NULL)509 //cout << &m_constantWindow << endl; 510 //if (m_constantWindow != NULL) 492 511 // { 493 512 // cout << "--------------------" << endl; 494 513 // cout << "Pointeur non Nul!" << endl; 495 514 // cout << "--------------------" << endl; 496 // m_ ConstantCopy= NULL;515 // m_constantWindow = NULL; 497 516 // cout << "Pointeur initialisé à NULL!" << endl; 498 517 // cout << "--------------------" << endl; 499 518 // } 500 //if (m_ ConstantCopy== NULL)519 //if (m_constantWindow == NULL) 501 520 // cout << "Pointeur Nul!" << endl; 502 521 // cout << "--------------------" << endl; … … 561 580 562 581 theConstantTable; 563 if (m_hat Copy!= NULL) //Teste si l'objet n'est pas déjà crée.582 if (m_hatnameWindow != NULL) //Teste si l'objet n'est pas déjà crée. 564 583 { 565 delete m_hat Copy;566 m_hat Copy= new HatNameWindow(&theHeaderList, &theConstantTable); //Crée un autre objet.567 espace->addWindow(m_hat Copy)->move(350, 0);568 m_hat Copy->show();569 espace->setActiveWindow(m_ ConstantCopy);584 delete m_hatnameWindow; 585 m_hatnameWindow = new HatNameWindow(&theHeaderList, &theConstantTable); //Crée un autre objet. 586 espace->addWindow(m_hatnameWindow)->move(350, 0); 587 m_hatnameWindow->show(); 588 espace->setActiveWindow(m_constantWindow); 570 589 } 571 590 } … … 574 593 void MainWindow::hatUpdate(QString choix) { 575 594 576 if (m_hat Copy!= NULL) //Teste si l'objet n'est pas déjà crée.595 if (m_hatnameWindow != NULL) //Teste si l'objet n'est pas déjà crée. 577 596 { 578 //delete m_hat Copy;579 m_hat Copy= new HatNameWindow(&theHeaderList, &theConstantTable); //Crée un autre objet.580 espace->addWindow(m_hat Copy)->move(350, 0);581 m_hat Copy->show();582 espace->setActiveWindow(m_ ConstantCopy);597 //delete m_hatnameWindow; 598 m_hatnameWindow = new HatNameWindow(&theHeaderList, &theConstantTable); //Crée un autre objet. 599 espace->addWindow(m_hatnameWindow)->move(350, 0); 600 m_hatnameWindow->show(); 601 espace->setActiveWindow(m_constantWindow); 583 602 } 584 603 } … … 758 777 h_file.close(); 759 778 } 760 761 779 762 780 /*************************************** Implementation of the method generateDefaultHFile() ******************************************************/ … … 837 855 //mwc.setFileListController("wwww.h"); 838 856 MainWindowController & mwc2 = MainWindowController::getInstance(); 839 m_hat Copy= mwc2.getHatName();840 espace->addWindow(m_hat Copy);841 842 m_hat Copy->show();857 m_hatnameWindow = mwc2.getHatName(); 858 espace->addWindow(m_hatnameWindow); 859 860 m_hatnameWindow->show(); 843 861 844 862 } … … 1003 1021 //description << "//Contexts ----------------------------------------------------------------------" << endl; 1004 1022 1005 //for(QStringList::iterator it = m_ ContextCopy->getContextData().begin(); it != m_ContextCopy->getContextData().end(); it++)1023 //for(QStringList::iterator it = m_contextWindow->getContextData().begin(); it != m_contextWindow->getContextData().end(); it++) 1006 1024 // description << "option " << it->toStdString() << endl; 1007 1025 // description << endl; … … 1009 1027 description << "//TRAJECTOIRES name type uptime offtime dtime steptime -------------" << endl; 1010 1028 1011 /* for(vector <string>::iterator it = m_ ContextCopy->getContextData().begin(); it != m_ContextCopy->getContextData().end(); it++)1029 /* for(vector <string>::iterator it = m_contextWindow->getContextData().begin(); it != m_contextWindow->getContextData().end(); it++) 1012 1030 description << "option " << it->toStdString() << endl; 1013 1031 description << endl; … … 1025 1043 1026 1044 1027 // for (QStringList::iterator it = m_space Copy->getData().begin(); it != m_spaceCopy->getData().end(); it++)1045 // for (QStringList::iterator it = m_spaceWindow->getData().begin(); it != m_spaceWindow->getData().end(); it++) 1028 1046 // description << "space " << it->toStdString() << endl; 1029 1047 // description << endl; … … 1031 1049 //description << "//NETWARD ---------------------------------------------------------------------------" << endl; 1032 1050 1033 /*for (QStringList::iterator it = m_netward Copy->getDataNetward().begin(); it != m_netwardCopy->getDataNetward().end(); it++)1051 /*for (QStringList::iterator it = m_netwardWindow->getDataNetward().begin(); it != m_netwardWindow->getDataNetward().end(); it++) 1034 1052 description << "netward " << it->toStdString() << endl; 1035 1053 description << endl;*/ 1036 1054 // description << "//MODUL --------------------------------------------------------------------------" << endl; 1037 1055 1038 /* for (QStringList::iterator it = m_modul Copy->getDataModul().begin(); it != m_modulCopy->getDataModul().end(); it++)1056 /* for (QStringList::iterator it = m_modulWindow->getDataModul().begin(); it != m_modulWindow->getDataModul().end(); it++) 1039 1057 description << "modul " << it->toStdString() << endl; 1040 1058 description << endl;*/ 1041 1059 //description << "//CONNECTIONS----------------------------------------------------------------------" << endl; 1042 1060 1043 /* for (QStringList::iterator it = m_ctin Copy->getDataCtin().begin(); it != m_ctinCopy->getDataCtin().end(); it++)1061 /* for (QStringList::iterator it = m_ctinWindow->getDataCtin().begin(); it != m_ctinWindow->getDataCtin().end(); it++) 1044 1062 description << "ctin " << it->toStdString() << endl; */ 1045 1063 // description << "//USER FUNCTIONS ----------------------------------------------------------------" << endl; 1046 1064 //description << endl; 1047 1065 1048 /* for (QStringList::iterator it = m_insertFCT Copy->getDataFCT().begin(); it != m_insertFCTCopy->getDataFCT().end(); it++)1066 /* for (QStringList::iterator it = m_insertFCTWindow->getDataFCT().begin(); it != m_insertFCTWindow->getDataFCT().end(); it++) 1049 1067 description << "insert_fct " << it->toStdString() << endl; 1050 1068 description << endl; -
trunk/yao/src/interface/src/include/MainWindow.hpp
r348 r349 108 108 void createTrajectoryWindow(); 109 109 void createSpaceWindow(); 110 void createOperaWindow(); 111 void createNetwardWindow(); 110 112 void createModulWindow(); 111 113 void initializeWindow(int anInt); … … 207 209 QString curFile; 208 210 QDockWidget *fenetreProjet; 209 ConstantWindow *m_ ConstantCopy;210 HatNameWindow *m_hat Copy;211 ContextWindow *m_ ContextCopy;212 TrajectoryWindow *m_traj Copy;213 SpaceWindow *m_space Copy;214 OperaWindow *m_opera Copy;215 NetwardWindow *m_netward Copy;216 ModulWindow *m_modul Copy;217 ConnectionWindow *m_ctin Copy;218 OrderWindow *m_order Copy;219 InsertFCTWindow *m_insertFCT Copy;211 ConstantWindow *m_constantWindow; 212 HatNameWindow *m_hatnameWindow; 213 ContextWindow *m_contextWindow; 214 TrajectoryWindow *m_trajectoryWindow; 215 SpaceWindow *m_spaceWindow; 216 OperaWindow *m_operaWindow; 217 NetwardWindow *m_netwardWindow; 218 ModulWindow *m_modulWindow; 219 ConnectionWindow *m_ctinWindow; 220 OrderWindow *m_orderWindow; 221 InsertFCTWindow *m_insertFCTWindow; 220 222 221 223 FilesViewer *fv;
Note: See TracChangeset
for help on using the changeset viewer.