Salome HOME
fix bug with "Compute" operation invoked from Preview dialog (The problem that dialog...
authorptv <ptv@opencascade.com>
Tue, 21 Apr 2009 11:27:21 +0000 (11:27 +0000)
committerptv <ptv@opencascade.com>
Tue, 21 Apr 2009 11:27:21 +0000 (11:27 +0000)
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.h

index ed8117059232a7fc94279a329e964094809f503b..8e9400a4c785515b442737ec49812fcd29da28c7 100644 (file)
@@ -1433,6 +1433,17 @@ SMESHGUI_ComputeDlg* SMESHGUI_BaseComputeOp::computeDlg() const
   return myCompDlg;
 }
 
+//================================================================================
+/*!
+ * \brief returns from compute mesh result dialog
+ */
+//================================================================================
+
+bool SMESHGUI_BaseComputeOp::onApply()
+{
+  return true;
+}
+
 //================================================================================
 /*!
  * \brief Return a table
@@ -1479,17 +1490,6 @@ void SMESHGUI_ComputeOp::startOperation()
   computeMesh();
 }
 
-//================================================================================
-/*!
- * \brief perform it's intention action: compute mesh
- */
-//================================================================================
-
-bool SMESHGUI_ComputeOp::onApply()
-{
-  return true;
-}
-
 //================================================================================
 /*!
  * \brief Gets dialog of this operation
@@ -1559,6 +1559,8 @@ void SMESHGUI_PrecomputeOp::startOperation()
     
     // connect signals
     connect( myDlg, SIGNAL( preview() ), this, SLOT( onPreview() ) );
+    connect( myDlg, SIGNAL( dlgOk() ), this, SLOT( onCompute() ) );
+    connect( myDlg, SIGNAL( dlgApply() ), this, SLOT( onCompute() ) );
   }
   myActiveDlg = myDlg;
 
@@ -1588,6 +1590,10 @@ void SMESHGUI_PrecomputeOp::startOperation()
 
   SMESHGUI_BaseComputeOp::startOperation();
 
+  // disconnect slot from preview dialog to have Apply from results of compute operation only 
+  disconnect( myDlg, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
+  disconnect( myDlg, SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
+
   myDlg->show();
 }
 
@@ -1675,24 +1681,16 @@ void SMESHGUI_PrecomputeOp::initDialog()
 
 //================================================================================
 /*!
- * \brief perform it's intention action: 
+ * \brief perform it's intention action: compute mesh
  */
 //================================================================================
 
-bool SMESHGUI_PrecomputeOp::onApply()
+void SMESHGUI_PrecomputeOp::onCompute()
 {
-  QObject* obj = sender();
-  if ( obj != myDlg && myActiveDlg == myDlg )
-    return true; // just return from error messages
-  if ( myActiveDlg == myDlg )
-  {
-    myDlg->hide();
-    myMapShapeId.clear();
-    myActiveDlg = computeDlg();
-    computeMesh();
-  }
-
-  return true;
+  myDlg->hide();
+  myMapShapeId.clear();
+  myActiveDlg = computeDlg();
+  computeMesh();
 }
 
 //================================================================================
@@ -1704,11 +1702,10 @@ bool SMESHGUI_PrecomputeOp::onApply()
 void SMESHGUI_PrecomputeOp::onCancel()
 {
   QObject* curDlg = sender();
-  if ( curDlg == computeDlg() )
+  if ( curDlg == computeDlg() && myActiveDlg == myDlg )
   {
-    if ( myActiveDlg == myDlg ) // return from error messages
-      myDlg->show();
-
+    // return from error messages
+    myDlg->show();
     return;
   }
 
index 5ec969cc7777b6f32c94c986415c05e935eb326d..9a84f8a1c26b919fbf8160449528def81f33af30 100644 (file)
@@ -84,6 +84,7 @@ protected:
                                                    const QString& );
     
 protected slots:
+  virtual bool                   onApply();
   void                           onPreviewShape();
   void                           onPublishShape();
   void                           onShowBadMesh();
@@ -120,7 +121,6 @@ protected:
   virtual void                   startOperation();
 
 protected slots:
-  virtual bool                   onApply();
 };
 
 /*!
@@ -144,11 +144,11 @@ protected:
   virtual void                   initDialog();
 
 protected slots:
-  virtual bool                   onApply();
   virtual void                   onCancel();
 
 private slots:
   void                           onPreview();
+  void                           onCompute();
 
 private:
   QMap< int, int >               myMapShapeId;