7 #include "ioPacs/SPacsConfigurationEditor.hpp" 9 #include <fwCom/Signal.hpp> 10 #include <fwCom/Signal.hxx> 11 #include <fwCom/Signals.hpp> 13 #include <fwGui/dialog/MessageDialog.hpp> 15 #include <fwGuiQt/container/QtContainer.hpp> 17 #include <fwPacsIO/exceptions/Base.hpp> 19 #include <fwServices/macros.hpp> 21 #include <boost/foreach.hpp> 23 #include <QGridLayout> 24 #include <QHBoxLayout> 26 #include <QVBoxLayout> 34 static const ::fwServices::IService::KeyType s_CONFIG_INOUT =
"config";
51 _sstream <<
"SPacsConfigurationEditor::info";
60 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
62 if (!pacsConfiguration)
65 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
67 SLM_ASSERT(
"Pacs configuration object should not be null.", pacsConfiguration);
70 ::fwGuiQt::container::QtContainer::sptr qtContainer = fwGuiQt::container::QtContainer::dynamicCast(getContainer());
72 QGridLayout* gridLayout =
new QGridLayout();
77 gridLayout->addWidget(
new QLabel(
"Local application title:"), 0, 0);
83 gridLayout->addWidget(
new QLabel(
"Pacs host name:"), 2, 0);
89 gridLayout->addWidget(
new QLabel(
"Pacs application title:"), 3, 0);
96 gridLayout->addWidget(
new QLabel(
"Pacs application port:"), 4, 0);
102 gridLayout->addWidget(
new QLabel(
"Move application title:"), 5, 0);
109 gridLayout->addWidget(
new QLabel(
"Move application port:"), 6, 0);
117 (pacsConfiguration->getRetrieveMethod() == ::fwPacsIO::data::PacsConfiguration::MOVE_RETRIEVE_METHOD) ? 0 : 1);
118 gridLayout->addWidget(
new QLabel(
"Retrieve method:"), 7, 0);
125 qtContainer->setLayout(gridLayout);
130 localApplicationTitleChanged()));
131 QObject::connect(
m_pacsHostNameWidget, SIGNAL(editingFinished()),
this, SLOT(pacsHostNameChanged()));
133 SLOT(pacsApplicationTitleChanged()));
135 SLOT(pacsApplicationPortChanged(
int)));
137 SLOT(moveApplicationTitleChanged()));
139 SLOT(moveApplicationPortChanged(
int)));
140 QObject::connect(
m_retrieveMethodWidget, SIGNAL(currentIndexChanged(
int)),
this, SLOT(retrieveMethodChanged(
int)));
153 SLOT(localApplicationTitleChanged()));
154 QObject::disconnect(
m_pacsHostNameWidget, SIGNAL(editingFinished()),
this, SLOT(pacsHostNameChanged()));
156 SLOT(pacsApplicationTitleChanged()));
158 SLOT(pacsApplicationPortChanged(
int)));
160 SLOT(moveApplicationTitleChanged()));
162 SLOT(moveApplicationPortChanged(
int)));
164 SLOT(retrieveMethodChanged(
int)));
186 void SPacsConfigurationEditor::pingPacs()
188 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
190 if (!pacsConfiguration)
193 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
196 ::fwPacsIO::SeriesEnquirer::sptr seriesEnquirer = ::fwPacsIO::SeriesEnquirer::New();
198 bool success =
false;
201 seriesEnquirer->initialize(
202 pacsConfiguration->getLocalApplicationTitle(),
203 pacsConfiguration->getPacsHostName(),
204 pacsConfiguration->getPacsApplicationPort(),
205 pacsConfiguration->getPacsApplicationTitle(),
206 pacsConfiguration->getMoveApplicationTitle());
207 seriesEnquirer->connect();
208 success = seriesEnquirer->pingPacs();
209 seriesEnquirer->disconnect();
228 messageBox.
setIcon(::fwGui::dialog::IMessageDialog::INFO);
229 messageBox.
addButton(::fwGui::dialog::IMessageDialog::OK);
236 void SPacsConfigurationEditor::modifiedNotify(::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration)
247 void SPacsConfigurationEditor::localApplicationTitleChanged()
249 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
251 if (!pacsConfiguration)
254 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
258 modifiedNotify(pacsConfiguration);
263 void SPacsConfigurationEditor::pacsHostNameChanged()
265 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
267 if (!pacsConfiguration)
270 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
274 modifiedNotify(pacsConfiguration);
279 void SPacsConfigurationEditor::pacsApplicationTitleChanged()
281 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
283 if (!pacsConfiguration)
286 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
290 modifiedNotify(pacsConfiguration);
295 void SPacsConfigurationEditor::pacsApplicationPortChanged(
int value)
297 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
299 if (!pacsConfiguration)
302 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
304 pacsConfiguration->setPacsApplicationPort(static_cast<unsigned short>(value));
306 modifiedNotify(pacsConfiguration);
311 void SPacsConfigurationEditor::moveApplicationTitleChanged()
313 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
315 if (!pacsConfiguration)
318 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
322 modifiedNotify(pacsConfiguration);
327 void SPacsConfigurationEditor::moveApplicationPortChanged(
int value)
329 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
331 if (!pacsConfiguration)
334 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
336 pacsConfiguration->setMoveApplicationPort(static_cast<unsigned short>(value));
338 modifiedNotify(pacsConfiguration);
343 void SPacsConfigurationEditor::retrieveMethodChanged(
int index)
345 ::fwPacsIO::data::PacsConfiguration::sptr pacsConfiguration = this->getInOut< ::fwPacsIO::data::PacsConfiguration >(
347 if (!pacsConfiguration)
350 pacsConfiguration = this->getObject< ::fwPacsIO::data::PacsConfiguration >();
352 pacsConfiguration->setRetrieveMethod(
355 GET_RETRIEVE_METHOD));
357 modifiedNotify(pacsConfiguration);
#define FW_DEPRECATED_KEY(newKey, access, version)
Use this macro when deprecating a service key to warn the developer.
virtual IOPACS_API void starting() override
Override.
Class allowing to block a Connection.
ioPacs contains services use to deal with PACS using DCMTK library.
#define SLM_TRACE_FUNC()
Trace contextual function signature.
QPointer< QLineEdit > m_pacsApplicationTitleWidget
Pacs application title.
virtual FWGUI_API void setMessage(const std::string &msg) override
Set the message.
Defines the service interface managing the editor service for object.
IOPACS_API void info(std::ostream &_sstream) override
Override.
Defines the generic message box for IHM. Use the Delegate design pattern.
FWGUI_API void destroy()
Stops sub-views and toobar services. Destroys view, sub-views and toolbar containers.
virtual IOPACS_API ~SPacsConfigurationEditor() noexcept
Destructor.
This class defines a Pacs configuration.
virtual IOPACS_API void configuring() override
Configuring method. This method is used to configure the service.
virtual IOPACS_API void stopping() override
Override.
Base class of fwPacsIO Exceptions.
UpdateSlotType::sptr m_slotUpdate
Slot to call update method.
virtual FWGUI_API void addButton(IMessageDialog::Buttons button) override
Add a button (OK, YES_NO, YES, NO, CANCEL)
virtual FWGUI_API IMessageDialog::Buttons show() override
Show the message box and return the clicked button.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
QPointer< QLineEdit > m_localApplicationTitleWidget
Local application title.
IOPACS_API SPacsConfigurationEditor() noexcept
Constructor.
This editor service is used to edit a pacs configuration.
QPointer< QComboBox > m_retrieveMethodWidget
Retrieve method.
FWGUI_API void create()
Creates view, sub-views and toolbar containers. Manages sub-views and toobar services.
virtual FWGUI_API void setIcon(IMessageDialog::Icons icon) override
Set the icon (CRITICAL, WARNING, INFO or QUESTION)
QPointer< QLineEdit > m_pacsHostNameWidget
Pacs host name.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
#define SLM_TRACE(message)
QPointer< QPushButton > m_pingPacsButtonWidget
Test button.
QPointer< QSpinBox > m_pacsApplicationPortWidget
Pacs application port.
QPointer< QSpinBox > m_moveApplicationPortWidget
Move application port.
QPointer< QLineEdit > m_moveApplicationTitleWidget
Move application title.
IOPACS_API void updating() override
Override.
virtual FWGUI_API void setTitle(const std::string &title) override
Set the title of the message box.
FWGUI_API void initialize()
Initialize managers.