- Timestamp:
- 02/18/10 17:10:23 (14 years ago)
- Location:
- trunk/yao/src/interface/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yao/src/interface/src/BaseWindow.cpp
r201 r205 4 4 5 5 this->setWindowTitle("Directive ."); /*!< To set the window's title. */ 6 //isCalled = false;6 isCalled = false; 7 7 // Instanciation des classes. 8 8 // Déclaration des boutons et champs de saisie de texte. 9 10 //compteur = 0; 9 compteur = 0; 11 10 12 11 m_nameLabel = new QLabel("Entrée 1: "); /*!< QLabel for Nom de la constante . */ … … 48 47 //index = m_tableView ->currentIndex(); 49 48 50 //m_modeleListeNoms = new QStringListModel(m_listeNoms);49 m_modeleListeNoms = new QStringListModel(m_listeNoms); 51 50 52 51 this->setLayout(m_layoutGrid); //Activation du gestionnaire principal. 53 52 54 53 // Gestion des connexions entre les widgets. 55 connect(m_quitButton , SIGNAL(clicked()), this, SLOT(close())); /*!< slot for the close this windows*/ 56 //connect(m_delButton , SIGNAL(clicked()), this, SLOT(delete Row())); /*!< To delete the object selected in the view*/ 57 //connect(m_addButton , SIGNAL(clicked()), this, SLOT(add Row())); /*!< This slot add the object in the view */ 58 //connect(m_HelpButton, SIGNAL(clicked()), this, SLOT(call Help())); /*!< This slot opens the help window */ 59 //connect(m_saveButton, SIGNAL(clicked()), this, SLOT(save Data())); /*!< This slot save data in structure */ 54 connect(m_quitButton, SIGNAL(clicked()), this, SLOT(close())); /*!< slot for the close this windows*/ 55 connect(m_addButton, SIGNAL(clicked()), this, SLOT(addRowInTable())); /*!< This slot add the object in the view */ 56 connect(m_delButton, SIGNAL(clicked()), this, SLOT(deleteRow())); /*!< To delete the object selected in the view*/ 57 connect(m_saveButton, SIGNAL(clicked()), this, SLOT(saveData())); /*!< This slot save data in structure */ 60 58 61 59 this->setFixedWidth(baseSize().width() + 410); 62 60 } 63 /****************************************** add Row() method **********************************************/64 /*void BaseWindow::add Row() {61 /****************************************** addRowInTable() method **********************************************/ 62 void BaseWindow::addRowInTable() { 65 63 66 64 addRow(); // Permet de créer une nouvelle dans le tableau d'affichage. … … 71 69 static int i = 1; 72 70 static int j = 1; 73 QString Nom = m_ligneNom 74 QString Val = m_ligneValeur 75 76 77 for(int i1 = 0; i1 < Nom 78 if(!((Nom .at(i1) >= QChar('a')&& Nom .at(i1) <= QChar('z')) || (Nom .at(i1) >= QChar('A')&& Nom .at(i1) <= QChar('Z')) //--------79 || (Nom .at(i1) >= QChar('0')&& Nom .at(i1) <= QChar('9')) || (Nom .at(i1) == QChar('_')))) //|| (line1.isEmpty())71 QString Nom = m_ligneNom->text(); 72 QString Val = m_ligneValeur->text(); 73 74 75 for(int i1 = 0; i1 < Nom.size(); i1++) 76 if(!((Nom .at(i1) >= QChar('a')&& Nom .at(i1) <= QChar('z')) || (Nom .at(i1) >= QChar('A')&& Nom .at(i1) <= QChar('Z')) 77 || (Nom .at(i1) >= QChar('0')&& Nom .at(i1) <= QChar('9')) || (Nom .at(i1) == QChar('_')))) //|| (line1.isEmpty()) 80 78 { 81 79 QMessageBox::critical(this, "Erreur", "Veuillez entrer une valeur exacte du nom de la constante."); 82 80 return; // Arrêt de la méthode 83 81 } 84 for(int i2 = 0; i2 < Val 82 for(int i2 = 0; i2 < Val.size(); i2++) 85 83 if(!((Val .at(i2) >= QChar('a') && Val .at(i2) <= QChar('z')) || (Val .at(i2) >= QChar('A')&& Val .at(i2) <= QChar('Z')) 86 ||(Val .at(i2) >= QChar('0') && Val .at(i2) <= QChar('9')) || (Val .at(i2) == QChar('_')) || (Val .at(i2) == QChar('-')) || (Val .at(i2) == QChar('E')) || (Val .at(i2) == QChar('e')) || (Val .at(i2) == QChar('+')) || (Val .at(i2) == QChar('.')))) //|| (line1.isEmpty()) 87 { 84 ||(Val .at(i2) >= QChar('0') && Val .at(i2) <= QChar('9')) || (Val .at(i2) == QChar('_')) || (Val .at(i2) == QChar('-')) 85 || (Val .at(i2) == QChar('E')) || (Val .at(i2) == QChar('e')) || (Val .at(i2) == QChar('+')) || (Val .at(i2) == QChar('.')))) { 86 88 87 QMessageBox::critical(this, "Erreur", "Veuillez entrer une valeur correcte pour la constante."); 89 88 return; // Arrêt de la méthode 90 89 } 91 if ( m_ligneNom->text().isEmpty())90 if (m_ligneNom->text().isEmpty()) 92 91 { 93 QMessageBox::critical(this, "Erreur", "Le champ du nom de la constante est vide: entrer un nom SVP!");94 return; // Arrêt de la méthode92 QMessageBox::critical(this, "Erreur", "Le champ du nom de la constante est vide: entrer un nom SVP!"); 93 return; // Arrêt de la méthode 95 94 } 96 95 … … 98 97 if (isCalled) {--i ; isCalled = false; } 99 98 100 addNameInTable(i, j, m_ligneNom ->text()); 101 m_listeNoms .append(m_ligneNom ->text() + " " + m_ligneValeur ->text()); 102 addValueInTable(i, j, m_ligneValeur ->text()); 103 99 addNameInTable(i, j, m_ligneNom->text()); 100 m_listeNoms.append(m_ligneNom->text() + " " + m_ligneValeur->text()); 101 addValueInTable(i, j, m_ligneValeur->text()); 104 102 i++; 105 103 } 106 104 107 105 initialiserChamps(); 108 }*/ 106 } 107 /************************************ addRow() method ****************************************************/ 108 void BaseWindow::addRow() { 109 110 int row = m_tableView->rowCount(); 111 m_tableView->insertRow(row); 112 compteur ++; 113 } 114 109 115 /************************************ delete Row() method ****************************************************/ 110 /*void BaseWindow::deleteRow() {111 112 m_tableView ->removeRow(m_tableView->currentRow());116 void BaseWindow::deleteRow() { 117 118 m_tableView->removeRow(m_tableView->currentRow()); 113 119 isCalled = true; 114 120 -- compteur; 115 121 testContenu(compteur); 116 } */122 } 117 123 118 124 /****************************************************************************************/ 119 /*void BaseWindow::addNameInTable(int ligne, int colonne, QString nom ) {125 void BaseWindow::addNameInTable(int ligne, int colonne, QString nom ) { 120 126 121 127 QTableWidgetItem *chaine = new QTableWidgetItem; 122 128 chaine->setText(nom ); 123 129 124 m_tableView 125 } */130 m_tableView->setItem(ligne-1, colonne-1, new QTableWidgetItem(nom )); 131 } 126 132 127 133 /****************************************************************************************/ 128 /*void BaseWindow::addValueInTable(int ligne, int colonne, QString valeur ) {134 void BaseWindow::addValueInTable(int ligne, int colonne, QString valeur ) { 129 135 130 136 QTableWidgetItem *chaine = new QTableWidgetItem; 131 137 chaine->setText(valeur ); 132 138 133 m_tableView ->setItem(ligne - 1, colonne, chaine); 134 }*/ 135 136 /****************************************************************************************/ 137 /*void BaseWindow::addRow() { 138 139 int row = m_tableView ->rowCount(); 140 m_tableView ->insertRow(row); 141 compteur ++; 142 }*/ 143 /****************************************************************************************/ 144 /*void BaseWindow::save Data() { 139 m_tableView->setItem(ligne - 1, colonne, chaine); 140 } 141 142 /*****************************************************************************************************************************************************/ 143 void BaseWindow::saveData() { 145 144 146 145 QTableWidgetItem *cell1 = new QTableWidgetItem; 147 146 QTableWidgetItem *cell2 = new QTableWidgetItem; 148 147 149 for (int i = 0; i < m_tableView ->rowCount() ; i++) { 150 cell1 = m_tableView ->item(i,0); 151 cell2 = m_tableView ->item(i,1); 148 for (int i = 0; i < m_tableView->rowCount() ; i++) { 149 150 cell1 = m_tableView->item(i, 0); 151 cell2 = m_tableView->item(i, 1); 152 152 153 153 m_savedData.push_back(cell1->text() + " " + cell2->text()); 154 154 155 155 } 156 156 //for (QStringList::iterator it = Data.begin(); it != Data.end(); it++) 157 157 //cout << "Voici les valeurs ajoutées: " << it->toStdString() <<endl; 158 m_quitButton ->setEnabled(true); 159 }*/ 160 /****************************************************************************************/ 161 //void BaseWindow::initialiserChamps() { 162 163 // m_ligneNom ->setText(""); 164 // m_ligneValeur ->setText(""); 165 //} 166 167 /************************************ Implémentation de la méthode callHelp ****************************************/ 168 //void BaseWindow::call Help() 169 //{ 170 // QMessageBox::about(this, tr("Aide sur la directive ."),("<p> La directive permet d'associer un nom symbolique à une valeur." 171 // "<p><u>Exemple 1</u>: szx 12 <p><u>Exemple 2</u>: szy \"chaine\"<p> <u>Exemple 3</u>: szz szx" 172 // "<p> Pour plus d'informations sur , <a href=\"help/ _aide.html\">cliquez ici.</a>")); 173 //} 174 175 /****************************************************************************************/ 176 177 /****************************************************************************************************************************/ 178 //QStringList BaseWindow::getData () { 179 180 // return Data; 181 //} 158 m_quitButton->setEnabled(true); 159 } 160 /*****************************************************************************************************************************************************/ 161 void BaseWindow::initialiserChamps() { 162 163 m_ligneNom->setText(""); 164 m_ligneValeur->setText(""); 165 } 166 167 182 168 183 169 /************************************ testContenu() ***************************************************/ 184 /*bool BaseWindow::testContenu(int anInt) {170 bool BaseWindow::testContenu(int anInt) { 185 171 186 172 if (anInt != 0) { 187 m_delButton 188 m_save 173 m_delButton->setEnabled(true); 174 m_saveButton->setEnabled(true); 189 175 } 190 176 else 191 177 { 192 m_delButton ->setDisabled(true); 193 m_save Button->setDisabled(true); 194 } 195 }*/ 196 178 m_delButton->setDisabled(true); 179 m_saveButton->setDisabled(true); 180 } 181 } 182 /****************************************************************************************************************************/ 183 QStringList BaseWindow::getData () { 184 185 return m_savedData; 186 } 197 187 /****************************************************************************************/ 198 //void BaseWindow::closeEvent(QCloseEvent *event) { 199 188 void BaseWindow::closeEvent(QCloseEvent *event) { 189 190 //QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); 191 QMessageBox msgBox; 192 msgBox.setText("Le document a été modifié."); 193 msgBox.setInformativeText("Voulez-vous sauvegarder les modifications apportées?"); 194 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); 195 msgBox.setDefaultButton(QMessageBox::Yes); 196 int ret = msgBox.exec(); 197 198 if (ret == QMessageBox::Yes) 199 event->accept(); 200 else event->ignore(); 201 202 //QMessageBox::warning(this, tr("Application"), tr("Le document a été modifié.\n Voulez-vous sauvegarder les modifications apportées?"), 203 // QMessageBox::Yes | QMessageBox::Default, 204 // QMessageBox::No, 205 // QMessageBox::Cancel | QMessageBox::Escape); 206 200 207 // if (maybeSave()) { 201 208 //writeSettings(); … … 205 212 // event->ignore(); 206 213 207 //}214 } 208 215 /***************************************************************************************************************/ 209 216 /*bool BaseWindow::maybeSave() -
trunk/yao/src/interface/src/DefvalWindow.cpp
r201 r205 23 23 DefvalWindow::DefvalWindow(BaseWindow *parent): BaseWindow(parent) { /*!< The constructor. */ 24 24 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; 29 // Instanciation des classes. 30 // Déclaration des boutons et champs de saisie de texte. 25 setWindowTitle("Directive Defval."); /*!< To set the window's title. */ 26 m_nameLabel->setText("Constante: "); 27 m_valueLabel->setText("Valeur: "); 28 connect(m_helpButton, SIGNAL(clicked()), this, SLOT(callDefvalHelp())); 29 31 30 } 31 /********************************************************************************/ 32 //QStringList DefvalWindow::getDataDefval() { 33 //QStringList test; 34 // return test;//defvalData; 35 //} 36 /******************************************************************************************************************************************************/ 37 void DefvalWindow::callDefvalHelp() 38 { 39 QMessageBox::about(this, tr("Aide sur la directive defval."), 40 ("<p> La directive defval permet d'associer un nom symbolique à une valeur." 41 "<p><u>Exemple 1</u>: defval szx 12 <p><u>Exemple 2</u>: defval szy \"chaine\"<p> <u>Exemple 3</u>: defval szz szx" 42 "<p> Pour plus d'informations sur defval, <a href=\"help/defval_aide.html\">cliquez ici.</a>")); 43 } 44 /******************************************************************************************************************************************************/ 32 45 /****************************************************************************************/ 33 46 /*void DefvalWindow::closeEvent(QCloseEvent *event) { … … 66 79 return tar; 67 80 }*/ 68 /********************************************************************************/69 QStringList DefvalWindow::getDataDefval() {70 QStringList test;71 return test;//defvalData;72 }73 81 74 -
trunk/yao/src/interface/src/Include/BaseWindow.hpp
r201 r205 7 7 #include <QLineEdit> 8 8 #include <QLabel> 9 //#include <QTextStream>9 #include <QTextCodec> 10 10 #include <QGridLayout> 11 11 //#include <QStandardItemModel> 12 12 //#include <QString> 13 13 //#include <QFileDialog> 14 //#include <QStringListModel>14 #include <QStringListModel> 15 15 //#include <QStringList> 16 16 //#include <QIODevice> 17 //#include <QMessageBox>18 //#include <QCloseEvent>17 #include <QMessageBox> 18 #include <QCloseEvent> 19 19 #include <iostream> 20 20 #include <QHBoxLayout> … … 27 27 public : 28 28 BaseWindow(QWidget *parent=0); 29 QStringList getData(); 29 30 30 QGridLayout *m_layoutGrid; 31 private: 32 31 protected slots: 32 void addRowInTable(); 33 void deleteRow(); 34 void saveData(); 35 36 protected: 37 //The functions 38 void addRow(); 39 bool testContenu(int anInt); 40 void addNameInTable(int ligne, int colonne, QString nom); 41 void addValueInTable(int ligne, int colonne, QString valeur); 42 void initialiserChamps(); 43 void closeEvent(QCloseEvent *event); 44 45 // Variables 33 46 QLabel *m_nameLabel; 34 47 QLabel *m_valueLabel; … … 43 56 QPushButton *m_helpButton; 44 57 58 QGridLayout *m_layoutGrid; 45 59 QHBoxLayout *m_layoutH1; 46 60 … … 52 66 53 67 //QString lstF; 54 //QStringList m_listeNomsDefval;68 QStringList m_listeNoms; 55 69 //QStringList m_listeValeursDefval; 56 //QStringListModel *m_modeleListeNoms;57 //QStringList defvalData;70 QStringListModel *m_modeleListeNoms; 71 QStringList m_savedData; 58 72 59 //bool isCalled;73 bool isCalled; 60 74 61 //int compteur; 75 int compteur; 76 77 62 78 }; 63 79 -
trunk/yao/src/interface/src/Include/DefvalWindow.hpp
r201 r205 26 26 27 27 DefvalWindow(BaseWindow *parent=0); /*!< This function returns the constante's data. */ 28 QStringList getDataDefval();28 //QStringList getDataDefval(); 29 29 protected : 30 30 // void closeEvent(QCloseEvent *event); 31 31 32 32 public slots : /*!< Functions called after a click. */ 33 33 void callDefvalHelp(); 34 34 }; 35 35 #endif -
trunk/yao/src/interface/src/MainWindow.cpp
r201 r205 23 23 24 24 */ 25 26 25 27 26 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { … … 66 65 //horizontalLayout->addWidget(tabWidget); 67 66 tabWidget->setCurrentIndex(1); 68 67 //connect(espace, SIGNAL(windowActivated(QWidget * w)), this, SLOT(setActiveWindow(QWidget * w))); 69 68 70 69 … … 481 480 description << "#DEFVAL pour definir des directives ------------------------------------------DEFVAL" << endl; 482 481 483 for (QStringList::iterator it = m_defvalCopy->getData Defval().begin(); it != m_defvalCopy->getDataDefval().end(); it++)482 for (QStringList::iterator it = m_defvalCopy->getData().begin(); it != m_defvalCopy->getData().end(); it++) 484 483 description << "defval " << it->toStdString() << endl; 485 484 description << endl;
Note: See TracChangeset
for help on using the changeset viewer.