Program: vv
Module: $RCSfile: vvToolSimpleInputSelectorWidget.cxx,v $
Language: C++
- Date: $Date: 2010/03/17 11:23:46 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2010/03/24 20:35:13 $
+ Version: $Revision: 1.3 $
Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
Copyright (C) 2010
#include "vvToolSimpleInputSelectorWidget.h"
#include "vvSlicerManager.h"
+#include <QAbstractButton>
//------------------------------------------------------------------------------
vvToolSimpleInputSelectorWidget::vvToolSimpleInputSelectorWidget(QWidget * parent, Qt::WindowFlags f):
connect(mInputSelectionButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(mInputSelectionButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(mInputSequenceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeInput(int)));
- DD("vvToolSimpleInputSelectorWidget::Initialize");
- DD(mSlicerManagerList.size());
if (mSlicerManagerList.size() == 1) {
- DD("Initialize::accept");
- accept();
+ if (!mAllowSkip) accept();
}
+ if (mSlicerManagerList.size() == 0) {
+ reject();
+ }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::SetText(QString & s) {
+ mGroupBox->setTitle(s);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::EnableAllowSkip(bool b) {
+ mAllowSkip = b;
+ if (mAllowSkip) {
+ mInputSelectionButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Discard);
+ connect(mInputSelectionButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(skip(QAbstractButton*)));
+ }
+ else
+ mInputSelectionButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolSimpleInputSelectorWidget::SetInputList(const std::vector<vvSlicerManager*> & l, int index) {
- DD("vvToolSimpleInputSelectorWidget::SetInputList");
- DD(index);
+ if (l.size() == 0) {
+ // TODO !!!
+ DD("no input > error message");
+ reject();
+ }
mInputSequenceBox->clear();
for(unsigned int i=0; i<l.size(); i++)
mSlicerManagerList.push_back(l[i]);
mInputSequenceBox->addItem(mSlicerManagerList[i]->GetFileName().c_str());
}
mInputSequenceBox->setCurrentIndex(mCurrentIndex);
- if (mSlicerManagerList.size() == 0) {
- // TODO !!!
- DD("no input > error message");
- reject();
- }
+ changeInput(mCurrentIndex);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvToolSimpleInputSelectorWidget::reject() {
- DD("vvToolSimpleInputSelectorWidget::reject()");
emit rejected();
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::skip(QAbstractButton* b) {
+ if (b->text() == "Discard") emit sigskip();
+}
+//------------------------------------------------------------------------------
+
+
//------------------------------------------------------------------------------
void vvToolSimpleInputSelectorWidget::changeInput(int index) {
- DD("changeInput");
- DD(index);
if (index<0) return;
mCurrentIndex = index;
vvImage * mCurrentImage = mSlicerManagerList[index]->GetImage();