1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HYDROGUI_ChannelDlg.h"
25 #include "HYDROGUI_Tool.h"
33 HYDROGUI_ChannelDlg::HYDROGUI_ChannelDlg( HYDROGUI_Module* theModule, const QString& theTitle )
34 : HYDROGUI_InputPanel( theModule, theTitle )
37 myObjectNameGroup = new QGroupBox( tr( "CHANNEL_NAME" ), mainFrame() );
39 myObjectName = new QLineEdit( myObjectNameGroup );
41 QBoxLayout* aNameLayout = new QHBoxLayout( myObjectNameGroup );
42 aNameLayout->setMargin( 5 );
43 aNameLayout->setSpacing( 5 );
44 aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
45 aNameLayout->addWidget( myObjectName );
48 QGroupBox* aParamGroup = new QGroupBox( tr( "CHANNEL_PARAMETERS" ), mainFrame() );
50 //myGuideLines = new HYDROGUI_ObjComboSelector( theModule, KIND_POLYLINE, aParamGroup );
51 myGuideLines = new QComboBox( aParamGroup );
52 myGuideLines->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
54 //myProfiles = new HYDROGUI_ObjComboSelector( theModule, KIND_PROFILE, aParamGroup );
55 myProfiles = new QComboBox( aParamGroup );
56 myProfiles->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
58 QGridLayout* aParamsLayout = new QGridLayout( aParamGroup );
59 aParamsLayout->setMargin( 5 );
60 aParamsLayout->setSpacing( 5 );
61 aParamsLayout->addWidget( new QLabel( tr( "CHANNEL_GUIDE_LINE" ), aParamGroup ), 0, 0 );
62 aParamsLayout->addWidget( myGuideLines, 0, 1 );
63 aParamsLayout->addWidget( new QLabel( tr( "CHANNEL_PROFILE" ), aParamGroup ), 1, 0 );
64 aParamsLayout->addWidget( myProfiles, 1, 1 );
67 addWidget( myObjectNameGroup );
68 addWidget( aParamGroup );
72 // Connect signals and slots
73 connect( myGuideLines, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onChannelDefChanged() ) );
74 connect( myProfiles, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onChannelDefChanged() ) );
77 HYDROGUI_ChannelDlg::~HYDROGUI_ChannelDlg()
81 void HYDROGUI_ChannelDlg::reset()
83 bool isBlocked = blockSignals( true );
85 myObjectName->clear();
87 myGuideLines->clear();
90 blockSignals( isBlocked );
92 onChannelDefChanged();
95 void HYDROGUI_ChannelDlg::setObjectName( const QString& theName )
97 myObjectName->setText( theName );
100 QString HYDROGUI_ChannelDlg::getObjectName() const
102 return myObjectName->text();
105 void HYDROGUI_ChannelDlg::setGuideLineNames( const QStringList& theGuideLines )
107 bool isBlocked = blockSignals( true );
109 myGuideLines->clear();
110 myGuideLines->addItems( theGuideLines );
112 blockSignals( isBlocked );
115 void HYDROGUI_ChannelDlg::setGuideLineName( const QString& theGuideLine )
117 int aNewIdx = myGuideLines->findText( theGuideLine );
118 if ( aNewIdx != myGuideLines->currentIndex() )
120 myGuideLines->setCurrentIndex( aNewIdx );
124 onChannelDefChanged();
128 QString HYDROGUI_ChannelDlg::getGuideLineName() const
130 return myGuideLines->currentText();
133 void HYDROGUI_ChannelDlg::setProfileNames( const QStringList& theProfiles )
135 bool isBlocked = blockSignals( true );
138 myProfiles->addItems( theProfiles );
140 blockSignals( isBlocked );
143 void HYDROGUI_ChannelDlg::setProfileName( const QString& theProfile )
145 int aNewIdx = myProfiles->findText( theProfile );
146 if ( aNewIdx != myProfiles->currentIndex() )
148 myProfiles->setCurrentIndex( aNewIdx );
152 onChannelDefChanged();
156 QString HYDROGUI_ChannelDlg::getProfileName() const
158 return myProfiles->currentText();
161 void HYDROGUI_ChannelDlg::onChannelDefChanged()
163 if ( signalsBlocked() )
166 emit CreatePreview();