Changeset 319
- Timestamp:
- 05/12/10 16:13:11 (14 years ago)
- Location:
- trunk/yao/src/interface/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yao/src/interface/src/ConstantWindow.cpp
r317 r319 38 38 m_helpButton->setMaximumSize(35, 25); 39 39 m_delButton = new QPushButton("Supprimer", this); /*!< QPushButton for Supprimer. */ 40 m_delButton ->setDisabled(true); /*!< setDisabled is true. */40 if(isLocalConstantTableEmpty()) m_delButton ->setDisabled(true); /*!< setDisabled is true. */ 41 41 m_quitButton = new QPushButton("Quitter", this); /*!< QPushButton for Quitter. */ 42 42 … … 87 87 void ConstantWindow::addRowInTable() { 88 88 89 //testContenu(compteur); // Permet de vérifier si une ligne est présente dans le tableau d'affichage.90 89 QString Nom = m_ligneNom->text(); 91 90 QString Val = m_ligneValeur->text(); … … 144 143 } 145 144 146 initialiserChamps();145 eraseData(); 147 146 } 148 147 148 /*******************************************************************************************************************************************************/ 149 149 /******************************************************************* delete Row() method ***************************************************************/ 150 150 void ConstantWindow::deleteRow() { … … 160 160 m_localConstantTable->erase(m_localConstantTable->begin() + r); 161 161 162 for (unsigned int i=0; i < localHeaderList->size(); i++ ) //Parcourt le vecteur en fonction de sa taille (nombre d'éléments)162 for (unsigned int i=0; i < localHeaderList->size(); i++ ) //Parcourt le vecteur de HatName en fonction de sa taille (nombre d'éléments) 163 163 { 164 164 165 if (element.toString().toStdString() == localHeaderList->at(i)) //Teste si l'élé ement à supprimer dans defval est aussi dans hat165 if (element.toString().toStdString() == localHeaderList->at(i)) //Teste si l'élément à supprimer dans defval est aussi dans hat 166 166 localHeaderList->erase(localHeaderList->begin() + i);//localHeaderList->begin() +i ); 167 167 } 168 168 169 169 emit rowIsDeleted(element.toString()); // signal emis lorsqu'une ligne retirée du tableau. 170 } 171 } 172 173 /***************************************************** initialiserChamps() *****************************************************************************/ 174 void ConstantWindow::initialiserChamps() { 170 if(isLocalConstantTableEmpty()) m_delButton->setDisabled(true); 171 } 172 173 } 174 175 /*******************************************************************************************************************************************************/ 176 /***************************************************** eraseData() *****************************************************************************/ 177 void ConstantWindow::eraseData() { 175 178 176 179 m_ligneNom->setText(""); … … 178 181 } 179 182 /*******************************************************************************************************************************************************/ 183 /*******************************************************************************************************************************************************/ 180 184 void ConstantWindow::saveData() { 181 185 … … 184 188 } 185 189 190 /*******************************************************************************************************************************************************/ 191 bool ConstantWindow::isLocalConstantTableEmpty() { 192 193 if (m_localConstantTable->empty()) 194 return true; 195 else 196 return false; 197 } 186 198 /******************************************************** callConstantHelp() ***************************************************************************/ 187 199 void ConstantWindow::callConstantHelp() { … … 194 206 } 195 207 /*******************************************************************************************************************************************************/ 196 void ConstantWindow::testContenu(int anInt) {197 198 if (anInt != 0) {199 m_delButton->setEnabled(true);200 }201 else {202 203 m_delButton->setDisabled(true);204 }205 }206 208 /*******************************************************************************************************************************************************/ 207 209 void ConstantWindow::closeEvent(QCloseEvent *event) { 208 210 209 emit windowIsClosed(1); 210 /*int ret = QMessageBox::warning(this, tr("Confirmation de fermeture"), 211 tr("Voulez-vous vraiment quitter?"), 212 QMessageBox::Yes | QMessageBox::Default, 213 QMessageBox::Cancel | QMessageBox::Escape); 214 if (ret == QMessageBox::Yes) { 215 event->accept(); 216 //this->~ConstantWindow(); 217 } 218 else 219 event->ignore(); 220 */ 221 /* if (maybeSave()) { 222 //writeSettings(); 223 event->accept(); 224 } 225 else 226 event->ignore(); 227 */ 228 //this->~ConstantWindow(); 229 } 230 /*******************************************************************************************************************************************************/ 231 /*******************************************************************************************************************************************************/ 232 /*******************************************************************************************************************************************************/ 233 211 if (!(m_ligneNom->text().isEmpty()) && !(m_ligneValeur->text().isEmpty())) { //When the two QLineEdit content data, show a confirmation box. 212 213 int ret = QMessageBox::warning(this, tr("Confirmation de fermeture"), tr("Voulez-vous vraiment quitter?"), 214 QMessageBox::Yes | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape); 215 216 if (ret == QMessageBox::Yes) 217 event->accept(); 218 else 219 event->ignore(); 220 221 } 222 emit windowIsClosed(1); //The signal is emitted with parameter "1" which is used for "DevalWindow". 223 } 224 225 /*******************************************************************************************************************************************************/ 234 226 /************************************************ Le destructeur ~ConstantWindow() ********************************************************************/ 235 227 ConstantWindow::~ConstantWindow() { … … 240 232 241 233 } 242 243 /*******************************************************************************************************************************************************/ 244 245 234 /****************************************************************************************************************************************************/ 235 /************************************************** The end of the file. ****************************************************************************/ 236 /****************************************************************************************************************************************************/ -
trunk/yao/src/interface/src/HatNameWindow.cpp
r317 r319 14 14 using namespace yao; //! \namespace yao 15 15 16 /*************************************** Implémentation du constructeur**************************************************/16 /*************************************** The class constructor: HatNameWindow() ********************************************************************/ 17 17 HatNameWindow::HatNameWindow(vector <string> *aHeaderList, Table <Constant> *aConstantTable, QWidget *parent) : QWidget(parent), modeleFichiers(NULL), 18 18 vueFichiers(NULL), modeleHatName(NULL), hatHeaderList(NULL), localConstantTable(NULL) … … 108 108 } 109 109 110 /************************************* *****************************************************************************************************************/110 /************************************* Implementation of the method callHatHelp() **********************************************************************/ 111 111 void HatNameWindow::callHatHelp() { 112 112 … … 114 114 115 115 } 116 /*************************************** ***************************************************************************************************************/116 /*************************************** Implementation of the method addHatRow() ********************************************************************/ 117 117 void HatNameWindow::addHatRow() { 118 118 … … 127 127 modeleHatName->setItem(modeleHatName->rowCount(), new QStandardItem(QString(constantValue.c_str()))); 128 128 hatHeaderList->push_back(hatFile); 129 initialiserChamps();129 eraseData(); 130 130 } 131 131 … … 158 158 hatHeaderList->push_back(hatFile); 159 159 modeleHatName->setItem(modeleHatName->rowCount(), new QStandardItem(QString(hatFile.c_str()))); 160 initialiserChamps();160 eraseData(); 161 161 } 162 162 … … 171 171 else { 172 172 if (hatFile.length() < 2) { 173 initialiserChamps();173 eraseData(); 174 174 return ; 175 175 } … … 181 181 hatHeaderList->push_back(hatFile); 182 182 183 initialiserChamps();183 eraseData(); 184 184 } 185 185 } 186 186 187 187 } 188 //cout << "Nombre de lignes: " << modeleHatName->rowCount() << endl; 189 } 190 /****************************************************************************************/ 188 } 189 /*********************************************** Implementation of the method deleteHatRow() ********************************************************/ 191 190 void HatNameWindow::deleteHatRow() { 192 191 193 /*QItemSelectionModel *selection = vueFichiers->selectionModel();194 QModelIndex indexElementSelectionne = selection->currentIndex();195 QVariant elementSelectionne = modeleHatName->data(indexElementSelectionne, Qt::DisplayRole);196 197 listeFichiers.removeOne(elementSelectionne.toString());//Retrait de l'élément sélectionné de l'objet QStringList198 //modeleHatName->setStringList(listeFichiers); //On indique au modÚle la liste des éléments à afficher.199 */200 // -- compteur;201 // testContenu(compteur);202 203 //int c = vueFichiers->currentIndex().row();204 192 QItemSelectionModel *selection = vueFichiers->selectionModel(); //Un ensemble sur les éléments selectionnés 205 193 index = selection->currentIndex(); //Précision de l'élément courant selectionné … … 208 196 if (selection->hasSelection()) // Evite certains effets indésirables: suppression de la derniere ligne aprÚs clic sur le vide. 209 197 { 210 modeleHatName->removeRows( r, 1);// Le 2Úme parametre indique le nombre de ligne à supprimer198 modeleHatName->removeRows(vueFichiers->currentIndex().row(), 1);// Le 2Úme parametre indique le nombre de ligne à supprimer 211 199 hatHeaderList->erase(hatHeaderList->begin() + r);//On met à jour la structure de données en supprimant aussi l'élement. 212 200 //m_tableView->resizeRowToContents(c - 1); // columnCountChanged(c , c-1); 213 201 } 214 202 215 216 203 } 217 204 218 /*********************************************** *****************************************/219 void HatNameWindow:: initialiserChamps() {205 /*********************************************** *Implementation of the method************************************************************************/ 206 void HatNameWindow::eraseData() { 220 207 221 208 m_comboHatName->clearEditText(); 222 209 } 223 210 224 /***************************************************************************************/ 225 void HatNameWindow::toUpdateView(QString choix) { 226 227 228 //cout << choix.toStdString() << endl; 229 /* 230 int c = vueFichiers->currentIndex().row(); 231 232 // cout << c << endl; 233 QItemSelectionModel *selection = vueFichiers->selectionModel(); 234 index = modeleHatName->indexFromItem(new QStandardItem(choix));//currentIndex(); 235 QVariant element = modeleHatName->data(index, Qt::DisplayRole); 236 //cout << element.toString() << endl; 237 // QMessageBox::information(this, "Selection", element.toString()); 238 QList <QStandardItem *> list; 239 for (int i = 0; i <= modeleHatName->rowCount(); i++) { 240 241 list << modeleHatName->findItems(choix); 242 //modeleHatName 243 244 245 // if (element.toString() == choix) 246 } 247 248 for(QList <QStandardItem *>::iterator it = list.begin(); it != list.end(); it++ ) //int i = 0; i < list.size() ++i) 249 // if(list.at(i) == choix ) return ; 250 cout << "blabla" << endl;//choix << endl; 251 252 // if (element.toString() == choix) 253 // modeleHatName->removeRow(c); 254 // cout << "Ligne supprimée!" << endl; 255 */ 256 //QVariant element = modeleHatName->data(index, Qt::DisplayRole); 257 258 //modeleHatName; 259 260 //cout << "Dans le hat" << endl; 261 //this->activateWindow(); 262 //modeleHatName->refresh(); 263 //modeleHatName->reset(); 264 //vueFichiers->reset(); 265 //~HatNameWindow(); 266 // if (this->isActiveWindow()) 267 // vueFichiers->reset(); 268 //vueFichiers = new QListView; 269 //toResetWindow(); 270 //vueFichiers->setModel(modeleHatName); 271 //cout << element << endl; 272 //QMessageBox::information(this, "Selection", choix); 273 274 // HatNameWindow(hatHeaderList, localConstantTable); 275 //vueFichiers->~QListView(); 276 //vueFichiers = new QListView; 277 //vueFichiers->setModel(modeleHatName); 278 279 } 280 281 /******************************************************/ 282 //void HatNameWindow::toResetWindow() { 283 284 // vueFichiers->reset(); 285 286 //} 287 /******************************************************/ 211 /***************************************************Implementation of the method***********************************************************************/ 288 212 void HatNameWindow::closeEvent(QCloseEvent *event){ 289 213 … … 293 217 294 218 } 295 /*************************************************** *************************************/219 /***************************************************Implementation of the method***********************************************************************/ 296 220 void HatNameWindow::ouvrirProjetExistant() { 297 221 … … 301 225 } 302 226 303 /**************************************************** ************************************/227 /****************************************************Implementation of the method*********************************************************************/ 304 228 void HatNameWindow::testPresenceFichier() { 305 229 … … 309 233 m_supHatName->setEnabled(true); 310 234 } 311 /*************************************************** *************************************/235 /***************************************************Implementation of the method************************************************************************/ 312 236 vector<string> *HatNameWindow::getTheHeaderList() { 313 237 … … 316 240 } 317 241 318 /**************************************************** ************************************/242 /****************************************************Implementation of the method***********************************************************************/ 319 243 void HatNameWindow::setTheHeaderList(vector<string> *theHeaderList) { 320 244 … … 322 246 } 323 247 324 /****************************************************** **********************************/248 /******************************************************Implementation of the method*********************************************************************/ 325 249 void HatNameWindow::setLocalProjectName(string name) { 326 250 … … 329 253 } 330 254 331 /****************************************************** **********************************/255 /****************************************************** Implementation of the method getLocalProjectName() *******************************************/ 332 256 string HatNameWindow::getLocalProjectName() { 333 257 … … 337 261 338 262 339 /******************************************************* *********************************/263 /******************************************************* Implementation of the method getHatList() ****************************************************/ 340 264 QStringList HatNameWindow::getHatList() { 341 265 … … 343 267 344 268 } 345 /***************************************************************************************/346 bool HatNameWindow::testContenu(int anInt) {347 348 if (anInt != 0) {349 m_supHatName->setEnabled(true);350 //m_enregHatName->setEnabled(true);351 352 return true;353 }354 else355 {356 m_supHatName->setDisabled(true);357 //m_enregHatName->setDisabled(true);358 359 return false;360 }361 362 }363 269 /******************************************************************************************************************************************************/ 364 270 //void HatNameWindow::updateComb 365 /******************************************************** **********************************************************************************************/271 /******************************************************** Implementation of the destructor ************************************************************/ 366 272 HatNameWindow::~HatNameWindow() { 367 273 368 274 // delete vueFichiers; 369 275 } 370 371 276 /****************************************************************************************************************************************************/ 277 /************************************************** The end of the file. ****************************************************************************/ 278 /****************************************************************************************************************************************************/ -
trunk/yao/src/interface/src/MainWindow.cpp
r318 r319 543 543 m_hatCopy->show(); 544 544 espace->setActiveWindow(m_ConstantCopy); 545 m_hatCopy->toUpdateView(choix);545 //m_hatCopy->toUpdateView(choix); 546 546 } 547 547 -
trunk/yao/src/interface/src/include/ConstantWindow.hpp
r317 r319 2 2 * \file ConstantWindow.hpp 3 3 * \brief ConstantWindow class for visual_YAO. 4 * \version 20 09/12/26(yyyy/mm/dd)5 * \author MAYAKI Abdouramane & MAYOMBO Alexis.4 * \version 2010/05/12 (yyyy/mm/dd) 5 * \author MAYAKI Abdouramane. 6 6 */ 7 7 #ifndef DEFVALWINDOW_HPP … … 42 42 43 43 ConstantWindow(yao::Table<yao::Constant> *aConstantTable, std::vector <std::string> *aHeaderList, QWidget *parent=0); 44 void testContenu(int anInt);45 void initialiserChamps();44 void eraseData(); 45 bool isLocalConstantTableEmpty(); 46 46 ~ConstantWindow(); 47 47 48 protected : 48 49 void closeEvent(QCloseEvent *event); 49 //bool event(QEvent *event);50 50 51 51 public slots : /*!< Functions called after a click. */ -
trunk/yao/src/interface/src/include/HatNameWindow.hpp
r317 r319 50 50 void setLocalProjectName(std::string name); 51 51 std::string getLocalProjectName(); 52 bool testContenu(int anInt);53 void toUpdateView(QString choix);54 // void toResetWindow();55 52 ~HatNameWindow(); 56 53 … … 67 64 void addHatRow(); /*!< This function is called to insert data in the model. */ 68 65 void deleteHatRow(); /*!< This function is called to delete data from the model. */ 69 void initialiserChamps(); /*!< This function is called to initialize the lineEdit. */66 void eraseData(); /*!< This function is called to initialize the lineEdit. */ 70 67 void ouvrirProjetExistant(); /*!< This function is called to open an existing project. */ 71 68 void appelEnregistrer(); /*!< This function is called to save the current project in the file model */
Note: See TracChangeset
for help on using the changeset viewer.