useCaseBuilder->UnRegister();
\endcode
-\section use_case_compatibility Remark about compatibility with existing studies
+\section use_case_compatibility Remark about compatibility with existing study
If you decide to switch your module to the use case builder approach to provide
customization for the data tree representation, you must take care of compatibility
with existing SALOME studies. Basically it means that you have to add
-a simple code to \c Load() (and \c LoadASCII() if necessary) method
+a simple code to \c Load() method
of your module, which adds tree node attributes to all data entities
in the data tree of your module. The simplest way to do
this is to iterate through all data items and recursively add them to
{
bool result = true;
if( activeStudy() ) {
- int answer = SUIT_MessageBox::question( desktop(),
+ int answer = !activeStudy()->isModified() ? 1 :
+ SUIT_MessageBox::question( desktop(),
tr( "APPCLOSE_CAPTION" ),
tr( "STUDYCLOSE_DESCRIPTION" ),
tr( "APPCLOSE_SAVE" ),
}
if (message.indexOf("studyCleared") == 0) {
// Disconnect GUI from active study, because it was closed on DS side.
- if (activeStudy() && activeStudy()->isModified()) {
+ if (activeStudy()) {
closeActiveDoc( false );
// Disable 'Connect' action
QAction* a = action( ConnectId );
std::string aTmpDir = myListOfFiles[0];
// Create a list to store names of created files
- SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
- aSeq->length(n);
+ ListOfFiles aSeq;
+ aSeq.reserve(n);
for (int i = 0; i < n; i++)
- aSeq[i] = CORBA::string_dup(myListOfFiles[i + 1].c_str());
+ aSeq.push_back(CORBA::string_dup(myListOfFiles[i + 1].c_str()));
// Convert a file to the byte stream
- aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), isMultiFile);
+ aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq, isMultiFile);
// Remove the files and tmp directory, created by the component storage procedure
- if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
+ if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq, true);
}
return aStreamFile._retn();
// Convert the byte stream theStream to a files and place them in the tmp directory.
// The files and temporary directory must be deleted by the component loading procedure.
- SALOMEDS::ListOfFileNames_var aSeq =
+ ListOfFiles aSeq =
SALOMEDS_Tool::PutStreamToFiles(theFile, aTmpDir.c_str(), isMultiFile);
// Store list of file names to be used by the component loading procedure
- const int n = aSeq->length() + 1;
+ const int n = aSeq.size() + 1;
ListOfFiles listOfFiles (n);
listOfFiles[0] = aTmpDir;
for (int i = 1; i < n; i++)
// it can be changed outside of GUI
// TEMPORARILY SOLUTION: better to be implemented with help of SALOMEDS observers
if ( studyDS() ) {
- QString newName = QString::fromUtf8(studyDS()->Name().c_str());
+ QString newName = QString::fromUtf8(studyDS()->URL().c_str());
if ( LightApp_Study::studyName() != newName ) {
SalomeApp_Study* that = const_cast<SalomeApp_Study*>( this );
that->setStudyName( newName );
return false;
setStudyDS( study );
- setStudyName( QString::fromUtf8(study->Name().c_str()) );
+ setStudyName( QString::fromUtf8(study->URL().c_str()) );
// create myRoot
SalomeApp_RootObject* aRoot=new SalomeApp_RootObject( this );
bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false );
- bool res = (isAscii ?
- studyDS()->SaveAsASCII( theFileName.toUtf8().data(), isMultiFile ) :
- studyDS()->SaveAs ( theFileName.toUtf8().data(), isMultiFile ))
+ bool res = studyDS()->SaveAs( theFileName.toUtf8().data(), isMultiFile, isAscii )
&& CAM_Study::saveDocumentAs( theFileName );
res = res && saveStudyData(theFileName);
bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false );
- bool res = (isAscii ?
- studyDS()->SaveASCII( isMultiFile ) :
- studyDS()->Save ( isMultiFile )) && CAM_Study::saveDocument();
+ bool res = studyDS()->Save( isMultiFile, isAscii ) && CAM_Study::saveDocument();
res = res && saveStudyData(studyName());
if ( res )
if (isMultiFile)
return;
- std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName );
+ SALOMEDS_Tool::ListOfFiles aListOfFiles = GetListOfFiles( theModuleName );
if (aListOfFiles.size() > 0) {
std::string aTmpDir = aListOfFiles[0];
const int n = aListOfFiles.size() - 1;
- SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
- aSeq->length(n);
+ std::vector<std::string> aSeq;
+ aSeq.reserve(n);
for (int i = 0; i < n; i++)
- aSeq[i] = CORBA::string_dup(aListOfFiles[i + 1].c_str());
+ aSeq.push_back(CORBA::string_dup(aListOfFiles[i + 1].c_str()));
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
+ SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq, true);
}
}
_argc = argc ;
_argv = argv ;
_isGUI = false ;
- _runningStudies= 0 ;
_orb = CORBA::ORB::_duplicate(orb) ;
_poa = PortableServer::POA::_duplicate(poa) ;
_GUIMutex = GUIMutex;
/*!
Send a SALOME::StatSession structure (see idl) to the client
- (number of running studies and presence of GUI)
+ (presence of GUI)
*/
/*class QtLock
{
{
// update Session state
_GUIMutex->lock();
+ int activeStudy = 0;
- _runningStudies = 0;
{
//QtLock lock;
_isGUI = SUIT_Session::session();
if ( _isGUI && SUIT_Session::session()->activeApplication() )
- _runningStudies = SUIT_Session::session()->activeApplication()->getNbStudies();
+ activeStudy = SUIT_Session::session()->activeApplication()->getNbStudies();
}
// getting stat info
- SALOME::StatSession_var myStats = new SALOME::StatSession ;
- if (_runningStudies)
+ SALOME::StatSession_var myStats = new SALOME::StatSession;
+ if (activeStudy)
myStats->state = SALOME::running ;
else if (_isShuttingDown)
myStats->state = SALOME::shutdown ;
else
myStats->state = SALOME::asleep ;
- myStats->runningStudies = _runningStudies ;
myStats->activeGUI = _isGUI ;
_GUIMutex->unlock();
CORBA::Boolean _isGUI ;
QMutex* _GUIMutex ;
QWaitCondition* _GUILauncher;
- int _runningStudies ;
CORBA::ORB_var _orb;
PortableServer::POA_var _poa;
bool _isShuttingDown;