X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_CreatePatternDlg.cxx;h=b17b231e69a60a4fc48ad5395e06afa52b5ab1d0;hb=03d855b75b0404e50b1b4a74d52f45d9de50654a;hp=ef7f198ee9966f23ef4d9b82eb4e8875173d3c39;hpb=0635c9fc80f67d1e5dc0e94ec85f487286a92070;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx old mode 100755 new mode 100644 index ef7f198ee..b17b231e6 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESHGUI_CreatePatternDlg.cxx // Author : Sergey LITONIN, Open CASCADE S.A.S. // SMESH includes @@ -104,10 +105,7 @@ SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI* theModule, aDlgLay->setStretchFactor( aMainFrame, 1 ); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) - mySelector = aViewWindow->GetSelector(); - - myHelpFileName = "pattern_mapping_page.html"; + myHelpFileName = "pattern_mapping.html"; Init( theType ); } @@ -193,11 +191,11 @@ QWidget* SMESHGUI_CreatePatternDlg::createMainFrame( QWidget* theParent ) // Connect signals and slots connect( myTypeGrp, SIGNAL( buttonClicked( int ) ), - this, SLOT( onTypeChanged( int ) ) ); + this, SLOT( onTypeChanged( int ) ) ); connect( myProjectChk, SIGNAL( toggled( bool ) ), - this, SLOT( onProject( bool ) ) ); + this, SLOT( onProject( bool ) ) ); connect( aSelBtn, SIGNAL( clicked() ), - this, SLOT( onSelBtnClicked() ) ); + this, SLOT( onSelBtnClicked() ) ); return aMainGrp; } @@ -229,7 +227,7 @@ QWidget* SMESHGUI_CreatePatternDlg::createButtonFrame( QWidget* theParent ) aLay->addWidget( myHelpBtn ); connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( onOk() ) ); - connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( onClose() ) ); + connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( mySaveBtn, SIGNAL( clicked() ), this, SLOT( onSave() ) ); connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); @@ -246,7 +244,7 @@ SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg() //======================================================================= // function : onProject() -// purpose : SLOT. Called when state of "Project nodes on ther face" +// purpose : SLOT. Called when state of "Project nodes on other face" // checkbox is changed //======================================================================= void SMESHGUI_CreatePatternDlg::onProject( bool ) @@ -274,11 +272,11 @@ void SMESHGUI_CreatePatternDlg::Init( const int theType ) // selection and SMESHGUI connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), - this, SLOT( onSelectionDone() ) ); + this, SLOT( onSelectionDone() ) ); connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), - this, SLOT( onDeactivate() ) ); + this, SLOT( onDeactivate() ) ); connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), - this, SLOT( onClose() ) ); + this, SLOT( reject() ) ); mySwitch2d->setEnabled( theType == Type_2d ); mySwitch3d->setEnabled( theType == Type_3d ); @@ -291,7 +289,7 @@ void SMESHGUI_CreatePatternDlg::Init( const int theType ) QApplication::instance()->processEvents(); updateGeometry(); - resize( minimumSize() ); + resize(100,100); activateSelection(); onSelectionDone(); @@ -342,8 +340,8 @@ bool SMESHGUI_CreatePatternDlg::isValid() { if ( myGeomObj->_is_nil() ) { SUIT_MessageBox::information( this, - tr( "SMESH_INSUFFICIENT_DATA" ), - tr( "SMESHGUI_INVALID_PARAMETERS" ) ); + tr( "SMESH_INSUFFICIENT_DATA" ), + tr( "SMESHGUI_INVALID_PARAMETERS" ) ); return false; } return true; @@ -380,7 +378,7 @@ void SMESHGUI_CreatePatternDlg::onSave() SUIT_FileDlg* aDlg = new SUIT_FileDlg( this, false ); aDlg->setWindowTitle( tr( "SAVE_PATTERN" ) ); aDlg->setFileMode( QFileDialog::AnyFile ); - aDlg->setFilter( tr( "PATTERN_FILT" ) ); + aDlg->setNameFilter( tr( "PATTERN_FILT" ) ); if ( myName->text() != "" ) aDlg->selectFile( myName->text() ); @@ -394,25 +392,25 @@ void SMESHGUI_CreatePatternDlg::onSave() if ( QFileInfo( fName ).suffix().isEmpty() ) fName = autoExtension( fName ); - fName = QDir::convertSeparators( fName ); + fName = QDir::toNativeSeparators( fName ); QString aData( myPattern->GetString() ); long aLen = aData.length(); QFile aFile( fName ); aFile.open( QIODevice::WriteOnly ); - long aWritten = aFile.write( aData.toLatin1(), aLen ); + long aWritten = aFile.write( aData.toUtf8(), aLen ); aFile.close(); if ( aWritten != aLen ) { SUIT_MessageBox::information( this, - tr( "SMESH_ERROR" ), - tr( "ERROR_OF_SAVING" ) ); + tr( "SMESH_ERROR" ), + tr( "ERROR_OF_SAVING" ) ); } else { //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) - aViewWindow->SetSelectionMode( ActorSelection ); + aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); @@ -465,7 +463,7 @@ void SMESHGUI_CreatePatternDlg::onOk() else { //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) - aViewWindow->SetSelectionMode( ActorSelection ); + aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); @@ -481,17 +479,17 @@ void SMESHGUI_CreatePatternDlg::onOk() } //======================================================================= -// function : onClose() +// function : reject() // purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_CreatePatternDlg::onClose() +void SMESHGUI_CreatePatternDlg::reject() { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); emit Close(); } @@ -512,11 +510,11 @@ void SMESHGUI_CreatePatternDlg::onHelp() platform = "application"; #endif SUIT_MessageBox::warning( this, - tr( "WRN_WARNING" ), - tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", - platform ) ). - arg( myHelpFileName ) ); + tr( "WRN_WARNING" ), + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", + platform ) ). + arg( myHelpFileName ) ); } } @@ -532,7 +530,7 @@ bool SMESHGUI_CreatePatternDlg::loadFromObject( const bool theMess ) if ( myPattern->_is_nil() ) myPattern = SMESH::GetPattern(); - if ( myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil() ) + if ( (myMesh->_is_nil() && mySubMesh->_is_nil()) || myGeomObj->_is_nil() ) return false; SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather(); @@ -571,7 +569,7 @@ void SMESHGUI_CreatePatternDlg::onSelectionDone() { try { SALOME_ListIO aList; - mySelectionMgr->selectedObjects( aList, SVTK_Viewer::Type() ); + mySelectionMgr->selectedObjects( aList ); if ( aList.Extent() != 1 ) return; @@ -624,7 +622,7 @@ void SMESHGUI_CreatePatternDlg::onSelectionDone() //======================================================================= // function : onDeactivate() -// purpose : SLOT called when dialog must be deativated +// purpose : SLOT called when dialog must be deactivated //======================================================================= void SMESHGUI_CreatePatternDlg::onDeactivate() { @@ -638,7 +636,7 @@ void SMESHGUI_CreatePatternDlg::onDeactivate() //======================================================================= void SMESHGUI_CreatePatternDlg::enterEvent( QEvent* ) { - // there is a stange problem that enterEvent() comes after onSave() + // there is a strange problem that enterEvent() comes after onSave() if ( isVisible () ) { mySMESHGUI->EmitSignalDeactivateDialog(); setEnabled( true ); @@ -647,15 +645,6 @@ void SMESHGUI_CreatePatternDlg::enterEvent( QEvent* ) } } -//================================================================================= -// function : closeEvent() -// purpose : Close dialog box -//================================================================================= -void SMESHGUI_CreatePatternDlg::closeEvent( QCloseEvent* ) -{ - onClose(); -} - //======================================================================= // function : onSelBtnClicked() // purpose : SLOT. Called when -> button clicked. @@ -754,20 +743,20 @@ void SMESHGUI_CreatePatternDlg::activateSelection() if ( myType == Type_2d ) { mySelectionMgr->installFilter( new SMESH_NumberFilter( "SMESH", - TopAbs_SHAPE, - -1, - TopAbs_FACE ) ); + TopAbs_SHAPE, + -1, + TopAbs_FACE ) ); } else { TColStd_MapOfInteger aTypes; aTypes.Add( TopAbs_SHELL ); aTypes.Add( TopAbs_SOLID ); mySelectionMgr->installFilter( new SMESH_NumberFilter( "SMESH", - TopAbs_FACE, - 6, - aTypes, - GEOM::GEOM_Object::_nil(), - true ) ); + TopAbs_FACE, + 6, + aTypes, + GEOM::GEOM_Object::_nil(), + true ) ); } }