Fixed text file permissions
[snark14.git] / tools / Input / experiment.cpp
1 /** @file experiment.cpp
2     @package snark14Input
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
6 */
7
8 #include "experiment.h"
9
10 #include <qframe.h>
11 #include <qlabel.h>
12 #include <qlineedit.h>
13 #include <qpushbutton.h>
14 #include <qlayout.h>
15 #include <qvariant.h>
16 #include <qtooltip.h>
17 #include <qwhatsthis.h>
18
19 /* 
20  *  Constructs a experimentwindow which is a child of 'parent', with the 
21  *  name 'name' and widget flags set to 'f' 
22  *
23  *  The dialog will by default be modeless, unless you set 'modal' to
24  *  TRUE to construct a modal dialog.
25 @param void
26 @author Bruno M. Carvalho
27 @version 1.0 */
28 experimentwindow::experimentwindow( QWidget* parent,  const char* name, bool modal, WFlags fl )
29     : QDialog( parent, name, modal, fl )
30 {
31     if ( !name )
32         setName( "experimentwindow" );
33     resize( 400, 150 ); 
34     setMinimumSize( QSize( 400, 150 ) );
35     setMaximumSize( QSize( 400, 150 ) );
36     setCaption( tr( "Experiment's Comments Window" ) );
37
38     TextLabel1 = new QLabel( this, "TextLabel1" );
39     TextLabel1->setGeometry( QRect( 15, 30, 15, 30 ) ); 
40     QFont TextLabel1_font(  TextLabel1->font() );
41     TextLabel1_font.setFamily( "adobe-helvetica" );
42     TextLabel1_font.setPointSize( 16 );
43     TextLabel1->setFont( TextLabel1_font ); 
44     TextLabel1->setText( tr( "*" ) );
45
46     comments = new QLineEdit( this, "comments" );
47     comments->setGeometry( QRect( 35, 25, 335, 30 ) ); 
48     comments->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, comments->sizePolicy().hasHeightForWidth() ) );
49
50     Line9 = new QFrame( this, "Line9" );
51     Line9->setGeometry( QRect( -5, 75, 420, 16 ) ); 
52     Line9->setFrameStyle( QFrame::HLine | QFrame::Sunken );
53
54     okbutton = new QPushButton( this, "okbutton" );
55     okbutton->setGeometry( QRect( 50, 90, 100, 40 ) ); 
56     okbutton->setText( tr( "OK" ) );
57     QObject::connect(okbutton,SIGNAL(clicked()),this,SLOT(accept()));
58
59     cancelbutton = new QPushButton( this, "cancelbutton" );
60     cancelbutton->setGeometry( QRect( 250, 90, 100, 40 ) ); 
61     cancelbutton->setText( tr( "Cancel" ) );
62     QObject::connect(cancelbutton,SIGNAL(clicked()),this,SLOT(reject()));
63 }
64
65 /*  
66  *  Destroys the object and frees any allocated resources
67  */
68 experimentwindow::~experimentwindow()
69 {
70     // no need to delete child widgets, Qt does it all for us
71 }
72
73 /*  
74  *  Main event handler. Reimplemented to handle application
75  *  font changes
76  */
77 bool experimentwindow::event( QEvent* ev )
78 {
79     bool ret = QDialog::event( ev ); 
80     if ( ev->type() == QEvent::ApplicationFontChange ) {
81         QFont TextLabel1_font(  TextLabel1->font() );
82         TextLabel1_font.setFamily( "adobe-helvetica" );
83         TextLabel1_font.setPointSize( 16 );
84         TextLabel1->setFont( TextLabel1_font ); 
85     }
86     return ret;
87 }
88
89 /** Returns a string of comments 
90 @param void
91 @return mode
92 @author Bruno M. Carvalho
93 @version 1.0 */
94 QString experimentwindow::getOutput()
95 {
96   QString output;
97
98   output.sprintf("* ");
99   output+=comments->text();
100   return output;
101 }