Salome HOME
Qt4 porting: the filter is editable, but should not be (MESH-026 GUI test scenario)
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Preferences_ScalarBarDlg.cxx
index 5b4cbd873528903e6f7e101fb60363d95b6f3ecf..b30ce298275912c493753ee7e6dc70a494701d4c 100644 (file)
 // SALOME GUI includes
 #include <SUIT_Desktop.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_MessageBox.h>
 
+#include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <SALOME_ListIO.hxx>
 
@@ -272,12 +275,14 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
   QHBoxLayout* myButtonGrpLayout = new QHBoxLayout( myButtonGrp );
   myButtonGrpLayout->setSpacing( SPACING_SIZE ); myButtonGrpLayout->setMargin( MARGIN_SIZE );
 
-  myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), myButtonGrp );
+  myOkBtn = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), myButtonGrp );
   myOkBtn->setAutoDefault( true ); myOkBtn->setDefault( true );
   myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), myButtonGrp );
   myApplyBtn->setAutoDefault( true );
   myCancelBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), myButtonGrp );
   myCancelBtn->setAutoDefault( true );
+  myHelpBtn = new QPushButton( tr("SMESH_BUT_HELP"), myButtonGrp );
+  myHelpBtn->setAutoDefault(true);
 
   myButtonGrpLayout->addWidget( myOkBtn );
   myButtonGrpLayout->addSpacing( 10 );
@@ -285,6 +290,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
   myButtonGrpLayout->addSpacing( 10 );
   myButtonGrpLayout->addStretch();
   myButtonGrpLayout->addWidget( myCancelBtn );
+  myButtonGrpLayout->addWidget( myHelpBtn );
 
   aTopLayout->addWidget( myButtonGrp );
 
@@ -367,11 +373,14 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
   connect( myOkBtn,             SIGNAL( clicked() ), this, SLOT( onOk() ) );
   connect( myApplyBtn,          SIGNAL( clicked() ), this, SLOT( onApply() ) );
   connect( myCancelBtn,         SIGNAL( clicked() ), this, SLOT( onCancel() ) );
+  connect( myHelpBtn,           SIGNAL(clicked()),   this, SLOT( onHelp() ) );
   connect( myXSpin,             SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
   connect( myYSpin,             SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
   connect( aOrientationGrp,     SIGNAL( buttonClicked( int ) ),   this, SLOT( onOrientationChanged() ) );
   connect( mySelectionMgr,      SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
   connect( mySMESHGUI,          SIGNAL( SignalCloseAllDialogs() ),   this, SLOT( onCancel() ) );
+
+  myHelpFileName = "about_quality_controls_page.html";
 }
 
 //=================================================================================================
@@ -475,6 +484,33 @@ void SMESHGUI_Preferences_ScalarBarDlg::onCancel()
   close();
 }
 
+//=================================================================================================
+/*!
+ *  SMESHGUI_Preferences_ScalarBarDlg::onHelp
+ *
+ *  Help button slot
+ */
+//=================================================================================================
+void SMESHGUI_Preferences_ScalarBarDlg::onHelp()
+{
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) 
+    app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
+                            tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                            arg(app->resourceMgr()->stringValue("ExternalBrowser", 
+                                                                platform)).
+                            arg(myHelpFileName));
+  }
+}
+
 //=================================================================================================
 /*!
  *  SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged