From 44a2277a1a9b53dd1ca7cec27fab991882212c00 Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 9 Dec 2009 10:02:02 +0000 Subject: [PATCH] First compilable version --- src/SMESHGUI/Makefile.am | 2 + src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx | 15 +- src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h | 3 +- .../SMESHGUI_ExtrusionAlongPathDlg.cxx | 25 +--- src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h | 3 +- src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx | 30 +--- src/SMESHGUI/SMESHGUI_ExtrusionDlg.h | 3 +- src/SMESHGUI/SMESHGUI_Helper.cxx | 137 ++++++++++++++++++ src/SMESHGUI/SMESHGUI_Helper.h | 62 ++++++++ src/SMESHGUI/SMESHGUI_Hypotheses.cxx | 22 ++- src/SMESHGUI/SMESHGUI_Hypotheses.h | 2 +- src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx | 12 +- src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h | 3 +- src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx | 19 +-- src/SMESHGUI/SMESHGUI_MeshPatternDlg.h | 3 +- src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx | 19 +-- src/SMESHGUI/SMESHGUI_MoveNodesDlg.h | 3 +- src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx | 16 +- src/SMESHGUI/SMESHGUI_MultiEditDlg.h | 3 +- src/SMESHGUI/SMESHGUI_NodesDlg.cxx | 16 +- src/SMESHGUI/SMESHGUI_NodesDlg.h | 3 +- src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx | 25 +--- src/SMESHGUI/SMESHGUI_RevolutionDlg.h | 3 +- src/SMESHGUI/SMESHGUI_RotationDlg.cxx | 24 +-- src/SMESHGUI/SMESHGUI_RotationDlg.h | 3 +- src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx | 15 +- src/SMESHGUI/SMESHGUI_SmoothingDlg.h | 3 +- src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx | 26 +--- src/SMESHGUI/SMESHGUI_SymmetryDlg.h | 3 +- src/SMESHGUI/SMESHGUI_TranslationDlg.cxx | 26 +--- src/SMESHGUI/SMESHGUI_TranslationDlg.h | 3 +- src/SMESH_I/SMESH_Gen_i_1.cxx | 3 + src/SMESH_I/SMESH_Hypothesis_i.cxx | 2 + src/SMESH_I/SMESH_Mesh_i.cxx | 2 + src/SMESH_I/SMESH_NoteBook.cxx | 5 +- .../StdMeshersGUI_NbSegmentsCreator.cxx | 8 +- .../StdMeshersGUI_NbSegmentsCreator.h | 2 +- .../StdMeshersGUI_StdHypothesisCreator.cxx | 4 +- .../StdMeshersGUI_StdHypothesisCreator.h | 2 +- 39 files changed, 320 insertions(+), 240 deletions(-) create mode 100644 src/SMESHGUI/SMESHGUI_Helper.cxx create mode 100644 src/SMESHGUI/SMESHGUI_Helper.h diff --git a/src/SMESHGUI/Makefile.am b/src/SMESHGUI/Makefile.am index 1b278b946..a4edc0785 100644 --- a/src/SMESHGUI/Makefile.am +++ b/src/SMESHGUI/Makefile.am @@ -41,6 +41,7 @@ salomeinclude_HEADERS = \ SMESHGUI_PatternUtils.h \ SMESHGUI_GroupUtils.h \ SMESHGUI_PatternWidget.h \ + SMESHGUI_Helper.h \ SMESHGUI_CreatePatternDlg.h \ SMESHGUI_MeshPatternDlg.h \ SMESHGUI_NodesDlg.h \ @@ -99,6 +100,7 @@ lib_LTLIBRARIES = libSMESH.la dist_libSMESH_la_SOURCES = \ SMESHGUI.cxx \ SMESHGUI_PatternWidget.cxx \ + SMESHGUI_Helper.cxx \ SMESHGUI_CreatePatternDlg.cxx \ SMESHGUI_MeshPatternDlg.cxx \ SMESHGUI_SpinBox.cxx \ diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index 1e58867d0..3e819cd53 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -72,6 +72,7 @@ //================================================================================= SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule ) : QDialog(SMESH::GetDesktop(theModule)), + SMESHGUI_Helper(theModule), mySMESHGUI(theModule), mySelectionMgr(SMESH::GetSelectionMgr(theModule)) { @@ -513,17 +514,7 @@ void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge) //================================================================================= bool SMESHGUI_BuildCompoundDlg::isValid() { - QString msg; - bool ok=true; - if(CheckBoxMerge->isChecked()) - ok = SpinBoxTol->isValid( msg, true ); - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } + if( CheckBoxMerge->isChecked() ) + return checkParameters( true, 1, SpinBoxTol ); return true; } diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h index c1085739d..9629b1b00 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -53,7 +54,7 @@ class SUIT_SelectionFilter; // class : SMESHGUI_BuildCompoundDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT; diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index 2131b25e6..cb5656231 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -109,6 +109,7 @@ private: //================================================================================= SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule ) : QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myFilterDlg( 0 ) @@ -1132,14 +1133,9 @@ int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId() //======================================================================= void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded() { - QString msg; - if( !AngleSpin->isValid( msg, true ) ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); + if( !checkParameters( true, 1, AngleSpin ) ) return; - } + AnglesList->addItem(AngleSpin->text()); myAnglesList.append(AngleSpin->GetValue()); @@ -1242,20 +1238,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::setFilters() //================================================================================= bool SMESHGUI_ExtrusionAlongPathDlg::isValid() { - QString msg; - bool ok = true; - ok = XSpin->isValid( msg, true ) && ok; - ok = YSpin->isValid( msg, true ) && ok; - ok = ZSpin->isValid( msg, true ) && ok; - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } - return true; + return checkParameters( true, 3, XSpin, YSpin, ZSpin ); } //================================================================================= diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h index e93985ae1..b132cb8db 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -59,7 +60,7 @@ class SUIT_SelectionFilter; // class : SMESHGUI_ExtrusionAlongPathDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 7c32fc1e2..31e76131e 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -88,6 +88,7 @@ //================================================================================= SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) : QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myFilterDlg( 0 ), @@ -1009,26 +1010,11 @@ void SMESHGUI_ExtrusionDlg::setFilters() //================================================================================= bool SMESHGUI_ExtrusionDlg::isValid() { - QString msg; - bool ok = true; - if ( RadioButton3->isChecked() ) { - ok = SpinBox_Dx->isValid( msg, true ) && ok; - ok = SpinBox_Dy->isValid( msg, true ) && ok; - ok = SpinBox_Dz->isValid( msg, true ) && ok; - } else if ( RadioButton4->isChecked() ) { - ok = SpinBox_Vx->isValid( msg, true ) && ok; - ok = SpinBox_Vy->isValid( msg, true ) && ok; - ok = SpinBox_Vz->isValid( msg, true ) && ok; - ok = SpinBox_VDist->isValid( msg, true ) && ok; - } - ok = SpinBox_NbSteps->isValid( msg, true ) && ok; - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } - return true; + QList aSpinBoxList; + if ( RadioButton3->isChecked() ) + aSpinBoxList << SpinBox_Dx << SpinBox_Dy << SpinBox_Dz; + else if ( RadioButton4->isChecked() ) + aSpinBoxList << SpinBox_Vx << SpinBox_Vy << SpinBox_Vz; + aSpinBoxList << SpinBox_NbSteps; + return checkParameters( true, aSpinBoxList ); } diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h index 4425d29f7..c9ce09248 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // SALOME GUI includes #include @@ -61,7 +62,7 @@ class SalomeApp_IntSpinBox; // class : SMESHGUI_ExtrusionDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_Helper.cxx b/src/SMESHGUI/SMESHGUI_Helper.cxx new file mode 100644 index 000000000..493ca2337 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Helper.cxx @@ -0,0 +1,137 @@ +// Copyright (C) 2007-2008 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 +// +// 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 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// SMESH SMESHGUI : GUI for SMESH component +// File : SMESHGUI_Helper.cxx +// Author : Oleg UVAROV +// SMESH includes +// +#include "SMESHGUI_Helper.h" +#include "SMESHGUI.h" + +// SALOME GUI includes +#include +#include +#include + +#include +#include +#include +#include + +// IDL includes +//#include +//#include CORBA_SERVER_HEADER(SMESH_Mesh) +//#include CORBA_SERVER_HEADER(SMESH_MeshEditor) + +//================================================================================= +// name : SMESHGUI_Helper::SMESHGUI_Helper +// Purpose : +//================================================================================= +SMESHGUI_Helper::SMESHGUI_Helper( SMESHGUI* theModule ) : + mySMESHGUI( theModule ), + myNotebook( 0 ) +{ +} + +//======================================================================= +// name : SMESHGUI_Helper::~SMESHGUI_Helper +// Purpose : +//======================================================================= +SMESHGUI_Helper::~SMESHGUI_Helper() +{ + if( myNotebook ) + { + delete myNotebook; + myNotebook = 0; + } +} + +//================================================================ +// Function : checkParameters +// Purpose : +//================================================================ +bool SMESHGUI_Helper::checkParameters( bool theMess, int theCount, QAbstractSpinBox* theFirstSpinBox, ... ) +{ + va_list aSpins; + va_start( aSpins, theFirstSpinBox ); + + int aCounter = 0; + QList aSpinBoxList; + QAbstractSpinBox* aSpinBox = theFirstSpinBox; + while( aSpinBox && aCounter < theCount ) + { + aSpinBoxList.append( aSpinBox ); + aSpinBox = va_arg( aSpins, QAbstractSpinBox* ); + aCounter++; + } + return checkParameters( theMess, aSpinBoxList ); +} + +//================================================================ +// Function : checkParameters +// Purpose : +//================================================================ +bool SMESHGUI_Helper::checkParameters( bool theMess, const QList& theSpinBoxList ) +{ + SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( !app ) + return false; + + QString msg; + QStringList absentParams; + + bool ok = true; + QListIterator anIter( theSpinBoxList ); + while( anIter.hasNext() ) + { + QAbstractSpinBox* aSpinBox = anIter.next(); + if( SalomeApp_DoubleSpinBox* aDoubleSpinBox = dynamic_cast( aSpinBox ) ) + ok = aDoubleSpinBox->isValid( msg, absentParams, theMess ) && ok; + else if( SalomeApp_IntSpinBox* anIntSpinBox = dynamic_cast( aSpinBox ) ) + ok = anIntSpinBox->isValid( msg, absentParams, theMess ) && ok; + } + + if( !ok && theMess ) + { + if( !absentParams.isEmpty() ) + app->defineAbsentParameters( absentParams ); + else + { + QString str( QObject::tr( "SMESH_INCORRECT_INPUT" ) ); + if( !msg.isEmpty() ) + str += "\n" + msg; + SUIT_MessageBox::critical( mySMESHGUI->desktop(), QObject::tr( "SMESH_ERROR" ), str ); + } + } + return ok; +} + +//================================================================ +// Function : getNotebook +// Purpose : +//================================================================ +SalomeApp_Notebook* SMESHGUI_Helper::getNotebook() +{ + if ( !myNotebook ) + myNotebook = new SalomeApp_Notebook( mySMESHGUI->activeStudy() ); + return myNotebook; +} diff --git a/src/SMESHGUI/SMESHGUI_Helper.h b/src/SMESHGUI/SMESHGUI_Helper.h new file mode 100644 index 000000000..b94ef8239 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Helper.h @@ -0,0 +1,62 @@ +// Copyright (C) 2007-2008 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 +// +// 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 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 +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// SMESH SMESHGUI : GUI for SMESH component +// File : SMESHGUI_Helper.h +// Author : Oleg UVAROV +// +#ifndef SMESHGUI_HELPER_H +#define SMESHGUI_HELPER_H + +// SMESH includes +#include "SMESH_SMESHGUI.hxx" + +// Qt includes +#include + +class SMESHGUI; +class SalomeApp_Notebook; +class QAbstractSpinBox; + +//================================================================================= +// class : SMESHGUI_Helper +// purpose : Helper class for dialog box development, can be used as the second +// base class for dialog box (or for corresponding operation, if exists). +// Contains methods performing operations with SALOME Notebook parameters. +//================================================================================= +class SMESHGUI_EXPORT SMESHGUI_Helper +{ +public: + SMESHGUI_Helper( SMESHGUI* ); + virtual ~SMESHGUI_Helper(); + +protected: + bool checkParameters( bool, int, QAbstractSpinBox*, ... ); + bool checkParameters( bool, const QList& ); + + SalomeApp_Notebook* getNotebook(); + +private: + SMESHGUI* mySMESHGUI; + SalomeApp_Notebook* myNotebook; +}; + +#endif // SMESHGUI_HELPER_H diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index b0ced7bb6..793cc1751 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include // Qt includes @@ -192,6 +193,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame() break; case QVariant::String: { + /* ouv: temporarily disabled if((*anIt).isVariable) { _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); QString aVar = (*anIt).myValue.toString(); @@ -213,13 +215,14 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame() } } else { + */ QLineEdit* le = new QLineEdit( GroupC1 ); le->setObjectName( (*anIt).myName ); attuneStdWidget( le, i ); le->setText( (*anIt).myValue.toString() ); connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) ); w = le; - } + //} } break; } @@ -476,7 +479,7 @@ bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWi return false; } -bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const +bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg, QStringList& absentParams ) const { bool ok = true; ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end(); @@ -485,12 +488,12 @@ bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) ) { SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt ); - ok = sb->isValid( msg, true ) && ok; + ok = sb->isValid( msg, absentParams, true ) && ok; } else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) ) { SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt ); - ok = sb->isValid( msg, true ) && ok; + ok = sb->isValid( msg, absentParams, true ) && ok; } } return ok; @@ -599,8 +602,17 @@ void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f ) void SMESHGUI_HypothesisDlg::accept() { QString msg; - if ( myCreator && !myCreator->checkParams( msg ) ) + QStringList absentParams; + if ( myCreator && !myCreator->checkParams( msg, absentParams ) ) { + if( !absentParams.isEmpty() ) + { + SalomeApp_Application* app = + dynamic_cast( SUIT_Session::session()->activeApplication() ); + if( app ) + app->defineAbsentParameters( absentParams ); + return; + } QString str( tr( "SMESH_INCORRECT_INPUT" ) ); if ( !msg.isEmpty() ) str += "\n" + msg; diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index 0891def1b..70da0b4d3 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -57,7 +57,7 @@ public: void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject*, const QString& ); void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr); - virtual bool checkParams( QString& ) const; + virtual bool checkParams( QString&, QStringList& ) const; virtual void onReject(); virtual QString helpPage() const; diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index ae769c301..e7de2f041 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -267,6 +267,7 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on) //================================================================================ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp() + : SMESHGUI_Helper( getSMESHGUI() ) { mySimulation = 0; myDlg = new SMESHGUI_MakeNodeAtPointDlg; @@ -375,8 +376,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() QString msg; if ( !isValid( msg ) ) { // node id is invalid if( !msg.isEmpty() ) - SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ), - tr("INVALID_ID") ); + SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ), msg ); dlg()->show(); return false; } @@ -442,6 +442,9 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg ) { + if( !checkParameters( !myNoPreview, 3, myDlg->myX, myDlg->myY, myDlg->myZ ) ) + return false; + bool ok = true; if ( myMeshActor && myDlg->myMoveRBtn->isChecked() && @@ -455,11 +458,6 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg ) if( !ok ) msg += tr("INVALID_ID") + "\n"; } - - ok = myDlg->myX->isValid( msg, !myNoPreview ) && ok; - ok = myDlg->myY->isValid( msg, !myNoPreview ) && ok; - ok = myDlg->myZ->isValid( msg, !myNoPreview ) && ok; - return ok; } diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h index 6df8ba722..b32d550e8 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h @@ -27,6 +27,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" #include "SMESHGUI_Dialog.h" #include "SMESHGUI_SelectionOp.h" @@ -43,7 +44,7 @@ class SMESHGUI_MakeNodeAtPointDlg; /*! * \brief Operation to make a mesh pass through a point */ -class SMESHGUI_EXPORT SMESHGUI_MakeNodeAtPointOp: public SMESHGUI_SelectionOp +class SMESHGUI_EXPORT SMESHGUI_MakeNodeAtPointOp: public SMESHGUI_SelectionOp, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index d80523066..b7c9bcca4 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -106,6 +106,7 @@ //======================================================================= SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule ) : QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myBusy( false ), @@ -413,20 +414,12 @@ bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess) { if (isRefine()) { - QString msg; - bool ok = true; - ok = myNode1->isValid( msg, theMess ) && ok; - if (myType == Type_3d) - ok = myNode2->isValid( msg, theMess ) && ok; - if( !ok ) { - if( theMess ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - } + QList aSpinBoxList; + aSpinBoxList << myNode1; + if( myType == Type_3d ) + aSpinBoxList << myNode2; + if( !checkParameters( theMess, aSpinBoxList ) ) return false; - } } QList ids; diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h index e3e2d6870..4ca20af42 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h @@ -27,6 +27,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -58,7 +59,7 @@ class SMESHGUI_PatternWidget; Description : Dialog to specify filters for VTK viewer */ -class SMESHGUI_EXPORT SMESHGUI_MeshPatternDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_MeshPatternDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index 6243255af..abeffde07 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -86,6 +86,7 @@ //================================================================================= SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg(SMESHGUI* theModule): QDialog(SMESH::GetDesktop(theModule)), + SMESHGUI_Helper(theModule), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule) { @@ -281,23 +282,7 @@ bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) tr("NODE_ID_IS_NOT_DEFINED")); return false; } - - QString msg; - bool ok = true; - ok = myX->isValid( msg, theMess ) && ok; - ok = myY->isValid( msg, theMess ) && ok; - ok = myZ->isValid( msg, theMess ) && ok; - if( !ok ) { - if( theMess ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - } - return false; - } - - return true; + return checkParameters( theMess, 3, myX, myY, myZ ); } //======================================================================= diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h index cfd43786f..f3cf3777e 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -46,7 +47,7 @@ class LightApp_SelectionMgr; // class : SMESHGUI_MoveNodesDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index 907f8a65b..4879a2026 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -103,6 +103,7 @@ SMESHGUI_MultiEditDlg const int theMode, const bool the3d2d): QDialog(SMESH::GetDesktop(theModule)), + SMESHGUI_Helper(theModule), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule) @@ -1173,20 +1174,7 @@ bool SMESHGUI_UnionOfTrianglesDlg::isValid (const bool theMess) bool ok = SMESHGUI_MultiEditDlg::isValid( theMess ); if( !ok ) return false; - - QString msg; - ok = myMaxAngleSpin->isValid( msg, theMess ); - if( !ok ) { - if( theMess ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - } - return false; - } - - return ok; + return checkParameters( theMess, 1, myMaxAngleSpin ); } bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor, diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.h b/src/SMESHGUI/SMESHGUI_MultiEditDlg.h index f14996814..1f98f85cd 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.h +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.h @@ -27,6 +27,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -63,7 +64,7 @@ class QButtonGroup; * union of two neighboring triangles */ -class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index 76b75dbb9..04f5d717c 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -223,6 +223,7 @@ namespace SMESH //================================================================================= SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ): QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySMESHGUI( theModule ) @@ -610,18 +611,5 @@ void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= bool SMESHGUI_NodesDlg::isValid() { - QString msg; - bool ok = true; - ok = SpinBox_X->isValid( msg, true ) && ok; - ok = SpinBox_Y->isValid( msg, true ) && ok; - ok = SpinBox_Z->isValid( msg, true ) && ok; - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } - return true; + return checkParameters( true, 3, SpinBox_X, SpinBox_Y, SpinBox_Z ); } diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.h b/src/SMESHGUI/SMESHGUI_NodesDlg.h index 8fc28eacc..1cc52b758 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -55,7 +56,7 @@ namespace SMESH // class : SMESHGUI_NodesDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_NodesDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_NodesDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index 484989dfd..811ed0748 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -89,6 +89,7 @@ //================================================================================= SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) : QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myVectorDefinition(NONE_SELECT), @@ -1181,24 +1182,8 @@ void SMESHGUI_RevolutionDlg::setFilters() //================================================================================= bool SMESHGUI_RevolutionDlg::isValid() { - QString msg; - bool ok = true; - ok = SpinBox_X->isValid( msg, true ) && ok; - ok = SpinBox_Y->isValid( msg, true ) && ok; - ok = SpinBox_Z->isValid( msg, true ) && ok; - ok = SpinBox_DX->isValid( msg, true ) && ok; - ok = SpinBox_DY->isValid( msg, true ) && ok; - ok = SpinBox_DZ->isValid( msg, true ) && ok; - ok = SpinBox_Angle->isValid( msg, true ) && ok; - ok = SpinBox_NbSteps->isValid( msg, true ) && ok; - ok = SpinBox_Tolerance->isValid( msg, true ) && ok; - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } - return true; + return checkParameters( true, 9, + SpinBox_X, SpinBox_Y, SpinBox_Z, + SpinBox_DX, SpinBox_DY, SpinBox_DZ, + SpinBox_Angle, SpinBox_NbSteps, SpinBox_Tolerance ); } diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h index 4d0c51693..918f4c31a 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // SALOME GUI includes #include @@ -65,7 +66,7 @@ class QAction; // class : SMESHGUI_RevolutionDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index d9352dbc8..731a84208 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -89,6 +89,7 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action //================================================================================= SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) : QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myFilterDlg(0), @@ -997,23 +998,8 @@ void SMESHGUI_RotationDlg::setFilters() //================================================================================= bool SMESHGUI_RotationDlg::isValid() { - bool ok = true; - QString msg; - - ok = SpinBox_X->isValid( msg, true ) && ok; - ok = SpinBox_Y->isValid( msg, true ) && ok; - ok = SpinBox_Z->isValid( msg, true ) && ok; - ok = SpinBox_DX->isValid( msg, true ) && ok; - ok = SpinBox_DY->isValid( msg, true ) && ok; - ok = SpinBox_DZ->isValid( msg, true ) && ok; - ok = SpinBox_Angle->isValid( msg, true ) && ok; - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } - return true; + return checkParameters( true, 7, + SpinBox_X, SpinBox_Y, SpinBox_Z, + SpinBox_DX, SpinBox_DY, SpinBox_DZ, + SpinBox_Angle ); } diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.h b/src/SMESHGUI/SMESHGUI_RotationDlg.h index bb743746f..19153b254 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.h +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -56,7 +57,7 @@ class SMESH_LogicalFilter; // class : SMESHGUI_RotationDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index 1cab8d3f4..b5f14b00c 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -90,6 +90,7 @@ //================================================================================= SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) : QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myFilterDlg(0), @@ -826,17 +827,5 @@ void SMESHGUI_SmoothingDlg::setNodeFilters() //================================================================================= bool SMESHGUI_SmoothingDlg::isValid() { - QString msg; - bool ok = true; - ok = SpinBox_IterationLimit->isValid( msg, true ) && ok; - ok = SpinBox_AspectRatio->isValid( msg, true ) && ok; - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } - return true; + return checkParameters( true, 2, SpinBox_IterationLimit, SpinBox_AspectRatio ); } diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h index 6def01cae..08bfd7842 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -57,7 +58,7 @@ class SMESH_LogicalFilter; // class : SMESHGUI_SmoothingDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_SmoothingDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_SmoothingDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index 5da44a6ae..6d73d7d02 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -90,6 +90,7 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) : QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myFilterDlg(0), @@ -1096,24 +1097,9 @@ void SMESHGUI_SymmetryDlg::setFilters() //================================================================================= bool SMESHGUI_SymmetryDlg::isValid() { - bool ok = true; - QString msg; - - ok = SpinBox_X->isValid( msg, true ) && ok; - ok = SpinBox_Y->isValid( msg, true ) && ok; - ok = SpinBox_Z->isValid( msg, true ) && ok; - if (GetConstructorId() != 0) { - ok = SpinBox_DX->isValid( msg, true ) && ok; - ok = SpinBox_DY->isValid( msg, true ) && ok; - ok = SpinBox_DZ->isValid( msg, true ) && ok; - } - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } - return true; + QList aSpinBoxList; + aSpinBoxList << SpinBox_X << SpinBox_Y << SpinBox_Z; + if( GetConstructorId() != 0 ) + aSpinBoxList << SpinBox_DX << SpinBox_DY << SpinBox_DZ; + return checkParameters( true, aSpinBoxList ); } diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h index 1d763eb2e..0e6ea24f1 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -56,7 +57,7 @@ class SMESH_LogicalFilter; // class : SMESHGUI_SymmetryDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 97d5ca582..993fab16f 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -107,6 +107,7 @@ private: //================================================================================= SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) : QDialog( SMESH::GetDesktop( theModule ) ), + SMESHGUI_Helper( theModule ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myFilterDlg(0), @@ -1044,24 +1045,9 @@ void SMESHGUI_TranslationDlg::setFilters() //================================================================================= bool SMESHGUI_TranslationDlg::isValid() { - bool ok = true; - QString msg; - - ok = SpinBox1_1->isValid( msg, true ) && ok; - ok = SpinBox1_2->isValid( msg, true ) && ok; - ok = SpinBox1_3->isValid( msg, true ) && ok; - if (GetConstructorId() == 0) { - ok = SpinBox2_1->isValid( msg, true ) && ok; - ok = SpinBox2_2->isValid( msg, true ) && ok; - ok = SpinBox2_3->isValid( msg, true ) && ok; - } - - if( !ok ) { - QString str( tr( "SMESH_INCORRECT_INPUT" ) ); - if ( !msg.isEmpty() ) - str += "\n" + msg; - SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); - return false; - } - return true; + QList aSpinBoxList; + aSpinBoxList << SpinBox1_1 << SpinBox1_2 << SpinBox1_3; + if( GetConstructorId() == 0 ) + aSpinBoxList << SpinBox2_1 << SpinBox2_2 << SpinBox2_3; + return checkParameters( true, aSpinBoxList ); } diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.h b/src/SMESHGUI/SMESHGUI_TranslationDlg.h index cfd77378a..81dc6cfa3 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.h +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.h @@ -28,6 +28,7 @@ // SMESH includes #include "SMESH_SMESHGUI.hxx" +#include "SMESHGUI_Helper.h" // Qt includes #include @@ -56,7 +57,7 @@ class SMESH_LogicalFilter; // class : SMESHGUI_TranslationDlg // purpose : //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog, public SMESHGUI_Helper { Q_OBJECT diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index 2b216fe26..7fed0cced 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -940,6 +940,7 @@ void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theP //======================================================================= char* SMESH_Gen_i::ParseParameters(const char* theParameters) { + /* ouv: temporarily disabled //const char* aParameters = theParameters; // const char* aParameters = CORBA::string_dup(theParameters); TCollection_AsciiString anInputParams; @@ -982,6 +983,8 @@ char* SMESH_Gen_i::ParseParameters(const char* theParameters) } } return CORBA::string_dup(anInputParams.ToCString()); + */ + return NULL; } //======================================================================= diff --git a/src/SMESH_I/SMESH_Hypothesis_i.cxx b/src/SMESH_I/SMESH_Hypothesis_i.cxx index b677e647b..cacae2503 100644 --- a/src/SMESH_I/SMESH_Hypothesis_i.cxx +++ b/src/SMESH_I/SMESH_Hypothesis_i.cxx @@ -188,6 +188,7 @@ char* SMESH_Hypothesis_i::GetParameters() SMESH::ListOfParameters* SMESH_Hypothesis_i::GetLastParameters() { SMESH::ListOfParameters_var aResult = new SMESH::ListOfParameters(); + /* ouv: temporarily disabled SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen(); if(gen) { char *aParameters; @@ -207,6 +208,7 @@ SMESH::ListOfParameters* SMESH_Hypothesis_i::GetLastParameters() } } } + */ return aResult._retn(); } diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index bc0369dcc..4236db269 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -3408,6 +3408,7 @@ char* SMESH_Mesh_i::GetParameters() SMESH::string_array* SMESH_Mesh_i::GetLastParameters() { SMESH::string_array_var aResult = new SMESH::string_array(); + /* ouv: temporarily disabled SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen(); if(gen) { char *aParameters = GetParameters(); @@ -3422,6 +3423,7 @@ SMESH::string_array* SMESH_Mesh_i::GetLastParameters() } } } + */ return aResult._retn(); } diff --git a/src/SMESH_I/SMESH_NoteBook.cxx b/src/SMESH_I/SMESH_NoteBook.cxx index 2345a4279..09083c3b9 100644 --- a/src/SMESH_I/SMESH_NoteBook.cxx +++ b/src/SMESH_I/SMESH_NoteBook.cxx @@ -639,6 +639,7 @@ void SMESH_NoteBook::ReplaceVariables() //================================================================================ void SMESH_NoteBook::InitObjectMap() { + /* ouv: temporarily disabled SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen(); if(!aGen) return; @@ -700,6 +701,7 @@ void SMESH_NoteBook::InitObjectMap() _objectMap.insert(pair(TCollection_AsciiString(aSObject->GetID()),aState)); } } + */ } //================================================================================ @@ -825,6 +827,7 @@ bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double& { bool ok = false; + /* ouv: temporarily disabled SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen(); if(!aGen) return ok; @@ -844,7 +847,7 @@ bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double& theValue = aStudy->GetReal(aVarName.ToCString()); ok = true; } - + */ return ok; } diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 2ee5473af..4283d4760 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -80,17 +80,17 @@ StdMeshersGUI_NbSegmentsCreator::~StdMeshersGUI_NbSegmentsCreator() { } -bool StdMeshersGUI_NbSegmentsCreator::checkParams( QString& msg ) const +bool StdMeshersGUI_NbSegmentsCreator::checkParams( QString& msg, QStringList& absentParams ) const { - if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) ) + if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg, absentParams ) ) return false; NbSegmentsHypothesisData data_old, data_new; readParamsFromHypo( data_old ); readParamsFromWidgets( data_new ); bool res = storeParamsToHypo( data_new ); storeParamsToHypo( data_old ); - res = myNbSeg->isValid( msg, true ) && res; - res = myScale->isValid( msg, true ) && res; + res = myNbSeg->isValid( msg, absentParams, true ) && res; + res = myScale->isValid( msg, absentParams, true ) && res; return res; } diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h index 6053e8d34..34682a25f 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h @@ -64,7 +64,7 @@ public: StdMeshersGUI_NbSegmentsCreator(); virtual ~StdMeshersGUI_NbSegmentsCreator(); - virtual bool checkParams( QString& ) const; + virtual bool checkParams( QString&, QStringList& ) const; protected: virtual QFrame* buildFrame(); diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 0d72900dc..b5b2d1208 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -343,9 +343,9 @@ namespace { */ //================================================================================ -bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const +bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg, QStringList& absentParams ) const { - if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) ) + if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg, absentParams ) ) return false; // check if object reference parameter is set, as it has no default value diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h index 0973c5c03..011ff8945 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h @@ -41,7 +41,7 @@ public: StdMeshersGUI_StdHypothesisCreator( const QString& ); virtual ~StdMeshersGUI_StdHypothesisCreator(); - virtual bool checkParams( QString& ) const; + virtual bool checkParams( QString&, QStringList& ) const; protected: virtual QFrame* buildFrame (); -- 2.39.2