]> SALOME platform Git repositories - modules/smesh.git/commitdiff
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 786c72f9d48602341bc7d8a311371206f9f9df91..647a6092df74105b347b87f67acdf864b1c8797f 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 54c1013244e38aa91b8250558b79eb28d0c5c461..bc8c406834fe98678d1d3c8c9c099ca4ef09d2ae 100644 (file)
@@ -401,6 +401,8 @@ private slots:
   void activate();
   void deactivate();
   void updateSelection();
+  void help();
+  void dump();
 
 private:
   SMESHGUI_CtrlInfo*  myCtrlInfo;
index 6a8b6750f79bd7df7514a1a40bc7ef83e70b5a23..0a6dfcf052c7dd0e046d97dd3589faa45c4f2f1e 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 7423e43ea0dd273b6786a099c2510b34fe630fff..a5e3a690af9cbc999b4c10cfcaa15e4acd642f9a 100755 (executable)
@@ -7228,6 +7228,18 @@ en raison de leurs types incompatibles:
 </context>
 <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>