Changeset 387


Ignore:
Timestamp:
07/20/10 16:55:49 (14 years ago)
Author:
yerima
Message:

ConstantName? is ok in trajectory uptime, offtime, dtime and steptime's combobox. Visual Yao.

Location:
trunk/yao/src/interface
Files:
6 edited

Legend:

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

    r363 r387  
    4343                MainWindow fen1;//  = new MainWindow(&m_mwc); //fen1->show(); 
    4444                fen1.show(); 
    45  
     45                 
    4646                return app.exec(); 
    4747 
  • trunk/yao/src/interface/src/MainWindow.cpp

    r386 r387  
    1515#include<iostream> 
    1616 
     17//using namespace antlr; 
    1718using namespace std; 
    1819using namespace yao; 
     
    500501/**************************************** Implementation of the method nouveauProjet (SLOT) *******************************************************/ 
    501502void MainWindow::openProject()  { // Affiche la fenetre nouveau projet lorsqu'elle est appelée. 
     503 
     504 
     505        //FilePath filename="test_00.d"; 
     506   
     507    //try{ 
     508      // Check argument count. 
     509      //if(argc <= 1) 
     510        //throw runtime_error("No file specified"); 
     511   
     512      // Check if help menu is required. 
     513     // if(strcmp(argv[1], "-h") == 0){ 
     514       // Display::displayHelp(); 
     515       // exit(EXIT_SUCCESS); 
     516     // } 
     517   
     518      //filename = argv[1]; 
     519      //if(filename.getExtension().empty()) 
     520       // filename += ".d"; 
     521   
     522      // Initilization of the lexer and lexing (wrapped from the object tokenizer) 
     523      //Tokenizer tokenizer(filename); 
     524      // Initialization of the parser and parsing (wrapped from the object tokenizer) 
     525    //  Translator translator(tokenizer); 
     526      // Code generation of the files Y1ProjectName.h and Y2ProjectName.h 
     527      //translator.generateCode(); 
     528  //    translator.descriptionVisualYAO(); 
     529 //     exitStatus = EXIT_SUCCESS; 
     530      //cout << "End application" << endl; 
     531   
     532//      translator.theConstantTable; 
     533        //m_ConstantCopy = new ConstantWindow(&theConstantTable, &theHeaderList);  
     534 //for (Table<Constant>::iterator it = translator.theConstantTable.begin(); it != translator.theConstantTable.end(); it++) 
     535   //                     cout << it->getName() << " " << it->getText() << endl;         
     536 
     537          //QMessageBox msgBox; 
     538          //msgBox.setWindowTitle("Aide sur la création d'un nouveau projet."); 
     539   
     540         // translator.theConstantTable; 
     541         
    502542 
    503543        QFileDialog *dialogue = new QFileDialog(this); //Crée une boite de dialogue 
  • trunk/yao/src/interface/src/TrajectoryWindow.cpp

    r380 r387  
    1919        localTrajectoryTable            = aTrajectoryTable; 
    2020        localConstantTable              = aConstantTable; 
     21 
     22        QRegExp regExp("[A-Za-z_][A-Za-z0-9_]*"); 
     23        m_trajNameLine->setValidator(new QRegExpValidator(regExp, this));        
    2124 
    2225        if(isTrajectoryTableEmpty()) m_trajDelButton->setDisabled(true); 
     
    9093void TrajectoryWindow::addTrajRow() { 
    9194 
    92         //The following attributs are string. 
    93         QString trajName = m_trajNameLine->text(); 
    94         QString upTime = m_comboNbuptimeTraj->currentText(); // A convertir en entier avant l'insertion. 
     95        try { 
     96                //The following attributs are string. 
     97                QString trajName = m_trajNameLine->text(); 
     98                QString typeTraj = m_ligneTypeTraj->text();//Toujours le même. D'où son initialisation de départ. 
     99                string upTime = m_comboNbuptimeTraj->currentText().toStdString(); // A convertir en entier avant l'insertion. 
     100                string offTime = m_comboOfftimeTraj->currentText().toStdString(); // A convertir en double avant l'insertion. 
    95101                //upTime = QString(localConstantTable->find(upTime.toStdString())->getText().c_str()); 
    96         QString stepTime = m_comboSteptimeTraj->currentText(); // A convertir en entier avant l'insertion. 
    97         QString dTime = m_comboDtimeTraj->currentText(); // A convertir en double avant l'insertion. 
    98         QString offTime = m_comboOfftimeTraj->currentText(); // A convertir en double avant l'insertion. 
    99         QString typeTraj = m_ligneTypeTraj->text();//Toujours le même. D'où son initialisation de départ. 
    100  
    101         int  boot = toInt(upTime.toStdString()); 
    102         int  size = toInt(stepTime.toStdString()); 
    103         double step = toDouble(dTime.toStdString());  
    104         double offset = toDouble(offTime.toStdString());  
     102                string dTime = m_comboDtimeTraj->currentText().toStdString(); // A convertir en double avant l'insertion. 
     103                string stepTime = m_comboSteptimeTraj->currentText().toStdString(); // A convertir en entier avant l'insertion. 
     104 
     105                int  boot = toInt(upTime); 
     106                double offset = toDouble(offTime);  
     107                double step = toDouble(dTime);  
     108                int  size = toInt(stepTime); 
     109 
     110                int row = m_trajModel->rowCount(); //To get all time the last line number. 
     111                if(trajName.isEmpty()) 
     112                        { 
     113                                QMessageBox::about(this, tr("Erreur de saisie!"), tr("Veuillez renseigner le champ \"Nom trajectoire\".")); 
     114                                return; 
     115                        } 
     116                if(upTime.empty()) 
     117                        { 
     118                                QMessageBox::about(this, tr("Erreur de saisie!"), tr("Veuillez renseigner le champ \"Initialisation\".")); 
     119                                return; 
     120                        } 
     121                if(offTime.empty()) 
     122                        { 
     123                                QMessageBox::about(this, tr("Erreur de saisie!"), tr("Veuillez renseigner le champ \"Décalage\".")); 
     124                                return; 
     125                        } 
     126                if(dTime.empty()) 
     127                        { 
     128                                QMessageBox::about(this, tr("Erreur de saisie!"), tr("Veuillez renseigner le champ \"Position\".")); 
     129                                return; 
     130                        } 
     131         
     132                if(stepTime.empty()) 
     133                        { 
     134                                QMessageBox::about(this, tr("Erreur de saisie!"), tr("Veuillez renseigner le champ \"Pas de temps\".")); 
     135                                return; 
     136                        } 
     137         
     138         
    105139                 
     140                Constant *constantForUptime; //Nous créons d'abord un pointeur de constante. 
     141                Constant *constantForOfftime; //Nous créons d'abord un pointeur de constante. 
     142                Constant *constantForDtime; //Nous créons d'abord un pointeur de constante. 
     143                Constant *constantForSteptime; //Nous créons d'abord un pointeur de constante. 
     144                 
     145                constantForUptime = localConstantTable->find(upTime); 
     146                constantForOfftime = localConstantTable->find(offTime); 
     147                constantForDtime = localConstantTable->find(dTime); 
     148                constantForSteptime = localConstantTable->find(stepTime); 
     149 
     150                //Uptime control         
     151                if (constantForUptime != 0)  
     152                        upTime = localConstantTable->find(upTime)->getText(); 
     153                else { 
     154                        for(unsigned int i=0; i < upTime.size(); i++) { 
     155                                if(!(upTime[i] >= '0' && upTime[i] <= '9')) { 
     156 
     157                                        QMessageBox::about(this, tr("Erreur de saisie!"), tr("Saisir un entier ou faire un choix dans la liste deroulante du champ \"Initialisation\".")); 
     158                                        return; 
     159                                } 
     160 
     161                        } 
     162 
     163                        upTime = m_comboNbuptimeTraj->currentText().toStdString(); 
     164                } 
     165                //Offtime control. 
     166                if (constantForOfftime != NULL)  
     167                        offTime = localConstantTable->find(offTime)->getText(); 
     168                else { 
     169                        for(unsigned int i=0; i < offTime.size(); i++) { 
     170                                if(!(offTime[i] >= '0' && offTime[i] <= '9')) { 
     171 
     172                                        QMessageBox::about(this, tr("Erreur de saisie!"), tr("Saisir un entier ou faire un choix dans la liste deroulante du champ \"Decalage\".")); 
     173                                        return; 
     174                                } 
     175 
     176                        } 
     177 
     178                        offTime = m_comboOfftimeTraj->currentText().toStdString(); 
     179                } 
     180                //Dtime control. 
     181                if (constantForDtime != NULL)  
     182                        dTime = localConstantTable->find(dTime)->getText(); 
     183                else { 
     184                        for(unsigned int i=0; i < dTime.size(); i++) { 
     185                                if(!(dTime[i] >= '0' && dTime[i] <= '9')) { 
     186 
     187                                        QMessageBox::about(this, tr("Erreur de saisie!"), tr("Saisir un entier ou faire un choix dans la liste deroulante du champ \"Position\".")); 
     188                                        return; 
     189                                } 
     190 
     191                        } 
     192 
     193                        dTime = m_comboDtimeTraj->currentText().toStdString(); 
     194                } 
     195                //Steptime control. 
     196                if (constantForSteptime != NULL)  
     197                        stepTime = localConstantTable->find(stepTime)->getText(); 
     198                else { 
     199                        for(unsigned int i=0; i < stepTime.size(); i++) { 
     200                                if(!(stepTime[i] >= '0' && stepTime[i] <= '9')) { 
     201 
     202                                        QMessageBox::about(this, tr("Erreur de saisie!"), tr("Saisir un entier ou faire un choix dans la liste deroulante du champ \"Pas de temps\".")); 
     203                                        return; 
     204                                } 
     205 
     206                        } 
     207 
     208                        stepTime = m_comboSteptimeTraj->currentText().toStdString(); 
     209                } 
     210 
     211                if (upTime >= stepTime) { 
     212                        QMessageBox::about(this, tr("Erreur de saisie!"), tr("Le pas de temps(steptime) doit-etre superieur a l'initialisation(uptime).")); 
     213                        return; 
     214         
     215                }                
     216 
     217                m_trajModel->setItem(row, 0, new QStandardItem(trajName));  
     218                m_trajModel->setItem(row, 1, new QStandardItem(typeTraj));  
     219                m_trajModel->setItem(row, 2, new QStandardItem(QString(upTime.c_str()))); 
     220                m_trajModel->setItem(row, 3, new QStandardItem(QString(offTime.c_str()))); 
     221                m_trajModel->setItem(row, 4, new QStandardItem(QString(dTime.c_str()))); 
     222                m_trajModel->setItem(row, 5, new QStandardItem(QString(stepTime.c_str()))); 
     223 
     224 
     225        } 
     226 
     227        catch(...) { 
     228 
     229                QMessageBox::critical(this, "Erreur", "Erreur dans la méthode addTrajRow()"); 
     230                                        return; 
     231                                 
     232 
     233        } 
     234/*               
    106235        Constant *c; //Nous créons d'abord un pointeur de constante. 
    107236  
     
    323452                                 
    324453                                        QMessageBox::critical(this, "Erreur", "theBoot doit être supérieur à theSize"); 
     454                                        return; 
    325455                                 
    326456                                } 
     
    330460                                } 
    331461                        } 
    332  
     462*/ 
    333463        if(!isTrajectoryTableEmpty()) m_trajDelButton->setEnabled(true); 
    334464        initialiserChamps(); 
     
    374504        m_comboNbuptimeTraj->setCurrentIndex(0); 
    375505        m_comboOfftimeTraj->setEditText("0"); 
     506        m_comboDtimeTraj->setEditText("1"); 
    376507        m_comboSteptimeTraj->setCurrentIndex(0); 
    377508 
  • trunk/yao/src/interface/src/include/MainWindow.hpp

    r386 r387  
    66#include <cstdlib> 
    77 
    8 //#include "../Translator.hpp" 
    9 /* 
    108#include <iostream> 
    119#include "../../../help/FilePath.hpp" 
    12 #include "../../../Translator.hpp" 
     10//#include "../../../Translator.hpp" 
     11//#include "../../../analyzers/BaseLexer.hpp" 
    1312#include "../../../help/Display.hpp" 
    14 //#include "interface/src/include/ConstantWindow.hpp" 
    15 //#include "interface/src/include/HatNameWindow.hpp" 
    16 //#include <QMessageBox> 
    17 #include <antlr/TokenStreamRecognitionException.hpp> 
    18  */ 
     13//#include <antlr/TokenStreamRecognitionException.hpp> 
     14 
    1915  
    2016//#include "MainWindowController.hpp" 
    2117#include "../help/Enforcer.hpp" 
    22 #include "../help/FilePath.hpp" 
     18//#include "../help/FilePath.hpp" 
    2319#include "../YAOObjects/Modul.hpp" 
    2420 
     
    4642#include "ConnectionWindow.hpp" 
    4743#include "NewProjectWindow.hpp" 
    48 /* 
    49 using namespace antlr; 
    50 using namespace std; 
    51 using namespace yao; 
    52 */ 
    5344 
    5445/*! 
  • trunk/yao/src/interface/src/ui_/trajectorywindow.ui

    r384 r387  
    2929    <enum>QFrame::Raised</enum> 
    3030   </property> 
    31    <widget class="QWidget" name="layoutWidget"> 
     31   <widget class="QWidget" name=""> 
    3232    <property name="geometry"> 
    3333     <rect> 
    3434      <x>10</x> 
    3535      <y>10</y> 
    36       <width>321</width> 
     36      <width>331</width> 
    3737      <height>198</height> 
    3838     </rect> 
     
    4242      <layout class="QVBoxLayout" name="verticalLayout_3"> 
    4343       <item> 
    44         <widget class="QLabel" name="m_nameLabel"> 
    45          <property name="text"> 
    46           <string>Nom trajectoire</string> 
    47          </property> 
    48         </widget> 
    49        </item> 
    50        <item> 
    51         <widget class="QLabel" name="m_typeLabel"> 
    52          <property name="text"> 
    53           <string>Type</string> 
    54          </property> 
    55         </widget> 
    56        </item> 
    57        <item> 
    58         <widget class="QLabel" name="m_labelTrajNbuptime"> 
    59          <property name="text"> 
    60           <string>Initialisation (uptime &gt;=0.0)</string> 
    61          </property> 
    62         </widget> 
    63        </item> 
    64        <item> 
    65         <widget class="QLabel" name="m_labelTrajOfftime"> 
    66          <property name="text"> 
    67           <string>Décalage (offtime &gt;=0.0)</string> 
    68          </property> 
    69         </widget> 
    70        </item> 
    71        <item> 
    72         <widget class="QLabel" name="m_labelTrajNDtime"> 
    73          <property name="text"> 
    74           <string>Position (dtime)</string> 
    75          </property> 
    76         </widget> 
    77        </item> 
    78        <item> 
    79         <widget class="QLabel" name="m_labelTrajNbsteptime"> 
    80          <property name="text"> 
    81           <string>Pas de temps (steptime &gt; uptime)</string> 
    82          </property> 
    83         </widget> 
     44        <layout class="QHBoxLayout" name="horizontalLayout_3"> 
     45         <item> 
     46          <widget class="QLabel" name="m_nameLabel"> 
     47           <property name="text"> 
     48            <string>Nom trajectoire</string> 
     49           </property> 
     50          </widget> 
     51         </item> 
     52         <item> 
     53          <spacer name="horizontalSpacer_2"> 
     54           <property name="orientation"> 
     55            <enum>Qt::Horizontal</enum> 
     56           </property> 
     57           <property name="sizeHint" stdset="0"> 
     58            <size> 
     59             <width>40</width> 
     60             <height>20</height> 
     61            </size> 
     62           </property> 
     63          </spacer> 
     64         </item> 
     65        </layout> 
     66       </item> 
     67       <item> 
     68        <layout class="QHBoxLayout" name="horizontalLayout_4"> 
     69         <item> 
     70          <widget class="QLabel" name="m_typeLabel"> 
     71           <property name="text"> 
     72            <string>Type</string> 
     73           </property> 
     74          </widget> 
     75         </item> 
     76         <item> 
     77          <spacer name="horizontalSpacer_3"> 
     78           <property name="orientation"> 
     79            <enum>Qt::Horizontal</enum> 
     80           </property> 
     81           <property name="sizeHint" stdset="0"> 
     82            <size> 
     83             <width>40</width> 
     84             <height>20</height> 
     85            </size> 
     86           </property> 
     87          </spacer> 
     88         </item> 
     89        </layout> 
     90       </item> 
     91       <item> 
     92        <layout class="QHBoxLayout" name="horizontalLayout_5"> 
     93         <item> 
     94          <widget class="QLabel" name="m_labelTrajNbuptime"> 
     95           <property name="text"> 
     96            <string>Initialisation (uptime &gt;=0.0)</string> 
     97           </property> 
     98          </widget> 
     99         </item> 
     100         <item> 
     101          <spacer name="horizontalSpacer_4"> 
     102           <property name="orientation"> 
     103            <enum>Qt::Horizontal</enum> 
     104           </property> 
     105           <property name="sizeHint" stdset="0"> 
     106            <size> 
     107             <width>40</width> 
     108             <height>20</height> 
     109            </size> 
     110           </property> 
     111          </spacer> 
     112         </item> 
     113        </layout> 
     114       </item> 
     115       <item> 
     116        <layout class="QHBoxLayout" name="horizontalLayout_6"> 
     117         <item> 
     118          <widget class="QLabel" name="m_labelTrajOfftime"> 
     119           <property name="text"> 
     120            <string>Décalage (offtime &gt;=0.0)</string> 
     121           </property> 
     122          </widget> 
     123         </item> 
     124         <item> 
     125          <spacer name="horizontalSpacer_5"> 
     126           <property name="orientation"> 
     127            <enum>Qt::Horizontal</enum> 
     128           </property> 
     129           <property name="sizeHint" stdset="0"> 
     130            <size> 
     131             <width>40</width> 
     132             <height>20</height> 
     133            </size> 
     134           </property> 
     135          </spacer> 
     136         </item> 
     137        </layout> 
     138       </item> 
     139       <item> 
     140        <layout class="QHBoxLayout" name="horizontalLayout_7"> 
     141         <item> 
     142          <widget class="QLabel" name="m_labelTrajNDtime"> 
     143           <property name="text"> 
     144            <string>Position (dtime)</string> 
     145           </property> 
     146          </widget> 
     147         </item> 
     148         <item> 
     149          <spacer name="horizontalSpacer_6"> 
     150           <property name="orientation"> 
     151            <enum>Qt::Horizontal</enum> 
     152           </property> 
     153           <property name="sizeHint" stdset="0"> 
     154            <size> 
     155             <width>40</width> 
     156             <height>20</height> 
     157            </size> 
     158           </property> 
     159          </spacer> 
     160         </item> 
     161        </layout> 
     162       </item> 
     163       <item> 
     164        <layout class="QHBoxLayout" name="horizontalLayout_8"> 
     165         <item> 
     166          <widget class="QLabel" name="m_labelTrajNbsteptime"> 
     167           <property name="text"> 
     168            <string>Pas de temps (steptime &gt; uptime)</string> 
     169           </property> 
     170          </widget> 
     171         </item> 
     172         <item> 
     173          <spacer name="horizontalSpacer_7"> 
     174           <property name="orientation"> 
     175            <enum>Qt::Horizontal</enum> 
     176           </property> 
     177           <property name="sizeHint" stdset="0"> 
     178            <size> 
     179             <width>40</width> 
     180             <height>20</height> 
     181            </size> 
     182           </property> 
     183          </spacer> 
     184         </item> 
     185        </layout> 
    84186       </item> 
    85187      </layout> 
     
    176278     <rect> 
    177279      <x>410</x> 
    178       <y>40</y> 
    179       <width>87</width> 
     280      <y>20</y> 
     281      <width>81</width> 
    180282      <height>95</height> 
    181283     </rect> 
  • trunk/yao/src/interface/ui_newprojectwindow.h

    r386 r387  
    22** Form generated from reading UI file 'newprojectwindow.ui' 
    33** 
    4 ** Created: Tue Jul 13 14:35:14 2010 
     4** Created: Mon Jul 19 16:25:13 2010 
    55**      by: Qt User Interface Compiler version 4.6.3 
    66** 
Note: See TracChangeset for help on using the changeset viewer.