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
This commit is contained in:
eap 2013-07-23 12:35:23 +00:00
parent eeba8f9c90
commit 7608df4ad1
4 changed files with 90 additions and 6 deletions

View 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 );
QGridLayout* l = new QGridLayout ( this );
QHBoxLayout* btnLayout = new QHBoxLayout;
btnLayout->setSpacing( SPACING );
btnLayout->setMargin( 0 );
btnLayout->addWidget( okBtn );
btnLayout->addWidget( dumpBtn );
btnLayout->addStretch( 10 );
btnLayout->addWidget( helpBtn );
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");
}

View File

@ -401,6 +401,8 @@ private slots:
void activate();
void deactivate();
void updateSelection();
void help();
void dump();
private:
SMESHGUI_CtrlInfo* myCtrlInfo;

View 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>

View File

@ -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>