Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
15 #include <QThread>
16 
17 const std::string QmitkNDIAbstractDeviceWidget::VIEW_ID = "org.mitk.views.NDIAbstractDeviceWidget";
18 
22  , m_ScanPortsWorkerThread(new QThread())
23 {
24 }
25 
27 {
29  CreateConnections();
30 }
31 
33 {
36 }
37 
38 void QmitkNDIAbstractDeviceWidget::CreateConnections()
39 {
40  //slots for the worker thread
41  connect(m_ScanPortsWorker, SIGNAL(PortsScanned(int, QString, int)), this, SLOT(AutoScanPortsFinished(int, QString, int)));
42  connect(m_ScanPortsWorkerThread, SIGNAL(started()), m_ScanPortsWorker, SLOT(ScanPortsThreadFunc()));
43 }
44 
46 {
47  this->setEnabled(false);
48  AddOutput("<br>Scanning...");
49  m_ScanPortsWorkerThread->start();
50 }
51 
52 void QmitkNDIAbstractDeviceWidget::AutoScanPortsFinished(int Port, QString result, int PortType)
53 {
55 #ifdef WIN32
56  if (PortType != -1) { MITK_WARN << "Port type is specified although this should not be the case for Windows. Ignoring port type."; }
57 #else //linux systems
58  SetPortTypeToGUI(PortType);
59 #endif
60  SetPortValueToGUI(Port);
61  AddOutput(result.toStdString());
62  this->setEnabled(true);
63 }
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:19
PERSISTENCE_GET_SERVICE_METHOD_MACRO void InitializeSuperclassWidget()
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
void AddOutput(std::string s) override=0
Optional method to add output to a small screen in the trackingToolbox (see QmitkNDIPolarisWidget) ...
QmitkNDIAbstractDeviceWidget(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)