1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // SUPERV SUPERVGUI : GUI for Supervisor component
22 // File : SUPERVGUI_BrowseNodeDlg.cxx
23 // Author : Vitaly SMETANNIKOV
26 #include "SALOMEDSClient.hxx"
27 #include "SALOMEDS_SObject.hxx"
28 #include "SALOMEDS_Study.hxx"
30 #include "SalomeApp_Application.h"
31 #include "LightApp_SelectionMgr.h"
32 #include "SalomeApp_Study.h"
33 #include "SUIT_Session.h"
35 #include "SALOME_ListIO.hxx"
37 #include "SUPERVGUI_BrowseNodeDlg.h"
38 #include "SUPERVGUI_CanvasNode.h"
39 #include "SUPERVGUI_CanvasPort.h"
40 #include "SUPERVGUI.h"
44 #include <qlineedit.h>
45 #include <qpushbutton.h>
47 #include <qgroupbox.h>
48 #include <qvalidator.h>
50 #include <boost/shared_ptr.hpp>
51 using namespace boost;
56 SUPERVGUI_PortField::SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePort ) {
58 myIsEditable = myPort->IsInput() && ( !myPort->IsLinked() );
60 QString aLabelTxt(myPort->Name());
62 /*SUPERV_CNode aNode = myPort->Node();
63 SALOME_ModuleCatalog::Service* aService = aNode->Service();
64 SALOME_ModuleCatalog::ListOfServicesParameter aList;
65 aList = (myPort->IsInput())? aService->ServiceinParameter : aService->ServiceoutParameter;
66 for (int i = 0; i < aList.length(); i++) {
67 SALOME_ModuleCatalog::ServicesParameter* aParam = &(aList[i]);
68 if (aLabelTxt == aParam->Parametername) {
69 aLabelTxt += QString(" (") + QString(aParam->Parametertype) + QString(")");
73 aLabelTxt += QString(":");*/
75 // mkr : the following way is easyer to get ports' type than commented above
76 QString aPortType = QString(myPort->Type());
77 aLabelTxt += QString(" (") + aPortType + QString("):");
79 myLabel = new QLabel(aLabelTxt, theParent );
81 myValue = new QLineEdit( theParent );
82 myLabel->setBuddy( myValue );
84 myValue->setReadOnly( !myIsEditable );
85 QPalette aPalette = myValue->palette();
86 aPalette.setInactive(aPalette.disabled());
87 aPalette.setActive(aPalette.disabled());
88 myValue->setPalette(aPalette);
92 if ( !aPortType.compare(QString("boolean")) )
93 myValue->setValidator( new QIntValidator( 0, 1, theParent ) );
95 if ( !aPortType.compare(QString("short")) || !aPortType.compare(QString("int")) || !aPortType.compare(QString("long")) )
96 myValue->setValidator( new QIntValidator( theParent ) );
98 if ( !aPortType.compare(QString("float")) || !aPortType.compare(QString("double")) )
99 myValue->setValidator( new QDoubleValidator( theParent ) );
101 if ( !aPortType.compare(QString("char")) ) {
103 myValue->setValidator( new QRegExpValidator( aRX, theParent ) );
108 myValue->installEventFilter( this );
112 * Sets value from text edit control to engine of port
114 bool SUPERVGUI_PortField::setNewValue() {
115 if ( !myIsEditable ) return false;
117 QString aTxt = myValue->text();
118 //mkr : fix for bug IPAL9441
119 //if ( aTxt.isNull() || aTxt.isEmpty() ) return false;
121 if ( aTxt.find( "Unknown" ) < 0 ) {
122 SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
124 MESSAGE("NULL Supervision module!");
127 return myPort->Input( aSupMod->getEngine()->StringValue( aTxt ) );
135 bool SUPERVGUI_PortField::eventFilter( QObject* o, QEvent* e )
137 if ( o == myValue ) {
138 if ( e->type() == QEvent::FocusIn ) {
142 return QObject::eventFilter( o, e );
147 * Constructor (SUPERVGUI_CanvasNode)
149 SUPERVGUI_BrowseNodeDlg::SUPERVGUI_BrowseNodeDlg( SUPERVGUI_CanvasNode* theNode )
150 : QDialog( SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
152 myNodeCanvas = theNode;
157 void SUPERVGUI_BrowseNodeDlg::init()
160 setSizeGripEnabled( true );
161 myPortsList.setAutoDelete( true );
163 SUPERV_CNode aEngine = myNodeCanvas->getEngine();
165 setName( "SUPERVGUI_BrowseNodeDlg" );
166 setCaption( tr( "TIT_BROWSENODE" ) + aEngine->Name() );
168 QGridLayout* aBaseLayout = new QGridLayout( this );
169 aBaseLayout->setMargin( 11 ); aBaseLayout->setSpacing( 6 );
171 QGroupBox* aInBox = new QGroupBox( 2, Qt::Horizontal, "Input", this );
172 aInBox->setMargin( 11 );
173 aBaseLayout->addWidget( aInBox, 0, 0 );
175 QGroupBox* aOutBox = new QGroupBox( 2, Qt::Horizontal, "Output", this);
176 aOutBox->setMargin( 11 );
177 aBaseLayout->addWidget( aOutBox, 0, 1 );
179 myIsEditable = false;
182 SUPERV_Ports ports = aEngine->Ports();
183 int n = ports->length();
185 for ( int i = 0; i < n; i++ ) {
186 if ( ports[i]->IsInput() ) {
187 if ( !ports[i]->IsGate() ) { // not a gate
188 SUPERVGUI_PortField* aField = new SUPERVGUI_PortField( aInBox, ports[i] );
189 if ( aField->isEditable() )
191 myPortsList.append( aField );
192 if ( !myActiveField )
193 myActiveField = aField;
194 connect( aField, SIGNAL( activated() ), this, SLOT( onFieldActivated() ) );
199 if ( !ports[i]->IsGate() ) { // not a gate
200 myPortsList.append( new SUPERVGUI_PortField( aOutBox, ports[i] ) );
206 QGroupBox* aBtnBox = new QGroupBox( this );
207 aBtnBox->setColumnLayout( 0, Qt::Vertical );
208 aBtnBox->layout()->setSpacing( 0 );
209 aBtnBox->layout()->setMargin( 0 );
211 QHBoxLayout* aBtnLayout = new QHBoxLayout( aBtnBox->layout() );
212 aBtnLayout->setAlignment( Qt::AlignTop );
213 aBtnLayout->setSpacing( 6 );
214 aBtnLayout->setMargin( 11 );
216 if ( myIsEditable ) {
217 QLabel* aInfoLab = new QLabel( tr( "ENTER_OR_SELECT_LBL" ), this );
218 aBaseLayout->addMultiCellWidget( aInfoLab, 1, 1, 0, 1 );
220 QPushButton* aOkBtn = new QPushButton( tr( "BUT_OK" ), aBtnBox );
221 connect( aOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
222 aBtnLayout->addWidget( aOkBtn );
223 aBaseLayout->addMultiCellWidget( aBtnBox, 2, 2, 0, 1 );
225 aBaseLayout->addMultiCellWidget( aBtnBox, 1, 1, 0, 1 );
227 aBtnLayout->addStretch();
228 QPushButton* aCancelBtn = new QPushButton( myIsEditable ? tr( "BUT_CANCEL" ) : tr( "BUT_CLOSE" ), aBtnBox );
229 aBtnLayout->addWidget( aCancelBtn );
230 connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
233 aBtnLayout->addStretch();
235 SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
236 if ( aSupMod ) connect( (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))->selectionMgr(),
237 SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
238 else MESSAGE("NULL Supervision module!");
240 myNodeCanvas->getMain()->lockedGraph(true);
246 SUPERVGUI_BrowseNodeDlg::~SUPERVGUI_BrowseNodeDlg() {
250 * Set current values of editable ports
252 void SUPERVGUI_BrowseNodeDlg::setValues() {
253 SUPERVGUI_PortField* aField;
254 for ( aField = myPortsList.first(); aField; aField = myPortsList.next() ) {
255 if ( aField->getData().isEmpty() || aField->getData().isNull() ) // mkr : PAL11406
261 * Set inputed values of editable ports and then closes and destroys dialog
263 void SUPERVGUI_BrowseNodeDlg::accept() {
264 myNodeCanvas->getMain()->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
265 if ( myIsEditable ) {
266 SUPERVGUI_PortField* aField;
267 for ( aField = myPortsList.first(); aField; aField = myPortsList.next() ) {
268 aField->setNewValue();
270 myNodeCanvas->sync();
271 myNodeCanvas->getMain()->getCanvas()->update();
273 myNodeCanvas->getMain()->lockedGraph(false);
280 * Closes and destroys dialog
282 void SUPERVGUI_BrowseNodeDlg::reject() {
283 myNodeCanvas->getMain()->lockedGraph(false);
289 * Update current values on show event
291 void SUPERVGUI_BrowseNodeDlg::showEvent( QShowEvent* theEvent ) {
293 QDialog::showEvent( theEvent );
297 * Slot, called when field is focused
299 void SUPERVGUI_BrowseNodeDlg::onFieldActivated()
301 SUPERVGUI_PortField* aField = (SUPERVGUI_PortField*)sender();
302 myActiveField = (aField->isEditable())? aField : 0;
307 QString getIORfromIO (const Handle(SALOME_InteractiveObject)& theIO,
308 SUPERVGUI * theModule)
311 if (!theIO->hasEntry()) return ior;
313 SalomeApp_Study* anAppStudy = dynamic_cast<SalomeApp_Study*>(theModule->getActiveStudy());
314 _PTR(SObject) aSObj (anAppStudy->studyDS()->FindObjectID(theIO->getEntry()));
316 _PTR(GenericAttribute) anAttr;
317 if (aSObj->FindAttribute(anAttr, "AttributeIOR")) {
318 _PTR(AttributeIOR) anIOR (anAttr);
319 ior = anIOR->Value().c_str();
323 // old code, it is useless, because <aSSObj->GetObject()> here will be NULL
324 // (because it is retrieved from <aSSObj> by stored IOR)
326 SALOMEDS_Study* aSStudy = dynamic_cast<SALOMEDS_Study*>( aSObj->GetStudy().get() );
327 SALOMEDS_SObject* aSSObj = dynamic_cast<SALOMEDS_SObject*>( aSObj.get() );
328 if ( aSStudy && aSSObj )
329 ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str();
334 // default value: null IOR (IOR:01000000010000000000...)
335 SalomeApp_Application* anApp = theModule->getApp();
336 CORBA::Object_var aNullObj;
337 ior = anApp->orb()->object_to_string(aNullObj);
339 // try to load a component data from an opened (presumably) study
340 _PTR(SComponent) aSComp = aSObj->GetFatherComponent();
341 std::string aCompIOR;
342 if (!aSComp->ComponentIOR(aCompIOR)) {
343 std::string aCompDataType = aSComp->ComponentDataType();
345 // obtain a driver by a component data type
346 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
347 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
348 SALOME_LifeCycleCORBA * LCC = anApp->lcc();
351 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType.c_str());
352 if (CORBA::is_nil(anEngineObj))
353 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType.c_str());
355 if (!CORBA::is_nil(anEngineObj))
356 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
361 if (!CORBA::is_nil(anEngine)) {
363 _PTR(StudyBuilder) aStudyBuilder = aSObj->GetStudy()->NewBuilder();
366 CORBA::String_var aDriverIOR = anApp->orb()->object_to_string(anEngine);
367 aStudyBuilder->LoadWith(aSComp, aDriverIOR.in());
374 // now try to obtain the IOR once again (after successfull component data loading)
375 if (aSObj->FindAttribute( anAttr, "AttributeIOR" )) {
376 _PTR(AttributeIOR) anIOR ( anAttr );
377 ior = anIOR->Value().c_str();
380 } // if (!CORBA::is_nil(anEngine))
381 } // if (!aSComp->ComponentIOR(aCompIOR))
386 } // no name namespace
389 * Slot, called when selection is changed
391 void SUPERVGUI_BrowseNodeDlg::onSelectionChanged()
393 if ( myActiveField ) {
398 SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
400 MESSAGE("NULL Supervision module!");
404 SalomeApp_Application* anApp = aSupMod->getApp();
405 anApp->selectionMgr()->selectedObjects( aList );
407 if ( aList.Extent() == 1 ) {
408 Handle( SALOME_InteractiveObject ) anIO = aList.First();
409 if ( anIO->hasEntry() ) {
410 QString ior = ::getIORfromIO(anIO, aSupMod);
411 myActiveField->setData( ior );
419 * Constructor (SUPERVGUI_CanvasPort)
421 SUPERVGUI_GetValueDlg::SUPERVGUI_GetValueDlg( SUPERVGUI_CanvasPort* thePort )
422 : QDialog( SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
424 myPortCanvas = thePort;
429 void SUPERVGUI_GetValueDlg::init()
432 setSizeGripEnabled( true );
434 setName( "SUPERVGUI_GetValueDlg" );
435 setCaption( tr( "TIT_SETVALUE_PORT" ) );
437 QGridLayout* aBaseLayout = new QGridLayout( this );
438 aBaseLayout->setMargin( 11 ); aBaseLayout->setSpacing( 6 );
440 QGroupBox* aBox = new QGroupBox( this );
441 aBox->setColumnLayout( 0, Qt::Vertical );
442 aBox->layout()->setSpacing( 0 ); aBox->layout()->setMargin( 0 );
443 QGridLayout* aBoxLayout = new QGridLayout( aBox->layout() );
444 aBoxLayout->setAlignment( Qt::AlignTop );
445 aBoxLayout->setSpacing( 6 ); aBoxLayout->setMargin( 11 );
446 aBaseLayout->addWidget( aBox, 0, 0 );
447 aBox->setMinimumWidth( 200 );
449 QLabel* aInfoLab = new QLabel( tr( "ENTER_OR_SELECT_LBL" ), aBox );
450 QFont fnt = aInfoLab->font(); fnt.setBold( true ); aInfoLab->setFont( fnt );
451 aBoxLayout->addMultiCellWidget( aInfoLab, 0, 0, 0, 1 );
452 SUPERV_Port aEngine = myPortCanvas->getEngine();
454 myField = new SUPERVGUI_PortField( aBox, aEngine );
455 bool myIsEditable = myField->isEditable();
456 aBoxLayout->addWidget( myField->myLabel, 1, 0 );
457 aBoxLayout->addWidget( myField->myValue, 1, 1 );
459 QGroupBox* aBtnBox = new QGroupBox( this );
460 aBtnBox->setColumnLayout( 0, Qt::Vertical );
461 aBtnBox->layout()->setSpacing( 0 ); aBtnBox->layout()->setMargin( 0 );
462 QHBoxLayout* aBtnLayout = new QHBoxLayout( aBtnBox->layout() );
463 aBtnLayout->setAlignment( Qt::AlignTop );
464 aBtnLayout->setSpacing( 6 ); aBtnLayout->setMargin( 11 );
466 aBaseLayout->addWidget( aBtnBox, 1, 0 );
468 if ( myIsEditable ) {
469 myOKBtn = new QPushButton( tr( "BUT_OK" ), aBtnBox );
470 connect( myOKBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
471 aBtnLayout->addWidget( myOKBtn );
474 aBtnLayout->addStretch();
475 myCancelBtn = new QPushButton( myIsEditable ? tr( "BUT_CANCEL" ) : tr( "BUT_CLOSE" ), aBtnBox );
476 aBtnLayout->addWidget( myCancelBtn );
477 connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
480 aBtnLayout->addStretch();
482 myField->updateGUI();
484 SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
485 if ( aSupMod ) connect( (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))->selectionMgr(),
486 SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
487 else MESSAGE("NULL Supervision module!");
489 myPortCanvas->getMain()->lockedGraph(true);
495 SUPERVGUI_GetValueDlg::~SUPERVGUI_GetValueDlg() {
499 * Set entered value into port and then closes and destroys dialog
501 void SUPERVGUI_GetValueDlg::accept() {
502 myPortCanvas->getMain()->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
503 if ( myField->setNewValue() ) {
505 myPortCanvas->sync();
507 // asv : 19.11.04 : fix for 6170, last comment of it about BrowsePort - update node status
508 // asv : 13.12.04 : commented out sync() of Node. See 2.21.
509 //if ( myPortCanvas->parent() && myPortCanvas->parent()->inherits( "SUPERVGUI_CanvasNode" ) ) {
510 // SUPERVGUI_CanvasNode* aNode = (SUPERVGUI_CanvasNode*)myPortCanvas->parent();
514 myPortCanvas->getMain()->getCanvas()->update();
517 if ( QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(),
518 tr( "ERROR" ), tr( "MSG_CANT_SETVAL" ),
519 QMessageBox::Retry, QMessageBox::Abort) == QMessageBox::Retry )
523 myPortCanvas->getMain()->lockedGraph(false);
530 * Closes and destroys dialog
532 void SUPERVGUI_GetValueDlg::reject() {
533 myPortCanvas->getMain()->lockedGraph(false);
539 * Slot, called when selection is changed
541 void SUPERVGUI_GetValueDlg::onSelectionChanged()
546 SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
548 MESSAGE("NULL Supervision module!");
552 SalomeApp_Application* anApp = aSupMod->getApp();
553 anApp->selectionMgr()->selectedObjects( aList );
555 if ( aList.Extent() == 1 ) {
556 Handle( SALOME_InteractiveObject ) anIO = aList.First();
557 if ( anIO->hasEntry() ) {
558 QString ior = ::getIORfromIO(anIO, aSupMod);
559 myField->setData( ior );
566 // ----------------------------
568 // ----------------------------
570 SUPERVGUI_StreamInDlg::SUPERVGUI_StreamInDlg(SUPERVGUI_CanvasStreamPortIn* thePort)
571 :QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
573 myPortCanvas = thePort;
577 void SUPERVGUI_StreamInDlg::init()
579 setSizeGripEnabled( true );
580 setCaption( tr( "MSG_STREAM_DLG_TIT" ) );
582 QVBoxLayout* TopLayout = new QVBoxLayout( this, 11, 6 );
584 QFrame* aCtrlPane = new QFrame(this);
585 QGridLayout* aCtrlLayout = new QGridLayout( aCtrlPane, 4, 10 );
588 QLabel* aSchemaLbl = new QLabel(tr("MSG_STREAM_SCHEMA"),aCtrlPane);
589 aCtrlLayout->addWidget(aSchemaLbl, 0, 0);
591 mySchemaCombo = new QComboBox(aCtrlPane, "SchemaBox" );
592 mySchemaCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
593 mySchemaCombo->insertItem("SCHENULL");
594 mySchemaCombo->insertItem("TI");
595 mySchemaCombo->insertItem("TF");
596 mySchemaCombo->insertItem("DELTA");
597 aCtrlLayout->addWidget(mySchemaCombo, 0, 1);
600 QLabel* aInterLbl = new QLabel(tr("MSG_STREAM_INTER"),aCtrlPane);
601 aCtrlLayout->addWidget(aInterLbl, 1, 0);
603 myInterCombo = new QComboBox(aCtrlPane, "InterBox" );
604 myInterCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
605 myInterCombo->insertItem("INTERNULL");
606 myInterCombo->insertItem("L0");
607 myInterCombo->insertItem("L1");
608 aCtrlLayout->addWidget(myInterCombo, 1, 1);
611 QLabel* aExtraLbl = new QLabel(tr("MSG_STREAM_EXTRA"),aCtrlPane);
612 aCtrlLayout->addWidget(aExtraLbl, 2, 0);
614 myExterCombo = new QComboBox(aCtrlPane, "ExtraBox" );
615 myExterCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
616 myExterCombo->insertItem("EXTRANULL");
617 myExterCombo->insertItem("E0");
618 myExterCombo->insertItem("E1");
619 aCtrlLayout->addWidget(myExterCombo, 2, 1);
621 TopLayout->addWidget( aCtrlPane );
624 QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
625 GroupButtons->setColumnLayout(0, Qt::Vertical );
626 GroupButtons->layout()->setSpacing( 0 );
627 GroupButtons->layout()->setMargin( 0 );
628 QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
629 GroupButtonsLayout->setAlignment( Qt::AlignTop );
630 GroupButtonsLayout->setSpacing( 5 );
631 GroupButtonsLayout->setMargin( 8 );
633 QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons );
634 QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
636 GroupButtonsLayout->addWidget( okB, 0, 0 );
637 GroupButtonsLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
638 GroupButtonsLayout->addWidget( cancelB, 0, 2 );
640 TopLayout->addWidget( GroupButtons );
642 connect( okB, SIGNAL( clicked() ), this, SLOT( accept() ) );
643 connect( cancelB, SIGNAL( clicked() ), this, SLOT( reject() ) );
647 void SUPERVGUI_StreamInDlg::setData() {
648 SUPERV::KindOfSchema aSchema;
649 SUPERV::KindOfInterpolation aInterpolat;
650 SUPERV::KindOfExtrapolation aExtrapolat;
652 myPortCanvas->getStreamEngine()->Params(aSchema, aInterpolat, aExtrapolat);
654 mySchemaCombo->setCurrentItem((int)aSchema);
655 myInterCombo->setCurrentItem((int)aInterpolat);
656 myExterCombo->setCurrentItem((int)aExtrapolat);
659 void SUPERVGUI_StreamInDlg::accept() {
660 myPortCanvas->getMain()->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
661 myPortCanvas->getStreamEngine()->SetParams((SUPERV::KindOfSchema) mySchemaCombo->currentItem(),
662 (SUPERV::KindOfInterpolation) myInterCombo->currentItem(),
663 (SUPERV::KindOfExtrapolation) myExterCombo->currentItem());
668 //-------------------------------------------------------------------------
669 SUPERVGUI_StreamOutDlg::SUPERVGUI_StreamOutDlg(SUPERVGUI_CanvasStreamPortOut* thePort)
670 :QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
672 myPortCanvas = thePort;
676 void SUPERVGUI_StreamOutDlg::init()
678 setSizeGripEnabled( true );
679 setCaption( tr( "MSG_STREAM_DLG_TIT" ) );
681 QVBoxLayout* TopLayout = new QVBoxLayout( this, 11, 6 );
683 QFrame* aCtrlPane = new QFrame(this);
684 QGridLayout* aCtrlLayout = new QGridLayout( aCtrlPane, 4, 10 );
686 QLabel* aLbl = new QLabel(tr("MSG_STREAM_LEVEL"),aCtrlPane);
687 aCtrlLayout->addWidget(aLbl, 0, 0);
689 myValEdit = new QLineEdit( aCtrlPane, "ValEdit" );
690 myValEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
691 myValEdit->setValidator( new QIntValidator(this) );
692 SUPERV_StreamPort aEngine = myPortCanvas->getStreamEngine();
693 myValEdit->setText(QString("%1").arg(aEngine->NumberOfValues()));
694 aCtrlLayout->addWidget(myValEdit, 0, 1);
695 TopLayout->addWidget( aCtrlPane );
698 QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
699 GroupButtons->setColumnLayout(0, Qt::Vertical );
700 GroupButtons->layout()->setSpacing( 0 );
701 GroupButtons->layout()->setMargin( 0 );
702 QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
703 GroupButtonsLayout->setAlignment( Qt::AlignTop );
704 GroupButtonsLayout->setSpacing( 5 );
705 GroupButtonsLayout->setMargin( 8 );
707 QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons );
708 QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
710 GroupButtonsLayout->addWidget( okB, 0, 0 );
711 GroupButtonsLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
712 GroupButtonsLayout->addWidget( cancelB, 0, 2 );
714 TopLayout->addWidget( GroupButtons );
716 connect( okB, SIGNAL( clicked() ), this, SLOT( accept() ) );
717 connect( cancelB, SIGNAL( clicked() ), this, SLOT( reject() ) );
720 void SUPERVGUI_StreamOutDlg::accept() {
722 QString aStr = myValEdit->text();
724 aRes = aStr.toLong();
725 myPortCanvas->getStreamEngine()->SetNumberOfValues(aRes);