1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : VisuGUI_SweepPrefDlg.cxx
25 // Author : Laurent CORNABE & Hubert ROLLAND
30 #include "VisuGUI_SweepPrefDlg.h"
36 VisuGUI_SweepPrefDlg::VisuGUI_SweepPrefDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
37 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
40 setName( "VisuGUI_SweepPrefDlg" );
41 setCaption( tr( "Sweeping Preferences" ) );
42 setSizeGripEnabled( TRUE );
44 QVBoxLayout* TopLayout = new QVBoxLayout( this );
45 TopLayout->setSpacing( 6 );
46 TopLayout->setMargin( 11 );
48 TopGroup = new QGroupBox( this, "TopGroup" );
49 TopGroup->setColumnLayout(0, Qt::Vertical );
50 TopGroup->layout()->setSpacing( 0 );
51 TopGroup->layout()->setMargin( 0 );
52 QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
53 TopGroupLayout->setAlignment( Qt::AlignTop );
54 TopGroupLayout->setSpacing( 6 );
55 TopGroupLayout->setMargin( 11 );
57 TimeLabel = new QLabel( tr( "Time step (second):" ), TopGroup, "TimeLabel" );
58 TimeSpin = new QAD_SpinBoxDbl( TopGroup, 0.1, 1000.0, 0.1 );
59 TimeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
60 TimeSpin->setMinimumSize( 70, 0 );
61 TimeSpin->setValue( 0.2 );
63 CyclesLabel = new QLabel( tr( "Number of cycles:" ), TopGroup, "CyclesLabel" );
64 CyclesSpin = new QSpinBox( 1, 100, 1, TopGroup, "CyclesSpin" );
65 CyclesSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
66 CyclesSpin->setMinimumSize( 70, 0 );
67 CyclesSpin->setValue( 1 );
69 StepsLabel = new QLabel( tr( "Number of steps:" ), TopGroup, "StepsLabel" );
70 StepsSpin = new QSpinBox( 1, 200, 1, TopGroup, "StepsSpin" );
71 StepsSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
72 StepsSpin->setMinimumSize( 70, 0 );
73 StepsSpin->setValue( 20 );
75 TopGroupLayout->addWidget( TimeLabel, 0, 0 );
76 TopGroupLayout->addWidget( TimeSpin, 0, 1 );
77 TopGroupLayout->addWidget( CyclesLabel, 1, 0 );
78 TopGroupLayout->addWidget( CyclesSpin, 1, 1 );
79 TopGroupLayout->addWidget( StepsLabel, 2, 0 );
80 TopGroupLayout->addWidget( StepsSpin, 2, 1 );
82 GroupButtons = new QGroupBox( this, "GroupButtons" );
83 GroupButtons->setColumnLayout(0, Qt::Vertical );
84 GroupButtons->layout()->setSpacing( 0 );
85 GroupButtons->layout()->setMargin( 0 );
86 QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
87 GroupButtonsLayout->setAlignment( Qt::AlignTop );
88 GroupButtonsLayout->setSpacing( 6 );
89 GroupButtonsLayout->setMargin( 11 );
91 buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
92 buttonOk->setAutoDefault( TRUE );
93 buttonOk->setDefault( TRUE );
94 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
95 GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
96 buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
97 buttonCancel->setAutoDefault( TRUE );
98 GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
100 TopLayout->addWidget( TopGroup, 0, 0);
101 TopLayout->addWidget( GroupButtons, 1, 0 );
103 // signals and slots connections ===========================================
104 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
105 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
111 VisuGUI_SweepPrefDlg::~VisuGUI_SweepPrefDlg()
118 void VisuGUI_SweepPrefDlg::setTimeStep( double step )
120 TimeSpin->setValue( step );
126 double VisuGUI_SweepPrefDlg::getTimeStep()
128 return TimeSpin->value();
134 void VisuGUI_SweepPrefDlg::setNbCycles( int nbc )
136 CyclesSpin->setValue( nbc );
142 int VisuGUI_SweepPrefDlg::getNbCycles()
144 return CyclesSpin->value();
150 void VisuGUI_SweepPrefDlg::setNbSteps( int nbs )
152 StepsSpin->setValue( nbs );
158 int VisuGUI_SweepPrefDlg::getNbSteps()
160 return StepsSpin->value();