Ignore:
Timestamp:
06/18/10 14:02:48 (14 years ago)
Author:
yerima
Message:

The syntax of directives names is m_directiveWindow in visual Yao. Opera and netward window have their method to create window.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yao/src/interface/src/MainWindow.cpp

    r348 r349  
    3434*/ 
    3535 
    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)  { 
     36MainWindow::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)  { 
    3737 
    3838        setWindowTitle(" Visual YAO ");         //Gives a title to the mainwindow. 
     
    263263        connect(m_spaceButton, SIGNAL(clicked()), this, SLOT(changeColorSpaceButton())); 
    264264     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())); 
    269266        connect(m_operaButton, SIGNAL(clicked()), this, SLOT(changeColorOperaButton())); 
    270267 
    271268     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())); 
    276270        connect(m_netwardButton, SIGNAL(clicked()), this, SLOT(changeColorNetwardButton())); 
    277271 
     
    280274       connect(m_modulButton, SIGNAL(clicked()), this, SLOT(changeColorModulButton())); 
    281275     m_ctinButton      = new QPushButton(tr("Connection"), this); 
    282         m_ctinCopy = new ConnectionWindow; //mwc.getCtin(); 
    283         espace->addWindow(m_ctinCopy); 
    284         m_ctinCopy->hide(); 
    285         connect(m_ctinButton, SIGNAL(clicked()), m_ctinCopy, 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())); 
    286280        connect(m_ctinButton, SIGNAL(clicked()), this, SLOT(changeColorCtinButton())); 
    287281     m_orderButton     = new QPushButton(tr("Order"), this); 
    288         m_orderCopy = new OrderWindow; //mwc.getOrder(); 
    289         espace->addWindow(m_orderCopy); 
    290         m_orderCopy->hide(); 
    291         connect(m_orderButton, SIGNAL(clicked()), m_orderCopy, 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())); 
    292286        connect(m_orderButton, SIGNAL(clicked()), this, SLOT(changeColorOrderButton())); 
    293287 
    294288     m_insertFCTButton = new QPushButton(tr("Insert_fct"), this); 
    295        m_insertFCTCopy = new InsertFCTWindow; //mwc.getInsertFCT(); 
    296         espace->addWindow(m_insertFCTCopy); 
    297         m_insertFCTCopy->hide(); 
    298         connect(m_insertFCTButton, SIGNAL(clicked()), m_insertFCTCopy, 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())); 
    299293        connect(m_insertFCTButton, SIGNAL(clicked()), this, SLOT(changeColorInsertFCTButton())); 
    300294 
     
    304298void MainWindow::createDefvalWindow() { 
    305299 
    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.  
    311305        } 
    312306 
    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. 
    316310 
    317311} 
     
    319313void MainWindow::createHatNameWindow() { 
    320314 
    321         if (m_hatCopy == NULL) { //to test if the object is already created. 
    322  
    323         m_hatCopy = new HatNameWindow(&theHeaderList, &theConstantTable); //Then create the object and initialize it. 
    324         espace->addWindow(m_hatCopy)->move(350, 0); //Put the object in the workspace (here, espace is the QWorkspace's object.) 
    325         m_hatCopy->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.  
    326320        } 
    327321 
    328         connect(m_hatCopy, 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. 
    329323} 
    330324/********************************************* Implementation of the method createContextWindow() *************************************************/ 
    331325void MainWindow::createContextWindow() { 
    332326 
    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(); 
    338332        } 
    339333 
    340         connect(m_ContextCopy, SIGNAL(contextWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
     334        connect(m_contextWindow, SIGNAL(contextWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
    341335} 
    342336/********************************************* Implementation of the method createTrajectoryWindow() ************************************************/ 
    343337void MainWindow::createTrajectoryWindow() { 
    344338 
    345         if (m_trajCopy == NULL) { //to test if the object is already created. 
    346  
    347         m_trajCopy = new TrajectoryWindow(&theTrajectoryTable, &theConstantTable); //mwc.getTraj(); 
    348         espace->addWindow(m_trajCopy)->move(30, 10); 
    349         m_trajCopy->show();  
    350  
    351         //m_trajCopy = 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; 
    352346        } 
    353347 
    354         connect(m_trajCopy, SIGNAL(trajectoryWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
     348        connect(m_trajectoryWindow, SIGNAL(trajectoryWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
    355349} 
    356350/********************************************* Implementation of the method createSpaceWindow() ************************************************/ 
    357351void MainWindow::createSpaceWindow() { 
    358352 
    359         if (m_spaceCopy == NULL) { //to test if the object is already created. 
    360          
    361         m_spaceCopy = new SpaceWindow(&theSpaceTable, &theTrajectoryTable, &theConstantTable); //mwc.getSpace(); 
    362         espace->addWindow(m_spaceCopy)->move(30, 20); 
    363         m_spaceCopy->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();  
    364358        } 
    365359 
    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() ************************************************/ 
     364void 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() ************************************************/ 
     376void 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 
    367386} 
    368387/********************************************* Implementation of the method createModulWindow() ************************************************/ 
    369388void MainWindow::createModulWindow() { 
    370389 
    371         if (m_modulCopy == NULL) { //to test if the object is already created. 
     390        if (m_modulWindow == NULL) { //to test if the object is already created. 
    372391        //ModulWindow::ModulWindow(Table <Modul> *aModulTable, Table <Space> *aSpaceTable, Table <Operator> *anOperatorTable, QWidget *parent) 
    373         //connect(m_modulButton, SIGNAL(clicked()), m_modulCopy, SLOT(show())); 
     392        //connect(m_modulButton, SIGNAL(clicked()), m_modulWindow, SLOT(show())); 
    374393   
    375         m_modulCopy = new ModulWindow(&theModulTable, &theSpaceTable, &theOperaTable, &theConstantTable, &the_mwc); //mwc.getModul(); 
    376         espace->addWindow(m_modulCopy); 
    377         espace->addWindow(m_modulCopy)->move(30, 20); 
    378         m_modulCopy->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();  
    379398        } 
    380399 
    381         connect(m_modulCopy, SIGNAL(modulWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
     400        connect(m_modulWindow, SIGNAL(modulWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
    382401 
    383402} 
     
    395414         
    396415                case 1: {  
    397                                 m_ConstantCopy = NULL;  
     416                                m_constantWindow = NULL;  
    398417                                break; 
    399418                        } 
    400419                case 2: {  
    401                                 m_hatCopy = NULL;  
     420                                m_hatnameWindow = NULL;  
    402421                                break; 
    403422                        } 
    404423                case 3: {  
    405                                 m_ContextCopy  = NULL;  
     424                                m_contextWindow  = NULL;  
    406425                                break; 
    407426                        } 
    408427                case 4: {  
    409                                 m_trajCopy = NULL;  
     428                                m_trajectoryWindow = NULL;  
    410429                                break; 
    411430                        } 
    412431                case 5: {  
    413                                 m_spaceCopy = NULL;  
     432                                m_spaceWindow = NULL;  
    414433                                break; 
    415434                        } 
    416435                case 6: {  
    417                                 m_operaCopy = NULL;  
     436                                m_operaWindow = NULL;  
    418437                        }       break; 
    419438                case 7: {                
    420                                 m_netwardCopy = NULL;  
     439                                m_netwardWindow = NULL;  
    421440                                break; 
    422441                        } 
    423442                case 8: {  
    424                                 m_modulCopy = NULL;  
     443                                m_modulWindow = NULL;  
    425444                                break; 
    426445                        } 
    427446                case 9: {  
    428                                 m_ctinCopy = NULL;  
     447                                m_ctinWindow = NULL;  
    429448                                break; 
    430449                        } 
    431450                case 10: {  
    432                                 m_orderCopy = NULL;  
     451                                m_orderWindow = NULL;  
    433452                                break; 
    434453                        } 
    435454                case 11: {  
    436                                 m_insertFCTCopy = NULL;  
     455                                m_insertFCTWindow = NULL;  
    437456                                break; 
    438457                        } 
    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;  
    440459        } 
    441460         
     
    488507//for (Table<Constant>::iterator it = translator.theConstantTable.begin(); it != translator.theConstantTable.end(); it++) 
    489508//                       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) 
    492511          //      { 
    493512        //      cout << "--------------------" << endl; 
    494513        //      cout << "Pointeur non Nul!" << endl; 
    495514        //      cout << "--------------------" << endl; 
    496         //      m_ConstantCopy = NULL; 
     515        //      m_constantWindow = NULL; 
    497516        //      cout << "Pointeur initialisé à NULL!" << endl; 
    498517        //      cout << "--------------------" << endl; 
    499518        //      } 
    500         //if (m_ConstantCopy == NULL) 
     519        //if (m_constantWindow == NULL) 
    501520        //      cout << "Pointeur Nul!" << endl; 
    502521        //      cout << "--------------------" << endl; 
     
    561580         
    562581        theConstantTable; 
    563         if (m_hatCopy != 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. 
    564583                {  
    565                         delete m_hatCopy; 
    566                         m_hatCopy = new HatNameWindow(&theHeaderList, &theConstantTable); //Crée un autre objet. 
    567                         espace->addWindow(m_hatCopy)->move(350, 0); 
    568                         m_hatCopy->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); 
    570589                } 
    571590} 
     
    574593void MainWindow::hatUpdate(QString choix) { 
    575594 
    576         if (m_hatCopy != 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. 
    577596                {  
    578                         //delete m_hatCopy; 
    579                         m_hatCopy = new HatNameWindow(&theHeaderList, &theConstantTable); //Crée un autre objet. 
    580                         espace->addWindow(m_hatCopy)->move(350, 0); 
    581                         m_hatCopy->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); 
    583602                } 
    584603} 
     
    758777     h_file.close(); 
    759778   } 
    760  
    761779 
    762780/*************************************** Implementation of the method generateDefaultHFile() ******************************************************/ 
     
    837855        //mwc.setFileListController("wwww.h"); 
    838856        MainWindowController & mwc2 = MainWindowController::getInstance();  
    839         m_hatCopy = mwc2.getHatName(); 
    840         espace->addWindow(m_hatCopy); 
    841  
    842         m_hatCopy->show(); 
     857        m_hatnameWindow = mwc2.getHatName(); 
     858        espace->addWindow(m_hatnameWindow); 
     859 
     860        m_hatnameWindow->show(); 
    843861 
    844862} 
     
    10031021        //description << "//Contexts  ----------------------------------------------------------------------" << endl; 
    10041022         
    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++) 
    10061024          //     description << "option " << it->toStdString() << endl; 
    10071025            //       description << endl; 
     
    10091027               description << "//TRAJECTOIRES name type uptime offtime dtime steptime -------------" << endl; 
    10101028 
    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++) 
    10121030               description << "option " << it->toStdString() << endl; 
    10131031                   description << endl; 
     
    10251043 
    10261044 
    1027       // for (QStringList::iterator it = m_spaceCopy->getData().begin(); it != m_spaceCopy->getData().end(); it++) 
     1045      // for (QStringList::iterator it = m_spaceWindow->getData().begin(); it != m_spaceWindow->getData().end(); it++) 
    10281046        //    description << "space " << it->toStdString() << endl; 
    10291047          //  description << endl; 
     
    10311049        //description << "//NETWARD ---------------------------------------------------------------------------" << endl; 
    10321050 
    1033        /*for (QStringList::iterator it = m_netwardCopy->getDataNetward().begin(); it != m_netwardCopy->getDataNetward().end(); it++) 
     1051       /*for (QStringList::iterator it = m_netwardWindow->getDataNetward().begin(); it != m_netwardWindow->getDataNetward().end(); it++) 
    10341052            description << "netward " << it->toStdString() << endl; 
    10351053            description << endl;*/ 
    10361054           // description << "//MODUL --------------------------------------------------------------------------" << endl; 
    10371055    
    1038      /*  for (QStringList::iterator it = m_modulCopy->getDataModul().begin(); it != m_modulCopy->getDataModul().end(); it++) 
     1056     /*  for (QStringList::iterator it = m_modulWindow->getDataModul().begin(); it != m_modulWindow->getDataModul().end(); it++) 
    10391057           description << "modul " << it->toStdString() << endl; 
    10401058           description << endl;*/ 
    10411059           //description << "//CONNECTIONS----------------------------------------------------------------------" << endl; 
    10421060 
    1043       /* for (QStringList::iterator it = m_ctinCopy->getDataCtin().begin(); it != m_ctinCopy->getDataCtin().end(); it++) 
     1061      /* for (QStringList::iterator it = m_ctinWindow->getDataCtin().begin(); it != m_ctinWindow->getDataCtin().end(); it++) 
    10441062           description << "ctin " << it->toStdString() << endl; */ 
    10451063          // description << "//USER FUNCTIONS   ----------------------------------------------------------------" << endl; 
    10461064            //description << endl; 
    10471065 
    1048    /*    for (QStringList::iterator it = m_insertFCTCopy->getDataFCT().begin(); it != m_insertFCTCopy->getDataFCT().end(); it++) 
     1066   /*    for (QStringList::iterator it = m_insertFCTWindow->getDataFCT().begin(); it != m_insertFCTWindow->getDataFCT().end(); it++) 
    10491067           description << "insert_fct " << it->toStdString() << endl; 
    10501068            description << endl; 
Note: See TracChangeset for help on using the changeset viewer.