Salome HOME
Copyrights update 2015.
[samples/sierpinsky.git] / src / SierpinskyGUI / SierpinskyGUI_RunDlg.cxx
index b47f1ef689c689bcc2722195c749d930ea4b4094..435680dcfe2ced70b2eb5891debb495dd36da381 100644 (file)
@@ -1,37 +1,59 @@
+// Copyright (C) 2005-2015  OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 ///////////////////////////////////////////////////////////
 // File    : SierpinskyGUI_RunDlg.cxx
 // Author  : Vadim SANDLER (OCN)
 // Created : 13/07/05
-// Copyright (C) 2005 Open CASCADE
 ///////////////////////////////////////////////////////////
 
 #include "SierpinskyGUI_RunDlg.h"
+#include "SierpinskyGUI.h"
 #include "SALOME_LifeCycleCORBA.hxx"
 #include "SalomeApp_Application.h"
-//#include "VisuGUI_Tools.h"
-
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qgroupbox.h>
-#include <qcheckbox.h>
-#include <qspinbox.h>
-#include <qthread.h>
-#include <qprogressbar.h>
-#include <qapplication.h>
+
+#include <QLabel>
+#include <QLineEdit>
+#include <QLayout>
+#include <QPushButton>
+#include <QGroupBox>
+#include <QCheckBox>
+#include <QSpinBox>
+#include <QThread>
+#include <QProgressBar>
+#include <QApplication>
 
 #include <SUIT_Application.h>
 #include <SUIT_Desktop.h>
 #include <SUIT_FileDlg.h>
-#include <QtxDblSpinBox.h>
+#include <QtxDoubleSpinBox.h>
 #include <SUIT_MessageBox.h>
 
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(Sierpinsky)
 #include CORBA_CLIENT_HEADER(Randomizer)
 #include CORBA_CLIENT_HEADER(SALOMEDS)
+#ifdef WITH_VISU
 #include CORBA_CLIENT_HEADER(VISU_Gen)
+#endif
+
+#include <utilities.h>
 
 /*!
  * Get Randomizer component engine
@@ -42,7 +64,7 @@ static RANDOMIZER_ORB::RANDOMIZER_var getRandomizerEngine()
   if( CORBA::is_nil( aGen ) ) {
     try{
       SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
-      Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServerPy","RANDOMIZER");
+      Engines::EngineComponent_var aComponent = aLCC.FindOrLoad_Component("FactoryServerPy","RANDOMIZER");
       aGen = RANDOMIZER_ORB::RANDOMIZER::_narrow( aComponent );
     }
     catch (CORBA::Exception&){
@@ -64,7 +86,7 @@ static SIERPINSKY_ORB::SIERPINSKY_var getSierpinskyEngine()
   if( CORBA::is_nil( aGen ) ) {
     try{
       SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
-      Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","SIERPINSKY");
+      Engines::EngineComponent_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","SIERPINSKY");
       aGen = SIERPINSKY_ORB::SIERPINSKY::_narrow( aComponent );
     }
     catch (CORBA::Exception&){
@@ -77,6 +99,7 @@ static SIERPINSKY_ORB::SIERPINSKY_var getSierpinskyEngine()
   return aGen;
 }
 
+#ifdef WITH_VISU
 /*!
  * Get VISU component engine
  */
@@ -86,7 +109,7 @@ static VISU::VISU_Gen_var getVisuEngine()
   if( CORBA::is_nil( aGen ) ) {
     try{
       SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
-      Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","VISU");
+      Engines::EngineComponent_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","VISU");
       aGen = VISU::VISU_Gen::_narrow( aComponent );
     }
     catch (CORBA::Exception&){
@@ -99,12 +122,13 @@ static VISU::VISU_Gen_var getVisuEngine()
   }
   return aGen;
 }
+#endif
 
 #define MY_EVENT QEvent::User + 555
-class MyEvent : public QCustomEvent
+class MyEvent : public QEvent
 {
 public:
-  MyEvent( const int iter ) : QCustomEvent( MY_EVENT ), myIter( iter ) {}
+  MyEvent( const int iter ) : QEvent( (QEvent::Type)(MY_EVENT) ), myIter( iter ) {}
   int iter() const { return myIter; }
 
 private:
@@ -154,12 +178,16 @@ private:
 /*!
  * Constructor
  */
-SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent )
-     : QDialog( parent, "SierpinskyGUI_RunDlg", true, 
-               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
-       myThread( 0 )
+SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent, SierpinskyGUI* module )
+     : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+       myThread( 0 ), myModule( module )
 {
-  setCaption( tr( "CAPTION" ) );
+  setAttribute( Qt::WA_DeleteOnClose );
+
+  setObjectName("SierpinskyGUI_RunDlg");
+  setModal(true);
+
+  setWindowTitle( tr( "CAPTION" ) );
   setSizeGripEnabled( true );
   
   QGridLayout* topLayout = new QGridLayout( this ); 
@@ -167,18 +195,17 @@ SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent )
 
   // start point group
   box1 = new QGroupBox( tr( "START_POINT" ), this );
-  box1->setColumnLayout( 0, Qt::Vertical );
-  box1->layout()->setMargin( 0 ); box1->layout()->setSpacing( 0 );
-  QGridLayout* box1Layout = new QGridLayout( box1->layout() );
+  QGridLayout* box1Layout = new QGridLayout( box1 );
   box1Layout->setAlignment( Qt::AlignTop );
-  box1Layout->setMargin( MARGIN_SIZE ); box1Layout->setSpacing( SPACING_SIZE );
+  box1Layout->setMargin( MARGIN_SIZE );
+  box1Layout->setSpacing( SPACING_SIZE );
 
   QLabel* labX = new QLabel( "X:", box1 );
-  myStartX = new QtxDblSpinBox( 0.0, 1.0, 0.1 ,box1);
+  myStartX = new QtxDoubleSpinBox( 0.0, 1.0, 0.1 ,box1);
   myStartX->setMinimumWidth( 150 );
 
   QLabel* labY = new QLabel( "Y:", box1 );
-  myStartY = new QtxDblSpinBox( 0.0, 1.0, 0.1 ,box1);
+  myStartY = new QtxDoubleSpinBox( 0.0, 1.0, 0.1 ,box1);
   myStartY->setMinimumWidth( 150 );
 
   myStartRandom = new QCheckBox( tr( "RANDOM" ), box1 );
@@ -191,34 +218,33 @@ SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent )
 
   // base points group
   box2 = new QGroupBox( tr( "BASE_POINTS" ), this );
-  box2->setColumnLayout( 0, Qt::Vertical );
-  box2->layout()->setMargin( 0 ); box2->layout()->setSpacing( 0 );
-  QGridLayout* box2Layout = new QGridLayout( box2->layout() );
+  QGridLayout* box2Layout = new QGridLayout( box2 );
   box2Layout->setAlignment( Qt::AlignTop );
-  box2Layout->setMargin( MARGIN_SIZE ); box2Layout->setSpacing( SPACING_SIZE );
+  box2Layout->setMargin( MARGIN_SIZE );
+  box2Layout->setSpacing( SPACING_SIZE );
 
   QLabel* labX1 = new QLabel( "X1:", box2 );
-  myX1 = new QtxDblSpinBox( 0.0, 1.0, 0.1 , box2);
+  myX1 = new QtxDoubleSpinBox( 0.0, 1.0, 0.1 , box2);
   myX1->setMinimumWidth( 150 );
 
   QLabel* labY1 = new QLabel( "Y1:", box2 );
-  myY1 = new QtxDblSpinBox( 0.0, 1.0, 0.1 , box2);
+  myY1 = new QtxDoubleSpinBox( 0.0, 1.0, 0.1 , box2);
   myY1->setMinimumWidth( 150 );
 
   QLabel* labX2 = new QLabel( "X2:", box2 );
-  myX2 = new QtxDblSpinBox( 0.0, 1.0, 0.1 , box2);
+  myX2 = new QtxDoubleSpinBox( 0.0, 1.0, 0.1 , box2);
   myX2->setMinimumWidth( 150 );
 
   QLabel* labY2 = new QLabel( "Y2:", box2 );
-  myY2 = new QtxDblSpinBox( 0.0, 1.0, 0.1, box2);
+  myY2 = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, box2);
   myY2->setMinimumWidth( 150 );
 
   QLabel* labX3 = new QLabel( "X3:", box2 );
-  myX3 = new QtxDblSpinBox( 0.0, 1.0, 0.1, box2);
+  myX3 = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, box2);
   myX3->setMinimumWidth( 150 );
 
   QLabel* labY3 = new QLabel( "Y3:", box2 );
-  myY3 = new QtxDblSpinBox( 0.0, 1.0, 0.1, box2);
+  myY3 = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, box2);
   myY3->setMinimumWidth( 150 );
 
   myBaseRandom  = new QCheckBox( tr( "RANDOM" ), box2 );
@@ -241,15 +267,17 @@ SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent )
 
   // number of iterations
   QLabel* labIter = new QLabel( tr( "NB_ITERATIONS" ), this );
-  myIter = new QSpinBox( 1, 100000, 1, this );
+  myIter = new QSpinBox( this );
+  myIter->setMinimum(1);
+  myIter->setMaximum(100000);
+  myIter->setSingleStep(1);
 
   // results
   box3 = new QGroupBox( tr( "RESULTS" ), this );
-  box3->setColumnLayout( 0, Qt::Vertical );
-  box3->layout()->setMargin( 0 ); box3->layout()->setSpacing( 0 );
-  QGridLayout* box3Layout = new QGridLayout( box3->layout() );
+  QGridLayout* box3Layout = new QGridLayout( box3 );
   box3Layout->setAlignment( Qt::AlignTop );
-  box3Layout->setMargin( MARGIN_SIZE ); box3Layout->setSpacing( SPACING_SIZE );
+  box3Layout->setMargin( MARGIN_SIZE );
+  box3Layout->setSpacing( SPACING_SIZE );
 
   myJpegCheck = new QCheckBox( tr( "EXPORT_2_JPEG" ), box3 );
   myJpegFile = new QLineEdit( box3 );
@@ -259,7 +287,10 @@ SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent )
   myJpegBtn->setFixedSize( 20, 20 );
 
   QLabel* labJpeg = new QLabel( tr( "IMAGE_SIZE" ), box3 );
-  myJpegSize = new QSpinBox( 0, 1280, 10, box3 );
+  myJpegSize = new QSpinBox( box3 );
+  myJpegSize->setMinimum(0);
+  myJpegSize->setMaximum(1280);
+  myJpegSize->setSingleStep(10);
   myJpegSize->setMinimumWidth( 150 );
 
   QFrame* line = new QFrame( box3 );
@@ -273,27 +304,27 @@ SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent )
   myMedBtn->setFixedSize( 20, 20 );
 
   QLabel* labMed = new QLabel( tr( "MESH_SIZE" ), box3 );
-  myMedSize = new QtxDblSpinBox( 0.0, 1000, 1.0, box3);
+  myMedSize = new QtxDoubleSpinBox( 0.0, 1000, 1.0, box3);
   myMedSize->setMinimumWidth( 150 );
 
   myVisuCheck = new QCheckBox( tr( "IMPORT_MED_2_VISU" ), box3 );
 
-  box3Layout->addMultiCellWidget( myJpegCheck, 0, 0, 0, 3 );
-  box3Layout->addMultiCellWidget( myJpegFile,  1, 1, 0, 2 );
-  box3Layout->addWidget(          myJpegBtn,      1,    3 );
-  box3Layout->addWidget(          labJpeg,        2,    0 );
-  box3Layout->addWidget(          myJpegSize,     2,    1 );
-  box3Layout->addMultiCellWidget( line,        3, 3, 0, 3 );
-  box3Layout->addMultiCellWidget( myMedCheck,  4, 4, 0, 3 );
-  box3Layout->addMultiCellWidget( myMedFile,   5, 5, 0, 2 );
-  box3Layout->addWidget(          myMedBtn,       5,    3 );
-  box3Layout->addWidget(          labMed,         6,    0 );
-  box3Layout->addWidget(          myMedSize,      6,    1 );
-  box3Layout->addMultiCellWidget( myVisuCheck,    7, 7, 0, 3 );
+  box3Layout->addWidget( myJpegCheck, 0, 0, 1, 4 );
+  box3Layout->addWidget( myJpegFile,  1, 0, 1, 3 );
+  box3Layout->addWidget( myJpegBtn,   1, 3 );
+  box3Layout->addWidget( labJpeg,     2, 0 );
+  box3Layout->addWidget( myJpegSize,  2, 1 );
+  box3Layout->addWidget( line,        3, 0, 1, 4 );
+  box3Layout->addWidget( myMedCheck,  4, 0, 1, 4 );
+  box3Layout->addWidget( myMedFile,   5, 0, 1, 3 );
+  box3Layout->addWidget( myMedBtn,    5, 3 );
+  box3Layout->addWidget( labMed,      6, 0 );
+  box3Layout->addWidget( myMedSize,   6, 1 );
+  box3Layout->addWidget( myVisuCheck, 7, 0, 1, 4 );
 
   // progress bar
   myProgress = new QProgressBar( this );
-  myProgress->setPercentageVisible( false );
+  myProgress->setTextVisible( false );
   myProgress->setFixedHeight( 10 );
  
   // common buttons
@@ -304,13 +335,13 @@ SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent )
   btnLayout->addStretch();
   btnLayout->addWidget( myCancelBtn );
 
-  topLayout->addMultiCellWidget( box1,      0, 0, 0, 1 );
-  topLayout->addMultiCellWidget( box2,      1, 1, 0, 1 );
-  topLayout->addWidget(          labIter,      2,    0 );
-  topLayout->addWidget(          myIter,       2,    1 );
-  topLayout->addMultiCellWidget( box3,      3, 3, 0, 1 );
-  topLayout->addMultiCellWidget( myProgress,4, 4, 0, 1 );
-  topLayout->addMultiCellLayout( btnLayout, 5, 5, 0, 1 );
+  topLayout->addWidget( box1,       0, 0, 1, 2 );
+  topLayout->addWidget( box2,       1, 0, 1, 2 );
+  topLayout->addWidget( labIter,    2, 0 );
+  topLayout->addWidget( myIter,     2, 1 );
+  topLayout->addWidget( box3,       3, 0, 1, 2 );
+  topLayout->addWidget( myProgress, 4, 0, 1, 2 );
+  topLayout->addLayout( btnLayout,  5, 0, 1, 2 );
 
   // signals and slots connections
   connect( myJpegBtn,     SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
@@ -337,6 +368,9 @@ SierpinskyGUI_RunDlg::SierpinskyGUI_RunDlg( QWidget* parent )
   myMedCheck->setChecked( false );
   myMedSize->setValue( 100 );
   myVisuCheck->setChecked( true );
+#ifndef WITH_VISU
+  myVisuCheck->setVisible( false );
+#endif
   updateState();
 }
 
@@ -360,10 +394,10 @@ void SierpinskyGUI_RunDlg::onBrowse()
   const QObject* snd = sender();
   bool jpg = snd == myJpegBtn;
   QString aFileName = SUIT_FileDlg::getFileName( this, 
-                                               jpg ? myJpegFile->text() : myMedFile->text(), 
-                                               QStringList::split( ":", jpg ? tr( "JPEG_FILES") : tr( "MED_FILES" ) ),
-                                               jpg ? tr( "EXPORT_JPEG_FILE" ) : tr( "EXPORT_MED_FILE" ),
-                                               false );
+                                                jpg ? myJpegFile->text() : myMedFile->text(), 
+                                                (jpg ? tr( "JPEG_FILES") : tr( "MED_FILES" )).split( ":", QString::SkipEmptyParts ),
+                                                jpg ? tr( "EXPORT_JPEG_FILE" ) : tr( "EXPORT_MED_FILE" ),
+                                                false );
   if ( !aFileName.isEmpty() ) {
     jpg ? myJpegFile->setText( aFileName ) : myMedFile->setText( aFileName );
   }
@@ -414,10 +448,10 @@ void SierpinskyGUI_RunDlg::accept()
   SIERPINSKY_ORB::SIERPINSKY_var aSierpGen = getSierpinskyEngine();
 
   if( CORBA::is_nil( aRandGen ) || CORBA::is_nil( aSierpGen ) ) {
-    SUIT_MessageBox::error1( this,
-                           tr( "ERR_ERROR" ),
-                           tr( "EXEC_ERROR" ),
-                           tr( "OK_BTN") );
+    SUIT_MessageBox::critical( this,
+                              tr( "ERR_ERROR" ),
+                              tr( "EXEC_ERROR" ),
+                              tr( "OK_BTN") );
     return;
   }
 
@@ -425,13 +459,13 @@ void SierpinskyGUI_RunDlg::accept()
   QString aJPEGFile;
   int aJPEGSize = 0;
   if ( myJpegCheck->isChecked() ) {
-    aJPEGFile = myJpegFile->text().stripWhiteSpace();
+    aJPEGFile = myJpegFile->text().trimmed();
     aJPEGSize = myJpegSize->value();
     if ( aJPEGFile.isEmpty() || aJPEGSize <= 0 ) {
-      int res = SUIT_MessageBox::warn2( this,
-                                      tr( "WRN_WARNING" ),
-                                      tr( "JPEG_PARAMETERS_ERROR" ),
-                                      tr( "YES_BTN"), tr( "NO_BTN" ), 0, 1, 0 );
+      int res = SUIT_MessageBox::warning( this,
+                                         tr( "WRN_WARNING" ),
+                                         tr( "JPEG_PARAMETERS_ERROR" ),
+                                         tr( "YES_BTN"), tr( "NO_BTN" ), 0, 1, 0 );
       if ( res ) return;
     }
   }
@@ -440,13 +474,13 @@ void SierpinskyGUI_RunDlg::accept()
   QString aMEDFile;
   double aMEDSize = 0;
   if ( myMedCheck->isChecked() ) {
-    aMEDFile = myMedFile->text().stripWhiteSpace();
+    aMEDFile = myMedFile->text().trimmed();
     aMEDSize = myMedSize->value();
     if ( aMEDFile.isEmpty() || aMEDSize <= 0 ) {
-      int res = SUIT_MessageBox::warn2( this,
-                                      tr( "WRN_WARNING" ),
-                                      tr( "MED_PARAMETERS_ERROR" ),
-                                      tr( "YES_BTN"), tr( "NO_BTN" ), 0, 1, 0 );
+      int res = SUIT_MessageBox::warning( this,
+                                         tr( "WRN_WARNING" ),
+                                         tr( "MED_PARAMETERS_ERROR" ),
+                                         tr( "YES_BTN"), tr( "NO_BTN" ), 0, 1, 0 );
       if ( res ) return;
     }
   }
@@ -480,8 +514,8 @@ void SierpinskyGUI_RunDlg::accept()
   int iter = myIter->value();
 
   // start execution
-  myProgress->setTotalSteps( iter );
-  myProgress->setProgress( 0 );
+  myProgress->setMaximum( iter );
+  myProgress->setValue( 0 );
   if ( !myThread )
     myThread = new MyThread( this, x, y, iter );
   else
@@ -504,7 +538,7 @@ void SierpinskyGUI_RunDlg::stop()
   disconnect( myStartBtn, SIGNAL( clicked() ), this, SLOT( stop() ) );
   connect(    myStartBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
   myStartBtn->setText( tr( "START_BTN" ) );
-  myProgress->setProgress( 0 );
+  myProgress->setValue( 0 );
   box1->setEnabled( true );
   box2->setEnabled( true );
   box3->setEnabled( true );
@@ -520,7 +554,7 @@ void SierpinskyGUI_RunDlg::nextStep( const int step )
     disconnect( myStartBtn, SIGNAL( clicked() ), this, SLOT( stop() ) );
     connect(    myStartBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
     myStartBtn->setText( tr( "START_BTN" ) );
-    myProgress->setProgress( 0 );
+    myProgress->setValue( 0 );
     box1->setEnabled( true );
     box2->setEnabled( true );
     box3->setEnabled( true );
@@ -528,38 +562,44 @@ void SierpinskyGUI_RunDlg::nextStep( const int step )
 
     // export to JPEG
     if ( myJpegCheck->isChecked() ) {
-      QString aJPEGFile = myJpegFile->text().stripWhiteSpace();
+      QString aJPEGFile = myJpegFile->text().trimmed();
       int aJPEGSize = myJpegSize->value();
       if ( !aJPEGFile.isEmpty() && aJPEGSize > 0 ) {
-        bool res = getSierpinskyEngine()->ExportToJPEG( aJPEGFile.latin1(), aJPEGSize );
+        bool res = getSierpinskyEngine()->ExportToJPEG( aJPEGFile.toLatin1().data(), aJPEGSize );
+       if ( !res ) {
+         // error: can't create JPEG image
+       }
       }
     }
     // export to MED
     if ( myMedCheck->isChecked() ) {
-      QString aMEDFile = myMedFile->text().stripWhiteSpace();
+      QString aMEDFile = myMedFile->text().trimmed();
       double aMEDSize = myMedSize->value();
       if ( !aMEDFile.isEmpty() && aMEDSize > 0 ) {
-        bool res = getSierpinskyEngine()->ExportToMED( aMEDFile.latin1(), aMEDSize );
+        bool res = getSierpinskyEngine()->ExportToMED( aMEDFile.toLatin1().data(), aMEDSize );
+#ifdef WITH_VISU
        if ( res && myVisuCheck->isChecked() ) {
           VISU::VISU_Gen_var aVisuGen = getVisuEngine();
           if ( !CORBA::is_nil( aVisuGen ) ) {
-            VISU::Result_var aResult = aVisuGen->ImportFile( aMEDFile.latin1() );
+            VISU::Result_var aResult = aVisuGen->ImportFile( aMEDFile.toLatin1().data() );
             if ( !CORBA::is_nil( aResult ) )
               aVisuGen->MeshOnEntity( aResult, "Sierpinsky", VISU::NODE );
+           myModule->getApp()->updateObjectBrowser( true );
           }
         }
+#endif
       }
     }
   }
   else {
-    myProgress->setProgress( myProgress->totalSteps() - step );
+    myProgress->setValue( myProgress->maximum() - step );
   }
 }
 
 /*!
  *  Process progress event
  */
-void SierpinskyGUI_RunDlg::customEvent( QCustomEvent* e )
+void SierpinskyGUI_RunDlg::customEvent( QEvent* e )
 {
   if ( e->type() == MY_EVENT ) {
     MyEvent* me = (MyEvent*)e;