Salome HOME
MPV: Merge V1_2d
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Node.cxx
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SUPERVGUI_Node.cxx
25 //  Author : Francis KLOSS
26 //  Module : SUPERV
27
28 using namespace std;
29 #include "SUPERVGUI_Node.h"
30 #include "SUPERVGUI_Main.h"
31 #include "SUPERVGUI_Python.h"
32 #include "SUPERVGUI.h"
33 #include "SUPERVGUI_BrowseNodeDlg.h"
34 #include "SALOMEGUI_NameDlg.h"
35 #include "SUPERVGUI_Information.h"
36 #include "SUPERVGUI_ComputeNode.h"
37 #include "SUPERVGUI_ControlNode.h"
38
39 #include <qlayout.h>
40 #include <qlabel.h>
41 #include <qlineedit.h>
42 #include <qpushbutton.h>
43 #include <qhbox.h>
44 #include <qgroupbox.h>
45 #include <qtooltip.h>
46
47
48
49 SUPERVGUI_Node::SUPERVGUI_Node(QWidget* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
50     QFrame(theParent, "", WDestructiveClose),
51     myMain(theMain),
52     myNode(theNode),
53     warning(true),
54     step(true),
55     trace(true),
56     verbose(true),
57     aBrowseDlg(0)
58 {
59   Trace("SUPERVGUI_Node::SUPERVGUI_Node");
60   QPalette BackColor = QPalette(MAIN_BACK);
61   setPalette(BackColor);
62
63   setName(myNode->Name());
64   //myTitle = new SUPERVGUI_Label(0, LABEL_WIDTH, LABEL_HEIGHT, name(), QLabel::AlignLeft);
65   //connect(myTitle, SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));
66   //myTitle->hide();
67
68   myStatus = new SUPERVGUI_Label(0, LABEL_WIDTH/2, LABEL_HEIGHT, "", QLabel::AlignHCenter);
69   myTime = new SUPERVGUI_Label(0, LABEL_WIDTH/2, LABEL_HEIGHT, "00:00:00", QLabel::AlignHCenter);
70   myStatus->hide();
71   myTime->hide();
72
73   connect(myStatus, SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));
74   connect(myTime,   SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));
75
76   //create common popup
77   myPopup = new QPopupMenu(this);
78   if (myMain->isEditable() && getNodeType() != SUPERV::EndLoopNode 
79                            && getNodeType() != SUPERV::EndSwitchNode) {
80     myRenameItem  = myPopup->insertItem(tr("MSG_RENAME"), this, SLOT(rename()));
81     myDeleteItem = myPopup->insertItem(tr("MSG_DELETE"), this, SLOT(remove()));
82     mySeparatorId = myPopup->insertSeparator();
83   }
84   myPopup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
85   if ((getNodeType() != SUPERV::EndLoopNode) && (getNodeType() != SUPERV::EndSwitchNode))
86     myPopup->insertItem(tr("MSG_CHANGE_INFO"), this, SLOT(changeInformation()));
87   //myPopup->insertItem(tr("MSG_CONFIGURE"),   this, SLOT(configure()));
88
89   if (myMain->isEditable() && (getNodeType() != SUPERV::FactoryNode)
90                            && (getNodeType() != SUPERV::ComputingNode)) {
91     if ((getNodeType() != SUPERV::EndLoopNode)) {
92       QPopupMenu* aAddPortMnu = new QPopupMenu(this);
93       aAddPortMnu->insertItem("Input", this, SLOT(addInputPort()));
94       if (getNodeType() != SUPERV::LoopNode)
95         aAddPortMnu->insertItem("Output", this, SLOT(addOutputPort()));
96       
97       myPopup->insertSeparator();
98       if ((getNodeType() != SUPERV::EndSwitchNode))
99         myPopup->insertItem("Edit Function", this, SLOT(editFunction()));
100       myPopup->insertItem("Add Port", aAddPortMnu);
101     }
102   }
103
104   // create execution popup
105   myRunPopup = new QPopupMenu(this);
106   mySuspendItem = myRunPopup->insertItem(tr("MSG_SUSPEND"),     this, SLOT(suspendResume()));
107   myKillItem = myRunPopup->insertItem(tr("MSG_KILL"),        this, SLOT(kill()));
108   //myStopItem = myRunPopup->insertItem(tr("MSG_STOP"),        this, SLOT(stopRestart()));
109
110   setState(myNode->State());
111 }
112
113 SUPERVGUI_Node::~SUPERVGUI_Node()
114 {
115   Trace("SUPERVGUI_Node::~SUPERVGUI_Node")
116 }
117
118
119 void SUPERVGUI_Node::sync() {
120   setState(myNode->State());
121 }
122
123 void SUPERVGUI_Node::syncOnEvent(SUPERV::GraphState theStateFromEvent) {
124   setState(theStateFromEvent);
125 }
126
127 void SUPERVGUI_Node::setState(SUPERV::GraphState theState)
128 {
129   MESSAGE("NodeState="<<theState);
130   myRunPopup->changeItem(mySuspendItem, tr("MSG_SUSPEND"));
131   myRunPopup->setItemEnabled(mySuspendItem, true);
132   myRunPopup->setItemEnabled(myStopItem, false);
133
134   switch (theState) {
135   case SUPERV_Waiting:
136     myStatus->setText("Waiting");
137     myStatus->setPaletteBackgroundColor(QColor(35, 192, 255));
138     break;
139   case SUPERV_Running:
140   case SUPERV::ReadyState:
141     myStatus->setText("Running");
142     myStatus->setPaletteBackgroundColor(QColor(32,210,32));
143     myRunPopup->changeItem(myStopItem, tr("MSG_STOP"));
144     myRunPopup->setItemEnabled(myStopItem, true);
145     break;
146   case SUPERV_Suspend:
147   case SUPERV::SuspendReadyState:
148     myStatus->setText("Suspended");
149     myStatus->setPaletteBackgroundColor(QColor(255,180, 0));
150     myRunPopup->changeItem(mySuspendItem, tr("MSG_RESUME"));
151     break;
152   case SUPERV_Done:
153     myStatus->setText("Finished");
154     myStatus->setPaletteBackgroundColor(QColor(255, 158, 255));
155     myRunPopup->setItemEnabled(mySuspendItem, false);
156     myRunPopup->changeItem(myStopItem, tr("MSG_RESTART"));
157     myRunPopup->setItemEnabled(myStopItem, true);
158     break;
159   case SUPERV_Error: 
160     myStatus->setText("Aborted");
161     myStatus->setPaletteBackgroundColor(red);
162     myRunPopup->setItemEnabled(mySuspendItem, false);
163     myRunPopup->changeItem(myStopItem, tr("MSG_RESTART"));
164     myRunPopup->setItemEnabled(myStopItem, true);
165     break;
166   case SUPERV_Kill:
167     myStatus->setText("Killed");
168     myStatus->setPaletteBackgroundColor(red);
169     myRunPopup->setItemEnabled(mySuspendItem, false);
170     myRunPopup->changeItem(myStopItem, tr("MSG_RESTART"));
171     myRunPopup->setItemEnabled(myStopItem, true);
172     break;
173   default:
174     //cout<<"### Node state = "<<theState<<endl;
175     myStatus->setText("No Status");
176     myStatus->setPaletteBackgroundColor(QColor(NODE_RED, NODE_GREEN, NODE_BLUE));
177     myRunPopup->setItemEnabled(mySuspendItem, false);
178     break;
179   }
180   myTime->setPaletteBackgroundColor(myStatus->paletteBackgroundColor());
181   long sec = myNode->CpuUsed();
182   //    sec++;
183   char hms[9];
184   long s = sec/3600;
185   hms[0]=(char)(((s/10)%10)+48);
186   hms[1]=(char)((s%10)+48);
187   hms[2]=':';
188   sec = sec%3600;
189   s = sec/60;
190   hms[3]=(char)((s/10)+48);
191   hms[4]=(char)((s%10)+48);
192   hms[5]=':';
193   sec = sec%60;
194   hms[6]=(char)((sec/10)+48);
195   hms[7]=(char)((sec%10)+48);
196   hms[8]='\0';
197   myTime->setText(hms);  
198 }
199
200 void SUPERVGUI_Node::rename()
201 {
202   QString nm = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), myNode->Name() );
203   if ( !nm.isEmpty() ) {
204     setNodeName(nm);
205   }
206 }
207
208
209 void SUPERVGUI_Node::remove() {
210   Trace("SUPERVGUI_Node::remove");
211   deleteLinks();
212   myNode->destroy();
213   myMain->getGraph()->deleteNode(this);
214 }
215
216 void SUPERVGUI_Node::suspendResume() {
217   Trace("SUPERVGUI_Node::suspendResume");
218   int n = queryList("SUPERVGUI_Node")->count(); 
219   if (myNode->IsSuspended()) {
220     if (!((n==1)? myMain->getDataflow()->Resume() : myNode->Resume())) {
221       QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_RESUMENODE"));
222     }
223     else {
224       myMain->getMyThread()->startThread(tr("MSG_NODE_RESUMED1")+myNode->Name()+tr("MSG_NODE_RESUMED2"));
225     }
226   } else {
227     if (!((n==1)? myMain->getDataflow()->Suspend() : myNode->Suspend())) {
228       QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_SUSPENDNODE"));
229     } else {
230       myStatus->setPaletteBackgroundColor(QColor(255,180, 0));
231       myTime->setPaletteBackgroundColor(QColor(255,180, 0));
232       myMain->getMyThread()->stopThread(tr("MSG_NODE_SUSPENDED1")+myNode->Name()+tr("MSG_NODE_SUSPENDED2"));
233     }
234   }
235 }
236
237 void SUPERVGUI_Node::kill() {
238   Trace("SUPERVGUI_Node::kill");
239   int n = queryList("SUPERVGUI_Node")->count(); 
240   if (!((n==1)? myMain->getDataflow()->Kill() : myNode->Kill())) {
241     QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_KILLNODE"));
242   } else {
243     myStatus->setPaletteBackgroundColor(Qt::red);
244     myTime->setPaletteBackgroundColor(Qt::red);
245     myMain->getMyThread()->stopThread(tr("MSG_NODE_KILLED1")+myNode->Name()+tr("MSG_NODE_KILLED2"));
246   }
247 }
248
249 void SUPERVGUI_Node::stopRestart() {
250   Trace("SUPERVGUI_Node::stopRestart");
251   
252   int n = queryList("SUPERVGUI_Node")->count(); 
253   if ((myNode->State() == SUPERV_Stop) || (myNode->State() == SUPERV_Kill)) {
254     if (!((n==1)? myMain->getDataflow()->Run() : myNode->ReStart())) {
255       QMessageBox::warning(QAD_Application::getDesktop(),  tr("ERROR"), tr("MSG_CANT_RESTARTNODE"));
256     }
257   } else {
258     if (!((n==1)? myMain->getDataflow()->Stop() : myNode->Stop())) {
259       QMessageBox::warning(QAD_Application::getDesktop(),  tr("ERROR"), tr("MSG_CANT_STOPNODE"));
260     }
261   }
262 }
263
264 void SUPERVGUI_Node::changeInformation() {
265   SUPERVGUI_Information* aDlg = new SUPERVGUI_Information(myNode, !myMain->isEditable());
266   if (aDlg->exec() )
267     sync();
268   delete aDlg;
269   if (myNode->IsGOTO()) {
270     QString nmGT = myNode->Name();
271     if ( !nmGT.isEmpty() ) {
272       setNodeName(nmGT);
273     }
274   }
275   if (myMain->isEditable()) {
276     if (myMain->isArrayShown()) {  //Table View
277       if (myNode->IsLoop() || myNode->IsSwitch()) { //for synchronic names changing
278         QString nmA = myNode->Name();
279         if ( !nmA.isEmpty() ) {
280           setNodeName(nmA);
281           QString aStrA(tr("ENDNODE_PREFIX"));
282           aStrA+=nmA;
283           (dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->getTitle()->setText(aStrA);
284           (dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->setNodeName(aStrA);
285           // QToolTip::remove((dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->getTitle());
286           QToolTip::add((dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->getTitle(),
287                         (dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->getTitle()->text());
288
289         }
290       }
291       // QToolTip::remove((dynamic_cast<SUPERVGUI_Cell*>(this))->getTitle());
292       QToolTip::add((dynamic_cast<SUPERVGUI_Cell*>(this))->getTitle(),
293                     (dynamic_cast<SUPERVGUI_Cell*>(this))->getTitle()->text());
294       QToolTip::add((dynamic_cast<SUPERVGUI_Cell*>(this))->getComponent(),
295                     (dynamic_cast<SUPERVGUI_Cell*>(this))->getComponent()->text());
296     }
297     else {  //Graph View
298       if (myNode->IsLoop() || myNode->IsSwitch()) { //for synchronic names changing
299         QString nm = myNode->Name();
300         if ( !nm.isEmpty() ) {
301           setNodeName(nm);
302           QString aStr(tr("ENDNODE_PREFIX"));
303           aStr+=nm;
304           (dynamic_cast<SUPERVGUI_StartControlNode*>(this))->getEndNode()->setNodeName(aStr);
305         }
306       }
307       else {
308         if (!(myNode->IsGOTO())) {
309           // QToolTip::remove((dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getCommLabel());
310           QToolTip::add((dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getCommLabel(),
311                         (dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getCommLabel()->text());
312           QToolTip::add((dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getTitleLabel(),
313                         (dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getTitleLabel()->text());
314         }
315       }
316     }
317   }
318   /*    Trace("SUPERVGUI_Node::changeInformation")
319     if (Supervision.information(myNode, !myMain->isEditable())) {
320         myMain->syncAsync();
321         };*/
322 }
323
324 void SUPERVGUI_Node::configure() {
325     Trace("SUPERVGUI_Node::configure")
326     QMessageBox::warning(QAD_Application::getDesktop(),  tr("ERROR"), tr("MSG_NOT_IMPLEMENTED")); // kloss : a faire : lancer l'ihm DATA
327 }
328
329 void SUPERVGUI_Node::showPython() {
330     Trace("SUPERVGUI_Node::showPython")
331     SUPERVGUI_Python cp(myMain->getStudy()->get_PyInterp(), !myMain->isEditable());
332     cp.exec();
333 }
334
335 void SUPERVGUI_Node::showPopup(QMouseEvent* e) {
336   Trace("SUPERVGUI_Node::showPopup");
337   if (myMain->getDataflow()->IsExecuting())
338     myMain->showPopup(myRunPopup, e);
339   else
340     myMain->showPopup(myPopup, e);
341 }
342
343
344 void SUPERVGUI_Node::mousePressEvent(QMouseEvent* e) {
345   myMain->showPopup(myPopup, e);
346 }
347
348
349 bool SUPERVGUI_Node::isWarning() {
350     Trace("SUPERVGUI_Node::isWarning")
351     return(warning);
352 }
353
354 bool SUPERVGUI_Node::isStep() {
355     Trace("SUPERVGUI_Node::isStep")
356     return(step);
357 }
358
359 bool SUPERVGUI_Node::isTrace() {
360     Trace("SUPERVGUI_Node::isTrace")
361     return(trace);
362 }
363
364 bool SUPERVGUI_Node::isVerbose() {
365     Trace("SUPERVGUI_Node::isVerbose")
366     return(verbose);
367 }
368
369 void SUPERVGUI_Node::setWarning(bool b) {
370     Trace("SUPERVGUI_Node::setWarning")
371     warning = b;
372 }
373
374 void SUPERVGUI_Node::setStep(bool b) {
375     Trace("SUPERVGUI_Node::setStep")
376     step = b;
377 }
378
379 void SUPERVGUI_Node::setTrace(bool b) {
380     Trace("SUPERVGUI_Node::setTrace")
381     trace = b;
382 }
383
384 void SUPERVGUI_Node::setVerbose(bool b) {
385     Trace("SUPERVGUI_Node::setVerbose")
386     verbose = b;
387 }
388
389
390 void SUPERVGUI_Node::browse() {
391   if ( !aBrowseDlg ) {
392     aBrowseDlg = new SUPERVGUI_BrowseNodeDlg(this);
393     aBrowseDlg->installEventFilter( this );
394   }
395   if ( !aBrowseDlg->isVisible() )
396     aBrowseDlg->show();
397   else {
398     aBrowseDlg->raise();
399     aBrowseDlg->setActiveWindow();
400     aBrowseDlg->setFocus();
401   }
402 }
403
404 bool SUPERVGUI_Node::eventFilter( QObject* o, QEvent* e )
405 {
406   if ( o == aBrowseDlg && e->type() == QEvent::Close )
407     aBrowseDlg = 0;
408   return QFrame::eventFilter( o, e );
409 }
410
411
412 void SUPERVGUI_Node::setNodeName(QString aName) {
413   if ( myNode->SetName(aName.latin1())) {
414     setName(myNode->Name());
415     //myTitle->setText(aName);
416   } else 
417     QMessageBox::warning( QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_CANT_RENAMENODE" ) );
418 }
419
420
421 SUPERV_Port SUPERVGUI_Node::createInPort() {
422   SUPERVGUI_PortParamsDlg* aDlg = new SUPERVGUI_PortParamsDlg();
423   if (aDlg->exec()) {
424     if (aDlg->getName().isEmpty() || aDlg->getType().isEmpty()) {
425       QMessageBox::warning( QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_CANT_CREATE_PORT" ) );
426       return NULL;
427     }
428     SUPERV_INode aNode = getInlineNode();
429     if (SUPERV_isNull(aNode)) {
430       MESSAGE("SUPERVGUI_Node::createInPort: Node is wrong type");
431       return NULL;
432     }
433     SUPERV_Ports aPorts = aNode->Ports();
434     for (int i=0; i<aPorts->length(); i++) {
435       if (aDlg->getName() == QString(aPorts[i]->Name())){
436         QMessageBox::warning(0, tr("ERROR"), tr("MSG_PORT_EXIST"));
437         return NULL;
438       }
439     }
440     SUPERV_Port aPort = aNode->InPort(aDlg->getName().latin1(),
441                                       aDlg->getType().latin1());    
442     delete aDlg;
443     return aPort;
444   }
445   delete aDlg;
446   return NULL;
447 }
448
449
450 SUPERV_Port SUPERVGUI_Node::createOutPort() {
451   SUPERVGUI_PortParamsDlg* aDlg = new SUPERVGUI_PortParamsDlg();
452   if (aDlg->exec()) {
453     SUPERV_INode aNode = getInlineNode();
454     if (SUPERV_isNull(aNode)) {
455       MESSAGE("SUPERVGUI_Node::createInPort: Node is wrong type");
456       return NULL;
457     }
458     SUPERV_Ports aPorts = aNode->Ports();
459     for (int i=0; i<aPorts->length(); i++) {
460       if (aDlg->getName() == QString(aPorts[i]->Name())){
461         QMessageBox::warning(0, tr("ERROR"), tr("MSG_PORT_EXIST"));
462         return NULL;
463       }
464     }
465     SUPERV_Port aPort = aNode->OutPort(aDlg->getName().latin1(),
466                                        aDlg->getType().latin1());
467     delete aDlg;
468     return aPort;
469   }
470   delete aDlg;
471   return NULL;
472 }
473
474
475
476 void SUPERVGUI_Node::addInputPort() {
477   createInPort();
478 }
479
480
481 void SUPERVGUI_Node::addOutputPort() {
482   createOutPort();
483 }
484
485
486 void SUPERVGUI_Node::editFunction() {
487   if (getNodeType() == SUPERV::LoopNode) {
488     SUPERVGUI_EditPythonDlg* aDlg = new SUPERVGUI_EditPythonDlg(true);
489     SUPERV_LNode aLNode = getLoopNode();
490     aDlg->setInitFunction(aLNode->PyInit());
491     aDlg->setMoreFunction(aLNode->PyMore());
492     aDlg->setNextFunction(aLNode->PyNext());
493     if (aDlg->exec()) {
494       aLNode->SetPyInit(aDlg->getInitFuncName().latin1(), (aDlg->getInitFunction()).in());
495       aLNode->SetPyMore(aDlg->getMoreFuncName().latin1(), (aDlg->getMoreFunction()).in());
496       aLNode->SetPyNext(aDlg->getNextFuncName().latin1(), (aDlg->getNextFunction()).in());
497     }
498     delete aDlg;
499   } else {
500     SUPERVGUI_EditPythonDlg* aDlg = new SUPERVGUI_EditPythonDlg();
501     SUPERV_INode aINode = getInlineNode();
502     aDlg->setFunction(aINode->PyFunction());
503     if (aDlg->exec()) {
504       aINode->SetPyFunction(aDlg->getFuncName().latin1(), (aDlg->getFunction()).in());
505     }
506     delete aDlg;
507   }
508 }
509
510
511
512
513
514
515 /*!
516  * Port parameters dialog definition
517  */
518
519 static const char* MyTypeStrings[] = 
520   {"string", "boolean", "char", "short", "int", "long", "float", "double", "objref"};
521
522 SUPERVGUI_PortParamsDlg::SUPERVGUI_PortParamsDlg()
523   : QDialog(QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu  )
524 {
525   setSizeGripEnabled( true );
526   setCaption("Port parameters");
527
528   QGridLayout* aBaseLayout = new QGridLayout( this );
529   aBaseLayout->setMargin( 11 ); aBaseLayout->setSpacing( 6 );
530
531   QLabel* aNameLbl = new QLabel("Port Name", this );
532   aBaseLayout->addWidget(aNameLbl, 0, 0);
533
534   myNameTxt = new QLineEdit( this );
535   aNameLbl->setBuddy( myNameTxt );
536   aBaseLayout->addWidget(myNameTxt, 0, 1);
537   
538   QLabel* aTypeLbl = new QLabel("Value Type", this );
539   aBaseLayout->addWidget(aTypeLbl, 1, 0);
540  
541   myTypeTxt = new QComboBox( this );
542   aTypeLbl->setBuddy( myTypeTxt );
543   myTypeTxt->insertStrList( MyTypeStrings );
544   aBaseLayout->addWidget(myTypeTxt, 1, 1);
545  
546   QGroupBox* aBtnBox = new QGroupBox( this );
547   aBtnBox->setColumnLayout( 0, Qt::Vertical );
548   aBtnBox->layout()->setSpacing( 0 ); aBtnBox->layout()->setMargin( 0 );
549   QHBoxLayout* aBtnLayout = new QHBoxLayout( aBtnBox->layout() );
550   aBtnLayout->setAlignment( Qt::AlignTop );
551   aBtnLayout->setSpacing( 6 ); aBtnLayout->setMargin( 11 );
552
553   aBaseLayout->addMultiCellWidget( aBtnBox, 2, 2, 0, 1 );
554
555   QPushButton* aOKBtn = new QPushButton( tr( "BUT_OK" ), aBtnBox );
556   connect( aOKBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
557   aBtnLayout->addWidget( aOKBtn );
558
559   aBtnLayout->addStretch();
560
561   QPushButton* aCancelBtn = new QPushButton( tr("BUT_CANCEL"), aBtnBox );
562   connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
563   aBtnLayout->addWidget( aCancelBtn );
564 }