1 // SUPERV SUPERVGUI : GUI for Supervisor 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 : SUPERVGUI_Service.cxx
25 // Author : Francis KLOSS
29 #include "SUPERVGUI_Service.h"
30 #include "SUPERVGUI_Main.h"
31 #include "SUPERVGUI.h"
32 #include "QAD_Tools.h"
33 #include "QAD_FileDlg.h"
35 #include "SALOME_NamingService.hxx"
36 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
38 #include <qtextstream.h>
41 static const char * ComponentIcon[] = {
48 " .................. ",
57 " .................. ",
61 " .. .. .. .. .. .. ",
63 " .. .. .. .. .. .. ",
67 static const char * InterfaceIcon[] = {
95 SUPERVGUI_Service::SUPERVGUI_Service(SALOME_NamingService* ns):
96 QDialog(QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
99 setSizeGripEnabled( true );
100 setCaption(tr("TIT_SERVICES"));
102 QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 4);
104 myTabPane = new QTabWidget(this);
105 connect(myTabPane, SIGNAL(currentChanged(QWidget *)), this, SLOT(tabChanged(QWidget *)));
107 // Create Tab for Corba services
108 QWidget* aCorbaPane = new QWidget(myTabPane);
109 QVBoxLayout* aBaseLayoutV= new QVBoxLayout(aCorbaPane, 0, 4);
110 aBaseLayoutV->setMargin(5);
111 aBaseLayoutV->setSpacing(10);
113 QHBoxLayout* aBaseLayout = new QHBoxLayout(aCorbaPane); //!!
115 components = new QListView(aCorbaPane);
116 components->addColumn(tr("COL_COMPONENTS"));
117 components->addColumn(tr("COL_PORTTYPE"));
118 components->addColumn(tr("COL_PORTWAY"));
119 components->setColumnAlignment(1, AlignLeft);
120 components->setColumnAlignment(2, AlignLeft);
121 components->setColumnAlignment(3, AlignLeft);
122 components->setSelectionMode(QListView::Extended);
123 components->setRootIsDecorated(true);
124 // aBaseLayout->addWidget(components);
125 aBaseLayoutV->addWidget(components); //!!
127 //QHGroupBox* aAddBox = new QHGroupBox(tr("TIT_ADDNODE"), aCorbaPane); //!!
128 //aAddBox->setInsideSpacing(20); //!!
130 QPushButton* aComputeCBtn = new QPushButton(tr("TIT_ADDCNODE"), aCorbaPane); //!!
131 connect(aComputeCBtn, SIGNAL(clicked()), this, SLOT(addComputeNode())); //!!
132 aComputeCBtn->setDefault(false);
134 QPushButton* aComputeBtn = new QPushButton(tr("TIT_ADDFNODE"), aCorbaPane);
135 connect(aComputeBtn, SIGNAL(clicked()), this, SLOT(addFactoryNode()));
136 aComputeBtn->setDefault(true);
138 aBaseLayout->addWidget(aComputeBtn);
139 aBaseLayout->addWidget(aComputeCBtn); //!!
141 aBaseLayoutV->insertLayout(-1, aBaseLayout);
142 myTabPane->addTab(aCorbaPane, tr("MODULES_PANE"));
145 // Create Tab for Python services
146 QWidget* aPythonPane = new QWidget(myTabPane);
147 QVBoxLayout* aPythonLayout = new QVBoxLayout(aPythonPane, 0, 4);
148 aPythonLayout->setMargin(5);
149 aPythonLayout->setSpacing(10);
152 QHGroupBox* aAddBox2 = new QHGroupBox(tr("TIT_ADDNODE"), aPythonPane);
153 aAddBox2->setInsideSpacing(20);
155 QLabel* aTypeLbl = new QLabel(tr("LBL_NODETYPE"), aAddBox2);
157 myTypeCombo = new QComboBox(aAddBox2);
158 myTypeCombo->insertItem("Computation");
159 myTypeCombo->insertItem("Switch");
160 myTypeCombo->insertItem("Loop");
161 myTypeCombo->insertItem("GoTo");
162 //myTypeCombo->insertItem("Label");
163 connect(myTypeCombo, SIGNAL(activated(int)), this, SLOT(typeNodeSelected(int)));
165 aPythonLayout->addWidget(aAddBox2);
168 myStackWidget = new QWidgetStack(aPythonPane);
171 myScriptPane = new SUPERVGUI_PythonEditPane(myStackWidget);
172 myOtherId = myStackWidget->addWidget(myScriptPane);
175 QTabWidget* aLoopTabPane = new QTabWidget(myStackWidget);
176 myInitPane = new SUPERVGUI_PythonEditPane(myStackWidget);
177 aLoopTabPane->addTab(myInitPane, "Init");
179 myMorePane = new SUPERVGUI_PythonEditPane(myStackWidget);
180 aLoopTabPane->addTab(myMorePane, "More");
182 myNextPane = new SUPERVGUI_PythonEditPane(myStackWidget);
183 aLoopTabPane->addTab(myNextPane, "Next");
184 myLoopId = myStackWidget->addWidget(aLoopTabPane);
186 myStackWidget->raiseWidget(myOtherId);
188 aPythonLayout->addWidget(myStackWidget, 1);
191 QPushButton* aCreateBtn = new QPushButton(tr("TIT_ADDNODE"), aPythonPane);
192 connect(aCreateBtn, SIGNAL(clicked()), this, SLOT(addInlineNode()));
193 aPythonLayout->addWidget(aCreateBtn);
195 myTabPane->addTab(aPythonPane, tr("INLINE_PANE"));
197 aMainLayout->addWidget(myTabPane);
200 QHBox* aBtnBox = new QHBox(this);
201 QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
202 aBtnLayout->addStretch();
204 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
205 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
207 aMainLayout->addWidget(aBtnBox);
217 void SUPERVGUI_Service::initialise() {
218 CORBA::Object_ptr obj = naming->Resolve("/Kernel/ModulCatalog");
219 SALOME_ModuleCatalog::ModuleCatalog_var *aModuleCatalog = new SALOME_ModuleCatalog::ModuleCatalog_var;
220 *aModuleCatalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj);
221 if (CORBA::is_nil(*aModuleCatalog)) {
222 setCaption("Error in Connexion to omniNames with '/Kernel/ModulCatalog'");
226 QAD_ResourceMgr* aResMgr = QAD_Desktop::createResourceManager();
228 SALOME_ModuleCatalog::ListOfComponents_var lComponents = (*aModuleCatalog)->GetComponentList();
229 long nbComp = lComponents->length();
230 for (int i=0; i<nbComp; i++) {
231 SALOME_ModuleCatalog::Acomponent_ptr C = (*aModuleCatalog)->GetComponent((char *)lComponents[i]);
232 QListViewItem* myComponentItem = new QListViewItem(components, (char*)lComponents[i]);
233 myComponentItem->setSelectable(false);
234 QString aIconName = C->component_icone();
235 if (!aIconName.isEmpty()) {
236 QString resDir = aResMgr->findFile(aIconName, C->componentname()) ;
238 resDir = QAD_Tools::addSlash(resDir);
239 QPixmap aIcone(resDir + aIconName);
240 QIconSet aIconSet(aIcone);
241 myComponentItem->setPixmap(0, aIconSet.pixmap(QIconSet::Small, QIconSet::Normal));
243 myComponentItem->setPixmap(0, ComponentIcon);
246 myComponentItem->setPixmap(0, ComponentIcon);
248 SALOME_ModuleCatalog::ListOfInterfaces* lInterfaces = C->GetInterfaceList();
249 long nbInterf = lInterfaces->length();
250 for (int j=0; j<nbInterf; j++) {
251 SALOME_ModuleCatalog::DefinitionInterface* Interface = C->GetInterface((char*)(*lInterfaces)[j]);
252 QListViewItem* myInterfaceItem = new QListViewItem(myComponentItem, (char*)Interface->interfacename);
253 myInterfaceItem->setSelectable(false);
254 myInterfaceItem->setPixmap(0, InterfaceIcon);
256 long nbServices = Interface->interfaceservicelist.length();
257 for (int k=0; k<nbServices; k++) {
258 SALOME_ModuleCatalog::Service* Service = &(Interface->interfaceservicelist[k]);
259 QListViewItem* myServiceItem = new QListViewItem(myInterfaceItem, (char*)Service->ServiceName);
260 myServiceItem->setSelectable(true);
261 components->ensureItemVisible(myServiceItem);
263 long nbPortsOut = Service->ServiceoutParameter.length();
264 for (int m=0; m<nbPortsOut; m++) {
265 SALOME_ModuleCatalog::ServicesParameter* PortOut = &(Service->ServiceoutParameter[m]);
266 QListViewItem* myPortOutItem = new QListViewItem(myServiceItem, (char*)PortOut->Parametername, (char*)PortOut->Parametertype, "Out");
267 myPortOutItem->setSelectable(false);
270 long nbPortsIn = Service->ServiceinParameter.length();
271 for (int l=0; l<nbPortsIn; l++) {
272 SALOME_ModuleCatalog::ServicesParameter* PortIn = &(Service->ServiceinParameter[l]);
273 QListViewItem* myPortInItem = new QListViewItem(myServiceItem, (char*)PortIn->Parametername, (char*)PortIn->Parametertype, "In");
274 myPortInItem->setSelectable(false);
283 SUPERVGUI_Service::~SUPERVGUI_Service() {
284 Trace("SUPERVGUI_Service::~SUPERVGUI_Service")
287 void SUPERVGUI_Service::addComputeNode() {
288 SUPERVGUI_Main* aMain = Supervision.getMain();
290 QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
292 CORBA::Object_ptr obj = naming->Resolve("/Kernel/ModulCatalog");
293 SALOME_ModuleCatalog::ModuleCatalog_var* aModuleCatalog = new SALOME_ModuleCatalog::ModuleCatalog_var;
294 *aModuleCatalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj);
295 if (CORBA::is_nil(*aModuleCatalog)) {
296 QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
300 QListViewItemIterator i(components);
301 for (; i.current(); ++i) {
303 if (item->isSelected()) {
304 const char* service = item->text(0).latin1();
305 const char* interface = item->parent()->text(0).latin1();
306 const char* component = item->parent()->parent()->text(0).latin1();
307 SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component);
308 if (myComponent==NULL) {
309 QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
311 const SALOME_ModuleCatalog::Service* myService = myComponent->GetService(interface, service);
314 SUPERV_CNode node = aMain->getDataflow()->CNode(*myService);
315 if (CORBA::is_nil(node)) {
316 QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
319 node->Coords(myX, myY);
322 aMain->addComputeNode(SUPERV::CNode::_narrow(node));
327 QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NONODE_TOADD"));
333 void SUPERVGUI_Service::addFactoryNode() {
334 SUPERVGUI_Main* aMain = Supervision.getMain();
336 QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
338 CORBA::Object_ptr obj = naming->Resolve("/Kernel/ModulCatalog");
339 SALOME_ModuleCatalog::ModuleCatalog_var* aModuleCatalog = new SALOME_ModuleCatalog::ModuleCatalog_var;
340 *aModuleCatalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj);
341 if (CORBA::is_nil(*aModuleCatalog)) {
342 QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
346 QListViewItemIterator i(components);
347 for (; i.current(); ++i) {
349 if (item->isSelected()) {
350 const char* service = item->text(0).latin1();
351 const char* interface = item->parent()->text(0).latin1();
352 const char* component = item->parent()->parent()->text(0).latin1();
353 SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component);
354 if (myComponent==NULL) {
355 QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
357 const SALOME_ModuleCatalog::Service* myService = myComponent->GetService(interface, service);
360 SUPERV_FNode node = aMain->getDataflow()->FNode(component, interface, *myService);
361 if (CORBA::is_nil(node)) {
362 QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
365 node->Coords(myX, myY);
368 aMain->addComputeNode(SUPERV::CNode::_narrow(node));
373 QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NONODE_TOADD"));
380 void SUPERVGUI_Service::addInlineNode() {
381 SUPERVGUI_Main* aMain = Supervision.getMain();
383 QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
385 int aSel = myTypeCombo->currentItem();
387 case 0: // Computation
388 if (myScriptPane->isDefined()) {
389 SUPERV_INode aNode = aMain->getDataflow()->INode(myScriptPane->getFuncName().latin1(),
390 (myScriptPane->getFunction()).in());
391 if (CORBA::is_nil(aNode)) {
392 QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
395 aNode->Coords(myX, myY);
398 aMain->addComputeNode(SUPERV::CNode::_narrow(aNode));
403 if (myScriptPane->isDefined()) {
404 SUPERV_INode aEndNode;
405 SUPERV_SNode aStartNode = aMain->getDataflow()->SNode(myScriptPane->getFuncName().latin1(),
406 (myScriptPane->getFunction()).in(),
408 if (CORBA::is_nil(aStartNode) || CORBA::is_nil(aEndNode)) {
409 QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
412 aStartNode->Coords(myX, myY);
413 aEndNode->Coords(myX + LABEL_WIDTH*2, myY);
416 aMain->addControlNode(SUPERV::CNode::_narrow(aStartNode), SUPERV::CNode::_narrow(aEndNode), true);
422 SUPERV_INode aEndNode;
423 SUPERV_LNode aStartNode = aMain->getDataflow()->LNode(myInitPane->getFuncName().latin1(), (myInitPane->getFunction()).in(),
424 myMorePane->getFuncName().latin1(), (myMorePane->getFunction()).in(),
425 myNextPane->getFuncName().latin1(), (myNextPane->getFunction()).in(),
427 if (CORBA::is_nil(aStartNode) || CORBA::is_nil(aEndNode)) {
428 QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
431 aStartNode->Coords(myX, myY);
432 aEndNode->Coords(myX + LABEL_WIDTH*2, myY);
435 aMain->addControlNode(SUPERV::CNode::_narrow(aStartNode), SUPERV::CNode::_narrow(aEndNode), true);
441 SUPERV_GNode aGotoNode;
442 if (myScriptPane->isDefined())
443 aGotoNode = aMain->getDataflow()->GNode(myScriptPane->getFuncName().latin1(),
444 (myScriptPane->getFunction()).in(), "");
446 aGotoNode = aMain->getDataflow()->GNode("GoTo", (myScriptPane->getFunction()).in(), "");
447 if (CORBA::is_nil(aGotoNode)) {
448 QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
451 aGotoNode->Coords(myX, myY);
454 aMain->addGOTONode(SUPERV::GNode::_narrow(aGotoNode));
463 void SUPERVGUI_Service::typeNodeSelected(int theRow) {
465 myStackWidget->raiseWidget(myLoopId);
467 myStackWidget->raiseWidget(myOtherId);
472 void SUPERVGUI_Service::choose() {
473 Trace("SUPERVGUI_Service::choose")
479 void SUPERVGUI_Service::showEvent(QShowEvent* theEvent) {
480 SUPERVGUI_Main* aMain = Supervision.getMain();
481 if (aMain && (!aMain->isArrayShown())) {
482 aMain->getGraph()->viewportToContents(0, 0, myX, myY);
484 QDialog::showEvent(theEvent);
488 void SUPERVGUI_Service::tabChanged(QWidget* theWidget) {
489 myIsInline = (myTabPane->currentPageIndex() == 1);
494 //*****************************************************
495 // Pane for Python script editing
496 //*****************************************************
497 SUPERVGUI_PythonEditPane::SUPERVGUI_PythonEditPane(QWidget* theParent)
501 QGridLayout* aEditLayout = new QGridLayout(this, 2, 4);
504 QPushButton* aLoadBtn = new QPushButton(tr("BUT_LOAD"), this);
505 connect(aLoadBtn, SIGNAL(clicked()), this, SLOT(loadFile()));
507 aEditLayout->addWidget(aLoadBtn, 0, 2);
509 myNextBtn = new QPushButton(tr("BUT_NEXT"), this);
510 myNextBtn->setEnabled(false);
511 connect(myNextBtn, SIGNAL(clicked()), this, SLOT(readFunction()));
513 aEditLayout->addWidget(myNextBtn, 0, 3);
516 myText = new QTextEdit(this);
517 myText->setWordWrap(QTextEdit::FixedColumnWidth);
518 myText->setWrapColumnOrWidth(80);
520 aEditLayout->addMultiCellWidget(myText, 1, 1, 0, 3);
525 * Load existing Python script
527 void SUPERVGUI_PythonEditPane::loadFile() {
528 QString aFileName = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
531 tr("TIT_LOADSCRIPT"),
533 if (aFileName.isEmpty()) return;
535 myFile = new QFile(aFileName);
536 if (!myFile->open(IO_ReadOnly)) {
537 QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"),
538 tr("MSG_CANT_LOADSCRIPT"));
541 myIStream = new QTextStream(myFile);
543 if (myIStream->atEnd()) {
544 QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"),
545 tr("MSG_EMTY_FILE"));
546 myNextBtn->setEnabled(false);
553 myNextBtn->setEnabled(true);
559 * Finds and Reads a function from current position in the opened file
561 void SUPERVGUI_PythonEditPane::readFunction() {
562 if (!myIStream) return;
564 while (!myIStream->atEnd()) {
565 QString aLine = myIStream->readLine();
566 if (aLine.isNull()) return;
568 // find first function
569 int aDefPos = aLine.find("def");
570 if (aDefPos == 0) { // only not a class members
573 /*int aStart = aLine.find(" ", aDefPos);
574 int aEnd = aLine.find("(", aStart);
575 QString aName = aLine.mid(aStart, (aEnd-aStart));
576 aName = aName.stripWhiteSpace();
577 myNameEdt->setText(aName);*/
581 aEnd = aLine.find(")", aStart);
582 QString aParams = aLine.mid(aStart, (aEnd-aStart));
583 aParams = aParams.stripWhiteSpace();
584 myParamEdt->setText(aParams);*/
586 myText->append(aLine);
588 QString aBodyLine = myIStream->readLine();
589 while ((!aBodyLine.isNull()) && aBodyLine[0].isSpace()) {
590 myText->append(aBodyLine);
591 aBodyLine = myIStream->readLine();
596 QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"),
597 tr("MSG_NOMORE_FUNCTIONS"));
600 myNextBtn->setEnabled(false);
606 QString SUPERVGUI_PythonEditPane::getFuncName() {
608 for (int i=0; i < myText->paragraphs(); i++) {
609 QString aLine = myText->text(i);
610 int aDefPos = aLine.find("def");
612 int aStart = aLine.find(" ", aDefPos);
613 int aEnd = aLine.find("(", aStart);
614 QString aName = aLine.mid(aStart, (aEnd-aStart));
615 return aName.stripWhiteSpace();
622 SUPERV_Strings SUPERVGUI_PythonEditPane::getFunction() {
623 SUPERV_Strings aStrings = new SUPERV::ListOfStrings();
624 aStrings->length(myText->paragraphs());
625 for (int i=0; i < myText->paragraphs(); i++) {
626 aStrings[i] = CORBA::string_dup(myText->text(i).latin1());
628 return aStrings._retn();
632 void SUPERVGUI_PythonEditPane::setFunction(SUPERV_Strings theStr) {
633 int aLen = theStr->length();
634 for (int i=0; i < aLen; i++)
635 myText->append(QString(theStr[i]));
643 SUPERVGUI_EditPythonDlg::SUPERVGUI_EditPythonDlg(bool isLoop)
644 :QDialog(QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
646 setSizeGripEnabled( true );
647 setCaption(tr("TIT_FUNC_PYTHON"));
649 QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 4);
651 QTabWidget* aLoopTabPane = new QTabWidget(this);
652 myInitPane = new SUPERVGUI_PythonEditPane(this);
653 aLoopTabPane->addTab(myInitPane, "Init");
655 myMorePane = new SUPERVGUI_PythonEditPane(this);
656 aLoopTabPane->addTab(myMorePane, "More");
658 myNextPane = new SUPERVGUI_PythonEditPane(this);
659 aLoopTabPane->addTab(myNextPane, "Next");
661 aMainLayout->addWidget(aLoopTabPane);
663 myEditPane = new SUPERVGUI_PythonEditPane(this);
664 aMainLayout->addWidget(myEditPane);
666 QGroupBox* aBtnBox = new QGroupBox( this );
667 aBtnBox->setColumnLayout( 0, Qt::Vertical );
668 aBtnBox->layout()->setSpacing( 0 ); aBtnBox->layout()->setMargin( 0 );
669 QHBoxLayout* aBtnLayout = new QHBoxLayout( aBtnBox->layout() );
670 aBtnLayout->setAlignment( Qt::AlignTop );
671 aBtnLayout->setSpacing( 6 ); aBtnLayout->setMargin( 11 );
673 QPushButton* aOKBtn = new QPushButton( tr( "BUT_OK" ), aBtnBox );
674 connect( aOKBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
675 aBtnLayout->addWidget( aOKBtn );
677 aBtnLayout->addStretch();
679 QPushButton* aCancelBtn = new QPushButton( tr("BUT_CANCEL"), aBtnBox );
680 connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
681 aBtnLayout->addWidget( aCancelBtn );
683 aMainLayout->addWidget(aBtnBox);