Changeset 201
- Timestamp:
- 02/17/10 09:56:57 (14 years ago)
- Location:
- trunk/yao/src/interface
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yao/src/interface/Main.cpp
r172 r201 17 17 #include <QTextCodec> 18 18 #include "src/Include/MainWindow.hpp" 19 20 #include <iostream>19 #include "BaseWindow.hpp" 20 //#include <iostream> 21 21 22 22 … … 30 30 31 31 MainWindow *fen1 = new MainWindow; fen1->show(); 32 32 //BaseWindow bw; 33 //bw.show(); 33 34 //TrajWindow tj; 34 35 //tj.show(); -
trunk/yao/src/interface/src/DefvalWindow.cpp
r195 r201 21 21 /***************************************** The constructor **********************************************************************/ 22 22 23 DefvalWindow::DefvalWindow( QWidget *parent): QWidget(parent) { /*!< The constructor. */23 DefvalWindow::DefvalWindow(BaseWindow *parent): BaseWindow(parent) { /*!< The constructor. */ 24 24 25 this->setWindowTitle("Directive Defval."); /*!< To set the window's title. */ 26 isCalled = false; 25 //this->setWindowTitle("Directive Defval."); /*!< To set the window's title. */ 26 QPushButton *b = new QPushButton("Test"); 27 m_layoutGrid->addWidget(b , 4, 5); 28 // isCalled = false; 27 29 // Instanciation des classes. 28 30 // Déclaration des boutons et champs de saisie de texte. 29 30 compteur = 0;31 32 m_labelNomDefval = new QLabel("Constante: "); /*!< QLabel for Nom de la constante . */33 m_labelValeurDefval = new QLabel("Valeur: "); /*!< QLabel for Valeur de la constante. */34 35 m_ligneNomDefval = new QLineEdit(this) ; /*!< Name of the QLineEdit. */36 m_ligneValeurDefval = new QLineEdit(this) ; /*!< Value of the QLineEdit. */37 38 m_ajoutDefval = new QPushButton("Ajouter", this); /*!< QPushButton for Ajout. */39 m_DefvalHelpButton = new QPushButton("De l'aide ?"); /*!< QPushButton for aide. */40 m_supDefval = new QPushButton("Supprimer", this); /*!< QPushButton for Supprimer. */41 m_supDefval->setDisabled(true); /*!< setDisabled is true. */42 m_saveDefvalButton = new QPushButton("Enregistrer", this); /*!< QPushButton for Enregistrer. */43 m_saveDefvalButton->setDisabled(true);44 m_quitDefval = new QPushButton("Quitter", this); /*!< QPushButton for Quitter. */45 46 QStringList horizontalHeaders;47 horizontalHeaders << "Constante(s)" << "Valeur(s)" << " "; /*!< added Nom Netward Entrees and sorties in table */48 vueDefval = new QTableWidget(0, 2); /*!< QTableWidget's in whitch the objects are listed for thue view. */49 vueDefval->setEditTriggers(QAbstractItemView::NoEditTriggers); /*!< this ligne give no edit mode*/50 vueDefval->setShowGrid(false); /*!< this ligne cover the grille in table */51 vueDefval->setSelectionBehavior(QAbstractItemView::SelectRows); /*!< this ligne give a section of the ligne */52 vueDefval->setHorizontalHeaderLabels(horizontalHeaders); /*!< displays the QTableWidget */53 //--------- Les gestionnaires de positionnement.54 m_layoutH1Defval = new QHBoxLayout;55 m_layoutH1Defval->addWidget(m_saveDefvalButton);56 m_layoutH1Defval->addWidget(m_quitDefval);//m_ajoutDefval);57 m_layoutGDefval = new QGridLayout; /*!< set QGridLayout m-layoutGDefval */58 m_layoutGDefval->addWidget(m_labelNomDefval, 0, 2);59 m_layoutGDefval->addWidget(m_ligneNomDefval, 0, 3, 1, 2);60 m_layoutGDefval->addWidget(m_labelValeurDefval, 1, 2);61 m_layoutGDefval->addWidget(m_ligneValeurDefval, 1, 3, 1, 2);62 m_layoutGDefval->addWidget(m_DefvalHelpButton, 3, 1); /*!< m_DefvalHelpButton in the QGridLayout */63 m_layoutGDefval->addWidget(vueDefval, 2, 2, 4, 3); /*!< added m_vueDefval in the QGridLayout */64 m_layoutGDefval->addWidget(m_ajoutDefval, 3, 5); /*!< added m_ajoutDefval in the QGridLayout */65 m_layoutGDefval->addWidget(m_supDefval, 4, 5); /*!< added m_supDefval in the QGridLayout */66 m_layoutGDefval->addLayout(m_layoutH1Defval, 6, 2, 1, 3); /*!< added m_saveDefvalButton in the QGridLayout */67 68 index = vueDefval->currentIndex();69 70 m_modeleListeNoms = new QStringListModel(m_listeNomsDefval);71 72 this->setLayout(m_layoutGDefval); //Activation du gestionnaire principal.73 74 // Gestion des connexions entre les widgets.75 connect(m_quitDefval, SIGNAL(clicked()), this, SLOT(close())); /*!< slot for the close this windows*/76 connect(m_supDefval, SIGNAL(clicked()), this, SLOT(deleteDefvalRow())); /*!< To delete the object selected in the view*/77 connect(m_ajoutDefval, SIGNAL(clicked()), this, SLOT(addDefvalRow())); /*!< This slot add the object in the view */78 connect(m_DefvalHelpButton, SIGNAL(clicked()), this, SLOT(callDefvalHelp())); /*!< This slot opens the help window */79 connect(m_saveDefvalButton, SIGNAL(clicked()), this, SLOT(saveDefvalData())); /*!< This slot save data in structure */80 81 this->setFixedWidth(baseSize().width() + 410);82 }83 /****************************************** addDefvalRow() method **********************************************/84 void DefvalWindow::addDefvalRow() {85 86 addRow(); // Permet de créer une nouvelle dans le tableau d'affichage.87 88 testContenu(compteur); // Permet de vérifier si une ligne est présente dans le tableau d'affichage.89 // Au cas échéant, on ne désactive pas les boutons "Enregistrer" et "Supprimer".90 91 static int i = 1;92 static int j = 1;93 QString NomDefval = m_ligneNomDefval->text();94 QString ValDefval = m_ligneValeurDefval->text();95 96 97 for(int i1 = 0; i1 < NomDefval.size(); i1++)98 if(!((NomDefval.at(i1) >= QChar('a')&& NomDefval.at(i1) <= QChar('z')) || (NomDefval.at(i1) >= QChar('A')&& NomDefval.at(i1) <= QChar('Z')) //--------99 || (NomDefval.at(i1) >= QChar('0')&& NomDefval.at(i1) <= QChar('9')) || (NomDefval.at(i1) == QChar('_')))) //|| (line1.isEmpty())100 {101 QMessageBox::critical(this, "Erreur", "Veuillez entrer une valeur exacte du nom de la constante.");102 return; // Arrêt de la méthode103 }104 for(int i2 = 0; i2 < ValDefval.size(); i2++)105 if(!((ValDefval.at(i2) >= QChar('a') && ValDefval.at(i2) <= QChar('z')) || (ValDefval.at(i2) >= QChar('A')&& ValDefval.at(i2) <= QChar('Z'))106 ||(ValDefval.at(i2) >= QChar('0') && ValDefval.at(i2) <= QChar('9')) || (ValDefval.at(i2) == QChar('_')) || (ValDefval.at(i2) == QChar('-')) || (ValDefval.at(i2) == QChar('E')) || (ValDefval.at(i2) == QChar('e')) || (ValDefval.at(i2) == QChar('+')) || (ValDefval.at(i2) == QChar('.')))) //|| (line1.isEmpty())107 {108 QMessageBox::critical(this, "Erreur", "Veuillez entrer une valeur correcte pour la constante.");109 return; // Arrêt de la méthode110 }111 if ( m_ligneNomDefval->text().isEmpty())112 {113 QMessageBox::critical(this, "Erreur", "Le champ du nom de la constante est vide: entrer un nom SVP!");114 return; // Arrêt de la méthode115 }116 117 if ((i!=0)&&(j!=0)) {118 if (isCalled) {--i ; isCalled = false; }119 120 addNameInTable(i, j, m_ligneNomDefval->text());121 m_listeNomsDefval.append(m_ligneNomDefval->text() + " " + m_ligneValeurDefval->text());122 addValueInTable(i, j, m_ligneValeurDefval->text());123 124 i++;125 }126 127 initialiserChamps();128 }129 /************************************ deleteDefvalRow() method ****************************************************/130 void DefvalWindow::deleteDefvalRow() {131 132 vueDefval->removeRow(vueDefval->currentRow());133 isCalled = true;134 -- compteur;135 testContenu(compteur);136 }137 138 /****************************************************************************************/139 void DefvalWindow::addNameInTable(int ligne, int colonne, QString nomDefval) {140 141 QTableWidgetItem *chaine = new QTableWidgetItem;142 chaine->setText(nomDefval);143 144 vueDefval->setItem(ligne-1, colonne-1, new QTableWidgetItem(nomDefval));145 }146 147 /****************************************************************************************/148 void DefvalWindow::addValueInTable(int ligne, int colonne, QString valeurDefval) {149 150 QTableWidgetItem *chaine = new QTableWidgetItem;151 chaine->setText(valeurDefval);152 153 vueDefval->setItem(ligne - 1, colonne, chaine);154 }155 156 /****************************************************************************************/157 void DefvalWindow::addRow() {158 159 int row = vueDefval->rowCount();160 vueDefval->insertRow(row);161 compteur ++;162 31 } 163 32 /****************************************************************************************/ 164 void DefvalWindow::saveDefvalData() { 165 166 QTableWidgetItem *cell1 = new QTableWidgetItem; 167 QTableWidgetItem *cell2 = new QTableWidgetItem; 168 169 for (int i = 0; i < vueDefval->rowCount() ; i++) { 170 cell1 = vueDefval->item(i,0); 171 cell2 = vueDefval->item(i,1); 172 173 defvalData.push_back(cell1->text() + " " + cell2->text()); 174 175 } 176 //for (QStringList::iterator it = defvalData.begin(); it != defvalData.end(); it++) 177 //cout << "Voici les valeurs ajoutées: " << it->toStdString() <<endl; 178 m_quitDefval->setEnabled(true); 179 } 180 /****************************************************************************************/ 181 void DefvalWindow::initialiserChamps() { 182 183 m_ligneNomDefval->setText(""); 184 m_ligneValeurDefval->setText(""); 185 } 186 187 /************************************ Implémentation de la méthode callHelpDefval ****************************************/ 188 void DefvalWindow::callDefvalHelp() 189 { 190 QMessageBox::about(this, tr("Aide sur la directive defval."),("<p> La directive defval permet d'associer un nom symbolique à une valeur." 191 "<p><u>Exemple 1</u>: defval szx 12 <p><u>Exemple 2</u>: defval szy \"chaine\"<p> <u>Exemple 3</u>: defval szz szx" 192 "<p> Pour plus d'informations sur defval, <a href=\"help/defval_aide.html\">cliquez ici.</a>")); 193 } 194 195 /****************************************************************************************/ 196 void DefvalWindow::ouvrirProjetExistant() { 197 198 QStringList filtres; 199 200 fd = new QFileDialog(this); 201 fd->setDirectory("."); 202 fd->setFileMode (QFileDialog::AnyFile); 203 204 filtres << "*.*" 205 << "Tous les fichiers (*.*)"; 206 fd->setFilters(filtres); 207 lstF = fd->getSaveFileName(); 208 } 209 /****************************************************************************************************************************/ 210 QStringList DefvalWindow::getDataDefval() { 211 212 return defvalData; 213 } 214 215 /************************************ testContenu() ***************************************************/ 216 bool DefvalWindow::testContenu(int anInt) { 217 218 if (anInt != 0) { 219 m_supDefval->setEnabled(true); 220 m_saveDefvalButton->setEnabled(true); 221 } 222 else 223 { 224 m_supDefval->setDisabled(true); 225 m_saveDefvalButton->setDisabled(true); 226 } 227 } 228 229 /****************************************************************************************/ 230 void DefvalWindow::closeEvent(QCloseEvent *event) { 33 /*void DefvalWindow::closeEvent(QCloseEvent *event) { 231 34 232 35 if (maybeSave()) { … … 237 40 event->ignore(); 238 41 239 } 42 }*/ 240 43 /***************************************************************************************************************/ 241 bool DefvalWindow::maybeSave()44 /*bool DefvalWindow::maybeSave() 242 45 { 243 46 if (isWindowModified()) { … … 255 58 return true; 256 59 } 257 60 */ 258 61 /************************************************************************************/ 259 62 … … 264 67 }*/ 265 68 /********************************************************************************/ 69 QStringList DefvalWindow::getDataDefval() { 70 QStringList test; 71 return test;//defvalData; 72 } 266 73 267 74 -
trunk/yao/src/interface/src/HatNameWindow.cpp
r195 r201 15 15 16 16 /*************************************** Implémentation du constructeur **************************************************/ 17 HatNameWindow::HatNameWindow(string param1, QWidget *parent) : QWidget(parent) {17 HatNameWindow::HatNameWindow(string aprojectName, QWidget *parent) : QWidget(parent) { 18 18 19 19 setWindowTitle("Directive Hatname."); // Titre de la fenetre. 20 compteur 20 compteur = 0; 21 21 22 22 m_labelNom1HatName = new QLabel("Nom du fichier (.h): "); … … 34 34 35 35 m_comboHatName->setEditable(true); 36 37 listeFichiers << param1.c_str();//this->getLocalProjectName().c_str();//NewProjectWindow::getNewProjectName().c_str();36 QString test = aprojectName.c_str();//"blablabla"; 37 listeFichiers << test;//aHeaderList.c_str();//param1.c_str();//this->getLocalProjectName().c_str();//NewProjectWindow::getNewProjectName().c_str(); 38 38 modeleFichiers = new QStringListModel(listeFichiers); 39 40 39 41 40 vueFichiers = new QListView; -
trunk/yao/src/interface/src/Include/DefvalWindow.hpp
r190 r201 7 7 #ifndef DEFVALWINDOW_HPP 8 8 #define DEFVALWINDOW_HPP 9 10 #include <QWidget> 11 #include <QTextStream> 12 #include <QPushButton> 13 #include <QGridLayout> 14 #include <QLineEdit> 15 #include <QStandardItemModel> 16 #include <QTableWidget> 17 #include <QString> 18 #include <QFileDialog> 19 #include <QStringListModel> 9 #include "BaseWindow.hpp" 20 10 #include <QStringList> 21 #include <QLabel> 22 #include <QIODevice> 23 #include <QMessageBox> 24 #include <QCloseEvent> 25 11 //#include <QPushButton> 26 12 //using namespace std; 27 13 28 class DefvalWindow : public QWidget{14 class DefvalWindow : public BaseWindow { 29 15 30 16 Q_OBJECT; … … 39 25 */ 40 26 41 DefvalWindow(QWidget *parent=0); /*!< This function returns the constante's data. */ 42 void addNameInTable(int ligne, int colonne, QString nomDefval); 43 void addValueInTable(int ligne, int colonne, QString valeurDefval); 44 void addRow(); 45 bool testContenu(int anInt); 46 bool maybeSave(); 47 QStringList getDataDefval(); 48 27 DefvalWindow(BaseWindow *parent=0); /*!< This function returns the constante's data. */ 28 QStringList getDataDefval(); 49 29 protected : 50 void closeEvent(QCloseEvent *event);30 // void closeEvent(QCloseEvent *event); 51 31 52 32 public slots : /*!< Functions called after a click. */ 53 33 54 void addDefvalRow(); /*!< This function is called to add row in the visual window model. */55 void deleteDefvalRow(); /*!< This function is called to delete row from the Yao model. */56 void initialiserChamps();57 void callDefvalHelp();58 void ouvrirProjetExistant();59 void saveDefvalData(); /*!< This function is called to add data in the Yao model. */60 //void fermerEnrDef();61 62 63 private :64 65 QLabel *m_labelNomDefval; /*!< QLabel for the Constante Name. */66 QLabel *m_labelValeurDefval; /*!< QLabel for the Constante value. */67 68 QLineEdit *m_ligneNomDefval; /*!< QLineEdit for the Constante Name. */69 QLineEdit *m_ligneValeurDefval; /*!< QLineEdit for the Constante Name. */70 71 QPushButton *m_ajoutDefval; /*!< The button "add". */72 QPushButton *m_supDefval; /*!< The button "delete". */73 QPushButton *m_saveDefvalButton; /*!< The button "save". */74 QPushButton *m_quitDefval; /*!< The button "close window". */75 QPushButton *m_DefvalHelpButton; /*!< The button "Help". */76 77 QGridLayout *m_layoutGDefval; //!< QGridLayout for m_layoutGDefval78 QHBoxLayout *m_layoutH1Defval; //!< QHBoxLayout m_layoutH1Defval79 80 QStandardItemModel *modeleDefval;81 QTableWidget *vueDefval; /*!< Name of the QTableWidget's object in whitch the objects are listed for the viewer. */82 83 QFileDialog *fd;84 QModelIndex index;85 86 QString lstF;87 QStringList m_listeNomsDefval;88 QStringList m_listeValeursDefval;89 QStringListModel *m_modeleListeNoms;90 QStringList defvalData;91 92 bool isCalled;93 94 int compteur;95 34 }; 96 97 35 #endif -
trunk/yao/src/interface/src/Include/HatNameWindow.hpp
r184 r201 44 44 */ 45 45 46 HatNameWindow(std::string param1 = "", QWidget *parent = 0);47 48 49 50 51 52 53 46 HatNameWindow(std::string aprojectName , QWidget *parent = 0); 47 void setNomFichierHat(QString nomFichierHat); /*!< This function sets the file's name. */ 48 std::string getNomFichierHat(); /*!< This function returns the fil's name */ 49 void testPresenceFichier(); 50 QStringList getHatName(); 51 void setLocalProjectName(std::string name); 52 std::string getLocalProjectName(); 53 bool testContenu(int anInt); 54 54 55 55 /*! -
trunk/yao/src/interface/src/Include/MainWindow.hpp
r171 r201 152 152 NewProjectWindow *copynp; 153 153 FilesViewer *fv; 154 std::stringcopyProjectName;154 char* copyProjectName; 155 155 std::vector<std::string> theHeaderList; 156 156 std::string filename; -
trunk/yao/src/interface/src/Include/MainWindowController.hpp
r171 r201 22 22 #include "NewProjectWindow.hpp" 23 23 #include "../YAOObjects/Table.hpp" 24 25 24 26 25 … … 52 51 OrderWindow *getOrder(); 53 52 InsertFCTWindow *getInsertFCT(); 54 NewProjectWindow *getNewProjectInstance();55 NewProjectWindow *getNP();53 void getNewProjectInstance(); 54 void getNP(); 56 55 57 56 SpaceController getSpaceController(); … … 62 61 private : 63 62 64 MainWindowController() {}63 MainWindowController() ;//{} 65 64 std::string m_projectNameInMWC; // MWC = MainWindowController 66 65 DefvalWindow *m_defval; … … 80 79 std::vector<std::string> m_theHeaderList; 81 80 yao::Table<yao::Trajectory> m_theTrajectoryTable; 82 81 bool npTest; 83 82 }; 84 83 -
trunk/yao/src/interface/src/MainWindow.cpp
r171 r201 33 33 MainWindowController & m_mwc = MainWindowController::getInstance(); 34 34 35 copyProjectName = m_mwc.getProjectNameFromMWC(); 36 35 //copyProjectName = m_mwc.getProjectNameFromMWC(); 37 36 fv = new FilesViewer(); //Création d'un espace montrant l'arborescence des fichiers sur le disque dûr. 38 37 … … 264 263 m_hatNameButton = new QPushButton(tr("Hatname"), this); 265 264 m_hatCopy = mwc.getHatName(); 266 265 //m_hatCopy->setLocalProjectName(copynp->getNewProjectName()); 267 266 espace->addWindow(m_hatCopy); 268 267 m_hatCopy->hide(); … … 369 368 370 369 activeBoutonsBarreOutils(); 371 copynp = new NewProjectWindow ;//mwc4.getNP();370 copynp = new NewProjectWindow();//mwc4.getNP(); 372 371 espace->addWindow(copynp); 373 372 copynp->show(); … … 376 375 montrerActionGenererD(); 377 376 377 std::cout << copynp->getNewProjectName() << std::endl; 378 378 //return true; 379 379 } … … 526 526 //genererDefval(); 527 527 //genererHat(); 528 //genererSpace();529 528 530 529 description.close(); … … 597 596 QMessageBox::Cancel | QMessageBox::Escape); 598 597 if (ret == QMessageBox::Yes) 599 true;//return save();598 return true;//return save(); 600 599 else if (ret == QMessageBox::Cancel) 601 600 return false; -
trunk/yao/src/interface/src/MainWindowController.cpp
r171 r201 4 4 //! \author MAYAKI Abdouramane & MAYOMBO Alexis. 5 5 6 7 6 #include "Include/MainWindowController.hpp" 8 7 #include <iostream> 9 8 //! \class MainWindowController & MainWindowController::getInstance() 10 9 //! \brief Implementation of the MainWindow controller for visual_YAO. … … 14 13 15 14 /****************************************************************************************************************************************/ 16 //MainWindowController::MainWindowController() {15 MainWindowController::MainWindowController() { 17 16 18 17 //for(vector<string>::iterator it = m_hat->getTheHeaderList().begin(); it != m_hat->getTheHeaderList().end(); it++) 19 18 //setTheHeaderList("test push_back"); 20 //np = new NewProjectWindow; 21 //setProjectNameInMWC("test.h");//np->getNewProjectName()); 19 npTest = false; 20 np = new NewProjectWindow; 21 np->hide(); 22 std::cout << /*np->getNewProjectName()*/"chaine in mainwindow controller." << std::endl; 23 // if (npTest) 24 // setProjectNameInMWC(np->getNewProjectName()); 25 // else 26 // setProjectNameInMWC("not ready!"); 27 28 //setProjectNameInMWC("test.h");//np->getNewProjectName()); 22 29 //m_defval = new DefvalWindow; 23 30 //m_projectNameInMWC = np->getNewProjectName(); 24 31 //m_hat->setLocalProjectName(m_projectNameInMWC); 25 32 //m_hat = new HatNameWindow("test"); 26 //setProjectNameInMWC(); 27 28 //} 33 34 } 29 35 /********************************************************* getInstance() ****************************************************************/ 30 36 MainWindowController & MainWindowController::getInstance() { … … 66 72 HatNameWindow *MainWindowController::getHatName() { 67 73 68 69 return new HatNameWindow(getProjectNameFromMWC()); 74 //setProjectNameInMWC(getNewProjectName()); 75 string g = getProjectNameFromMWC(); 76 return new HatNameWindow(g); 70 77 71 78 } … … 134 141 135 142 /**************************************************************** getNewProjectInstance() ***********************************************/ 136 NewProjectWindow *MainWindowController::getNewProjectInstance() {143 void MainWindowController::getNewProjectInstance() { 137 144 138 145 // m_projectName = np->name; 139 return this->getNP(); 140 } 146 getNP(); 147 std::cout << /*np->getNewProjectName()*/"Mon age!" << std::endl; 148 //if (npTest) 149 setProjectNameInMWC(np->getNewProjectName()); 150 // else 151 // setProjectNameInMWC("not ready!"); 152 153 154 } 155 141 156 142 157 /**************************************************************** getNP() ***************************************************************/ 143 NewProjectWindow *MainWindowController::getNP() { 144 145 return np; 158 void MainWindowController::getNP() { 159 np->show(); 160 161 //np = new NewProjectWindow; 162 npTest = true; 146 163 } 147 164 … … 196 213 197 214 198 199 /****************************************************************************************************************************************/ 215 /****************************************************************************************************************************************/ -
trunk/yao/src/interface/src/NewProjectWindow.cpp
r174 r201 19 19 //name = projectName; 20 20 //theHeaderList = &theHeaders; 21 21 // string testchaine; 22 22 this->setWindowTitle("Fenêtre de création d'un nouveau projet."); 23 23 … … 53 53 //setNewProjectName(newProjectName); 54 54 55 55 //aprojectName = "rrrrrr";//getNewProjectName(); 56 56 57 this->setFixedWidth(baseSize().width() + 450); 57 58 this->setLayout(m_layoutF); 58 59 this->move(width()/3,height()/3); 59 60 this->show(); 61 //projectname = "test" ;//newProjectName.c_str() ; 60 62 } 61 63
Note: See TracChangeset
for help on using the changeset viewer.