From: ouv Date: Tue, 24 Nov 2009 14:10:32 +0000 (+0000) Subject: Compilable version X-Git-Tag: PHASE_17_Part1_V1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=956c5d44f8ee3506d1f43ad7981643a682a91a9d;p=modules%2Fgui.git Compilable version --- diff --git a/src/SalomeApp/SalomeApp_Notebook.cxx b/src/SalomeApp/SalomeApp_Notebook.cxx index bf53ab5af..d24a6f0b6 100644 --- a/src/SalomeApp/SalomeApp_Notebook.cxx +++ b/src/SalomeApp/SalomeApp_Notebook.cxx @@ -34,11 +34,9 @@ SalomeApp_Notebook::SalomeApp_Notebook( SalomeApp_Study* theStudy ) { - SALOME::Notebook_var aRes; SALOMEDS_Study* aStudy = dynamic_cast( theStudy->studyDS().operator->() ); if( aStudy ) - aRes = aStudy->GetStudy()->GetNotebook(); - myNotebook = aRes._retn(); + myNotebook = aStudy->GetStudy()->GetNotebook(); } SalomeApp_Notebook::~SalomeApp_Notebook() @@ -99,7 +97,7 @@ QVariant SalomeApp_Notebook::get( const QString& theName ) const return convert( myNotebook->GetParameter( theName.toLatin1().constData() ) ); } -QVariant SalomeApp_Notebook::calculate( const QString& theExpr ) const +QVariant SalomeApp_Notebook::calculate( const QString& theExpr ) { if( CORBA::is_nil( myTmp ) ) { @@ -111,8 +109,8 @@ QVariant SalomeApp_Notebook::calculate( const QString& theExpr ) const myTmp = myNotebook->GetParameter( TMP_NAME ); } } - myTmp->SetExpression( theExpr ); - myTmp->Update(); + myTmp->SetExpression( theExpr.toLatin1().constData() ); + myTmp->Update( myNotebook._retn() ); return convert( myTmp ); } @@ -120,28 +118,24 @@ QVariant SalomeApp_Notebook::convert( SALOME::Parameter_ptr theParam ) const { QVariant aRes; if( !CORBA::is_nil( theParam ) ) - switch( aParam->GetType() ) + switch( theParam->GetType() ) { case SALOME::TBoolean: - aRes = aParam->AsBoolean(); + aRes = theParam->AsBoolean(); break; case SALOME::TInteger: - aRes = (int)aParam->AsInteger(); + aRes = (int)theParam->AsInteger(); break; case SALOME::TReal: - aRes = aParam->AsReal(); + aRes = theParam->AsReal(); break; case SALOME::TString: - aRes = aParam->AsString(); + aRes = theParam->AsString(); break; } return aRes; } -QVariant SalomeApp_Notebook::calculate( const QString& theExpr ) const -{ -} - void SalomeApp_Notebook::update() { myNotebook->Update(); @@ -170,25 +164,26 @@ QStringList SalomeApp_Notebook::absentParameters() const void SalomeApp_Notebook::setParameters( SALOME::ParameterizedObject_ptr theObject, int theCount, QAbstractSpinBox* theFirstSpin, ... ) { - SALOME::StringArray aParams; - aParams.length( theCount ); - QAbstractSpinBox** aSpin = &theFirstSpin; - for( int i=0; ilength( theCount ); + + QAbstractSpinBox** aSpinArray = &theFirstSpin; + for( int i=0; i( *aSpin ); - if( aDbl ) - { - continue; - } + QAbstractSpinBox* aSpin = *aSpinArray; + QString aText = aSpin->text(); - SalomeApp_IntSpinBox* anInt = dynamic_cast( *aSpin ); - if( anInt ) - { - continue; - } + bool anIsValue = false; + if( dynamic_cast( aSpin ) ) + aText.toDouble( &anIsValue ); + else if( dynamic_cast( aSpin ) ) + aText.toInt( &anIsValue ); + + if( anIsValue ) + aText = ""; - aParams[i] = CORBA::string_dup( "" ); + aParams[i] = CORBA::string_dup( aText.toLatin1().constData() ); } - theObject->SetParameters( myNotebook, aParams ); + theObject->SetParameters( myNotebook._retn(), aParams ); } diff --git a/src/SalomeApp/SalomeApp_Notebook.h b/src/SalomeApp/SalomeApp_Notebook.h index 8ffc0f312..6117e35ee 100644 --- a/src/SalomeApp/SalomeApp_Notebook.h +++ b/src/SalomeApp/SalomeApp_Notebook.h @@ -49,7 +49,7 @@ public: bool isParameter( const QString& theName ) const; void set( const QString& theName, const QVariant& theValue ); QVariant get( const QString& theName ) const; - QVariant calculate( const QString& theExpr ) const; + QVariant calculate( const QString& theExpr ); void update(); @@ -63,8 +63,8 @@ protected: QVariant convert( SALOME::Parameter_ptr theParam ) const; private: - SALOME::Notebook_ptr myNotebook; - SALOME::Parameter_ptr myTmp; + SALOME::Notebook_var myNotebook; + SALOME::Parameter_var myTmp; }; #endif