#include <Standard_Version.hxx>
+//---------------------------------------------------------
+#define USE_DEBUG
+//#define MB_IGNORE_QT
+//#define MB_FULL_DUMP
+#define MBCLASSNAME "LightApp_Application"
+#include "MBDebug.h"
+// <-- insert includes for addtional debug headers here!
+//---------------------------------------------------------
+
#define ToolBarMarker 0
#define DockWidgetMarker 1
myPrefs( 0 ),
myScreenHelper(new LightApp_FullScreenHelper())
{
+ DBG_FUN();
Q_INIT_RESOURCE( LightApp );
STD_TabDesktop* desk = new STD_TabDesktop();
*/
LightApp_Application::~LightApp_Application()
{
+ DBG_FUN();
savePreferences();
delete mySelMgr;
delete myScreenHelper;
/*!Start application.*/
void LightApp_Application::start()
{
+ DBG_FUN();
CAM_Application::start();
updateWindows();
/*!Closeapplication.*/
void LightApp_Application::closeApplication()
{
+ DBG_FUN();
#ifndef DISABLE_QTXWEBBROWSER
QProcess::startDetached( "HelpBrowser",
QStringList() << QString( "--remove=%1" ).arg( QApplication::instance()->applicationPid() ) );
*/
void LightApp_Application::onStudyOpened( SUIT_Study* theStudy )
{
+ DBG_FUN();
SUIT_DataObject* aRoot = 0;
if ( theStudy && theStudy->root() )
{
/*!Protected SLOT. On study saved.*/
void LightApp_Application::onStudySaved( SUIT_Study* s )
{
+ DBG_FUN();
QtxMRUAction* mru = ::qobject_cast<QtxMRUAction*>( action( MRUId ) );
- if ( mru && s )
+ if ( mru && s ) {
+ MSGEL("...adding [" << s->studyName().toStdString() << "] to MRU");
mru->insert( s->studyName() );
+ }
emit studySaved();
}
/*!Protected SLOT. On study closed.*/
void LightApp_Application::onStudyClosed( SUIT_Study* /*s*/ )
{
+ DBG_FUN();
/*
disconnect( this, SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
void LightApp_Application::studyOpened( SUIT_Study* s )
{
+ DBG_FUN();
CAM_Application::studyOpened( s );
updateWindows();
void LightApp_Application::studySaved( SUIT_Study* s )
{
+ DBG_FUN();
CAM_Application::studyOpened( s );
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
if ( aResMgr && activeStudy() ) {
void LightApp_Application::onMRUActivated( const QString& name )
{
+ DBG_FUN();
+ ARG(name);
SUIT_Session* s = SUIT_Session::session();
if ( s && s->activeApplication() == this )
onOpenDoc( name );
#include <SUIT_DataBrowser.h>
#include <SUIT_DataObject.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+//#define MB_IGNORE_QT
+//#define MB_FULL_DUMP
+#define MBCLASSNAME "LightApp_DataModel"
+#include "MBDebug.h"
+// <-- insert includes for addtional debug headers here!
+//---------------------------------------------------------
+
/*!
Constructor
*/
LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule )
: CAM_DataModel( theModule )
{
+ DBG_FUN();
myGroupId = 0;
if( module() )
myGroupId = qHash( module()->name() );
*/
LightApp_DataModel::~LightApp_DataModel()
{
+ DBG_FUN();
}
/*!
*/
bool LightApp_DataModel::open( const QString&, CAM_Study*, QStringList )
{
+ DBG_FUN();
emit opened(); //TODO: is it really needed? to be removed maybe...
return true;
}
*/
bool LightApp_DataModel::save( QStringList& )
{
+ DBG_FUN();
emit saved();
return true;
}
/*!
Emit saved()
*/
-bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList& )
+bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList&, bool isBackup/*=false*/ )
{
- emit saved();
+ DBG_FUN();
+ ARG(isBackup);
+ if (!isBackup)
+ emit saved();
return true;
}
*/
bool LightApp_DataModel::close()
{
+ DBG_FUN();
emit closed();
return true;
}
*/
void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* )
{
+ DBG_FUN();
// san: Previously modelRoot was casted to LightApp_ModuleObject*,
// BUT this is incorrect: in full SALOME the model root has different type.
// Hopefully LightApp_DataObject* is sufficient here.
virtual bool open( const QString&, CAM_Study*, QStringList );
virtual bool save( QStringList& );
- virtual bool saveAs( const QString&, CAM_Study*, QStringList& );
+ virtual bool saveAs( const QString&, CAM_Study*, QStringList&, bool isBackup=false );
virtual bool close();
virtual bool dumpPython( const QString&,
CAM_Study*,
#include <set>
+//---------------------------------------------------------
+#define USE_DEBUG
+//#define MB_IGNORE_QT
+//#define MB_FULL_DUMP
+#define MBCLASSNAME "LightApp_Study"
+#include "MBDebug.h"
+// <-- insert includes for addtional debug headers here!
+//---------------------------------------------------------
+
/*!
Constructor.
*/
LightApp_Study::LightApp_Study( SUIT_Application* app )
: CAM_Study( app )
{
+ DBG_FUN();
// HDF persistence
myDriver = new LightApp_HDFDriver();
//myDriver = new LightApp_Driver();
*/
LightApp_Study::~LightApp_Study()
{
+ DBG_FUN();
delete myDriver; myDriver = 0;
}
*/
bool LightApp_Study::createDocument( const QString& theStr )
{
+ DBG_FUN();
+ ARG(theStr);
// create myRoot
setRoot( new LightApp_RootObject( this ) );
*/
bool LightApp_Study::openDocument( const QString& theFileName )
{
+ DBG_FUN();
+ ARG(theFileName);
myDriver->ClearDriverContents();
// create files for models from theFileName
if( !openStudyData(theFileName, 0)) // 0 means persistence file
*/
bool LightApp_Study::loadDocument( const QString& theStudyName )
{
+ DBG_FUN();
+ ARG(theStudyName);
myDriver->ClearDriverContents();
if( !openStudyData(theStudyName, 0)) // 0 means persistence file
return false;
/*!
Saves document
*/
-bool LightApp_Study::saveDocumentAs( const QString& theFileName )
+bool LightApp_Study::saveDocumentAs( const QString& theFileName, bool isBackup/*=false*/ )
{
+ DBG_FUN();
+ ARG(theFileName);
+ ARG(isBackup);
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if( !resMgr )
return false;
bool res = saveStudyData(theFileName, 0); // 0 means persistence file
res = res && CAM_Study::saveDocumentAs( theFileName );
//SRN: BugID IPAL9377, removed usage of uninitialized variable <res>
- if ( res )
+ if ( res && !isBackup)
emit saved( this );
return res;
*/
bool LightApp_Study::saveDocument()
{
+ DBG_FUN();
ModelList list; dataModels( list );
myDriver->ClearDriverContents();
*/
void LightApp_Study::closeDocument(bool permanently)
{
+ DBG_FUN();
+ ARG(permanently);
// Inform everybody that this study is going to close when it's most safe to,
// i.e. in the very beginning
emit closed( this );
*/
void LightApp_Study::saveModuleData(QString theModuleName, int type, QStringList theListOfFiles)
{
+ DBG_FUN();
+ ARG(theModuleName);
+ ARG(type);
+ ARG(theListOfFiles);
int aNb = theListOfFiles.count();
if ( aNb == 0 )
return;
*/
bool LightApp_Study::saveStudyData( const QString& theFileName, int /*type*/ )
{
+ DBG_FUN();
+ ARG(theFileName);
ModelList list; dataModels( list );
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if( !resMgr )
virtual bool loadDocument( const QString& );
virtual bool saveDocument();
- virtual bool saveDocumentAs( const QString& );
+ virtual bool saveDocumentAs( const QString& , bool isBackup=false );
virtual void closeDocument(bool permanently = true);
+ virtual bool dump( const QString&, bool, bool, bool ) { return false; }
+
virtual bool isSaved() const;
virtual bool isModified() const;
#include "SUIT_MessageBox.h"
#include "SUIT_Application.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+//#define MB_IGNORE_QT
+//#define MB_FULL_DUMP
+#define MBCLASSNAME "SUIT_Study"
+#include "MBDebug.h"
+// <-- insert includes for addtional debug headers here!
+//---------------------------------------------------------
+
/*!\class SUIT_Study
* Support study management. Object management. Operation management.
*/
myIsModified( false ),
myBlockChangeState( false )
{
+ DBG_FUN();
static int _id = 0;
myId = ++_id;
+ SHOW(myId);
myRoot = new SUIT_DataObject();
}
/*!Destructor.*/
SUIT_Study::~SUIT_Study()
{
+ DBG_FUN();
delete myRoot;
myRoot = 0;
}
/*!
* Save document as \a fileName. Set file name.
*/
-bool SUIT_Study::saveDocumentAs( const QString& fileName )
-{
- myName = fileName;
- myIsSaved = true;
- myIsModified = false;
+bool SUIT_Study::saveDocumentAs( const QString& fileName, bool isBackup/*=false*/ )
+{
+ DBG_FUN();
+ ARG(fileName);
+ ARG(isBackup);
+ if (!isBackup) {
+ myName = fileName;
+ myIsSaved = true;
+ myIsModified = false;
+ }
+ SHOW(myName);
+ SHOW(myIsSaved);
+ SHOW(myIsModified);
return true;
}
*/
bool SUIT_Study::saveDocument()
{
+ DBG_FUN();
return saveDocumentAs( myName );
}
virtual bool createDocument( const QString& );
bool saveDocument();
- virtual bool saveDocumentAs( const QString& );
+ virtual bool saveDocumentAs( const QString& , bool isBackup=false );
virtual void update();
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
+//---------------------------------------------------------
+#define USE_DEBUG
+//#define MB_IGNORE_QT
+//#define MB_FULL_DUMP
+#define MBCLASSNAME "SalomeApp_Study"
+#include "MBDebug.h"
+// <-- insert includes for addtional debug headers here!
+//---------------------------------------------------------
+
//#define NOTIFY_BY_EVENT
class ObserverEvent : public QEvent
SalomeApp_Study::SalomeApp_Study( SUIT_Application* app )
: LightApp_Study( app ), myObserver( 0 )
{
+ DBG_FUN();
myStudyDS = SalomeApp_Application::getStudy();
}
*/
SalomeApp_Study::~SalomeApp_Study()
{
+ DBG_FUN();
if ( myObserver ) {
PortableServer::ObjectId_var oid = myObserver->_default_POA()->servant_to_id( myObserver );
myObserver->_default_POA()->deactivate_object( oid.in() );
*/
bool SalomeApp_Study::createDocument( const QString& theStr )
{
+ DBG_FUN();
+ ARG(theStr);
MESSAGE( "createDocument" );
setStudyName( QString::fromUtf8(myStudyDS->URL().c_str()) );
*/
bool SalomeApp_Study::openDocument( const QString& theFileName )
{
+ DBG_FUN();
+ ARG(theFileName);
MESSAGE( "openDocument" );
// read HDF file
*/
bool SalomeApp_Study::loadDocument( const QString& theStudyName )
{
+ DBG_FUN();
+ ARG(theStudyName);
MESSAGE( "loadDocument" );
setRoot( new SalomeApp_RootObject( this ) ); // create myRoot
Saves document
\param theFileName - name of file
*/
-bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
+bool SalomeApp_Study::saveDocumentAs( const QString& theFileName, bool isBackup/*=false*/ )
{
+ DBG_FUN();
+ ARG(theFileName);
+ ARG(isBackup);
+
bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", false );
- if ( store )
+ if ( store && !isBackup )
SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
ModelList list; dataModels( list );
if ( LightApp_DataModel* aModel =
dynamic_cast<LightApp_DataModel*>( it.next() ) ) {
listOfFiles.clear();
- aModel->saveAs( theFileName, this, listOfFiles );
+ aModel->saveAs( theFileName, this, listOfFiles, isBackup );
if ( !listOfFiles.isEmpty() )
saveModuleData(aModel->module()->name(), 0, // 0 means persistence file
listOfFiles);
res = res && saveStudyData(theFileName, 0); // 0 means persistence file
- if ( res )
+ if ( res && !isBackup)
emit saved( this );
return res;
*/
bool SalomeApp_Study::saveDocument()
{
+ DBG_FUN();
bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
if ( store )
SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
*/
void SalomeApp_Study::closeDocument(bool permanently)
{
+ DBG_FUN();
LightApp_Study::closeDocument(permanently);
// close SALOMEDS document
bool isMultiFile,
bool toSaveGUI )
{
+ DBG_FUN();
+ ARG(theFileName);
+ ARG(toPublish);
+ ARG(isMultiFile);
+ ARG(toSaveGUI);
int savePoint = 0;
_PTR(AttributeParameter) ap;
_PTR(IParameters) ip = ClientFactory::getIParameters(ap);
virtual bool loadDocument( const QString& );
virtual bool saveDocument();
- virtual bool saveDocumentAs( const QString& );
+ virtual bool saveDocumentAs( const QString& , bool isBackup=false );
virtual void closeDocument(bool permanently = true);