diff --git a/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Image_24.png b/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Image_24.png new file mode 100644 index 0000000000..0cc489d994 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Image_24.png differ diff --git a/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Load_48.png b/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Load_48.png new file mode 100644 index 0000000000..64d5375bc0 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Load_48.png differ diff --git a/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Remove_48.png b/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Remove_48.png new file mode 100644 index 0000000000..e2b94f96f2 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.datamanagerlight/resources/Remove_48.png differ diff --git a/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.cpp b/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.cpp index 80780d18c4..a28ef0516c 100644 --- a/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.cpp +++ b/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.cpp @@ -1,56 +1,95 @@ /*=================================================================== 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 "QmitkDataManagerLightView.h" +#include "mitkNodePredicateDataType.h" #include const std::string QmitkDataManagerLightView::VIEW_ID = "org.mitk.views.datamanagerlight"; struct QmitkDataManagerLightViewData { + // static + mitk::NodePredicateBase::Pointer m_Predicate; + + // data + QList m_DataNodes; + mitk::DataNode* m_SelectedNode; + + // widget + QListWidget* m_ListWidget; }; QmitkDataManagerLightView::QmitkDataManagerLightView() : d( new QmitkDataManagerLightViewData ) { + d->m_Predicate = mitk::NodePredicateDataType::New("Image"); + d->m_SelectedNode = 0; + d->m_ListWidget = 0; } QmitkDataManagerLightView::~QmitkDataManagerLightView() { delete d; } +void QmitkDataManagerLightView::NodeAdded(const mitk::DataNode *node) +{ + if( d->m_Predicate->CheckNode(node) ) + { + mitk::DataNode* nonConstNode = const_cast(node); + d->m_DataNodes.append(nonConstNode); + d->m_ListWidget->addItem( new QListWidgetItem( QString::fromStdString( node->GetName() ) ) ); + } +} + +void QmitkDataManagerLightView::NodeRemoved(const mitk::DataNode *node) +{ + mitk::DataNode* nonConstNode = const_cast(node); + int index = d->m_DataNodes.indexOf(nonConstNode); + if( index >= 0 ) + { + d->m_DataNodes.removeAt(index); + QListWidgetItem* item = d->m_ListWidget->takeItem(index); + delete item; + } +} + void QmitkDataManagerLightView::CreateQtPartControl(QWidget* parent) { QPushButton* loadButton = new QPushButton("Load image"); - QListWidget* listWidget = new QListWidget; + d->m_ListWidget = new QListWidget; QLabel* imageInfoLabel = new QLabel("Unknown name"); QGridLayout* layout = new QGridLayout; layout->addWidget( loadButton, 0,0 ); - layout->addWidget( listWidget, 1,0 ); + layout->addWidget( d->m_ListWidget, 1,0 ); layout->addWidget( imageInfoLabel, 2,0 ); parent->setLayout(layout); } void QmitkDataManagerLightView::SetFocus() { } + +void QmitkDataManagerLightView::on_DataItemList_currentRowChanged(int currentRow) +{ +} diff --git a/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.h b/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.h index 2abc06b9f2..229a6ba2b8 100644 --- a/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.h +++ b/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.h @@ -1,61 +1,74 @@ /*=================================================================== 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 QmitkDataManagerLightView_H_ #define QmitkDataManagerLightView_H_ /// Qmitk #include struct QmitkDataManagerLightViewData; /// /// \brief Data management view with reduced functions ("light") /// class QmitkDataManagerLightView : public QmitkAbstractView { Q_OBJECT public: static const std::string VIEW_ID; // = "org.mitk.extapp.defaultperspective" /// /// \brief Standard ctor. /// QmitkDataManagerLightView(); /// /// \brief Standard dtor. /// virtual ~QmitkDataManagerLightView(); + /// + /// add the node to the list ... + /// + virtual void NodeAdded(const mitk::DataNode* node); + + /// + /// remove the node + /// + virtual void NodeRemoved(const mitk::DataNode* node); + +protected slots: + void on_DataItemList_currentRowChanged ( int currentRow ); + protected: /// /// \brief Create the view here. /// virtual void CreateQtPartControl(QWidget* parent); /// - /// + /// focus on load image /// void SetFocus(); private: QmitkDataManagerLightViewData* d; }; #endif /*QmitkDataManagerLightView_H_*/