Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkNDIAbstractDeviceWidget.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 #include <QThread>
20 
21 const std::string QmitkNDIAbstractDeviceWidget::VIEW_ID = "org.mitk.views.NDIAbstractDeviceWidget";
22 
26  , m_ScanPortsWorkerThread(new QThread())
27 {
28 }
29 
31 {
33  CreateConnections();
34 }
35 
37 {
40 }
41 
42 void QmitkNDIAbstractDeviceWidget::CreateConnections()
43 {
44  //slots for the worker thread
45  connect(m_ScanPortsWorker, SIGNAL(PortsScanned(int, QString, int)), this, SLOT(AutoScanPortsFinished(int, QString, int)));
46  connect(m_ScanPortsWorkerThread, SIGNAL(started()), m_ScanPortsWorker, SLOT(ScanPortsThreadFunc()));
47 }
48 
50 {
51  this->setEnabled(false);
52  AddOutput("<br>Scanning...");
53  m_ScanPortsWorkerThread->start();
54 }
55 
56 void QmitkNDIAbstractDeviceWidget::AutoScanPortsFinished(int Port, QString result, int PortType)
57 {
59 #ifdef WIN32
60  if (PortType != -1) { MITK_WARN << "Port type is specified although this should not be the case for Windows. Ignoring port type."; }
61 #else //linux systems
62  SetPortTypeToGUI(PortType);
63 #endif
64  SetPortValueToGUI(Port);
65  AddOutput(result.toStdString());
66  this->setEnabled(true);
67 }
QmitkNDIAbstractDeviceWidget(QWidget *parent=0, Qt::WindowFlags f=0)
void PortsScanned(int Port, QString result, int PortType)
QmitkTrackingDeviceConfigurationWidgetScanPortsWorker * m_ScanPortsWorker
void AutoScanPortsFinished(int Port, QString result, int PortType)
virtual void SetPortTypeToGUI(int portType)=0
virtual void SetPortValueToGUI(int portValue)=0
#define MITK_WARN
Definition: mitkLogMacros.h:23
PERSISTENCE_GET_SERVICE_METHOD_MACRO void InitializeSuperclassWidget()
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
virtual void AddOutput(std::string s)=0
Optional method to add output to a small screen in the trackingToolbox (see QmitkNDIPolarisWidget) ...