diff --git a/Plugins/org.mitk.gui.qt.datamanagerlight/resources/DataManagerLight.qrc b/Plugins/org.mitk.gui.qt.datamanagerlight/resources/DataManagerLight.qrc
index aa773c96b6..dae63e4703 100644
--- a/Plugins/org.mitk.gui.qt.datamanagerlight/resources/DataManagerLight.qrc
+++ b/Plugins/org.mitk.gui.qt.datamanagerlight/resources/DataManagerLight.qrc
@@ -1,5 +1,8 @@
-
+
DataManagerLight.png
+ Image_24.png
+ Load_48.png
+ Remove_48.png
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 a28ef0516c..1c4ccd9994 100644
--- a/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.cpp
+++ b/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.cpp
@@ -1,95 +1,128 @@
/*===================================================================
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;
+ QIcon m_ItemIcon;
// data
QList m_DataNodes;
- mitk::DataNode* m_SelectedNode;
+ int m_CurrentIndex;
// widget
QListWidget* m_ListWidget;
+ QLabel* m_ImageInfoLabel;
};
QmitkDataManagerLightView::QmitkDataManagerLightView()
: d( new QmitkDataManagerLightViewData )
{
d->m_Predicate = mitk::NodePredicateDataType::New("Image");
- d->m_SelectedNode = 0;
+ d->m_ItemIcon = QIcon(":/org.mitk.gui.qt.datamanagerlight/Image_24.png");
+ d->m_CurrentIndex = -1;
d->m_ListWidget = 0;
+ d->m_ImageInfoLabel = 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() ) ) );
+ d->m_ListWidget->addItem( new QListWidgetItem( d->m_ItemIcon, 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);
+ MITK_INFO << "removing node at: " << index;
QListWidgetItem* item = d->m_ListWidget->takeItem(index);
delete item;
+
+ d->m_DataNodes.removeAt(index);
+ MITK_INFO << "item deleted";
}
}
void QmitkDataManagerLightView::CreateQtPartControl(QWidget* parent)
{
QPushButton* loadButton = new QPushButton("Load image");
d->m_ListWidget = new QListWidget;
- QLabel* imageInfoLabel = new QLabel("Unknown name");
+ d->m_ImageInfoLabel = new QLabel;
QGridLayout* layout = new QGridLayout;
layout->addWidget( loadButton, 0,0 );
- layout->addWidget( d->m_ListWidget, 1,0 );
- layout->addWidget( imageInfoLabel, 2,0 );
+ layout->addWidget( d->m_ImageInfoLabel, 1,0 );
+ layout->addWidget( d->m_ListWidget, 2,0 );
parent->setLayout(layout);
+
+ connect(d->m_ListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(on_DataItemList_currentRowChanged(int)) );
+ this->EvaluateLabelString();
}
void QmitkDataManagerLightView::SetFocus()
{
}
void QmitkDataManagerLightView::on_DataItemList_currentRowChanged(int currentRow)
{
+ MITK_INFO << "DataItemList currentRowChanged: " << currentRow;
+ Q_UNUSED(currentRow)
+
+ this->EvaluateLabelString();
+}
+
+void QmitkDataManagerLightView::EvaluateLabelString()
+{
+ d->m_CurrentIndex = d->m_ListWidget->currentRow();
+ MITK_INFO << "the currently selected index: " << d->m_CurrentIndex;
+
+ QString newLabelText = "Current patient: ";
+ if( d->m_CurrentIndex >= 0 )
+ {
+ // TODO WHERE IS THE PATIENT NAME?
+ std::string name = d->m_DataNodes.at(d->m_CurrentIndex)->GetName();
+ newLabelText.append( QString("%1" ).arg( QString::fromStdString(name) ) );
+ }
+ else
+ {
+ newLabelText.append("Unknown");
+ }
+ d->m_ImageInfoLabel->setText(newLabelText);
}
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 229a6ba2b8..5c8c95cb2d 100644
--- a/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.h
+++ b/Plugins/org.mitk.gui.qt.datamanagerlight/src/internal/QmitkDataManagerLightView.h
@@ -1,74 +1,79 @@
/*===================================================================
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);
+ ///
+ /// evaluate the new label string
+ ///
+ void EvaluateLabelString();
+
///
/// focus on load image
///
void SetFocus();
private:
QmitkDataManagerLightViewData* d;
};
#endif /*QmitkDataManagerLightView_H_*/