From: eap Date: Tue, 23 Jul 2013 12:35:23 +0000 (+0000) Subject: 0020976: EDF 1471 SMESH: New ergonomy to display quality controls X-Git-Tag: V7_3_0a1~258 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7608df4ad1558b8ec3a452e8e75b77cbc55c9379;p=modules%2Fsmesh.git 0020976: EDF 1471 SMESH: New ergonomy to display quality controls Make Quality Info dialog look same as Quality Info tab of Mesh Info dialog: add Help and Dump buttons --- diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index 786c72f9d..647a6092d 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -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( 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"); +} diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.h b/src/SMESHGUI/SMESHGUI_MeshInfo.h index 54c101324..bc8c40683 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.h @@ -401,6 +401,8 @@ private slots: void activate(); void deactivate(); void updateSelection(); + void help(); + void dump(); private: SMESHGUI_CtrlInfo* myCtrlInfo; diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 6a8b6750f..0a6dfcf05 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -7247,6 +7247,18 @@ as they are of improper type: CTRL_INFO Quality Info + + BUT_DUMP_MESH + &Dump + + + TEXT_FILES + Text files (*.txt) + + + SAVE_INFO + Save info + SMESHGUI_MinDistance diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index 7423e43ea..a5e3a690a 100755 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -7228,6 +7228,18 @@ en raison de leurs types incompatibles: SMESHGUI_CtrlInfoDlg + + SAVE_INFO + Save info + + + TEXT_FILES + Text files (*.txt) + + + BUT_DUMP_MESH + &Dump + CTRL_INFO Quality Info