1 // File: IntervalWindow.cxx
2 // Created: Thu Apr 3 10:55:19 2003
3 // Author: Oksana TCHEBANOVA
4 // <ota@parcex.nnov.matra-dtv.fr>
7 #include <IntervalWindow.hxx>
9 #include <qbuttongroup.h>
11 #include <qpushbutton.h>
13 # include "utilities.h"
15 #define MARGIN_SIZE 11
16 #define SPACING_SIZE 6
17 #define MIN_SPIN_WIDTH 100
19 IntervalWindow::IntervalWindow ( QWidget* parent )
20 : QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
22 BEGIN_OF("IntervalWindow constructor")
23 setCaption( tr( "Refresh Interval" ) );
24 setSizeGripEnabled( true );
26 QGridLayout* topLayout = new QGridLayout( this );
27 topLayout->setSpacing( SPACING_SIZE );
28 topLayout->setMargin( MARGIN_SIZE );
30 QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" );
31 intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical
32 intervalGrp->layout()->setSpacing( 0 );
33 intervalGrp->layout()->setMargin( 0 );
34 QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() );
35 intervalGrpLayout->setAlignment( Qt::AlignTop );
36 intervalGrpLayout->setSpacing( SPACING_SIZE );
37 intervalGrpLayout->setMargin( MARGIN_SIZE );
39 QHBoxLayout* aBtnLayout = new QHBoxLayout;
40 aBtnLayout->setSpacing( SPACING_SIZE );
41 aBtnLayout->setMargin( 0 );
43 myButtonOk = new QPushButton( this, "buttonOk" );
44 myButtonOk->setText( tr( "BUT_OK" ) );
45 myButtonOk->setAutoDefault( TRUE );
46 myButtonOk->setDefault( TRUE );
48 myButtonCancel = new QPushButton( this, "buttonCancel" );
49 myButtonCancel->setText( tr( "BUT_CANCEL" ) );
50 myButtonCancel->setAutoDefault( TRUE );
52 QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" );
53 TextLabel->setText( tr( "Please, enter a number of seconds:" ) );
55 mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" );
56 mySpinBox->setValue( 100 );
57 mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
58 mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
60 intervalGrpLayout->addWidget(TextLabel, 0, 0);
61 intervalGrpLayout->addWidget(mySpinBox, 0, 1);
63 aBtnLayout->addWidget( myButtonOk );
64 aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
65 aBtnLayout->addWidget( myButtonCancel );
67 topLayout->addWidget( intervalGrp, 0, 0 );
68 topLayout->addLayout( aBtnLayout, 1, 0 );
70 END_OF("IntervalWindow constructor")
72 IntervalWindow::~IntervalWindow() {}
74 Sets start interval size
76 void IntervalWindow::setValue(const int size)
78 mySpinBox->setValue(size);
84 int IntervalWindow::getValue()
86 return mySpinBox->value();
90 gets a pointer to myButtonOk
92 QPushButton* IntervalWindow::Ok()
98 gets a pointer to myButtonCancel
100 QPushButton* IntervalWindow::Cancel()
102 return myButtonCancel;