3 @author Bruno M. Carvalho and Deniz Sarioz
4 licensed under (open-source) QPL v1.0
5 which accompanies this distribution in the file QPL
8 /****************************************************************************
9 ** Form implementation generated from reading ui file 'skunk.ui'
11 ** Created: Wed May 15 18:20:06 2002
12 ** by: The User Interface Compiler (uic)
14 ** WARNING! All changes made in this file will be lost!
15 ****************************************************************************/
18 #include "variables.h"
20 #include <qbuttongroup.h>
22 #include <qlineedit.h>
24 #include <qpushbutton.h>
25 #include <qradiobutton.h>
29 #include <qwhatsthis.h>
30 #include <qmessagebox.h>
33 * Constructs a skunkwindow which is a child of 'parent', with the
34 * name 'name' and widget flags set to 'f'
36 * The dialog will by default be modeless, unless you set 'modal' to
37 * TRUE to construct a modal dialog.
39 @author Bruno M. Carvalho
41 skunkwindow::skunkwindow( QWidget* parent, const char* name, bool modal, WFlags fl )
42 : QDialog( parent, name, modal, fl )
45 setName( "skunkwindow" );
47 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) );
48 setMinimumSize( QSize( 400, 450 ) );
49 setMaximumSize( QSize( 400, 450 ) );
50 setCaption( tr( "Skunk Window" ) );
52 skunklabel = new QLabel( this, "skunklabel" );
53 skunklabel->setGeometry( QRect( 10, 10, 90, 30 ) );
54 skunklabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, skunklabel->sizePolicy().hasHeightForWidth() ) );
55 skunklabel->setMinimumSize( QSize( 90, 30 ) );
56 skunklabel->setMaximumSize( QSize( 90, 30 ) );
57 skunklabel->setText( tr( "SKUNK" ) );
59 skunkbuttongroup = new QButtonGroup( this, "skunkbuttongroup" );
60 skunkbuttongroup->setGeometry( QRect( 40, 40, 160, 120 ) );
61 skunkbuttongroup->setTitle( tr( "type" ) );
62 skunkbuttongroup->setAlignment( int( QButtonGroup::AlignHCenter ) );
64 phantombutton = new QRadioButton( skunkbuttongroup, "phantombutton" );
65 phantombutton->setGeometry( QRect( 10, 20, 110, 24 ) );
66 phantombutton->setText( tr( "PHANTOM" ) );
68 differencebutton = new QRadioButton( skunkbuttongroup, "differencebutton" );
69 differencebutton->setGeometry( QRect( 10, 50, 130, 24 ) );
70 differencebutton->setText( tr( "DIFFERENCE" ) );
72 nonebutton = new QRadioButton( skunkbuttongroup, "nonebutton" );
73 nonebutton->setGeometry( QRect( 10, 80, 80, 24 ) );
74 nonebutton->setText( tr( "NONE" ) );
75 nonebutton->setChecked(true);
77 minimumbutton = new QRadioButton( this, "minimumbutton" );
78 minimumbutton->setGeometry( QRect( 210, 50, 100, 30 ) );
79 minimumbutton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, minimumbutton->sizePolicy().hasHeightForWidth() ) );
80 minimumbutton->setMinimumSize( QSize( 100, 30 ) );
81 minimumbutton->setMaximumSize( QSize( 100, 30 ) );
82 minimumbutton->setText( tr( "MINIMUM" ) );
83 QObject::connect(minimumbutton,SIGNAL(clicked()),this,SLOT(activateMinimumFields()));
85 min = new QLineEdit( this, "min" );
86 min->setGeometry( QRect( 320, 50, 60, 28 ) );
87 min->setEnabled(FALSE);
89 minlabel = new QLabel( this, "min" );
90 minlabel->setGeometry( QRect( 335, 30, 40, 20 ) );
91 minlabel->setText( tr( "min" ) );
92 minlabel->setEnabled(FALSE);
94 maximumbutton = new QRadioButton( this, "maximumbutton" );
95 maximumbutton->setGeometry( QRect( 210, 100, 100, 30 ) );
96 maximumbutton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, maximumbutton->sizePolicy().hasHeightForWidth() ) );
97 maximumbutton->setMinimumSize( QSize( 100, 30 ) );
98 maximumbutton->setMaximumSize( QSize( 100, 30 ) );
99 maximumbutton->setText( tr( "MAXIMUM" ) );
100 QObject::connect(maximumbutton,SIGNAL(clicked()),this,SLOT(activateMaximumFields()));
102 max = new QLineEdit( this, "max" );
103 max->setGeometry( QRect( 320, 100, 60, 28 ) );
104 max->setEnabled(FALSE);
106 maxlabel = new QLabel( this, "max" );
107 maxlabel->setGeometry( QRect( 335, 80, 40, 20 ) );
108 maxlabel->setText( tr( "max" ) );
109 maxlabel->setEnabled(FALSE);
111 skunkbuttongroup2 = new QButtonGroup( this, "skunkbuttongroup2" );
112 skunkbuttongroup2->setGeometry( QRect( 40, 170, 160, 100 ) );
113 skunkbuttongroup2->setTitle( tr( "" ) );
114 skunkbuttongroup2->setAlignment( int( QButtonGroup::AlignHCenter ) );
116 amplitudebutton = new QRadioButton( skunkbuttongroup2, "amplitudebutton" );
117 amplitudebutton->setGeometry( QRect( 10, 10, 110, 24 ) );
118 amplitudebutton->setText( tr( "AMPLITUDE" ) );
120 intensitybutton = new QRadioButton( skunkbuttongroup2, "intensitybutton" );
121 intensitybutton->setGeometry( QRect( 10, 40, 130, 24 ) );
122 intensitybutton->setText( tr( "INTENSITY" ) );
124 nonebutton2 = new QRadioButton( skunkbuttongroup2, "nonebutton2" );
125 nonebutton2->setGeometry( QRect( 10, 70, 80, 24 ) );
126 nonebutton2->setText( tr( "NONE" ) );
127 nonebutton2->setChecked(true);
129 // fuzzbutton = new QRadioButton( this, "fuzzbutton" );
130 // fuzzbutton->setGeometry( QRect( 210, 190, 90, 30 ) );
131 // fuzzbutton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, fuzzbutton->sizePolicy().hasHeightForWidth() ) );
132 // fuzzbutton->setMinimumSize( QSize( 90, 30 ) );
133 // fuzzbutton->setMaximumSize( QSize( 90, 30 ) );
134 // fuzzbutton->setText( tr( "FUZZ" ) );
136 iterationflaglabel = new QLabel( this, "iterationflaglabel" );
137 iterationflaglabel->setGeometry( QRect( 130, 275, 130, 20 ) );
138 iterationflaglabel->setText( tr( "iteration_flag_line" ) );
140 iterationflagline = new QLineEdit( this, "iterationflagline" );
141 iterationflagline->setGeometry( QRect( 50, 295, 290, 30 ) );
142 iterationflagline->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, iterationflagline->sizePolicy().hasHeightForWidth() ) );
144 Line16 = new QFrame( this, "Line16" );
145 Line16->setGeometry( QRect( 0, 375, 400, 16 ) );
146 Line16->setFrameStyle( QFrame::HLine | QFrame::Sunken );
148 okbutton = new QPushButton( this, "okbutton" );
149 okbutton->setGeometry( QRect( 50, 390, 100, 40 ) );
150 okbutton->setText( tr( "OK" ) );
151 QObject::connect(okbutton,SIGNAL(clicked()),this,SLOT(checkValues()));
153 cancelbutton = new QPushButton( this, "cancelbutton" );
154 cancelbutton->setGeometry( QRect( 250, 390, 100, 40 ) );
155 cancelbutton->setText( tr( "Cancel" ) );
156 QObject::connect(cancelbutton,SIGNAL(clicked()),this,SLOT(reject()));
160 * Destroys the object and frees any allocated resources
162 skunkwindow::~skunkwindow()
164 // no need to delete child widgets, Qt does it all for us
168 /** Activates minimum fields
170 @author Bruno M. Carvalho
172 void skunkwindow::activateMinimumFields()
174 if(minimumbutton->isChecked()) {
175 min->setEnabled(TRUE);
176 minlabel->setEnabled(TRUE);
179 min->setEnabled(FALSE);
180 minlabel->setEnabled(FALSE);
184 /** Activates maximum fields
186 @author Bruno M. Carvalho
188 void skunkwindow::activateMaximumFields()
190 if(maximumbutton->isChecked()) {
191 max->setEnabled(TRUE);
192 maxlabel->setEnabled(TRUE);
195 max->setEnabled(FALSE);
196 maxlabel->setEnabled(FALSE);
201 /** Returns a string for SKUNK input sequence
204 @author Bruno M. Carvalho
206 QString skunkwindow::getOutput()
210 output.sprintf("SKUNK ");
211 if(phantombutton->isChecked()) {
212 output.append("PHANTOM ");
215 if(differencebutton->isChecked()) {
216 output.append("DIFFERENCE ");
218 if(minimumbutton->isChecked()) {
219 output.append("MINIMUM ");
223 if(maximumbutton->isChecked()) {
224 output.append("MAXIMUM ");
228 if(amplitudebutton->isChecked()) {
229 output.append("AMPLITUDE ");
232 if(intensitybutton->isChecked()) {
233 output.append("INTENSITY ");
235 // if(fuzzbutton->isChecked()) {
236 // output.append("FUZZ ");
239 output+=iterationflagline->text();
244 void skunkwindow::checkValues()
249 if(minimumbutton->isChecked()) {
250 mi=strtof((const char *)min->text());
254 if(maximumbutton->isChecked()) {
255 ma=strtof((const char *)max->text());
258 if(minimumbutton->isChecked()) {
263 if(!isintspace(iterationflagline->text()))
268 case 1: QMessageBox::information(this,"SnarkInput","Error!\n"
269 "Invalid min format");
271 case 2: QMessageBox::information(this,"SnarkInput","Error!\n"
272 "Invalid max format");
274 case 3: QMessageBox::information(this,"SnarkInput","Error!\n"
275 "min bigger than or equal to max");
277 case 4: QMessageBox::information(this,"SnarkInput","Error!\n"
278 "iteration_flag_line must contain\n"
279 "only 0-9 and spaces and must\n"