6 #include <qbuttongroup.h>
10 #include <qlineedit.h>
11 #include <qpushbutton.h>
12 #include <qradiobutton.h>
16 #include <qwhatsthis.h>
17 #include <qmessagebox.h>
19 superwindow::superwindow(QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl)
21 if (!name) setName("superwindow");
23 setSizePolicy( QSizePolicy((QSizePolicy::SizeType) 0, (QSizePolicy::SizeType) 0, sizePolicy().hasHeightForWidth()));
24 setMinimumSize(QSize(600, 280));
25 setMaximumSize(QSize(600, 280));
26 setCaption(tr("Superiorize Window"));
28 superlabel = new QLabel(this, "superlabel");
29 superlabel->setGeometry(QRect(10, 10, 150, 30));
30 superlabel->setSizePolicy(QSizePolicy((QSizePolicy::SizeType) 0, (QSizePolicy::SizeType) 0, superlabel->sizePolicy().hasHeightForWidth()));
31 superlabel->setMinimumSize(QSize(150, 30));
32 superlabel->setMaximumSize(QSize(150, 30));
33 superlabel->setText(tr("SUPERIORIZE"));
35 superbuttongroup = new QButtonGroup(this, "superbuttongroup");
36 superbuttongroup->setGeometry(QRect(15, 45, 575, 155));
37 superbuttongroup->setTitle(tr("options"));
38 superbuttongroup->setAlignment(int(QButtonGroup::AlignHCenter));
40 N = new QLineEdit(superbuttongroup, "N");
41 N->setGeometry(QRect(10, 45, 80, 24));
42 N->setSizePolicy(QSizePolicy((QSizePolicy::SizeType) 0, (QSizePolicy::SizeType) 0,N->sizePolicy().hasHeightForWidth()));
45 Nlabel = new QLabel(superbuttongroup, "Nlabel");
46 Nlabel->setGeometry(QRect(45, 20, 40, 20));
47 Nlabel->setText(tr("N"));
48 Nlabel->setEnabled(true);
50 a = new QLineEdit(superbuttongroup, "a");
51 a->setGeometry(QRect(100, 45, 80, 24));
52 a->setSizePolicy(QSizePolicy((QSizePolicy::SizeType) 0, (QSizePolicy::SizeType) 0,a->sizePolicy().hasHeightForWidth()));
55 alabel = new QLabel(superbuttongroup, "alabel");
56 alabel->setGeometry(QRect(135, 20, 40, 20));
57 alabel->setText(tr("a"));
58 alabel->setEnabled(true);
60 b = new QLineEdit(superbuttongroup, "b");
61 b->setGeometry(QRect(190, 45, 80, 24));
62 b->setSizePolicy(QSizePolicy((QSizePolicy::SizeType) 0, (QSizePolicy::SizeType) 0,b->sizePolicy().hasHeightForWidth()));
65 blabel = new QLabel(superbuttongroup, "blabel");
66 blabel->setGeometry(QRect(225, 20, 40, 20));
67 blabel->setText(tr("b"));
68 blabel->setEnabled(true);
70 sec_cri = new QComboBox(superbuttongroup, "sec_cri");
71 sec_cri->setGeometry(QRect(15, 100, 130, 30));
72 sec_cri->setSizePolicy(QSizePolicy((QSizePolicy::SizeType) 0, (QSizePolicy::SizeType) 0,sec_cri->sizePolicy().hasHeightForWidth()));
73 sec_cri->insertItem("TVAR", -1);
74 sec_cri->insertItem("SMOO", -1);
75 sec_cri->insertItem("SCR3", -1);
76 sec_cri->insertItem("SCR4", -1);
77 sec_cri->insertItem("SCR5", -1);
78 sec_cri->setEnabled(true);
79 //QObject::connect(sec_cri,SIGNAL(activated(int)),this,SLOT(setEpsilon()));
81 sec_crilabel = new QLabel(superbuttongroup, "sec_crilabel");
82 sec_crilabel->setGeometry(QRect(10, 80, 145, 20));
83 sec_crilabel->setText(tr("secondary criterion"));
84 sec_crilabel->setEnabled(true);
86 altl = new QComboBox(superbuttongroup, "altl");
87 altl->setGeometry(QRect(195, 100, 130, 30));
88 altl->setSizePolicy(QSizePolicy((QSizePolicy::SizeType) 0, (QSizePolicy::SizeType) 0,altl->sizePolicy().hasHeightForWidth()));
89 altl->insertItem("NONE", -1);
90 altl->insertItem("ATL1", -1);
91 altl->insertItem("ATL2", -1);
92 altl->setEnabled(true);
93 //QObject::connect(sec_cri,SIGNAL(activated(int)),this,SLOT(setEpsilon()));
95 altllabel = new QLabel(superbuttongroup, "altllabel");
96 altllabel->setGeometry(QRect(215, 80, 100, 20));
97 altllabel->setText(tr("alternative l"));
98 altllabel->setEnabled(true);
100 rprtcb = new QCheckBox( this, "rprtcb" );
101 rprtcb->setGeometry(QRect(380, 145, 80, 30));
102 rprtcb->setText( "RPRT" );
103 rprtcb->setChecked(false);
104 rprtcb->setEnabled(true);
105 QObject::connect(rprtcb,SIGNAL(clicked()),this,SLOT(setSkips()));
107 skips = new QLineEdit(superbuttongroup, "skips");
108 skips->setGeometry(QRect(450, 100, 80, 30));
109 skips->setSizePolicy(QSizePolicy((QSizePolicy::SizeType) 0, (QSizePolicy::SizeType) 0,skips->sizePolicy().hasHeightForWidth()));
110 skips->setEnabled(false);
112 skipslabel = new QLabel(superbuttongroup, "skipslabel");
113 skipslabel->setGeometry(QRect(465, 80, 60, 20));
114 skipslabel->setText(tr("skips"));
115 skipslabel->setEnabled(false);
117 okbutton = new QPushButton(this, "okbutton");
118 okbutton->setGeometry(QRect(50, 230, 100, 40));
119 okbutton->setText(tr("OK"));
120 QObject::connect(okbutton, SIGNAL(clicked()), this, SLOT(checkValues()));
122 cancelbutton = new QPushButton(this, "cancelbutton");
123 cancelbutton->setGeometry(QRect(280, 230, 100, 40));
124 cancelbutton->setText(tr("Cancel"));
125 QObject::connect(cancelbutton, SIGNAL(clicked()), this, SLOT(reject()));
129 * Destroys the object and frees any allocated resources
131 superwindow::~superwindow()
133 // no need to delete child widgets, Qt does it all for us
136 void superwindow::setSkips()
138 if (rprtcb->isChecked())
140 skips->setEnabled(TRUE);
141 skipslabel->setEnabled(TRUE);
145 skips->setEnabled(FALSE);
146 skipslabel->setEnabled(FALSE);
150 QString superwindow::getOutput()
154 output.sprintf("SUPERIORIZE ");
163 switch (sec_cri->currentItem())
166 output.append("TVAR");
169 output.append("SMOO");
172 output.append("SCR3");
175 output.append("SCR4");
178 output.append("SCR5");
182 switch (altl->currentItem())
185 // "none" is selected
188 output.append(" ATL1");
191 output.append(" ATL2");
195 if (rprtcb->isChecked())
197 output.append(" RPRT");
199 float s = strtof((const char *) skips->text());
203 output += skips->text();
210 void superwindow::checkValues()
218 iN = strtoi((const char *) N->text());
222 fa = strtof((const char *) a->text());
224 if ( fa <= 0 || fa>=1 ) f = 4;
226 fb = strtof((const char *) b->text());
228 if ( fb <= 0 || fb>1 ) f = 6;
236 QMessageBox::information(this, "SnarkInput", "Error!\n" "Invalid N format.");
240 QMessageBox::information(this, "SnarkInput", "Error!\n" "N must be >0.");
244 QMessageBox::information(this, "SnarkInput", "Error!\n" "Invalid a format.");
248 QMessageBox::information(this, "SnarkInput", "Error!\n" "a must be >0 and <1.");
252 QMessageBox::information(this, "SnarkInput", "Error!\n" "Invalid b format.");
256 QMessageBox::information(this, "SnarkInput", "Error!\n" "b must be >0 and <=1.");