Salome HOME
Fix bug 15567: MakeFuse() for compounds of faces raises error.
[modules/geom.git] / src / RepairGUI / RepairGUI_FreeFacesDlg.cxx
index 04c2b19b0d26b42f421bea34a379de2772ef5163..ea6491ff06e131c0843428c9c86927acba5d2930 100644 (file)
@@ -17,7 +17,7 @@
 //  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 
 #include "RepairGUI_FreeFacesDlg.h"
 
+#include "LightApp_Application.h"
+#include "LightApp_SelectionMgr.h"
 #include "SalomeApp_Application.h"
-#include "SalomeApp_SelectionMgr.h"
 #include "SalomeApp_Tools.h"
 
+#include "SUIT_MessageBox.h"
 #include "SUIT_Session.h"
 #include "SUIT_OverrideCursor.h"
 
@@ -64,11 +66,12 @@ using namespace std;
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent, const char* name, bool modal, WFlags fl)
-:QDialog( parent, "RepairGUI_FreeBoundDlg", false,
-         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
- GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
- myGeomGUI( GUI )
+RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent,
+                                               const char* name, bool modal, WFlags fl)
+  :QDialog(parent, "RepairGUI_FreeBoundDlg", false,
+           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+   GEOMBase_Helper(dynamic_cast<SUIT_Desktop*>(parent)),
+   myGeomGUI(GUI)
 {
   myDisplayer = 0;
 
@@ -97,10 +100,11 @@ RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent
   QFrame* aFrame = new QFrame( this );
   aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
   QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame );
+  QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame );
   QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
-  aBtnLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
   aBtnLay->addWidget( aCloseBtn );
   aBtnLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+  aBtnLay->addWidget( aHelpBtn );
 
   QVBoxLayout* aLay = new QVBoxLayout( this );
   aLay->setSpacing( SPACING );
@@ -109,7 +113,10 @@ RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent
   aLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
   aLay->addWidget( aFrame );
   
+  myHelpFileName = "check_free_faces.htm";
+
   connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
+  connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
   connect( mySelBtn,    SIGNAL( clicked() ),
            this,        SLOT  ( onSetEditCurrentArgument() ) );
   /***************************************************************/
@@ -140,6 +147,23 @@ void RepairGUI_FreeFacesDlg::onClose()
   erasePreview();
 }
 
+//=================================================================================
+// function : onHelp()
+// purpose  :
+//=================================================================================
+void RepairGUI_FreeFacesDlg::onHelp()
+{
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->moduleName()) : QString(""), myHelpFileName);
+  else {
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
+}
+
 //=================================================================================
 // function : onDeactivate
 // purpose  : Deactivate this dialog
@@ -328,3 +352,19 @@ void RepairGUI_FreeFacesDlg::onSetEditCurrentArgument()
   onSelectionDone();
 }
 
+//=================================================================================
+// function : keyPressEvent()
+// purpose  :
+//=================================================================================
+void RepairGUI_FreeFacesDlg::keyPressEvent( QKeyEvent* e )
+{
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Key_F1 )
+    {
+      e->accept();
+      onHelp();
+    }
+}