PAL10491. Add GetMessageOnAlgoStateErrors()

This commit is contained in:
eap 2005-11-14 09:17:11 +00:00
parent ad354c1c09
commit bf36cccf8e
2 changed files with 31 additions and 0 deletions

View File

@ -549,4 +549,33 @@ namespace SMESH{
if (MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed"); if (MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
return listSOmesh; return listSOmesh;
} }
#define CASE2MESSAGE(enum) case SMESH::enum: msg = QObject::tr( #enum ); break;
QString GetMessageOnAlgoStateErrors(const algo_error_array& errors)
{
QString resMsg = QObject::tr("SMESH_WRN_MISSING_PARAMETERS") + ":\n";
for ( int i = 0; i < errors.length(); ++i ) {
const SMESH::AlgoStateError & error = errors[ i ];
QString msg;
switch( error.name ) {
CASE2MESSAGE( MISSING_ALGO );
CASE2MESSAGE( MISSING_HYPO );
CASE2MESSAGE( NOT_CONFORM_MESH );
default: continue;
}
// apply args to message:
// %1 - algo name
if ( error.algoName.in() != 0 )
msg = msg.arg( error.algoName.in() );
// %2 - dimention
msg = msg.arg( error.algoDim );
// %3 - global/local
msg = msg.arg( QObject::tr( error.isGlobalAlgo ? "GLOBAL_ALGO" : "LOCAL_ALGO" ));
if ( i ) resMsg += ";\n";
resMsg += msg;
}
return resMsg;
}
} }

View File

@ -45,6 +45,7 @@ class HypothesisData;
class HypothesesSet; class HypothesesSet;
class SMESHGUI_GenericHypothesisCreator; class SMESHGUI_GenericHypothesisCreator;
class SALOMEDSClient_SObject; class SALOMEDSClient_SObject;
class algo_error_array;
namespace SMESH{ namespace SMESH{
@ -78,6 +79,7 @@ namespace SMESH{
typedef std::vector<_PTR(SObject)> SObjectList; typedef std::vector<_PTR(SObject)> SObjectList;
SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ; SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ;
QString GetMessageOnAlgoStateErrors(const algo_error_array& errors);
} }
#endif #endif