Changeset 339


Ignore:
Timestamp:
06/03/10 14:07:34 (14 years ago)
Author:
yerima
Message:

Adding and deleting buttons are ok in the O_EXTOBJ's widget. Visual Yao.

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

Legend:

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

    r338 r339  
    1919//! \brief Implementation of the Context window for visual_YAO. 
    2020 
    21 ContextWindow::ContextWindow(Table <Constant> *aConstantTable, QWidget *parent) : QWidget(parent) { 
     21ContextWindow::ContextWindow(Context *aContext, Table <Constant> *aConstantTable, QWidget *parent) : QWidget(parent) { 
    2222 
    2323   this->setWindowTitle("Directive Option."); 
     
    2525        compteur        = 0; 
    2626        localConstantTable = aConstantTable; 
     27        m_localContext  =       aContext; 
    2728        m_ContextLayoutH1        = new QHBoxLayout; 
    2829        m_ContextLayoutH2        = new QHBoxLayout; 
     
    6061                } 
    6162 
    62  
    63  
    6463        m_checkBoxO_GRADTEST    = new QCheckBox("O_GRADTEST") ; 
    6564        m_checkBoxO_VARINCR     = new QCheckBox("O_VARINCR") ; 
     
    8685 
    8786        m_contextTableView = new QTableView ;    
    88          
     87 
    8988        m_contextTableView->setModel(contextModele); 
    9089                  m_contextTableView->setEditTriggers(QAbstractItemView::NoEditTriggers); /*!< this ligne give no edit mode*/ 
     
    9392                  m_contextTableView->resizeColumnsToContents(); 
    9493 
     94        O_EXTOBJModele = new QStandardItemModel(0, 1) ;          
     95 
    9596        m_O_EXTOBJListView = new QListView ;    
    96  
     97                m_O_EXTOBJListView->setModel(O_EXTOBJModele);  
    9798        m_O_DBGLayoutG  = new QGridLayout; 
    9899                m_O_DBGLayoutG->addWidget(m_checkBoxO_DBG_NANF, 0, 0); 
     
    144145        connect(m_ContextHelpButton, SIGNAL(clicked()), this, SLOT(callContextHelp())); 
    145146         
     147         
     148        connect(m_addButtonO_EXTOBJ, SIGNAL(clicked()), this, SLOT(addO_EXTOBJRow())); 
     149         
     150        connect(m_delButtonO_EXTOBJ, SIGNAL(clicked()), this, SLOT(deleteO_EXTOBJRow())); 
     151 
    146152        setLayout(m_layoutGContext); 
    147153        setFixedWidth(baseSize().width() + 645); 
     
    158164         
    159165} 
    160  
     166/**************************************** Implémentation de la méthode addO_EXTOBJRow() *****************************************************************/ 
     167void ContextWindow::addO_EXTOBJRow() { 
     168 
     169        O_EXTOBJModele->appendRow(new QStandardItem(m_comboContextO_EXTOBJ->currentText()));  
     170        m_comboContextO_EXTOBJ->setCurrentIndex(0); 
     171} 
     172 
     173/**************************************** Implémentation de la méthode deleteO_EXTOBJRow() *****************************************************************/ 
     174void ContextWindow::deleteO_EXTOBJRow() { 
     175 
     176        QItemSelectionModel *selection = m_O_EXTOBJListView->selectionModel();  
     177        O_EXTOBJIndex = selection->currentIndex();  
     178         if (!O_EXTOBJIndex.isValid())  
     179                return;  
     180        QVariant element = O_EXTOBJModele->data(O_EXTOBJIndex, Qt::DisplayRole); 
     181        int r = O_EXTOBJIndex.row(); 
     182        if (selection->hasSelection()) { 
     183         O_EXTOBJModele->removeRows(m_O_EXTOBJListView->currentIndex().row(), 1);  
     184        //localHeaderList->erase(localHeaderList->begin() + r); 
     185        //if(isHeaderListEmpty()) m_delHatButton->setDisabled(true); 
     186        } 
     187        //cout << "Salut" << endl; 
     188} 
    161189/*************************************** Implémentation de la méthode eraseDataFromLineEdit() ****************************************************************/ 
    162190void ContextWindow::eraseDataFromLineEdit() { 
     
    176204        m_checkBoxO_DBG_TRC_LWARD->setChecked(false); 
    177205        m_checkBoxO_DBG_TRC_AWARD->setChecked(false); 
    178  
    179  
    180206                 
    181207} 
  • trunk/yao/src/interface/src/HatNameWindow.cpp

    r329 r339  
    1414/***************************************   The class constructor: HatNameWindow()  ********************************************************************/ 
    1515HatNameWindow::HatNameWindow(vector <string> *aHeaderList, Table <Constant> *aConstantTable, QWidget *parent) : QWidget(parent), modeleFichiers(NULL),  
    16 vueFichiers(NULL), modeleHatName(NULL), localHeaderList(NULL), localConstantTable(NULL) 
     16hatView(NULL), modeleHatName(NULL), localHeaderList(NULL), localConstantTable(NULL) 
    1717 
    1818{ 
     
    4646        for (vector <string>::iterator it = localHeaderList->begin(); it != localHeaderList->end(); it++) 
    4747                modeleHatName->appendRow(new QStandardItem(it->c_str())); 
    48         vueFichiers = new QListView; 
    49         vueFichiers->setModel(modeleHatName); 
     48        hatView = new QListView; 
     49        hatView->setModel(modeleHatName); 
    5050 
    5151        m_boutonouvrir->setIcon(QIcon("Images/icons/openfile.png")); //Affichage d'une image sur le bouton "ouvrir" 
     
    5757                m_layoutGHatName->addWidget(m_boutonouvrir, 0, 3, Qt::AlignLeft);        
    5858                 
    59                 m_layoutGHatName->addWidget(vueFichiers, 2, 1, 7, 2); 
     59                m_layoutGHatName->addWidget(hatView, 2, 1, 7, 2); 
    6060 
    6161                m_layoutGHatName->addWidget(m_boutonAjouter, 3, 3); 
     
    193193void HatNameWindow::deleteHatRow() { 
    194194 
    195          QItemSelectionModel *selection = vueFichiers->selectionModel(); //Un ensemble sur les éléments selectionnés 
     195         QItemSelectionModel *selection = hatView->selectionModel(); //Un ensemble sur les éléments selectionnés 
    196196         index = selection->currentIndex(); //Précision de l'élément courant selectionné 
    197197         
     
    203203         if (selection->hasSelection()) // Evite certains effets indésirables: suppression de la derniere ligne aprÚs clic sur le vide. 
    204204          { 
    205                  modeleHatName->removeRows(vueFichiers->currentIndex().row(), 1);// Le 2Úme parametre indique le nombre de ligne à supprimer 
     205                 modeleHatName->removeRows(hatView->currentIndex().row(), 1);// Le 2Úme parametre indique le nombre de ligne à supprimer 
    206206                 localHeaderList->erase(localHeaderList->begin() + r);//On met à jour la structure de données en supprimant aussi l'élement. 
    207207                 //m_tableView->resizeRowToContents(c - 1); // columnCountChanged(c , c-1); 
     
    292292HatNameWindow::~HatNameWindow() { 
    293293 
    294 //      delete vueFichiers; 
     294//      delete hatView; 
    295295} 
    296296/****************************************************************************************************************************************************/ 
  • trunk/yao/src/interface/src/MainWindow.cpp

    r336 r339  
    342342        if (m_ContextCopy == NULL) { //to test if the object is already created. 
    343343 
    344         m_ContextCopy = new ContextWindow(&theConstantTable); //mwc.getContext(); 
     344        m_ContextCopy = new ContextWindow(&theContext, &theConstantTable); //mwc.getContext(); 
    345345        espace->addWindow(m_ContextCopy)->move(5, 0); 
    346346        m_ContextCopy->show(); 
  • trunk/yao/src/interface/src/include/ContextWindow.hpp

    r337 r339  
    1818#include <QGroupBox>  
    1919#include <QStandardItemModel>  
     20#include <QItemSelectionModel>  
    2021#include <QModelIndex>  
    2122#include <QFileDialog> 
     
    3738 
    3839    public : 
    39                 ContextWindow(yao::Table <yao::Constant> *aConstantTable, QWidget *parent=0); 
     40                ContextWindow(yao::Context *aContext, yao::Table <yao::Constant> *aConstantTable, QWidget *parent=0); 
    4041                QStringList getContextData(); 
    4142                bool testContenu(int anInt); 
     
    4748                void saveContextData(); 
    4849                void addContextRow(); 
     50                void addO_EXTOBJRow(); 
     51                void deleteO_EXTOBJRow(); 
    4952                void deleteContextRow(); 
    5053                void callContextHelp();          
     
    101104 
    102105                QStandardItemModel *contextModele; 
     106                QStandardItemModel *O_EXTOBJModele; 
    103107                QModelIndex index; 
     108                QModelIndex O_EXTOBJIndex; 
    104109 
    105110                QTableView *m_contextTableView; 
    106111                QListView *m_O_EXTOBJListView ; 
    107112 
    108                 yao::Context *m_theContext; 
     113                yao::Context *m_localContext; 
    109114                std::vector<std::string> anVector; 
    110115                yao::Table <yao::Constant> *localConstantTable; 
  • trunk/yao/src/interface/src/include/HatNameWindow.hpp

    r320 r339  
    119119                QStringList listeFichiers; 
    120120                QStringListModel *modeleFichiers; 
    121                 QListView *vueFichiers; 
     121                QListView *hatView; 
    122122 
    123123                QStandardItemModel *modeleHatName; 
     
    131131                std::string localProjectName; 
    132132                yao::Table <yao::Constant> *localConstantTable; 
    133                 int i; 
    134133}; 
    135134#endif 
  • trunk/yao/src/interface/src/include/MainWindow.hpp

    r329 r339  
    88//#include "../Translator.hpp" 
    99 
    10  
    1110#include "MainWindowController.hpp" 
    1211#include "../help/Enforcer.hpp" 
    1312#include "../help/FilePath.hpp" 
    14  
     13#include "../YAOObjects/Modul.hpp" 
    1514 
    1615#include <QtGui> 
    1716#include <QMainWindow> 
    1817#include <QWorkspace> 
    19 #include <QPushButton> 
    20 #include <QTabWidget> 
    21 #include <QWidget> 
    22 #include <QCloseEvent> 
    23  
    2418 
    2519#include "ConnectionWindow.hpp" 
     
    3630#include "ContextWindow.hpp" 
    3731#include "OrderWindow.hpp" 
    38  
    39 #include "../YAOObjects/Table.hpp" 
    40 #include "../YAOObjects/Constant.hpp" 
    41 #include "../YAOObjects/Trajectory.hpp" 
    42 #include "../YAOObjects/Operator.hpp" 
    43 #include "../YAOObjects/Modul.hpp" 
    4432 
    4533/*! 
     
    9381                        void createNewProjectWindow(); 
    9482                        void helpMessage(); 
    95                         //void callHatModel(); 
    9683                        void createDefvalWindow(); 
    9784                        void createHatNameWindow(); 
     
    115102                        void openPathWindow(); 
    116103                        void setTitle(); 
    117                         //void setWindowTitle(const QString &title); 
    118104                        void hatUpdate(); 
    119105                        void hatUpdate(QString choix ); 
     
    227213                        yao::Table <yao::Constant> theConstantTable;                     
    228214                        std::vector <string> theHeaderList; 
     215                        yao::Context theContext; 
    229216                        yao::Table <yao::Trajectory> theTrajectoryTable; 
    230217                        yao::Table <yao::Space> theSpaceTable; 
Note: See TracChangeset for help on using the changeset viewer.