1 | //! \file SpaceintrajWindow.cpp |
---|
2 | //! \brief Implementation of the instructions file's window for visual_YAO. |
---|
3 | //! \version 2010/10/29 (yyyy/mm/dd) |
---|
4 | //! \author MAYAKI Abdouramane. |
---|
5 | |
---|
6 | /* |
---|
7 | Nom du Fichier: SpaceintrajWindow.cpp |
---|
8 | Nom de classe: SpaceintrajWindow |
---|
9 | Role: |
---|
10 | Nombre de methodes: |
---|
11 | Nombre d'attributs: |
---|
12 | */ |
---|
13 | |
---|
14 | #include "include/SpaceintrajWindow.hpp" |
---|
15 | |
---|
16 | using namespace std; |
---|
17 | using namespace yao; |
---|
18 | |
---|
19 | |
---|
20 | //! \class OrderWindow(QWidget *parent) : QWidget(parent) |
---|
21 | //! \brief Implementation of the Order window for visual_YAO. |
---|
22 | |
---|
23 | /*********************************************************************************************************************************/ |
---|
24 | SpaceintrajWindow::SpaceintrajWindow(Table <Trajectory> *aTrajectoryTable, Table <Space> *aSpaceTable, Table <Operator> *anOperatorTable, Order *anOrder, QWidget *parent) : QWidget(parent) { |
---|
25 | |
---|
26 | setupUi(this); |
---|
27 | |
---|
28 | m_rightSpaceNameButton->setIcon(QIcon("Images/icons/rightarrow2.png")); |
---|
29 | |
---|
30 | m_trajectoryTable = aTrajectoryTable; |
---|
31 | m_spaceTable = aSpaceTable; |
---|
32 | m_operatorTable = anOperatorTable; |
---|
33 | m_localOrder = anOrder; |
---|
34 | |
---|
35 | for (Table<Trajectory>::reverse_iterator it = m_trajectoryTable->rbegin(); it != m_trajectoryTable->rend(); it++) { |
---|
36 | m_trajNameComboBox->insertItem(1, QString(it->getName().c_str())); |
---|
37 | } |
---|
38 | |
---|
39 | for (Table<Space>::reverse_iterator it = m_spaceTable->rbegin(); it != m_spaceTable->rend(); it++) { |
---|
40 | m_spaceNameComboButton->insertItem(1, QString(it->getName().c_str())); |
---|
41 | } |
---|
42 | |
---|
43 | m_spaceOrOperanameModel = new QStandardItemModel(0, 1); |
---|
44 | m_spaceOrOperaNameListView->setModel(m_spaceOrOperanameModel); |
---|
45 | |
---|
46 | m_outlineModel2 = new QStandardItemModel(0, 3); |
---|
47 | m_outlineModel2->setHorizontalHeaderLabels(QStringList() << "" << "" << ""); |
---|
48 | |
---|
49 | m_outlineTreeView2->setModel(m_outlineModel2); |
---|
50 | /* |
---|
51 | |
---|
52 | connect(m_proposedParametersListView, SIGNAL(clicked(QModelIndex )), this, SLOT(selectedFunction(QModelIndex ))); |
---|
53 | connect(m_rightButton, SIGNAL(clicked()), this, SLOT(addInstructionRow())); |
---|
54 | */ |
---|
55 | connect(m_rightSpaceNameButton, SIGNAL(clicked()), this, SLOT(addSpaceNameInListView())); |
---|
56 | // connect(m_validationButton, SIGNAL(clicked()), this, SLOT(addTheEnd())); |
---|
57 | } |
---|
58 | /********************************* Implementation of the class *************************************************************************/ |
---|
59 | /********************************* Implementation of the selectedFunction(QModelIndex index) method ***********************************/ |
---|
60 | /*void SpaceintrajWindow::selectedFunction(QModelIndex index) { |
---|
61 | |
---|
62 | QItemSelectionModel *selection = m_proposedParametersListView->selectionModel(); |
---|
63 | //index = selection->currentIndex(); |
---|
64 | QVariant element = m_instructionLeftModel->data(index, Qt::DisplayRole); |
---|
65 | QString chaine = element.toString();//.toStdString(); |
---|
66 | m_fonctionNameLineEdit->setText(chaine); |
---|
67 | //QMessageBox::about(this, "Avis", chaine); |
---|
68 | //int r = index.row(); |
---|
69 | |
---|
70 | }*/ |
---|
71 | |
---|
72 | /********************************* Implementation of the addSpaceNameInListView() method *************************************************/ |
---|
73 | void SpaceintrajWindow::addSpaceNameInListView() { |
---|
74 | |
---|
75 | static int row = m_spaceOrOperanameModel->rowCount(); |
---|
76 | |
---|
77 | QString spaceNames = m_spaceNameComboButton->currentText(); |
---|
78 | |
---|
79 | if (spaceNames.isEmpty()){ |
---|
80 | |
---|
81 | // QMessageBox::critical(this, "Avertissement", "Le champ \"<I>Nom de la fonction<I>\" est obligatoire! Veuillez sélectionner une fonction parmi celles qui sont proposées dans la partie gauche de la fenêtre."); |
---|
82 | return; // Arrêt de la méthode |
---|
83 | } |
---|
84 | else { |
---|
85 | |
---|
86 | m_outlineModel2 ->setItem(0, 0, new QStandardItem("order ")); |
---|
87 | m_outlineModel2 ->setItem(0, 1, new QStandardItem("spaceintraj ")); |
---|
88 | m_outlineModel2 ->setItem(0, 2, new QStandardItem(m_trajNameComboBox->currentText())); |
---|
89 | |
---|
90 | m_outlineModel2->setItem(row +1, 1, new QStandardItem(spaceNames)); |
---|
91 | if (m_endCheckBox->isChecked()) emit theEndSignal(true); //m_outlineModel2->setItem(m_outlineModel2->rowCount(), 0, new QStandardItem("forder")); ; |
---|
92 | //m_outlineModel2->setItem(row +2, 0, new QStandardItem("forder")); |
---|
93 | //m_spaceOrOperaNameListView->setItem(m_spaceOrOperaNameListView->rowCount()-1, 1, new QStandardItem(val)); |
---|
94 | |
---|
95 | m_spaceOrOperanameModel->setItem(m_spaceOrOperanameModel->rowCount(), 0, new QStandardItem(spaceNames)); ; |
---|
96 | |
---|
97 | m_spaceNameComboButton->clearEditText(); |
---|
98 | |
---|
99 | row++; |
---|
100 | } |
---|
101 | |
---|
102 | /* QString nom = m_fonctionNameLineEdit->text(); |
---|
103 | QString val = m_fonctionParameterLineEdit->text(); |
---|
104 | |
---|
105 | if (nom.isEmpty()){ |
---|
106 | |
---|
107 | QMessageBox::critical(this, "Avertissement", "Le champ \"<I>Nom de la fonction<I>\" est obligatoire! Veuillez sélectionner une fonction parmi celles qui sont proposées dans la partie gauche de la fenêtre."); |
---|
108 | return; // Arrêt de la méthode |
---|
109 | } |
---|
110 | |
---|
111 | else { |
---|
112 | //if (!(m_ligneNom->text().isEmpty()) || (m_ligneValeur->text().isEmpty())) { |
---|
113 | // m_delButton->setEnabled(true); |
---|
114 | // Constant localConstant (Nom.toStdString(), Val.toStdString()); |
---|
115 | // m_localConstantTable->push_back(localConstant); |
---|
116 | m_instructionRightModel->setItem(m_instructionRightModel->rowCount(), 0, new QStandardItem(nom)); |
---|
117 | m_instructionRightModel->setItem(m_instructionRightModel->rowCount()-1, 1, new QStandardItem(val)); |
---|
118 | |
---|
119 | m_fonctionNameLineEdit->setText(""); |
---|
120 | m_fonctionParameterLineEdit->setText(""); |
---|
121 | } |
---|
122 | |
---|
123 | */ |
---|
124 | } |
---|
125 | /***********************************************************************************************************************/ |
---|
126 | /***************************************************** End of file *****************************************************/ |
---|
127 | /***********************************************************************************************************************/ |
---|