fw4spl
EquipmentEditor.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include "uiMedDataQt/widget/EquipmentEditor.hpp"
8 
9 #include <fwMedData/Equipment.hpp>
10 #include <fwMedData/Series.hpp>
11 
12 #include <boost/algorithm/string.hpp>
13 
14 #include <QFormLayout>
15 #include <QGroupBox>
16 #include <QLineEdit>
17 
18 namespace uiMedDataQt
19 {
20 namespace widget
21 {
22 
23 //-----------------------------------------------------------------------------
24 
26  QWidget(parent)
27 {
28  m_institutionName = new QLineEdit();
29 
30  QFormLayout* layout = new QFormLayout();
31 
32  layout->addRow(tr("Institution name"), m_institutionName);
33 
34  QGroupBox* group = new QGroupBox(tr("Equipment"));
35  group->setLayout(layout);
36  QVBoxLayout* topLayout = new QVBoxLayout();
37  topLayout->addWidget(group);
38  this->setLayout(topLayout);
39 }
40 
41 //-----------------------------------------------------------------------------
42 
44 {
45 }
46 
47 //-----------------------------------------------------------------------------
48 
50 {
51  SLM_ASSERT("Given series is null", series);
52  m_series = series;
53 
54  ::fwMedData::Equipment::sptr equipment = m_series->getEquipment();
55  SLM_ASSERT("Given series equipment is null", equipment);
56 
57  m_institutionName->setText(QString::fromStdString(equipment->getInstitutionName()).trimmed());
58 
59 }
60 
62 {
63  ::fwMedData::Equipment::sptr equipment = ::fwMedData::Equipment::New();
64  equipment->setInstitutionName(m_institutionName->text().trimmed().toStdString());
65 
66  return equipment;
67 }
68 
69 //------------------------------------------------------------------------------
70 
72 {
73  //TODO
74  return true;
75 }
76 
77 //-----------------------------------------------------------------------------
78 
79 } // namespace widget
80 } // namespace uiMedDataQt
81 
The namespace uiMedDataQt contains editors for medical data.
#define SPTR(_cls_)
UIMEDDATAQT_API std::shared_ptr< ::fwMedData::Equipment > getEquipment() const
Get the current Equipment.
UIMEDDATAQT_API EquipmentEditor(QWidget *parent=0)
Constructor.
UIMEDDATAQT_API ~EquipmentEditor()
Destructor.
UIMEDDATAQT_API void setSeries(std::shared_ptr< ::fwMedData::Series > series)
Set referring series.
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308
Widget to edit fwMedData::Equipment information.
UIMEDDATAQT_API bool isValid() const
Check if the equipment information entered in UI is valid.