7 #include "uiMedDataQt/widget/SeriesEditor.hpp" 9 #include "uiMedDataQt/constants.hpp" 10 #include "uiMedDataQt/InsertSeries.hpp" 12 #include <fwMedData/Series.hpp> 13 #include <fwMedData/types.hpp> 15 #include <boost/algorithm/string.hpp> 17 #include <QFormLayout> 19 #include <QHBoxLayout> 22 #include <QPushButton> 23 #include <QVBoxLayout> 32 ListInput::ListInput()
35 m_addPhysicianButton =
new QPushButton(tr(
"+"));
36 m_addPhysicianButton->setEnabled(
false);
37 m_removePhysicianButton =
new QPushButton(tr(
"-"));
38 m_removePhysicianButton->setEnabled(
false);
41 QHBoxLayout* inputLayout =
new QHBoxLayout();
43 inputLayout->addWidget(m_addPhysicianButton);
44 inputLayout->addWidget(m_removePhysicianButton);
45 QVBoxLayout* vLayout =
new QVBoxLayout();
47 vLayout->addLayout(inputLayout);
52 QObject::connect(m_addPhysicianButton, SIGNAL(clicked()),
54 QObject::connect(m_removePhysicianButton, SIGNAL(clicked()),
57 this->setLayout(vLayout);
80 for(
int i = 0; i < selectedItems.count(); ++i)
82 delete selectedItems.at(i);
94 SeriesEditor::SeriesEditor(QWidget* parent) :
97 m_modality =
new QLineEdit();
98 m_date =
new QLineEdit();
99 m_time =
new QLineEdit();
100 m_description =
new QLineEdit();
103 QFormLayout* layout =
new QFormLayout();
105 layout->addRow(tr(
"Modality"), m_modality);
106 layout->addRow(tr(
"Date"), m_date);
107 layout->addRow(tr(
"Time"), m_time);
108 layout->addRow(tr(
"Description"), m_description);
110 layout->addRow(tr(
"Physicians"), m_physicians);
112 QObject::connect(m_date, SIGNAL(textChanged(
const QString &)),
this, SLOT(onDateChanged(
const QString &)));
113 QObject::connect(m_time, SIGNAL(textChanged(
const QString &)),
this, SLOT(onTimeChanged(
const QString &)));
114 QObject::connect(m_description, SIGNAL(textChanged(
const QString &)),
this, SLOT(onDescChanged(
const QString &)));
116 QGroupBox* group =
new QGroupBox(tr(
"Series"));
117 group->setLayout(layout);
118 QVBoxLayout* topLayout =
new QVBoxLayout();
119 topLayout->addWidget(group);
120 this->setLayout(topLayout);
125 SeriesEditor::~SeriesEditor()
127 QObject::disconnect(m_date, SIGNAL(textChanged(
const QString &)),
this, SLOT(onDateChanged(
const QString &)));
128 QObject::disconnect(m_time, SIGNAL(textChanged(
const QString &)),
this, SLOT(onTimeChanged(
const QString &)));
129 QObject::disconnect(m_description, SIGNAL(textChanged(
const QString &)),
this,
130 SLOT(onDescChanged(
const QString &)));
137 if(m_date->text().trimmed().isEmpty())
139 m_palette.setColor(QPalette::Base, QColor(Qt::red));
143 m_palette.setColor(QPalette::Base, QColor(Qt::white));
146 m_date->setPalette(m_palette);
153 if(m_time->text().trimmed().isEmpty())
155 m_palette.setColor(QPalette::Base, QColor(Qt::red));
159 m_palette.setColor(QPalette::Base, QColor(Qt::white));
162 m_time->setPalette(m_palette);
169 if(m_description->text().trimmed().toStdString() == s_INSERT_NEW_SERIES_TEXT)
171 m_palette.setColor(QPalette::Base, QColor(Qt::red));
175 m_palette.setColor(QPalette::Base, QColor(Qt::white));
178 m_description->setPalette(m_palette);
188 m_modality->setText(QString::fromStdString(m_series->getModality()).trimmed());
189 m_description->setText(QString::fromStdString(m_series->getDescription()).trimmed());
190 m_date->setText(QString::fromStdString(series->
getDate()).trimmed());
191 m_time->setText(QString::fromStdString(series->
getTime()).trimmed());
194 this->onTimeChanged(m_time->text());
195 this->onDateChanged(m_date->text());
197 m_physicians->getListWidget()->clear();
198 for(::fwMedData::DicomValueType value : m_series->getPerformingPhysiciansName())
200 QListWidgetItem* newVal
201 =
new QListWidgetItem(QString::fromStdString(value).trimmed(), m_physicians->getListWidget());
209 ::fwMedData::Series::sptr series = ::uiMedDataQt::InsertSeries::New();
210 series->setModality(m_modality->text().trimmed().toStdString());
211 series->setDate(m_date->text().trimmed().toStdString());
212 series->setTime(m_time->text().trimmed().toStdString());
213 series->setDescription(m_description->text().trimmed().toStdString());
215 ::fwMedData::DicomValuesType newPerformingPhysiciansName;
216 for(
int i = 0; i < m_physicians->getListWidget()->count(); ++i)
218 newPerformingPhysiciansName.push_back(m_physicians->getListWidget()->item(i)->text().trimmed().toStdString());
221 series->setPerformingPhysiciansName(newPerformingPhysiciansName);
230 return !m_date->text().trimmed().isEmpty()
231 && !m_time->text().trimmed().isEmpty()
232 && m_description->text().trimmed().toStdString() != s_INSERT_NEW_SERIES_TEXT;
The namespace uiMedDataQt contains editors for medical data.
const DicomValueType & getTime() const
Time the Series started (0008,0031)
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
const DicomValueType & getDate() const
Date the Series started (0008,0021)
Holds series information.