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() ) );
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");
+}