Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYMachineWidget.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
21 // Added by qt3to4:
22 #include <QGridLayout>
23 #include <QLabel>
24 #include <QTextEdit>
25 
29 
30 #include "TYMachineWidget.h"
31 
32 #define TR(id) OLocalizator::getString("TYMachineWidget", (id))
33 
34 TYMachineWidget::TYMachineWidget(TYMachine* pElement, QWidget* _pParent /*=NULL*/)
35  : TYWidget(pElement, _pParent)
36 {
37  QString num;
38 
39  resize(300, 680);
40  setWindowTitle(TR("id_caption"));
41 
42  _elmW = new TYAcousticVolumeNodeWidget(pElement, this);
43 
44  _lineEditCategorie = new QLineEdit();
45  _lineEditCategorie->setText(num.setNum(getElement()->getCategorie()));
46 
47  _labelCategorie = new QLabel();
48  _labelCategorie->setText(TR("id_categorie_label"));
49 
50  _labelConstructeur = new QLabel();
51  _labelConstructeur->setText(TR("id_constructeur_label"));
52 
53  _lineEditConstructeur = new QLineEdit();
54  _lineEditConstructeur->setText(getElement()->getConstructeur());
55 
56  _labelModele = new QLabel();
57  _labelModele->setText(TR("id_modele_label"));
58 
59  _lineEditModele = new QLineEdit();
60  _lineEditModele->setText(getElement()->getModele());
61 
62  _lineEditComment = new QTextEdit(getElement()->getCommentaire());
63 
64  _labelComment = new QLabel();
65  _labelComment->setText(TR("id_commentaire_label"));
66 
67  _groupBoxLayout = new QGridLayout();
68  _groupBoxLayout->addWidget(_lineEditCategorie, 0, 1);
69  _groupBoxLayout->addWidget(_labelCategorie, 0, 0);
70  _groupBoxLayout->addWidget(_labelConstructeur, 1, 0);
71  _groupBoxLayout->addWidget(_lineEditConstructeur, 1, 1);
72  _groupBoxLayout->addWidget(_labelModele, 2, 0);
73  _groupBoxLayout->addWidget(_lineEditModele, 2, 1);
74  _groupBoxLayout->addWidget(_lineEditComment, 4, 0, 1, 2);
75  _groupBoxLayout->addWidget(_labelComment, 3, 0);
76 
77  _groupBox = new QGroupBox();
78  _groupBox->setTitle(TR(""));
79  _groupBox->setLayout(_groupBoxLayout);
80 
81  _machineLayout = new QGridLayout();
82  _machineLayout->addWidget(_elmW, 0, 0);
83  _machineLayout->addWidget(_groupBox, 1, 0);
84 
85  setLayout(_machineLayout);
86 }
87 
89 
91 {
92  QString num;
93 
95 
96  _lineEditComment->setPlainText(getElement()->getCommentaire());
97  _lineEditModele->setText(getElement()->getModele());
98  _lineEditConstructeur->setText(getElement()->getConstructeur());
99  _lineEditCategorie->setText(num.setNum(getElement()->getCategorie()));
100 }
101 
103 {
104  _elmW->apply();
105 
106  getElement()->setCommentaire(_lineEditComment->toPlainText());
107  getElement()->setModele(_lineEditModele->text());
108  getElement()->setConstructeur(_lineEditConstructeur->text());
109  getElement()->setCategorie(_lineEditCategorie->text().toInt());
110 
111  emit modified();
112 }
outil IHM pour un ensemble de volumes acoustiques (fichier header)
#define TR(id)
outil IHM pour une machine (fichier header)
Classe de l'objet IHM pour un ensemble de volumes acoustiques.
QGridLayout * _machineLayout
QLineEdit * _lineEditModele
QLabel * _labelComment
QGridLayout * _groupBoxLayout
QLabel * _labelCategorie
TYMachineWidget(TYMachine *pElement, QWidget *_pParent=NULL)
QLineEdit * _lineEditConstructeur
QLineEdit * _lineEditCategorie
QLabel * _labelModele
virtual void apply()
virtual void updateContent()
QGroupBox * _groupBox
QLabel * _labelConstructeur
virtual ~TYMachineWidget()
QTextEdit * _lineEditComment
TYAcousticVolumeNodeWidget * _elmW
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
void modified()