MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkAbstractTrackingDeviceWidget.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14
15#include <QThread>
16
18 : QWidget(parent, f)
19 , m_TestConnectionWorker(nullptr)
20 , m_TestConnectionWorkerThread(nullptr)
21 , m_ErrorMessage("")
22 , isInitialized(false)
23{
24}
25
34
39
41{
43 AddOutput(output.toStdString());
44 MITK_INFO << "Test connection: " << connected;
45 this->setEnabled(true);
46}
47
49{
50 this->setEnabled(false);
51 //construct a tracking device:
52 mitk::TrackingDevice::Pointer testTrackingDevice = GetTrackingDevice();
53 m_TestConnectionWorker->SetTrackingDevice(testTrackingDevice);
55}
56
57void QmitkAbstractTrackingDeviceWidget::CreateConnections() {
58 connect(m_TestConnectionWorker, SIGNAL(ConnectionTested(bool, QString)), this, SLOT(TestConnectionFinished(bool, QString)));
59 connect(m_TestConnectionWorkerThread, SIGNAL(started()), m_TestConnectionWorker, SLOT(TestConnectionThreadFunc()));
60
61 //move the worker to the thread
63}
64
66{
67 QmitkAbstractTrackingDeviceWidget* clonedWidget = this->Clone(parent);
68 if (!clonedWidget->IsInitialized())
69 MITK_ERROR << "Your cloned widget is not initialized!";
70 clonedWidget->create();
71
72 return clonedWidget;
73}
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
virtual mitk::TrackingDevice::Pointer GetTrackingDevice()=0
void TestConnectionFinished(bool connected, QString output)
PERSISTENCE_GET_SERVICE_METHOD_MACRO void InitializeSuperclassWidget()
QmitkAbstractTrackingDeviceWidget(QWidget *parent=nullptr, Qt::WindowFlags f={})
virtual QmitkAbstractTrackingDeviceWidget * Clone(QWidget *parent=nullptr) const =0
Subclass must implement this method to return a pointer to a copy of the object. Please don't forget ...
void ConnectionTested(bool connected, QString output)
std::string m_ErrorMessage
current problem description
QmitkTrackingDeviceConfigurationWidgetConnectionWorker * m_TestConnectionWorker
virtual void AddOutput(std::string)
Optional method to add output to a small screen in the trackingToolbox (see QmitkNDIPolarisWidget)
QmitkAbstractTrackingDeviceWidget * CloneForQt(QWidget *parent=nullptr) const
Return pointer to copy of the object. Internally use of QmitkUSAbstractCustomWidget::Clone() with add...