]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1341: now the tests application does not link with LightApp since this package... BR_DEMO
authorasl <asl@opencascade.com>
Fri, 3 Nov 2017 06:43:02 +0000 (09:43 +0300)
committerasl <asl@opencascade.com>
Fri, 3 Nov 2017 06:43:02 +0000 (09:43 +0300)
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_DataObject.h
src/HYDROGUI/HYDROGUI_ListSelector.cxx
src/HYDROGUI/HYDROGUI_ViewerDlg.cxx
src/HYDRO_tests/CMakeLists.txt

index 890e29a9b62441aaf0e15f14a286ab519bf246d5..ffaefe8310e87cec6bf41946c0397ce212f8b349 100644 (file)
@@ -38,7 +38,9 @@ HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
                                           const QString& theParentEntry,
                                           const bool theIsInOperation )
 : CAM_DataObject( theParent ),
+#ifndef TEST_MODE
   LightApp_DataObject( theParent ),
+#endif
   myData( theData ),
   myParentEntry( theParentEntry ),
   myIsValid( true ),
@@ -49,7 +51,7 @@ HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
 QString HYDROGUI_DataObject::entry() const
 {
   QString anEntry = HYDROGUI_DataObject::dataObjectEntry( modelObject() );
-  if( isReference() )
+  if( !refEntry().isEmpty() )
     anEntry.prepend( myParentEntry + "_" );
   return anEntry;
 }
@@ -70,7 +72,7 @@ QString HYDROGUI_DataObject::name() const
 
 QFont HYDROGUI_DataObject::font( const int theId ) const
 {
-  QFont aFont = LightApp_DataObject::font( theId );
+  QFont aFont = PARENT::font( theId );
   if( theId == NameId )
   {
     Handle(HYDROData_Entity) aDataObject = modelObject();
@@ -129,7 +131,7 @@ QColor HYDROGUI_DataObject::color( const ColorRole theRole, const int theId ) co
   }
 
   if ( !aColor.isValid() ) {
-    aColor = LightApp_DataObject::color( theRole, theId );
+    aColor = PARENT::color( theRole, theId );
   }
 
   return aColor;
@@ -166,7 +168,7 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const
 
     return aResMgr->loadPixmap( "HYDRO", anIcon );
   }
-  return LightApp_DataObject::icon( theId );
+  return PARENT::icon( theId );
 }
 
 QString HYDROGUI_DataObject::dataObjectEntry( const Handle(HYDROData_Entity)& theObject,
@@ -211,7 +213,7 @@ bool HYDROGUI_DataObject::renameAllowed( const int theColumnId ) const
   }
   else
   {
-    aRes = LightApp_DataObject::renameAllowed( theColumnId );
+    aRes = PARENT::renameAllowed( theColumnId );
   }
   return aRes;
 }
@@ -235,7 +237,9 @@ HYDROGUI_NamedObject::HYDROGUI_NamedObject( SUIT_DataObject* theParent,
                                             const QString&   theParentEntry,
                                             const bool       theIsInOperation  )
 : CAM_DataObject( theParent ),
+#ifndef TEST_MODE
   LightApp_DataObject( theParent ),
+#endif
   myName( theName ),
   myParentEntry( theParentEntry ),
   myIsInOperation( theIsInOperation )
@@ -262,12 +266,12 @@ QPixmap HYDROGUI_NamedObject::icon( const int theId ) const
   {
     return aResMgr->loadPixmap( "HYDRO", QObject::tr( "PARTITION_ICO" ) );
   }
-  return LightApp_DataObject::icon( theId );
+  return PARENT::icon( theId );
 }
 
 QFont HYDROGUI_NamedObject::font( const int theId ) const
 {
-  QFont aFont = LightApp_DataObject::font( theId );
+  QFont aFont = PARENT::font( theId );
   if( theId == NameId )
   {
   if ( dynamic_cast<CAM_ModuleObject*>( parent() ) )
index caa5eba4e653cc20cfd8020602cda67a9e17b4e7..12dfa7102db85e2164635dc314327b44b68441c6 100644 (file)
   #pragma warning( disable: 4251 )
 #endif
 
-#include <LightApp_DataObject.h>
+#ifdef TEST_MODE
+  #include <CAM_DataObject.h>
+  enum { 
+    EntryId = CAM_DataObject::VisibilityId + 1,    //!< entry column
+    RefEntryId                     //!< reference entry column
+  };
+  #define PARENT CAM_DataObject
+#else
+  #include <LightApp_DataObject.h>
+  #define PARENT LightApp_DataObject
+#endif
+
 #include <QString>
 #include <QMap>
 #include <QPixmap>
@@ -47,7 +58,7 @@
  * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
  * constructor the CAM object constructor manually for the correct initialization
  */
-class HYDROGUI_DataObject : public LightApp_DataObject
+class HYDROGUI_DataObject : public PARENT
 {
 public:
   //! Column id
@@ -166,7 +177,7 @@ protected:
  * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
  * constructor the CAM object constructor manually for the correct initialization
  */
-class HYDROGUI_NamedObject : public virtual LightApp_DataObject
+class HYDROGUI_NamedObject : public virtual PARENT
 {
 public:
   /**
index a973b0351ff7cecfc83cf754a3d94945c1476125..7ae11a62ba7c1bc2905c77b7a9874eb851435abc 100644 (file)
 
 #include "HYDROGUI_OrderedListWidget.h"
 
-#include <LightApp_DataOwner.h>
+#ifdef TEST_MODE
+  #include <SUIT_DataOwner.h>
+  class TestOwner : public SUIT_DataOwner
+  {
+  public:
+    TestOwner( const QString& entry ) { myEntry = entry; }
+    virtual ~TestOwner() {}
+
+    QString keyString() const { return myEntry; }
+    QString entry() const { return myEntry; }
+
+  private:
+    QString myEntry;
+  };
+  #define OWNER_CLASS TestOwner
+
+#else
+  #include <LightApp_DataOwner.h>
+  #define OWNER_CLASS LightApp_DataOwner
+#endif
 
 
 HYDROGUI_ListSelector::HYDROGUI_ListSelector( HYDROGUI_OrderedListWidget* theListWidget,
@@ -57,7 +76,7 @@ void HYDROGUI_ListSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const
 
   foreach ( const QString& anEntry, aSelectedEntries ) {
     if ( !anEntry.isEmpty() ) {
-      theList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( anEntry ) ) );
+      theList.append( SUIT_DataOwnerPtr( new OWNER_CLASS( anEntry ) ) );
     }
   }
 }
@@ -73,7 +92,7 @@ void HYDROGUI_ListSelector::setSelection( const SUIT_DataOwnerPtrList& theList )
   QStringList aSelectedEntries;
   SUIT_DataOwnerPtrList::const_iterator anIt = theList.begin();
   for ( ; anIt != theList.end(); ++anIt ) {
-    const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>( (*anIt).operator->() );
+    const OWNER_CLASS* anOwner = dynamic_cast<const OWNER_CLASS*>( (*anIt).operator->() );
     if ( anOwner ) {
       aSelectedEntries << anOwner->entry();
     }
index f82ae06ef5f00b4471e6992379e494a218bdc9f5..bf82bf405205ee3362f331f8af8032a645843a07 100644 (file)
@@ -47,7 +47,7 @@ HYDROGUI_ViewerDlg::HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QStrin
 : HYDROGUI_InputPanel( theModule, theTitle, true, isSplitter )
 {
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-  SUIT_Study* aStudy = theModule ? theModule->getApp()->activeStudy() : 0;
+  SUIT_Study* aStudy = theModule ? theModule->application()->activeStudy() : 0;
 
   myViewManager = new OCCViewer_ViewManager( aStudy, 0 );
   OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( true );
@@ -144,6 +144,10 @@ OCCViewer_ViewManager* HYDROGUI_ViewerDlg::viewManager() const
 
 SUIT_SelectionMgr* HYDROGUI_ViewerDlg::selectionMgr() const
 {
+#ifdef TEST_MODE
+  static SUIT_SelectionMgr* mgr = new SUIT_SelectionMgr();
+  return mgr;
+#else
     SUIT_SelectionMgr* aSelMgr = 0;
     if ( module() )
     {
@@ -152,6 +156,7 @@ SUIT_SelectionMgr* HYDROGUI_ViewerDlg::selectionMgr() const
             aSelMgr = app->selectionMgr();
     }
     return aSelMgr;
+#endif
 }
 
 void HYDROGUI_ViewerDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
index 0617a98dba75b4ae5b20b6fbd454f8bee67c0bf8..e446a72cbe8e0b10e93467bddf59674f410ea404 100644 (file)
@@ -109,7 +109,10 @@ ELSE()
 ENDIF()
 
 link_directories( $ENV{KERNEL_ROOT_DIR}/lib/salome $ENV{GUI_ROOT_DIR}/lib/salome $ENV{GEOM_ROOT_DIR}/lib/salome )
-SET( GUI_LIBRARIES ImageComposer qtx suit LightApp CAM OCCViewer )
+
+SET( GUI_LIBRARIES ImageComposer qtx suit CAM OCCViewer GraphicsView )
+# Please do not link with LightApp since in the full SALOME it is linked with CORBA (omniORB)
+
 SET( GEOM_LIBRARIES CurveCreator GEOMUtils GEOMUtils )
 
 link_directories( $ENV{ECWLIB_ROOT_DIR}/lib )