Ignore:
Timestamp:
07/31/10 21:19:33 (14 years ago)
Author:
yerima
Message:

Uploading an existing project is possible with defval and hatname's directive. We are going to manage the saving and the saving_as control this week-end.

File:
1 edited

Legend:

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

    r389 r391  
    1717//using namespace antlr; 
    1818using namespace std; 
     19using namespace antlr; 
    1920using namespace yao; 
    2021 
     
    3536*/ 
    3637 
    37 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("")    
     38MainWindow::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)     
    3839{ 
    3940 
     
    7475                 
    7576         
     77} 
     78 
     79/******************************************* Implementation of the method setTitle() *****************************************************************/ 
     80MainWindow::MainWindow(Table <Constant> aConstantTable): theConstantTablePt(aConstantTable) 
     81{ 
     82        theConstantTablePt = aConstantTable; 
     83        //theConstantTable;                      
    7684} 
    7785 
     
    223231 
    224232/********************************* Implementation of the method Implémentation de la methode createToolBar() ****************************************/ 
    225  
    226233void MainWindow::createToolBar() { 
    227234 
     
    245252 
    246253/******************************** Implementation of the method Implémentation de la methode cacherBarreOutils() ***************************************/ 
    247  
    248254void MainWindow::cacherBarreOutils() { 
    249255 
     
    252258 
    253259} 
     260 
    254261/********************************** Implementation of the method Implementation de la methode toolBarActions() ****************************************/ 
    255262void MainWindow::toolBarActions(QWorkspace &espace)  
     
    297304        desactivateToolBarButtons(); // Désactive tous les boutons de la barre d'outils 
    298305} 
     306 
    299307/*********************************************** Implementation of the method createDefvalWindow() *************************************************/ 
    300308void MainWindow::createDefvalWindow()  
     
    314322 
    315323} 
     324 
    316325/******************************************** Implementation of the method createHatNameWindow() ***************************************************/ 
    317326void MainWindow::createHatNameWindow() { 
     
    326335        connect(m_hatnameWindow, SIGNAL(hatWindowIsClosed(int)), this, SLOT(initializeWindow(int)));// The signal is in the HatNameWindow.hpp file. 
    327336} 
     337 
    328338/********************************************* Implementation of the method createContextWindow() *************************************************/ 
    329339void MainWindow::createContextWindow() { 
     
    338348        connect(m_contextWindow, SIGNAL(contextWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
    339349} 
     350 
    340351/********************************************* Implementation of the method createTrajectoryWindow() ************************************************/ 
    341352void MainWindow::createTrajectoryWindow() { 
     
    353364        connect(m_trajectoryWindow, SIGNAL(trajRowIsAdded(bool)), m_operaButton, SLOT(setEnabled(bool))); 
    354365} 
     366 
    355367/********************************************* Implementation of the method createSpaceWindow() ************************************************/ 
    356368void MainWindow::createSpaceWindow() { 
     
    392404 
    393405} 
     406 
    394407/********************************************* Implementation of the method createModulWindow() ************************************************/ 
    395408void MainWindow::createModulWindow() { 
     
    402415 
    403416        connect(m_modulWindow, SIGNAL(modulWindowIsClosed(int)), this, SLOT(initializeWindow(int))); 
    404  
    405417} 
    406418 
     
    418430 
    419431} 
     432 
    420433/********************************************* Implementation of the method createOrderWindow() ************************************************/ 
    421434void MainWindow::createOrderWindow() { 
     
    430443 
    431444} 
     445 
    432446/********************************************* Implementation of the method createInsertFCTWindow() ************************************************/ 
    433447void MainWindow::createInsertFCTWindow() { 
     
    443457 
    444458} 
     459 
    445460/********************************************* Implementation of the method directivesManage() *****************************************************/ 
    446461void MainWindow::directivesManager() { 
     
    464479        m_orderButton->setEnabled(true); 
    465480        m_insertFCTButton->setEnabled(true); 
    466  
    467 } 
     481} 
     482 
    468483/********************************** Implementation of the method desactivateToolBarButtons() *******************************************************/ 
    469484void MainWindow::desactivateToolBarButtons() { 
     
    526541 //     exitStatus = EXIT_SUCCESS; 
    527542      //cout << "End application" << endl; 
    528    
     543        QFileDialog *dialogue = new QFileDialog(this); //Crée une boite de dialogue 
     544 
     545        QString cheminFichier = dialogue->getOpenFileName(this, tr("Ouverture d'un project existant."), QDir::homePath(), tr("*.d *.i *.txt")); //Retourne le chemin du fichier. 
     546  
    529547//      translator.theConstantTable; 
    530548        //m_ConstantCopy = new ConstantWindow(&theConstantTable, &theHeaderList);  
     
    536554   
    537555         // translator.theConstantTable; 
    538          
    539  
    540         QFileDialog *dialogue = new QFileDialog(this); //Crée une boite de dialogue 
    541  
    542         QString cheminFichier = dialogue->getOpenFileName(this, tr("Ouverture d'un project existant."), QDir::homePath(), tr("*.d *.i *.txt")); //Retourne le chemin du fichier. 
     556 
     557        QProcess builder; 
     558 
     559        builder.setProcessChannelMode(QProcess::MergedChannels); 
     560        builder.start("Yao9Generator " + cheminFichier);//, QStringList() 
     561// <<"-e" 
     562// <<"/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf" 
     563 
     564// ); 
     565//char *test2[]; 
     566//QDebug ( QString * string ) 
     567 if (!builder.waitForFinished()) 
     568     qDebug() << "Make failed:" << builder.errorString(); 
     569 else 
     570     //qDebug << "Make output:" << builder.readAll(); 
     571        { 
     572                QString test(builder.readAll()); 
     573                //for (int i = 0; i <= test.size(); i++) 
     574                //      { 
     575                //              if (test.at(i) == ' ') 
     576                                         
     577                //      } 
     578 
     579                istringstream iss(test.toStdString()); 
     580                 
     581                FilePath mot; 
     582                FilePath name; 
     583                while ( getline(iss, mot, '\n' ) ) 
     584                        { 
     585                                 
     586                                if (mot.getExtension() == ".def1") 
     587                                {                        
     588                                        //cout << mot.getTitle() << endl; 
     589                                        name = mot; 
     590                                } 
     591                                if (mot.getExtension() == ".def2" && name.getExtension() == ".def1") 
     592                                { 
     593                                        Constant aConstant(name.getTitle(), mot.getTitle());     
     594                                        theConstantTable.push_back(aConstant); 
     595                                         
     596                                } 
     597                                if (mot.getExtension() == ".h") 
     598                                { 
     599                                        cout << mot << endl; 
     600                                        theHeaderList.push_back(mot);    
     601                                         
     602                                }               //theConstantTable.push_back(mot.getTitle()); 
     603                         
     604                        } 
     605        activateToolBarButtons(); 
     606         
     607                //cout << "Voici le resulat: " << test.toStdString() << endl; 
     608        } 
     609         
     610        //Tokenizer tokenizer("test_00.d");//cheminFichier.toStdString()); 
     611        //Translator translator(tokenizer); 
     612        //translator.descriptionVisualYAO(); 
     613        //translator.theConstantTable; 
     614        //for (Table<Constant>::iterator it = translator.theConstantTable.begin(); it != translator.theConstantTable.end(); it++) 
     615        //      cout << it->getName() << " " << it->getText() << endl; 
     616        //string test << qDebug(); 
     617 
     618        /*QProcess process; 
     619         
     620        process.start( "sudo ", QStringList()  
     621        << "-S"  
     622        << "-p" << "password:\n"  
     623        << "gnome-terminal" ); 
     624*/ 
     625        //string test = "Yao9Generator " + cheminFichier.toStdString();  
     626        //system(test.c_str());// "Yao9Generator projects/test_04/test_04.d");   
     627 
     628         
     629         
     630 
    543631        //QMessageBox::about(this, "test", "Ouverture un projet existant."); 
    544632} 
     633 
    545634/**************************************** Implementation of the method hatUpdate() ****************************************************************/ 
    546635void MainWindow::hatUpdate() { 
     
    580669                return; 
    581670} 
     671 
    582672/******************************************* Implementation of the method contextUpdate(QString choix) ************************************************/ 
    583673void MainWindow::contextUpdate() { 
     
    598688                return; 
    599689} 
     690 
    600691/***************************************** Implementation of the method montrerActionGenererD() ****************************************************/ 
    601  
    602692void MainWindow::montrerActionGenererD() { 
    603693 
     
    610700        actionCompilation->setEnabled(true); 
    611701} 
     702  
    612703/************************************************* Implementation of the method setProjectName(string chaine) **************************************/ 
    613704void MainWindow::setProjectName(string chaine) { 
     
    623714 
    624715/************************************* Implementation of the method setProjectPath(string aPath) ******************************************/ 
    625   
    626716void MainWindow::setProjectPath(string aPath) { 
    627717  
Note: See TracChangeset for help on using the changeset viewer.