00001 //###################################################################### 00002 // 00003 // GraspIt! 00004 // Copyright (C) 2002-2009 Columbia University in the City of New York. 00005 // All rights reserved. 00006 // 00007 // GraspIt! is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // GraspIt! is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with GraspIt!. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // Author(s): Andrew T. Miller 00021 // 00022 // $Id: gwsProjDlg.cpp,v 1.3 2009/03/25 22:10:14 cmatei Exp $ 00023 // 00024 //###################################################################### 00025 00030 #include "gwsProjDlg.h" 00031 00032 #include <QVariant> 00033 #include <QButtonGroup> 00034 #include <QCheckBox> 00035 #include <QComboBox> 00036 #include <QPushButton> 00037 #include <QImage> 00038 #include <QPixmap> 00039 00040 #include "gws.h" 00041 00042 /* // not needed? 00043 static QPixmap uic_load_pixmap_GWSProjDlg( const QString &name ) 00044 { 00045 const QMimeSource *m = QMimeSourceFactory::defaultFactory()->data( name ); 00046 if ( !m ) 00047 return QPixmap(); 00048 QPixmap pix; 00049 QImageDrag::decode( m, pix ); 00050 return pix; 00051 } 00052 */ 00053 00068 GWSProjDlg::GWSProjDlg( QWidget * parent) : QDialog( parent ) 00069 { 00070 setupUi(this); 00071 coordButtonGroup = new QButtonGroup(this); 00072 coordButtonGroup->setExclusive(false); 00073 QObject::connect(coordButtonGroup, SIGNAL(buttonClicked(int)),this,SLOT(coordBoxClicked(int))); 00074 coordButtonGroup->addButton(fxCheckBox); 00075 coordButtonGroup->addButton(fyCheckBox); 00076 coordButtonGroup->addButton(fzCheckBox); 00077 coordButtonGroup->addButton(txCheckBox); 00078 coordButtonGroup->addButton(tyCheckBox); 00079 coordButtonGroup->addButton(tzCheckBox); 00080 coordButtonGroup->setId(fxCheckBox,0); 00081 coordButtonGroup->setId(fyCheckBox,1); 00082 coordButtonGroup->setId(fzCheckBox,2); 00083 coordButtonGroup->setId(txCheckBox,3); 00084 coordButtonGroup->setId(tyCheckBox,4); 00085 coordButtonGroup->setId(tzCheckBox,5); 00086 //coordButtonGroup->hide(); 00087 for (int i=0;GWS::TYPE_LIST[i];i++) 00088 gwsTypeComboBox->insertItem(QString(GWS::TYPE_LIST[i])); 00089 OKButton->setEnabled(false); 00090 } 00091 00099 void GWSProjDlg::coordBoxClicked(int buttonNum) 00100 { 00101 QAbstractButton *b = coordButtonGroup->button(buttonNum); 00102 if (b->isChecked()) { 00103 if (whichFixed.size() < 3) { 00104 whichFixed.insert(buttonNum); 00105 if (whichFixed.size() == 3) OKButton->setEnabled(true); 00106 } 00107 else 00108 b->toggle(); 00109 } 00110 else { 00111 whichFixed.erase(buttonNum); 00112 OKButton->setEnabled(false); 00113 } 00114 } 00115 00119 GWSProjDlg::~GWSProjDlg() 00120 { 00121 // no need to delete child widgets, Qt does it all for us 00122 } 00123