From: vsr Date: Mon, 30 Jul 2007 14:03:49 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: qt4_porting_delivery_220807~72 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e8819780ac7b5d178c07dc34f13fc63e1e541962;p=modules%2Fgui.git *** empty log message *** --- diff --git a/src/CAM/CAM.pro b/src/CAM/CAM.pro index 634461537..7e8055dd7 100644 --- a/src/CAM/CAM.pro +++ b/src/CAM/CAM.pro @@ -18,14 +18,12 @@ HEADERS += CAM_Application.h HEADERS += CAM_DataModel.h HEADERS += CAM_DataObject.h HEADERS += CAM_Module.h -HEADERS += CAM_RootObject.h HEADERS += CAM_Study.h SOURCES = CAM_Application.cxx SOURCES += CAM_DataModel.cxx SOURCES += CAM_DataObject.cxx SOURCES += CAM_Module.cxx -SOURCES += CAM_RootObject.cxx SOURCES += CAM_Study.cxx TRANSLATIONS = resources/CAM_images.ts \ diff --git a/src/CAM/CAM_DataModel.cxx b/src/CAM/CAM_DataModel.cxx index 7af20dbe6..f792ab585 100755 --- a/src/CAM/CAM_DataModel.cxx +++ b/src/CAM/CAM_DataModel.cxx @@ -90,12 +90,14 @@ void CAM_DataModel::setRoot( const CAM_DataObject* newRoot ) return; if ( myRoot ) - myRoot->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) ); + myRoot->disconnect( SIGNAL( destroyed( SUIT_DataObject* ) ), + this, SLOT( onDestroyed( SUIT_DataObject* ) ) ); myRoot = (CAM_DataObject*)newRoot; if ( myRoot ) - myRoot->connect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) ); + myRoot->connect( SIGNAL( destroyed( SUIT_DataObject* ) ), + this, SLOT( onDestroyed( SUIT_DataObject* ) ) ); emit rootChanged( this ); } diff --git a/src/CAM/CAM_DataObject.cxx b/src/CAM/CAM_DataObject.cxx index dc71af10a..ebb433eae 100755 --- a/src/CAM/CAM_DataObject.cxx +++ b/src/CAM/CAM_DataObject.cxx @@ -23,7 +23,7 @@ /*! \class CAM_DataObject - \brief CAM-based implementation of data object. + \brief CAM-based implementation of the data object. In addition to base implementation provides integration with CAM_DataModel. @@ -53,26 +53,90 @@ CAM_DataObject::~CAM_DataObject() */ CAM_Module* CAM_DataObject::module() const { - CAM_Module* mod = 0; - - CAM_DataModel* data = dataModel(); - if ( data ) - mod = data->module(); - - return mod; + CAM_DataModel* dm = dataModel(); + return dm ? dm->module() : 0; } /*! \brief Get CAM data model. \return data model or 0 if it is not set - \sa CAM_RootObject class + \sa CAM_ModuleObject class */ CAM_DataModel* CAM_DataObject::dataModel() const { CAM_DataObject* parentObj = dynamic_cast( parent() ); + return parentObj ? parentObj->dataModel() : 0; +} + +/*! + \class CAM_ModuleObject + \brief CAM data model root object. + + This class is intended for optimized access to CAM_DataModel instance + from CAM_DataObject instances. + + To take advantage of this class in a specific application, + custom data model root object class should be derived from both CAM_ModuleObject + and application-specific DataObject implementation using virtual inheritance. +*/ + +/*! + \brief Constructor. + \param parent parent data object +*/ +CAM_ModuleObject::CAM_ModuleObject( SUIT_DataObject* parent ) +: CAM_DataObject( parent ), + myDataModel( 0 ) +{ +} + +/*! + \brief Constructor. + \param data data model + \param parent parent data object +*/ +CAM_ModuleObject::CAM_ModuleObject( CAM_DataModel* data, SUIT_DataObject* parent ) +: CAM_DataObject( parent ), + myDataModel( data ) +{ +} - if ( !parentObj ) - return 0; +/*! + \brief Destructor. + + Does nothing. +*/ +CAM_ModuleObject::~CAM_ModuleObject() +{ +} + +/*! + \brief Get root object name. + + If the data model is set, this method returns module name. + Otherwise returns empty string. + + \return root object name +*/ +QString CAM_ModuleObject::name() const +{ + return myDataModel ? myDataModel->module()->moduleName() : QString(); +} - return parentObj->dataModel(); +/*! + \brief Get data model. + \return data model pointer or 0 if it is not set +*/ +CAM_DataModel* CAM_ModuleObject::dataModel() const +{ + return myDataModel; +} + +/*! + \brief Set data model. + \param dm data model +*/ +void CAM_ModuleObject::setDataModel( CAM_DataModel* dm ) +{ + myDataModel = dm; } diff --git a/src/CAM/CAM_DataObject.h b/src/CAM/CAM_DataObject.h index f0b4affa8..e2e7febc7 100755 --- a/src/CAM/CAM_DataObject.h +++ b/src/CAM/CAM_DataObject.h @@ -36,6 +36,22 @@ public: virtual CAM_DataModel* dataModel() const; }; +class CAM_EXPORT CAM_ModuleObject : public virtual CAM_DataObject +{ +public: + CAM_ModuleObject( SUIT_DataObject* = 0 ); + CAM_ModuleObject( CAM_DataModel*, SUIT_DataObject* = 0 ); + virtual ~CAM_ModuleObject(); + + virtual QString name() const; + + virtual CAM_DataModel* dataModel() const; + virtual void setDataModel( CAM_DataModel* ); + +private: + CAM_DataModel* myDataModel; +}; + #endif #if _MSC_VER > 1000 diff --git a/src/CAM/CAM_RootObject.cxx b/src/CAM/CAM_RootObject.cxx deleted file mode 100755 index a710a6b78..000000000 --- a/src/CAM/CAM_RootObject.cxx +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAM_RootObject.h" - -#include "CAM_DataModel.h" -#include "CAM_Module.h" - -/*! - \class CAM_RootObject - \brief CAM data model root object. - - This class is intended for optimized access to CAM_DataModel instance - from CAM_DataObject instances. - - To take advantage of this class in a specific application, - custom data model root object class should be derived from both CAM_RootObject - and application-specific DataObject implementation using virtual inheritance. -*/ - -/*! - \brief Constructor. - \param parent parent data object -*/ -CAM_RootObject::CAM_RootObject( SUIT_DataObject* parent ) -: CAM_DataObject( parent ), - myDataModel( 0 ) -{ -} - -/*! - \brief Constructor. - \param data data model - \param parent parent data object -*/ -CAM_RootObject::CAM_RootObject( CAM_DataModel* data, SUIT_DataObject* parent ) -: CAM_DataObject( parent ), - myDataModel( data ) -{ -} - -/*! - \brief Destructor. - - Does nothing. -*/ -CAM_RootObject::~CAM_RootObject() -{ -} - -/*! - \brief Get root object name. - - If the data model is set, this method returns module name. - Otherwise returns empty string. - - \return root object name -*/ -QString CAM_RootObject::name() const -{ - QString aName = ""; - if (myDataModel) - aName = myDataModel->module()->moduleName(); - return aName; -} - -/*! - \brief Get data model. - \return data model pointer or 0 if it is not set -*/ -CAM_DataModel* CAM_RootObject::dataModel() const -{ - return myDataModel; -} - -/*! - \brief Set data model. - \param dm data model -*/ -void CAM_RootObject::setDataModel( CAM_DataModel* dm ) -{ - myDataModel = dm; -} diff --git a/src/CAM/CAM_RootObject.h b/src/CAM/CAM_RootObject.h deleted file mode 100755 index fd633b812..000000000 --- a/src/CAM/CAM_RootObject.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAM_ROOTOBJECT_H -#define CAM_ROOTOBJECT_H - -#include "CAM_DataObject.h" - -class CAM_EXPORT CAM_RootObject : public virtual CAM_DataObject -{ -public: - CAM_RootObject( SUIT_DataObject* = 0 ); - CAM_RootObject( CAM_DataModel*, SUIT_DataObject* = 0 ); - virtual ~CAM_RootObject(); - - virtual QString name() const; - - virtual CAM_DataModel* dataModel() const; - virtual void setDataModel( CAM_DataModel* ); - -private: - CAM_DataModel* myDataModel; -}; - -#endif - -#if _MSC_VER > 1000 -#pragma once -#endif diff --git a/src/CAM/CAM_Study.cxx b/src/CAM/CAM_Study.cxx index da1c304dd..fa0c1de5f 100755 --- a/src/CAM/CAM_Study.cxx +++ b/src/CAM/CAM_Study.cxx @@ -20,7 +20,6 @@ #include "CAM_DataModel.h" #include "CAM_DataObject.h" -#include "CAM_RootObject.h" #include "CAM_Module.h" /*! @@ -120,7 +119,7 @@ bool CAM_Study::removeDataModel( const CAM_DataModel* dm ) if ( !dm ) return true; - CAM_RootObject* aModelRoot = dynamic_cast( dm->root() ); + CAM_ModuleObject* aModelRoot = dynamic_cast( dm->root() ); if ( aModelRoot ) aModelRoot->setDataModel( 0 ); diff --git a/src/CAM/Makefile.am b/src/CAM/Makefile.am index 8c0b727a0..8f96c76ca 100755 --- a/src/CAM/Makefile.am +++ b/src/CAM/Makefile.am @@ -31,16 +31,14 @@ salomeinclude_HEADERS= \ CAM_DataModel.h \ CAM_DataObject.h \ CAM_Module.h \ - CAM_Study.h \ - CAM_RootObject.h + CAM_Study.h dist_libCAM_la_SOURCES= \ CAM_Application.cxx \ CAM_DataModel.cxx \ CAM_DataObject.cxx \ CAM_Module.cxx \ - CAM_Study.cxx \ - CAM_RootObject.cxx + CAM_Study.cxx MOC_FILES= \ CAM_Application_moc.cxx \