Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkIGTLMessageSourceSelectionWidget.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 
19 //mitk headers
20 #include <usGetModuleContext.h>
21 #include <usServiceReference.h>
22 
23 
24 
26  QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f)
27 {
28  m_Controls = NULL;
30  CreateQtPartControl(this);
31 }
32 
33 
35 {
36 
37 }
38 
40 {
41  if ( !m_Controls )
42  {
43  // create GUI widgets
44  m_Controls = new Ui::QmitkIGTLMessageSourceSelectionWidgetControls;
45  // setup GUI widgets
46  m_Controls->setupUi(parent);
47  }
48 
50 }
51 
53 {
54  if ( m_Controls )
55  {
56  connect( m_Controls->m_ServiceListWidget,
57  SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)),
59 
60  //initialize service list widget
61  std::string empty = "";
62  m_Controls->m_ServiceListWidget->Initialize<mitk::IGTLMessageSource>(
64  }
65 }
66 
68  {
69  if (!s) //nothing selected
70  {
71  //reset everything
72  this->m_CurrentIGTLMessageSource = NULL;
74  return;
75  }
76 
77  // Get storage
78  us::ModuleContext* context = us::GetModuleContext();
80  context->GetService<mitk::IGTLMessageSource>(s);
82  }
83 
85 {
86  return this->m_CurrentIGTLMessageSource;
87 }
itk::SmartPointer< Self > Pointer
void IGTLMessageSourceSelected(mitk::IGTLMessageSource::Pointer source)
This signal is emitted when a new OpenIGTLink message source is selected.
mitk::IGTLMessageSource::Pointer GetSelectedIGTLMessageSource()
OpenIGTLink message source.
static const std::string US_PROPKEY_DEVICENAME
virtual void CreateConnections()
Creation of the connections.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
Ui::QmitkIGTLMessageSourceSelectionWidgetControls * m_Controls
QmitkIGTLMessageSourceSelectionWidget(QWidget *parent=0, Qt::WindowFlags f=0)