00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "QmitkLevelWindowRangeChangeDialog.h" 00019 00020 #include <QMessageBox> 00021 00022 QmitkLevelWindowRangeChangeDialog::QmitkLevelWindowRangeChangeDialog(QWidget* parent, Qt::WindowFlags f) 00023 : QDialog(parent, f) 00024 { 00025 this->setupUi(this); 00026 00027 QObject::connect(okButton, SIGNAL(clicked()), this, SLOT(inputValidator())); 00028 } 00029 00030 int QmitkLevelWindowRangeChangeDialog::getLowerLimit() 00031 { 00032 return rangeMinSpinBox->value(); 00033 } 00034 00035 int QmitkLevelWindowRangeChangeDialog::getUpperLimit() 00036 { 00037 return rangeMaxSpinBox->value(); 00038 } 00039 00040 void QmitkLevelWindowRangeChangeDialog::setLowerLimit( int rangeMin ) 00041 { 00042 rangeMinSpinBox->setValue(rangeMin); 00043 } 00044 00045 void QmitkLevelWindowRangeChangeDialog::setUpperLimit( int rangeMax ) 00046 { 00047 rangeMaxSpinBox->setValue(rangeMax); 00048 } 00049 00050 void QmitkLevelWindowRangeChangeDialog::inputValidator() 00051 { 00052 if (!(rangeMinSpinBox->value() < rangeMaxSpinBox->value())) 00053 { 00054 QMessageBox::critical( this, "Change Range", 00055 "Upper limit has to be greater than lower limit.\n" 00056 "Please enter limits again." ); 00057 } 00058 else 00059 this->accept(); 00060 }