diff --git a/Modules/IGTUI/Qmitk/QmitkNavigationToolStorageSelectionWidget.cpp b/Modules/IGTUI/Qmitk/QmitkNavigationToolStorageSelectionWidget.cpp index b3359db191..5231991dd7 100644 --- a/Modules/IGTUI/Qmitk/QmitkNavigationToolStorageSelectionWidget.cpp +++ b/Modules/IGTUI/Qmitk/QmitkNavigationToolStorageSelectionWidget.cpp @@ -1,83 +1,84 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkNavigationToolStorageSelectionWidget.h" //mitk headers #include #include #include QmitkNavigationToolStorageSelectionWidget::QmitkNavigationToolStorageSelectionWidget(QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f) { m_Controls = nullptr; CreateQtPartControl(this); CreateConnections(); } QmitkNavigationToolStorageSelectionWidget::~QmitkNavigationToolStorageSelectionWidget() { } void QmitkNavigationToolStorageSelectionWidget::CreateQtPartControl(QWidget *parent) { if (!m_Controls) { // create GUI widgets m_Controls = new Ui::QmitkNavigationToolStorageSelectionWidgetControls; m_Controls->setupUi(parent); } } void QmitkNavigationToolStorageSelectionWidget::CreateConnections() { if ( m_Controls ) { connect( (QObject*)(m_Controls->m_ServiceListWidget), SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(NavigationToolStorageSelected(us::ServiceReferenceU)) ); + connect((QObject*)(m_Controls->m_ServiceListWidget), SIGNAL(ServiceModified(us::ServiceReferenceU)), this, SLOT(NavigationToolStorageSelected(us::ServiceReferenceU))); } //initialize service list widget std::string empty = ""; m_Controls->m_ServiceListWidget->Initialize(mitk::NavigationToolStorage::US_PROPKEY_STORAGE_NAME,empty); } void QmitkNavigationToolStorageSelectionWidget::NavigationToolStorageSelected(us::ServiceReferenceU s) { if (!s) //nothing selected { //reset everything m_CurrentStorage = nullptr; emit NavigationToolStorageSelected(m_CurrentStorage); return; } // Get storage us::ModuleContext* context = us::GetModuleContext(); m_CurrentStorage = context->GetService(s); emit NavigationToolStorageSelected(m_CurrentStorage); } mitk::NavigationToolStorage::Pointer QmitkNavigationToolStorageSelectionWidget::GetSelectedNavigationToolStorage() { return this->m_CurrentStorage; } diff --git a/Modules/QtWidgets/src/QmitkServiceListWidget.cpp b/Modules/QtWidgets/src/QmitkServiceListWidget.cpp index 212695d37b..3d1474cbe1 100644 --- a/Modules/QtWidgets/src/QmitkServiceListWidget.cpp +++ b/Modules/QtWidgets/src/QmitkServiceListWidget.cpp @@ -1,260 +1,257 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ //#define _USE_MATH_DEFINES #include // STL Headers #include // microservices #include #include #include #include const std::string QmitkServiceListWidget::VIEW_ID = "org.mitk.views.QmitkServiceListWidget"; QmitkServiceListWidget::QmitkServiceListWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), m_AutomaticallySelectFirstEntry(false), m_Controls(nullptr) { CreateQtPartControl(this); } QmitkServiceListWidget::~QmitkServiceListWidget() { m_Context->RemoveServiceListener(this, &QmitkServiceListWidget::OnServiceEvent); } void QmitkServiceListWidget::SetAutomaticallySelectFirstEntry(bool automaticallySelectFirstEntry) { m_AutomaticallySelectFirstEntry = automaticallySelectFirstEntry; } //////////////////// INITIALIZATION ///////////////////// void QmitkServiceListWidget::CreateQtPartControl(QWidget *parent) { if (!m_Controls) { // create GUI widgets m_Controls = new Ui::QmitkServiceListWidgetControls; m_Controls->setupUi(parent); this->CreateConnections(); } m_Context = us::GetModuleContext(); } void QmitkServiceListWidget::CreateConnections() { if (m_Controls) { connect(m_Controls->m_ServiceList, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(OnServiceSelectionChanged())); } } void QmitkServiceListWidget::InitPrivate(const std::string &namingProperty, const std::string &filter) { if (filter.empty()) m_Filter = "(" + us::ServiceConstants::OBJECTCLASS() + "=" + m_Interface + ")"; else m_Filter = filter; m_NamingProperty = namingProperty; m_Context->RemoveServiceListener(this, &QmitkServiceListWidget::OnServiceEvent); m_Context->AddServiceListener(this, &QmitkServiceListWidget::OnServiceEvent, m_Filter); // Empty ListWidget this->m_ListContent.clear(); m_Controls->m_ServiceList->clear(); // get Services std::vector services = this->GetAllRegisteredServices(); // Transfer them to the List for (std::vector::iterator it = services.begin(); it != services.end(); ++it) AddServiceToList(*it); } ///////////// Methods & Slots Handling Direct Interaction ///////////////// bool QmitkServiceListWidget::GetIsServiceSelected() { return (this->m_Controls->m_ServiceList->currentItem() != 0); } void QmitkServiceListWidget::OnServiceSelectionChanged() { us::ServiceReferenceU ref = this->GetServiceForListItem(this->m_Controls->m_ServiceList->currentItem()); if (!ref) { emit(ServiceSelectionChanged(us::ServiceReferenceU())); return; } emit(ServiceSelectionChanged(ref)); } us::ServiceReferenceU QmitkServiceListWidget::GetSelectedServiceReference() { return this->GetServiceForListItem(this->m_Controls->m_ServiceList->currentItem()); } std::vector QmitkServiceListWidget::GetAllServiceReferences() { std::vector result; for (size_t i = 0; i < m_ListContent.size(); i++) { result.push_back(m_ListContent[i].service); } return result; } ///////////////// Methods & Slots Handling Logic ////////////////////////// void QmitkServiceListWidget::OnServiceEvent(const us::ServiceEvent event) { // MITK_INFO << "ServiceEvent" << event.GetType(); switch (event.GetType()) { case us::ServiceEvent::MODIFIED: emit(ServiceModified(event.GetServiceReference())); - // emiting this signal is necessary to notify the change in toolbox to tool storage - emit(ServiceSelectionChanged(event.GetServiceReference())); - // Change service; add a new entry if service wasn't on list before if (!this->ChangeServiceOnList(event.GetServiceReference())) { this->AddServiceToList(event.GetServiceReference()); } break; case us::ServiceEvent::REGISTERED: emit(ServiceRegistered(event.GetServiceReference())); AddServiceToList(event.GetServiceReference()); break; case us::ServiceEvent::UNREGISTERING: emit(ServiceUnregistering(event.GetServiceReference())); RemoveServiceFromList(event.GetServiceReference()); break; case us::ServiceEvent::MODIFIED_ENDMATCH: emit(ServiceModifiedEndMatch(event.GetServiceReference())); RemoveServiceFromList(event.GetServiceReference()); break; } } /////////////////////// HOUSEHOLDING CODE ///////////////////////////////// QListWidgetItem *QmitkServiceListWidget::AddServiceToList(const us::ServiceReferenceU &serviceRef) { QListWidgetItem *newItem = new QListWidgetItem; newItem->setText(this->CreateCaptionForService(serviceRef)); // Add new item to QListWidget m_Controls->m_ServiceList->addItem(newItem); m_Controls->m_ServiceList->sortItems(); // Construct link and add to internal List for reference QmitkServiceListWidget::ServiceListLink link; link.service = serviceRef; link.item = newItem; m_ListContent.push_back(link); // Select first entry and emit corresponding signal if the list was // empty before and this feature is enabled if (m_AutomaticallySelectFirstEntry && m_Controls->m_ServiceList->selectedItems().isEmpty()) { m_Controls->m_ServiceList->setCurrentIndex(m_Controls->m_ServiceList->indexAt(QPoint(0, 0))); this->OnServiceSelectionChanged(); } return newItem; } bool QmitkServiceListWidget::RemoveServiceFromList(const us::ServiceReferenceU &serviceRef) { for (std::vector::iterator it = m_ListContent.begin(); it != m_ListContent.end(); ++it) { if (serviceRef == it->service) { int row = m_Controls->m_ServiceList->row(it->item); QListWidgetItem *oldItem = m_Controls->m_ServiceList->takeItem(row); delete oldItem; this->m_ListContent.erase(it); return true; } } return false; } bool QmitkServiceListWidget::ChangeServiceOnList(const us::ServiceReferenceU &serviceRef) { for (std::vector::iterator it = m_ListContent.begin(); it != m_ListContent.end(); ++it) { if (serviceRef == it->service) { it->item->setText(this->CreateCaptionForService(serviceRef)); return true; } } return false; } us::ServiceReferenceU QmitkServiceListWidget::GetServiceForListItem(QListWidgetItem *item) { for (std::vector::iterator it = m_ListContent.begin(); it != m_ListContent.end(); ++it) if (item == it->item) return it->service; // Return invalid ServiceReference (will evaluate to false in bool expressions) return us::ServiceReferenceU(); } std::vector QmitkServiceListWidget::GetAllRegisteredServices() { // Get Service References return m_Context->GetServiceReferences(m_Interface, m_Filter); } QString QmitkServiceListWidget::CreateCaptionForService(const us::ServiceReferenceU &serviceRef) { std::string caption; // TODO allow more complex formatting if (m_NamingProperty.empty()) caption = m_Interface; else { us::Any prop = serviceRef.GetProperty(m_NamingProperty); if (prop.Empty()) { MITK_WARN << "QmitkServiceListWidget tried to resolve property '" + m_NamingProperty + "' but failed. Resorting to interface name for display."; caption = m_Interface; } else caption = prop.ToString(); } return QString::fromStdString(caption); } diff --git a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui index 31020ffa1e..3dfa24914b 100644 --- a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui +++ b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui @@ -1,928 +1,928 @@ QmitkMITKIGTTrackingToolboxViewControls 0 0 849 701 0 0 QmitkTemplate - 0 + 1 Tracking QFrame::NoFrame QFrame::Raised 0 0 QFrame::NoFrame QFrame::Raised 10 75 true true Tracking Tools Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop 0 0 ToolStorage: <none> Qt::Horizontal 40 20 0 0 Qt::Horizontal 13 49 120 0 Auto Detection 120 0 Add Single Tool 120 0 Load Tool Storage 120 0 Reset QFrame::NoFrame QFrame::Raised 10 75 true Tracking Control Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop Status: disconnected Qt::Horizontal 40 20 142 0 Connect Qt::Horizontal 40 20 142 0 Start Tracking Qt::Horizontal 40 20 <html><head/><body><p><span style=" color:#ff0000;">Tracking Frozen!</span></p></body></html> true 142 0 Freeze Tracking Options Disable All Timers true <html><head/><body><p align="right"><span style=" color:#ff0000;">Rendering Disabled!</span></p></body></html> Qt::AutoText Update Rate Options Update Rate [per second] Qt::Horizontal 40 20 100 10 Use different Render and Log Update Rates false Render Update Rate [fps] Qt::Horizontal 40 20 false 0 100 10 false Log Update Rate [per second] Qt::Horizontal 40 20 false 1 120 10 60 Tracking Volume Options true Show Tracking Volume true Select Model: Open IGT Link Enable Open IGT Link MicroService true Select Open IGT Link Data Format: TRANSFORM QTDATA TDATA POSITION Other Options Show Tool Quaternions Simple UI Caution, only for backward compatibility: Inverse mode (Quaternions are stored inverse) Tool Visualization Options true Show Tool Projection false Show Tool Axis Logging Filename: Choose File Limit Number Of Logged Frames: Qt::Horizontal 40 20 1 9999 300 CSV format true XML format Skip invalid data Logging Status Logging OFF Logged Frames: 0 Qt::Horizontal 40 20 Start Logging Stop Logging Qt::Vertical 20 40 9 742 303 70 70 50 Connect 70 50 Start Tracking Qt::Horizontal 40 20 70 50 Advanced Mode QmitkToolTrackingStatusWidget QWidget
QmitkToolTrackingStatusWidget.h
1
QmitkTrackingDeviceConfigurationWidget QWidget
QmitkTrackingDeviceConfigurationWidget.h
1
QmitkNavigationToolCreationWidget QWidget
QmitkNavigationToolCreationWidget.h
1