7 #include "uiMedDataQt/widget/StudyEditor.hpp" 9 #include "uiMedDataQt/constants.hpp" 10 #include "uiMedDataQt/InsertSeries.hpp" 12 #include <fwData/String.hpp> 14 #include <fwMedData/Series.hpp> 15 #include <fwMedData/Study.hpp> 17 #include <fwMedDataTools/functions.hpp> 19 #include <boost/algorithm/string.hpp> 21 #include <QFormLayout> 35 m_date =
new QLineEdit();
36 m_time =
new QLineEdit();
37 m_referringPhysicianName =
new QLineEdit();
38 m_description =
new QLineEdit();
39 m_patientAge =
new QLineEdit();
41 QFormLayout* layout =
new QFormLayout();
43 layout->addRow(tr(
"Date"), m_date);
44 layout->addRow(tr(
"Time"), m_time);
45 layout->addRow(tr(
"Referring physician name"), m_referringPhysicianName);
46 layout->addRow(tr(
"Description"), m_description);
47 layout->addRow(tr(
"Patient age"), m_patientAge);
49 QObject::connect(m_date, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onDateChanged(
const QString&)));
50 QObject::connect(m_time, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onTimeChanged(
const QString&)));
51 QObject::connect(m_description, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onDescChanged(
const QString&)));
53 QGroupBox* group =
new QGroupBox(tr(
"Study"));
54 group->setLayout(layout);
55 QVBoxLayout* topLayout =
new QVBoxLayout();
56 topLayout->addWidget(group);
57 this->setLayout(topLayout);
64 QObject::disconnect(m_date, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onDateChanged(
const QString&)));
65 QObject::disconnect(m_time, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onTimeChanged(
const QString&)));
66 QObject::disconnect(m_description, SIGNAL(textChanged(
const QString&)),
this,
74 return !m_date->text().trimmed().isEmpty()
75 && m_description->text().trimmed().toStdString() != s_NEW_STUDY_TEXT
76 && !m_time->text().trimmed().isEmpty();
83 ::fwMedData::Study::sptr srcStudy = m_series->getStudy();
84 ::fwMedData::Study::sptr study = ::fwMedData::Study::New();
85 study->setDescription(m_description->text().trimmed().toStdString());
86 study->setDate(m_date->text().trimmed().toStdString());
87 study->setTime(m_time->text().trimmed().toStdString());
88 study->setReferringPhysicianName(m_referringPhysicianName->text().trimmed().toStdString());
89 study->setInstanceUID(srcStudy->getInstanceUID());
90 study->setPatientAge(srcStudy->getPatientAge());
92 std::string date = srcStudy->getDate();
93 ::boost::algorithm::trim(date);
94 std::string time = srcStudy->getTime();
95 ::boost::algorithm::trim(time);
96 std::string refP = srcStudy->getReferringPhysicianName();
97 ::boost::algorithm::trim(refP);
98 std::string age = srcStudy->getPatientAge();
99 ::boost::algorithm::trim(age);
102 const bool same = study->getDate() == date
103 && study->getTime() == time
104 && study->getReferringPhysicianName() == refP
105 && study->getInstanceUID() == srcStudy->getInstanceUID()
106 && study->getPatientAge() == age;
108 ::fwData::String::sptr fieldNewStudy = srcStudy->getField<
::fwData::String>(s_NEW_STUDY_FIELD_NAME);
109 if(fieldNewStudy || !same)
121 if(m_date->text().trimmed().isEmpty())
123 m_paletteDate.setColor(QPalette::Base, QColor(Qt::red));
127 m_paletteDate.setColor(QPalette::Base, QColor(Qt::white));
130 m_date->setPalette(m_paletteDate);
137 if(m_time->text().trimmed().isEmpty())
139 m_paletteTime.setColor(QPalette::Base, QColor(Qt::red));
143 m_paletteTime.setColor(QPalette::Base, QColor(Qt::white));
146 m_time->setPalette(m_paletteTime);
153 if(m_description->text().trimmed().toStdString() == s_NEW_STUDY_TEXT)
155 m_paletteTime.setColor(QPalette::Base, QColor(Qt::red));
159 m_paletteTime.setColor(QPalette::Base, QColor(Qt::white));
162 m_description->setPalette(m_paletteTime);
172 ::fwMedData::Study::sptr study = m_series->getStudy();
173 SLM_ASSERT(
"Given series study is null", study);
175 m_date->setText(QString::fromStdString(study->getDate()).trimmed());
176 m_time->setText(QString::fromStdString(study->getTime()).trimmed());
177 m_referringPhysicianName->setText(QString::fromStdString(study->getReferringPhysicianName()).trimmed());
178 m_description->setText(QString::fromStdString(study->getDescription()).trimmed());
179 m_patientAge->setText(QString::fromStdString(study->getPatientAge()).trimmed());
The namespace uiMedDataQt contains editors for medical data.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
Holds series information.
This class contains an std::string value.