SMESHGUI_PatternUtils.h \
SMESHGUI_GroupUtils.h \
SMESHGUI_PatternWidget.h \
+ SMESHGUI_Helper.h \
SMESHGUI_CreatePatternDlg.h \
SMESHGUI_MeshPatternDlg.h \
SMESHGUI_NodesDlg.h \
dist_libSMESH_la_SOURCES = \
SMESHGUI.cxx \
SMESHGUI_PatternWidget.cxx \
+ SMESHGUI_Helper.cxx \
SMESHGUI_CreatePatternDlg.cxx \
SMESHGUI_MeshPatternDlg.cxx \
SMESHGUI_SpinBox.cxx \
//=================================================================================
SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule )
: QDialog(SMESH::GetDesktop(theModule)),
+ SMESHGUI_Helper(theModule),
mySMESHGUI(theModule),
mySelectionMgr(SMESH::GetSelectionMgr(theModule))
{
//=================================================================================
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;
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
// class : SMESHGUI_BuildCompoundDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT;
//=================================================================================
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg( 0 )
//=======================================================================
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());
//=================================================================================
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 );
}
//=================================================================================
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
// class : SMESHGUI_ExtrusionAlongPathDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
//=================================================================================
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
: QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg( 0 ),
//=================================================================================
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<QAbstractSpinBox*> 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 );
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// SALOME GUI includes
#include <SALOME_InteractiveObject.hxx>
// class : SMESHGUI_ExtrusionDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
--- /dev/null
+// 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 <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+
+#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
+#include <SalomeApp_IntSpinBox.h>
+#include <SalomeApp_Notebook.h>
+
+// IDL includes
+//#include <SALOMEconfig.h>
+//#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<QAbstractSpinBox*> 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<QAbstractSpinBox*>& theSpinBoxList )
+{
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ if ( !app )
+ return false;
+
+ QString msg;
+ QStringList absentParams;
+
+ bool ok = true;
+ QListIterator<QAbstractSpinBox*> anIter( theSpinBoxList );
+ while( anIter.hasNext() )
+ {
+ QAbstractSpinBox* aSpinBox = anIter.next();
+ if( SalomeApp_DoubleSpinBox* aDoubleSpinBox = dynamic_cast<SalomeApp_DoubleSpinBox*>( aSpinBox ) )
+ ok = aDoubleSpinBox->isValid( msg, absentParams, theMess ) && ok;
+ else if( SalomeApp_IntSpinBox* anIntSpinBox = dynamic_cast<SalomeApp_IntSpinBox*>( 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;
+}
--- /dev/null
+// 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 <QList>
+
+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<QAbstractSpinBox*>& );
+
+ SalomeApp_Notebook* getNotebook();
+
+private:
+ SMESHGUI* mySMESHGUI;
+ SalomeApp_Notebook* myNotebook;
+};
+
+#endif // SMESHGUI_HELPER_H
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_Application.h>
+#include <SalomeApp_Application.h>
#include <SalomeApp_IntSpinBox.h>
// Qt includes
break;
case QVariant::String:
{
+ /* ouv: temporarily disabled
if((*anIt).isVariable) {
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
QString aVar = (*anIt).myValue.toString();
}
}
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;
}
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();
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;
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<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ if( app )
+ app->defineAbsentParameters( absentParams );
+ return;
+ }
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
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;
//================================================================================
SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp()
+ : SMESHGUI_Helper( getSMESHGUI() )
{
mySimulation = 0;
myDlg = new SMESHGUI_MakeNodeAtPointDlg;
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;
}
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() &&
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;
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
#include "SMESHGUI_Dialog.h"
#include "SMESHGUI_SelectionOp.h"
/*!
* \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
//=======================================================================
SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myBusy( false ),
{
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<QAbstractSpinBox*> aSpinBoxList;
+ aSpinBoxList << myNode1;
+ if( myType == Type_3d )
+ aSpinBoxList << myNode2;
+ if( !checkParameters( theMess, aSpinBoxList ) )
return false;
- }
}
QList<int> ids;
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
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
//=================================================================================
SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg(SMESHGUI* theModule):
QDialog(SMESH::GetDesktop(theModule)),
+ SMESHGUI_Helper(theModule),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule)
{
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 );
}
//=======================================================================
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
// class : SMESHGUI_MoveNodesDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
const int theMode,
const bool the3d2d):
QDialog(SMESH::GetDesktop(theModule)),
+ SMESHGUI_Helper(theModule),
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule)
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,
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
* union of two neighboring triangles
*/
-class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
//=================================================================================
SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ):
QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
mySMESHGUI( theModule )
//=================================================================================
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 );
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
// class : SMESHGUI_NodesDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_NodesDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_NodesDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
//=================================================================================
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myVectorDefinition(NONE_SELECT),
//=================================================================================
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 );
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// SALOME GUI includes
#include <SALOME_InteractiveObject.hxx>
// class : SMESHGUI_RevolutionDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
//=================================================================================
SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
//=================================================================================
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 );
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
// class : SMESHGUI_RotationDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
//=================================================================================
SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
//=================================================================================
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 );
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
// class : SMESHGUI_SmoothingDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_SmoothingDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_SmoothingDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
//=================================================================================
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<QAbstractSpinBox*> aSpinBoxList;
+ aSpinBoxList << SpinBox_X << SpinBox_Y << SpinBox_Z;
+ if( GetConstructorId() != 0 )
+ aSpinBoxList << SpinBox_DX << SpinBox_DY << SpinBox_DZ;
+ return checkParameters( true, aSpinBoxList );
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
// class : SMESHGUI_SymmetryDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
//=================================================================================
SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
+ SMESHGUI_Helper( theModule ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
//=================================================================================
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<QAbstractSpinBox*> aSpinBoxList;
+ aSpinBoxList << SpinBox1_1 << SpinBox1_2 << SpinBox1_3;
+ if( GetConstructorId() == 0 )
+ aSpinBoxList << SpinBox2_1 << SpinBox2_2 << SpinBox2_3;
+ return checkParameters( true, aSpinBoxList );
}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
+#include "SMESHGUI_Helper.h"
// Qt includes
#include <QDialog>
// class : SMESHGUI_TranslationDlg
// purpose :
//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog, public SMESHGUI_Helper
{
Q_OBJECT
//=======================================================================
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;
}
}
return CORBA::string_dup(anInputParams.ToCString());
+ */
+ return NULL;
}
//=======================================================================
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;
}
}
}
+ */
return aResult._retn();
}
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();
}
}
}
+ */
return aResult._retn();
}
//================================================================================
void SMESH_NoteBook::InitObjectMap()
{
+ /* ouv: temporarily disabled
SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
if(!aGen)
return;
_objectMap.insert(pair<TCollection_AsciiString,ObjectStates*>(TCollection_AsciiString(aSObject->GetID()),aState));
}
}
+ */
}
//================================================================================
{
bool ok = false;
+ /* ouv: temporarily disabled
SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
if(!aGen)
return ok;
theValue = aStudy->GetReal(aVarName.ToCString());
ok = true;
}
-
+ */
return ok;
}
{
}
-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;
}
StdMeshersGUI_NbSegmentsCreator();
virtual ~StdMeshersGUI_NbSegmentsCreator();
- virtual bool checkParams( QString& ) const;
+ virtual bool checkParams( QString&, QStringList& ) const;
protected:
virtual QFrame* buildFrame();
*/
//================================================================================
-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
StdMeshersGUI_StdHypothesisCreator( const QString& );
virtual ~StdMeshersGUI_StdHypothesisCreator();
- virtual bool checkParams( QString& ) const;
+ virtual bool checkParams( QString&, QStringList& ) const;
protected:
virtual QFrame* buildFrame ();