Salome HOME
0020976: EDF 1471 SMESH: New ergonomy to display quality controls
authoreap <eap@opencascade.com>
Tue, 23 Jul 2013 12:35:23 +0000 (12:35 +0000)
committereap <eap@opencascade.com>
Tue, 23 Jul 2013 12:35:23 +0000 (12:35 +0000)
Make Quality Info dialog look same as Quality Info tab of Mesh Info
dialog: add Help and Dump buttons

src/SMESHGUI/SMESHGUI_MeshInfo.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.h
src/SMESHGUI/SMESH_msg_en.ts
src/SMESHGUI/SMESH_msg_fr.ts

index 786c72f..647a609 100644 (file)
@@ -3518,16 +3518,29 @@ SMESHGUI_CtrlInfoDlg::SMESHGUI_CtrlInfoDlg( QWidget* parent )
   okBtn->setAutoDefault( true );
   okBtn->setDefault( true );
   okBtn->setFocus();
+  QPushButton* dumpBtn = new QPushButton( tr( "BUT_DUMP_MESH" ), this );
+  dumpBtn->setAutoDefault( true );
+  QPushButton* helpBtn = new QPushButton( tr( "SMESH_BUT_HELP" ), this );
+  helpBtn->setAutoDefault( true );
+
+  QHBoxLayout* btnLayout = new QHBoxLayout;
+  btnLayout->setSpacing( SPACING );
+  btnLayout->setMargin( 0 );
+
+  btnLayout->addWidget( okBtn );
+  btnLayout->addWidget( dumpBtn );
+  btnLayout->addStretch( 10 );
+  btnLayout->addWidget( helpBtn );
 
-  QGridLayout* l = new QGridLayout ( this );
+  QVBoxLayout* l = new QVBoxLayout ( this );
   l->setMargin( MARGIN );
   l->setSpacing( SPACING );
-  l->addWidget( myCtrlInfo, 0, 0, 1, 3 );
-  l->addWidget( okBtn, 1, 1 );
-  l->setColumnStretch( 0, 5 );
-  l->setColumnStretch( 2, 5 );
+  l->addWidget( myCtrlInfo );
+  l->addLayout( btnLayout );
 
-  connect( okBtn,                   SIGNAL( clicked() ),                      this, SLOT( reject() ) );
+  connect( okBtn,   SIGNAL( clicked() ), this, SLOT( reject() ) );
+  connect( dumpBtn, SIGNAL( clicked() ), this, SLOT( dump() ) );
+  connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) );
   connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
   connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( reject() ) );
 
@@ -3606,4 +3619,49 @@ void SMESHGUI_CtrlInfoDlg::deactivate()
   disconnect( SMESHGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ) );
 }
 
+/*!
+ * \brief Dump contents into a file
+ */
+void SMESHGUI_CtrlInfoDlg::dump()
+{
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+  if ( !app ) return;
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
+  if ( !appStudy ) return;
+  _PTR( Study ) aStudy = appStudy->studyDS();
 
+  QStringList aFilters;
+  aFilters.append( tr( "TEXT_FILES" ) );
+
+  DumpFileDlg fd( this );
+  fd.setWindowTitle( tr( "SAVE_INFO" ) );
+  fd.setFilters( aFilters );
+  fd.myBaseChk->hide();
+  fd.myElemChk->hide();
+  fd.myAddChk ->hide();
+  fd.myCtrlChk->hide();
+  if ( fd.exec() == QDialog::Accepted )
+  {
+    QString aFileName = fd.selectedFile();
+    if ( !aFileName.isEmpty() ) {
+      QFileInfo aFileInfo( aFileName );
+      if ( aFileInfo.isDir() )
+        return;
+      QFile aFile( aFileName );
+      if ( !aFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
+        return;
+      
+      QTextStream out( &aFile );
+      myCtrlInfo->saveInfo( out );
+    }
+  }
+}
+
+/*!
+ * \brief Show help
+ */
+void SMESHGUI_CtrlInfoDlg::help()
+{
+  SMESH::ShowHelpFile("mesh_infos_page.html#mesh_quality_info_anchor");
+}
index 54c1013..bc8c406 100644 (file)
@@ -401,6 +401,8 @@ private slots:
   void activate();
   void deactivate();
   void updateSelection();
+  void help();
+  void dump();
 
 private:
   SMESHGUI_CtrlInfo*  myCtrlInfo;
index 6a8b675..0a6dfcf 100644 (file)
@@ -7247,6 +7247,18 @@ as they are of improper type:
         <source>CTRL_INFO</source>
         <translation>Quality Info</translation>
     </message>
+    <message>
+        <source>BUT_DUMP_MESH</source>
+        <translation>&amp;Dump</translation>
+    </message>
+    <message>
+        <source>TEXT_FILES</source>
+        <translation>Text files (*.txt)</translation>
+    </message>
+    <message>
+        <source>SAVE_INFO</source>
+        <translation>Save info</translation>
+    </message>
 </context>
 <context>
     <name>SMESHGUI_MinDistance</name>
index 7423e43..a5e3a69 100755 (executable)
@@ -7229,6 +7229,18 @@ en raison de leurs types incompatibles:
 <context>
     <name>SMESHGUI_CtrlInfoDlg</name>
     <message>
+        <source>SAVE_INFO</source>
+        <translation type="unfinished">Save info</translation>
+    </message>
+    <message>
+        <source>TEXT_FILES</source>
+        <translation type="unfinished">Text files (*.txt)</translation>
+    </message>
+    <message>
+        <source>BUT_DUMP_MESH</source>
+        <translation type="unfinished">&amp;Dump</translation>
+    </message>
+    <message>
         <source>CTRL_INFO</source>
         <translation type="unfinished">Quality Info</translation>
     </message>