From f7f3615529212446fec937c57f7bce1b8854ee87 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 17 Jan 2011 17:05:25 +0000 Subject: [PATCH] Replace direct "Interface Applicative" usage by the function call --- src/SalomeApp/SalomeApp_Application.cxx | 2 +- src/SalomeApp/SalomeApp_Study.cxx | 22 +++++++--------------- src/SalomeApp/SalomeApp_Study.h | 1 - src/SalomeApp/SalomeApp_VisualState.cxx | 6 ++++-- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index aa203c523..1525e1b10 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -1285,7 +1285,7 @@ void SalomeApp_Application::updateObjectBrowser( const bool updateModels ) { _PTR(SComponent) aComponent ( it->Value() ); - if ( aComponent->ComponentDataType() == "Interface Applicative" ) + if ( aComponent->ComponentDataType() == study->getVisualComponentName().toLatin1().constData() ) continue; // skip the magic "Interface Applicative" component if ( !objectBrowser() ) diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index bb69f84be..f1e026db2 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -860,9 +860,9 @@ void SalomeApp_Study::components( QStringList& comps ) const for( _PTR(SComponentIterator) it ( studyDS()->NewComponentIterator() ); it->More(); it->Next() ) { _PTR(SComponent) aComponent ( it->Value() ); - if( aComponent && aComponent->ComponentDataType() == "Interface Applicative" ) - continue; // skip the magic "Interface Applicative" component - comps.append( aComponent->ComponentDataType().c_str() ); + // skip the magic "Interface Applicative" component + if ( aComponent && aComponent->ComponentDataType() != getVisualComponentName().toLatin1().constData() ) + comps.append( aComponent->ComponentDataType().c_str() ); } } @@ -890,7 +890,7 @@ std::vector SalomeApp_Study::getSavePoints() { std::vector v; - _PTR(SObject) so = studyDS()->FindComponent("Interface Applicative"); + _PTR(SObject) so = studyDS()->FindComponent( getVisualComponentName().toLatin1().constData() ); if(!so) return v; _PTR(StudyBuilder) builder = studyDS()->NewBuilder(); @@ -911,7 +911,7 @@ std::vector SalomeApp_Study::getSavePoints() void SalomeApp_Study::removeSavePoint(int savePoint) { if(savePoint <= 0) return; - _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint); + _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName().toLatin1().constData(), savePoint); _PTR(SObject) so = AP->GetSObject(); _PTR(StudyBuilder) builder = studyDS()->NewBuilder(); builder->RemoveObjectWithChildren(so); @@ -922,7 +922,7 @@ void SalomeApp_Study::removeSavePoint(int savePoint) */ QString SalomeApp_Study::getNameOfSavePoint(int savePoint) { - _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint); + _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName().toLatin1().constData(), savePoint); _PTR(IParameters) ip = ClientFactory::getIParameters(AP); return ip->getProperty("AP_SAVEPOINT_NAME").c_str(); } @@ -932,19 +932,11 @@ QString SalomeApp_Study::getNameOfSavePoint(int savePoint) */ void SalomeApp_Study::setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint) { - _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint); + _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName().toLatin1().constData(), savePoint); _PTR(IParameters) ip = ClientFactory::getIParameters(AP); ip->setProperty("AP_SAVEPOINT_NAME", nameOfSavePoint.toStdString()); } -/*! - \return a name of the component where visual parameters are stored -*/ -std::string SalomeApp_Study::getVisualComponentName() -{ - return "Interface Applicative"; -} - /*! * \brief Restores the study state */ diff --git a/src/SalomeApp/SalomeApp_Study.h b/src/SalomeApp/SalomeApp_Study.h index de95f130d..59feb8085 100644 --- a/src/SalomeApp/SalomeApp_Study.h +++ b/src/SalomeApp/SalomeApp_Study.h @@ -77,7 +77,6 @@ public: void removeSavePoint(int savePoint); QString getNameOfSavePoint(int savePoint); void setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint); - virtual std::string getVisualComponentName(); virtual void restoreState(int savePoint); void markAsSavedIn(QString theFileName); diff --git a/src/SalomeApp/SalomeApp_VisualState.cxx b/src/SalomeApp/SalomeApp_VisualState.cxx index 0c06d2fd5..2f330e6c1 100644 --- a/src/SalomeApp/SalomeApp_VisualState.cxx +++ b/src/SalomeApp/SalomeApp_VisualState.cxx @@ -118,7 +118,8 @@ int SalomeApp_VisualState::storeState() if ( savePoints.size() > 0) savePoint = savePoints[savePoints.size()-1] + 1; - _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint ); + _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName().toLatin1().constData(), + savePoint ); _PTR(IParameters) ip = ClientFactory::getIParameters( ap ); ViewManagerList lst; @@ -200,7 +201,8 @@ void SalomeApp_VisualState::restoreState(int savePoint) if ( !study ) return; - _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint ); + _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName().toLatin1().constData(), + savePoint ); _PTR(IParameters) ip = ClientFactory::getIParameters(ap); qApp->installEventFilter( this ); -- 2.39.2