3 @author Bruno M. Carvalho and Deniz Sarioz
4 modified by Joanna Klukowska (June 2008)
5 added two fields in LAST line fore agreement with snark14
6 licensed under (open-source) QPL v1.0
7 which accompanies this distribution in the file QPL
10 /****************************************************************************
11 ** Form implementation generated from reading ui file 'display.ui'
13 ** Created: Tue May 14 10:50:39 2002
14 ** by: The User Interface Compiler (uic)
16 ** WARNING! All changes made in this file will be lost!
17 ****************************************************************************/
20 #include "variables.h"
22 #include <qcheckbox.h>
25 #include <qlineedit.h>
26 #include <qpushbutton.h>
27 #include <qradiobutton.h>
31 #include <qwhatsthis.h>
32 #include <qmessagebox.h>
35 * Constructs a displaywindow which is a child of 'parent', with the
36 * name 'name' and widget flags set to 'f'
38 * The dialog will by default be modeless, unless you set 'modal' to
39 * TRUE to construct a modal dialog.
41 displaywindow::displaywindow( QWidget* parent, const char* name, bool modal, WFlags fl )
42 : QDialog( parent, name, modal, fl )
45 setName( "displaywindow" );
47 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) );
48 setMinimumSize( QSize( 400, 350 ) );
49 setMaximumSize( QSize( 400, 350 ) );
50 setCaption( tr( "Display Window" ) );
52 displaylabel = new QLabel( this, "displaylabel" );
53 displaylabel->setGeometry( QRect( 10, 10, 100, 30 ) );
54 displaylabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, displaylabel->sizePolicy().hasHeightForWidth() ) );
55 displaylabel->setMinimumSize( QSize( 100, 30 ) );
56 displaylabel->setMaximumSize( QSize( 100, 30 ) );
57 displaylabel->setText( tr( "DISPLAY" ) );
59 scalebox = new QCheckBox( this, "scalebox" );
60 scalebox->setGeometry( QRect( 30, 60, 80, 30 ) );
61 scalebox->setText( tr( "SCALE" ) );
62 QObject::connect(scalebox,SIGNAL(clicked()),this,SLOT(activateScaleFields()));
64 scale = new QLineEdit( this, "lowervalue" );
65 scale->setGeometry( QRect( 150, 60, 50, 30 ) );
66 scale->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, scale->sizePolicy().hasHeightForWidth() ) );
67 scale->setEnabled(FALSE);
69 scalelabel = new QLabel( this, "scalelabel" );
70 scalelabel->setGeometry( QRect( 150, 40, 40, 20 ) );
71 scalelabel->setText( tr( "scale" ) );
72 scalelabel->setEnabled(FALSE);
74 phantombox = new QCheckBox( this, "columnsbox" );
75 phantombox->setGeometry( QRect( 30, 130, 110, 30 ) );
76 phantombox->setText( tr( "PHANTOM" ) );
78 iterationflagline = new QLineEdit( this, "iterationflagline" );
79 iterationflagline->setGeometry( QRect( 50, 200, 310, 30 ) );
80 iterationflagline->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, iterationflagline->sizePolicy().hasHeightForWidth() ) );
82 iterationflaglabel = new QLabel( this, "iterationflaglabel" );
83 iterationflaglabel->setGeometry( QRect( 140, 180, 130, 20 ) );
84 iterationflaglabel->setText( tr( "iteration_flag_line" ) );
86 Line1 = new QFrame( this, "Line1" );
87 Line1->setGeometry( QRect( 0, 275, 400, 16 ) );
88 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
90 okbutton = new QPushButton( this, "okbutton" );
91 okbutton->setGeometry( QRect( 50, 290, 100, 40 ) );
92 okbutton->setText( tr( "OK" ) );
93 QObject::connect(okbutton,SIGNAL(clicked()),this,SLOT(checkValues()));
95 cancelbutton = new QPushButton( this, "cancelbutton" );
96 cancelbutton->setGeometry( QRect( 250, 290, 100, 40 ) );
97 cancelbutton->setText( tr( "Cancel" ) );
98 QObject::connect(cancelbutton,SIGNAL(clicked()),this,SLOT(reject()));
102 * Destroys the object and frees any allocated resources
104 displaywindow::~displaywindow()
106 // no need to delete child widgets, Qt does it all for us
109 /** Activates scale subfields
111 @author Bruno M. Carvalho
113 void displaywindow::activateScaleFields()
115 if(scalebox->isChecked()) {
116 scale->setEnabled(TRUE);
117 scalelabel->setEnabled(TRUE);
120 scale->setEnabled(FALSE);
121 scalelabel->setEnabled(FALSE);
125 /** Returns a string for DISPLAY input sequence
128 @author Bruno M. Carvalho
130 QString displaywindow::getOutput()
134 output.sprintf("DISPLAY ");
135 if(scalebox->isChecked()) {
136 output.append("SCALE ");
137 output+=scale->text();
140 if(phantombox->isChecked()) {
141 output.append("PHANTOM");
144 output+=iterationflagline->text();
148 void displaywindow::checkValues()
153 if(scalebox->isChecked()) {
154 s=strtof((const char *)scale->text().lower());
160 if(!isintspace(iterationflagline->text()))
165 case 1: QMessageBox::information(this,"SnarkInput","Error!\n"
166 "Invalid scale format");
168 case 2: QMessageBox::information(this,"SnarkInput","Error!\n"
169 "scale should be positive");
171 case 3: QMessageBox::information(this,"SnarkInput","Error!\n"
172 "iteration_flag_line must contain\n"
173 "only 0-9 and spaces and must\n"