-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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
#include <QObject>
#include <QVariant>
+//VSR: uncomment below macro to support unicode text properly in SALOME
+// current commented out due to regressions
+//#define PAL22528_UNICODE
+
+namespace
+{
+ QString fromUtf8( const char* txt )
+ {
+#ifdef PAL22528_UNICODE
+ return QString::fromUtf8( txt );
+#else
+ return QString( txt );
+#endif
+ }
+
+ QString fromUtf8( const std::string& txt )
+ {
+ return fromUtf8( txt.c_str() );
+ }
+}
+
/*!
\class SalomeApp_DataObject
\brief Implementation of the data object for use in CORBA-based
{
QString str;
if ( myObject )
- str = myObject->GetName().c_str();
+ str = fromUtf8( myObject->GetName() );
if ( str.isEmpty() ) {
_PTR(SObject) refObj = referencedObject();
if ( refObj )
- str = refObj->GetName().c_str();
+ str = fromUtf8( refObj->GetName() );
}
if ( isReference() ) {
_PTR(AttributePixMap) aPixAttr ( anAttr );
if ( aPixAttr->HasPixMap() ) {
QString componentType = componentDataType();
- QString pixmapID = aPixAttr->GetPixMap().c_str();
+ QString pixmapID = fromUtf8( aPixAttr->GetPixMap() );
// select a plugin within a component
QStringList plugin_pixmap = pixmapID.split( "::", QString::KeepEmptyParts );
if ( plugin_pixmap.size() == 2 ) {
if ( !CORBA::is_nil(aComponent) && aComponent->hasObjectInfo() ) {
LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
- if ( aRoot && aRoot->study() )
- return QString( (CORBA::String_var)aComponent->getObjectInfo( aRoot->study()->id(), entry().toLatin1().constData()) );
+ if ( aRoot && aRoot->study() ) {
+ CORBA::String_var data = aComponent->getObjectInfo( entry().toUtf8().constData());
+ QString objInfo = data.in();
+ QStringList l;
+ l << name();
+ if ( !objInfo.isEmpty() )
+ l << objInfo;
+ return l.join("\n");
+ }
}
}
}
bool ok = false;
// tmp??
- _PTR(UseCaseBuilder) aUseCaseBuilder = myObject->GetStudy()->GetUseCaseBuilder();
+ _PTR(UseCaseBuilder) aUseCaseBuilder = SalomeApp_Application::getStudy()->GetUseCaseBuilder();
if (aUseCaseBuilder->IsUseCaseNode(myObject)) {
ok = aUseCaseBuilder->HasChildren(myObject);
// TODO: check name as below?
}
else {
- _PTR(ChildIterator) it ( myObject->GetStudy()->NewChildIterator( myObject ) );
+ _PTR(ChildIterator) it ( SalomeApp_Application::getStudy()->NewChildIterator( myObject ) );
for ( ; it->More() && !ok; it->Next() ) {
_PTR(SObject) obj = it->Value();
if ( obj ) {
{
_PTR(AttributeString) strAttr = attr;
std::string str = strAttr->Value();
- QString aStrings = QString( str.c_str() );
+ QString aStrings = fromUtf8( str );
//Special case to show NoteBook variables in the "Value" column of the OB
- if ( LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() ) )
+ bool ok = false;
+ QStringList aSectionList = aStrings.split( "|" );
+ if ( !aSectionList.isEmpty() )
{
- if ( SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( aRoot->study() ) )
+ QString aLastSection = aSectionList.last();
+ QStringList aStringList = aLastSection.split( ":" );
+ if ( !aStringList.isEmpty() )
{
- _PTR(Study) studyDS( aStudy->studyDS() );
-
- bool ok = false;
- QStringList aSectionList = aStrings.split( "|" );
- if ( !aSectionList.isEmpty() )
+ ok = true;
+ for ( int i = 0, n = aStringList.size(); i < n; i++ )
{
- QString aLastSection = aSectionList.last();
- QStringList aStringList = aLastSection.split( ":" );
- if ( !aStringList.isEmpty() )
- {
- ok = true;
- for ( int i = 0, n = aStringList.size(); i < n; i++ )
- {
- QString aStr = aStringList[i];
- if ( studyDS->IsVariable( aStr.toStdString() ) )
- val.append( aStr + ", " );
- }
-
- if ( !val.isEmpty() )
- val.remove( val.length() - 2, 2 );
- }
+ QString aStr = aStringList[i];
+ if ( SalomeApp_Application::getStudy()->IsVariable( aStr.toStdString() ) )
+ val.append( aStr + ", " );
}
- if( !ok )
- val = aStrings;
+
+ if ( !val.isEmpty() )
+ val.remove( val.length() - 2, 2 );
}
}
+ if( !ok )
+ val = aStrings;
}
else if ( obj->FindAttribute( attr, "AttributeInteger" ) )
{
{
_PTR(AttributeComment) comm = attr;
std::string str = comm->Value();
- val = QString( str.c_str() );
+ val = fromUtf8( str );
}
return val;