diff --git a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h index 16145d205d..3fe06a2875 100644 --- a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h +++ b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h @@ -1,98 +1,98 @@ /*=================================================================== 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. ===================================================================*/ #ifndef _QmitkUSDeviceManagerWidget_H_INCLUDED #define _QmitkUSDeviceManagerWidget_H_INCLUDED #include "mitkUSUIExports.h" #include "ui_QmitkUSDeviceManagerWidgetControls.h" #include "mitkUSDeviceService.h" //QT headers #include #include //mitk header /** * @brief TODO * * @ingroup USUI */ class MitkUSUI_EXPORT QmitkUSDeviceManagerWidget :public QWidget { //this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT public: static const std::string VIEW_ID; QmitkUSDeviceManagerWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); virtual ~QmitkUSDeviceManagerWidget(); void Initialize(mitk::USDeviceService::Pointer deviceService); /* @brief This method is part of the widget an needs not to be called seperately. */ virtual void CreateQtPartControl(QWidget *parent); /* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/ virtual void CreateConnections(); signals: - /*! + /* \brief Sent, when the user clicks "Activate Device" */ void USDeviceActivated(); public slots: - /*! + /* \brief Should be called from the Implementing bundle whenever changes to the DeviceService happen */ void OnDeviceServiceUpdated(); protected slots: - /*! + /* \brief Called, when the Button Activate Device was clicked */ void OnClickedActivateDevice(); - /*! + /* \brief Called, when the Button Disconnect Device was clicked */ void OnClickedDisconnectDevice(); protected: Ui::QmitkUSDeviceManagerWidgetControls* m_Controls; ///< member holding the UI elements of this widget - /*! + /* \brief Constrcuts a ListItem from the given devie for display in the list of active devices */ QListWidgetItem* ConstructItemFromDevice(mitk::USDevice::Pointer device); private: mitk::USDeviceService::Pointer m_DeviceService; }; #endif // _QmitkUSDeviceManagerWidget_H_INCLUDED diff --git a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidgetControls.ui b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidgetControls.ui index 889a9ef7cb..12e83cb191 100644 --- a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidgetControls.ui +++ b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidgetControls.ui @@ -1,57 +1,57 @@ QmitkUSDeviceManagerWidgetControls 0 0 405 231 0 0 - QmitkToFConnection + QmitkUSDeviceManagerWidget 11 Connected Devices: Activate Device Disconnect Device diff --git a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.H similarity index 79% copy from Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h copy to Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.H index 16145d205d..0eb6bcb92f 100644 --- a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.H @@ -1,98 +1,98 @@ /*=================================================================== 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. ===================================================================*/ -#ifndef _QmitkUSDeviceManagerWidget_H_INCLUDED -#define _QmitkUSDeviceManagerWidget_H_INCLUDED +#ifndef _QmitkUSNewVideoDeviceWidget_H_INCLUDED +#define _QmitkUSNewVideoDeviceWidget_H_INCLUDED #include "mitkUSUIExports.h" -#include "ui_QmitkUSDeviceManagerWidgetControls.h" +#include "ui_QmitkUSNewVideoDeviceWidgetControls.h" #include "mitkUSDeviceService.h" //QT headers #include #include //mitk header /** * @brief TODO * * @ingroup USUI */ -class MitkUSUI_EXPORT QmitkUSDeviceManagerWidget :public QWidget +class MitkUSUI_EXPORT QmitkUSNewVideoDeviceWidget :public QWidget { //this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT public: static const std::string VIEW_ID; - QmitkUSDeviceManagerWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); - virtual ~QmitkUSDeviceManagerWidget(); + QmitkUSNewVideoDeviceWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); + virtual ~QmitkUSNewVideoDeviceWidget(); void Initialize(mitk::USDeviceService::Pointer deviceService); /* @brief This method is part of the widget an needs not to be called seperately. */ virtual void CreateQtPartControl(QWidget *parent); /* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/ virtual void CreateConnections(); signals: - /*! + /* \brief Sent, when the user clicks "Activate Device" */ void USDeviceActivated(); public slots: - /*! + /* \brief Should be called from the Implementing bundle whenever changes to the DeviceService happen */ void OnDeviceServiceUpdated(); protected slots: - /*! + /* \brief Called, when the Button Activate Device was clicked */ void OnClickedActivateDevice(); - /*! + /* \brief Called, when the Button Disconnect Device was clicked */ void OnClickedDisconnectDevice(); protected: - Ui::QmitkUSDeviceManagerWidgetControls* m_Controls; ///< member holding the UI elements of this widget + Ui::QmitkUSNewVideoDeviceWidgetControls* m_Controls; ///< member holding the UI elements of this widget - /*! + /* \brief Constrcuts a ListItem from the given devie for display in the list of active devices */ QListWidgetItem* ConstructItemFromDevice(mitk::USDevice::Pointer device); private: mitk::USDeviceService::Pointer m_DeviceService; }; -#endif // _QmitkUSDeviceManagerWidget_H_INCLUDED +#endif // _QmitkUSNewVideoDeviceWidget_H_INCLUDED diff --git a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp new file mode 100644 index 0000000000..493d22a06b --- /dev/null +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp @@ -0,0 +1,104 @@ +/*=================================================================== + +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 + +//QT headers + + +//mitk headers + + +//itk headers + + +const std::string QmitkUSNewVideoDeviceWidget::VIEW_ID = "org.mitk.views.QmitkUSNewVideoDeviceWidget"; + +QmitkUSNewVideoDeviceWidget::QmitkUSNewVideoDeviceWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f) +{ + m_Controls = NULL; + CreateQtPartControl(this); +} + +QmitkUSNewVideoDeviceWidget::~QmitkUSNewVideoDeviceWidget() +{ +} + +//////////////////// INITIALIZATION ///////////////////// + +void QmitkUSNewVideoDeviceWidget::Initialize (mitk::USDeviceService::Pointer deviceService){ + m_DeviceService = deviceService; +} + + +void QmitkUSNewVideoDeviceWidget::CreateQtPartControl(QWidget *parent) +{ + if (!m_Controls) + { + // create GUI widgets + m_Controls = new Ui::QmitkUSNewVideoDeviceWidgetControls; + m_Controls->setupUi(parent); + this->CreateConnections(); + } +} + +void QmitkUSNewVideoDeviceWidget::CreateConnections() +{ + if ( m_Controls ) + { + connect( m_Controls->m_BtnActivate, SIGNAL(clicked()), this, SLOT(OnClickedActivateDevice()) ); + connect( m_Controls->m_BtnDisconnect, SIGNAL(clicked()), this, SLOT(OnClickedDisconnectDevice()) ); + } +} + + +///////////// Methods & Slots Handling Direct Interaction ///////////////// + +void QmitkUSNewVideoDeviceWidget::OnClickedActivateDevice(){ + MITK_INFO << "Activated Device"; +} + +void QmitkUSNewVideoDeviceWidget::OnClickedDisconnectDevice(){ + MITK_INFO << "Disconnected Device"; +} + + + +///////////////// Methods & Slots Handling Logic ////////////////////////// + +void QmitkUSNewVideoDeviceWidget::OnDeviceServiceUpdated(){ + // Empty ListWidget + m_Controls->m_ConnectedDevices->clear(); + // get active Devices + std::vector devices = m_DeviceService->GetActiveDevices(); + + + for(std::vector::iterator it = devices.begin(); it != devices.end(); ++it) { + QListWidgetItem *newItem = ConstructItemFromDevice(it->GetPointer()); + m_Controls->m_ConnectedDevices->addItem(newItem); + } +} + + +/////////////////////// HOUSEHOLDING CODE ///////////////////////////////// + +QListWidgetItem* QmitkUSNewVideoDeviceWidget::ConstructItemFromDevice(mitk::USDevice::Pointer device){ + QListWidgetItem *result = new QListWidgetItem; + std::string text = device->GetDeviceManufacturer() + "|" + device->GetDeviceModel(); + result->setText(text.c_str()); + return result; +} \ No newline at end of file diff --git a/Modules/USUI/files.cmake b/Modules/USUI/files.cmake index 473be01dee..0747fcff17 100644 --- a/Modules/USUI/files.cmake +++ b/Modules/USUI/files.cmake @@ -1,16 +1,19 @@ set(CPP_FILES Qmitk/QmitkUSDeviceManagerWidget.cpp + Qmitk/QmitkUSNewVideoDeviceWidget.cpp ) set(UI_FILES Qmitk/QmitkUSDeviceManagerWidgetControls.ui + Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui ) set(MOC_H_FILES Qmitk/QmitkUSDeviceManagerWidget.h + Qmitk/QmitkUSNewVideoDeviceWidget.h ) # uncomment the following line if you want to use Qt resources set(QRC_FILES # resources/QmitkToFUtilWidget.qrc ) diff --git a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupportControls.ui b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupportControls.ui index fd9034e991..60b12dcbf1 100644 --- a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupportControls.ui +++ b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupportControls.ui @@ -1,135 +1,144 @@ UltrasoundSupportControls 0 0 467 461 0 0 QmitkTemplate 0 Device Manager 12 75 true Connected Devices: Debug: Add Device To Service + + + Qt::Vertical 20 40 US Imaging old QLabel { color: rgb(255, 0, 0) } Please select an image! Do image processing Do Something Qt::Vertical QSizePolicy::Expanding 17 348 QmitkUSDeviceManagerWidget QWidget
QmitkUSDeviceManagerWidget.h
1
+ + QmitkUSNewVideoDeviceWidget + QWidget +
QmitkUSNewVideoDeviceWidget.h
+ 1 +