From: Anthony GEAY Date: Fri, 19 Feb 2021 23:45:35 +0000 (+0100) Subject: WIP X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cdf1e64cdd257b5901cb52b1cd5be385dc126c40;p=modules%2Fgui.git WIP --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d401f948..8f67a2d97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -407,7 +407,7 @@ ENDIF(SALOME_USE_PYCONSOLE) # CORBA specific targets: IF(NOT SALOME_LIGHT_ONLY) LIST(APPEND _${PROJECT_NAME}_exposed_targets - SalomeIDLGUI SalomeSession SalomeApp SalomeGuiHelpers SalomeTreeData ToolsGUI) + SalomeIDLGUI SalomeSession SalomeApp SalomeAppSL SalomeAppImpl SalomeGuiHelpers SalomeTreeData ToolsGUI) ENDIF(NOT SALOME_LIGHT_ONLY) # Add all targets to the build-tree export set diff --git a/SalomeGUIConfig.cmake.in b/SalomeGUIConfig.cmake.in index d24b44d3b..925c10c24 100644 --- a/SalomeGUIConfig.cmake.in +++ b/SalomeGUIConfig.cmake.in @@ -201,6 +201,8 @@ SET(GUI_QDS QDS) SET(GUI_qtx qtx) SET(GUI_QxScene QxScene) SET(GUI_SalomeApp SalomeApp) +SET(GUI_SalomeAppSL SalomeAppSL) +SET(GUI_SalomeAppImpl SalomeAppImpl) SET(GUI_SalomeIDLGUI SalomeIDLGUI) SET(GUI_SalomeObject SalomeObject) SET(GUI_SalomePrs SalomePrs) diff --git a/src/SalomeApp/CMakeLists.txt b/src/SalomeApp/CMakeLists.txt index 10ae94a81..22e69a90d 100644 --- a/src/SalomeApp/CMakeLists.txt +++ b/src/SalomeApp/CMakeLists.txt @@ -124,7 +124,8 @@ ENDIF() # --- headers --- # header files / to be processed by moc -SET(_moc_HEADERS +SET(_moc_HEADERS + SalomeApp_Application_SL.h SalomeApp_Application.h SalomeApp_CheckFileDlg.h SalomeApp_DataModel.h @@ -184,6 +185,7 @@ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) # sources / static SET(_other_SOURCES + SalomeApp_Application_SL.cxx SalomeApp_Application.cxx SalomeApp_CheckFileDlg.cxx SalomeApp_DataModel.cxx @@ -226,9 +228,16 @@ SET(_py_SCRIPTS # --- rules --- -ADD_LIBRARY(SalomeApp ${SalomeApp_SOURCES}) -TARGET_LINK_LIBRARIES(SalomeApp ${_link_LIBRARIES}) -INSTALL(TARGETS SalomeApp EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) +ADD_LIBRARY(SalomeAppImpl ${SalomeApp_SOURCES}) +TARGET_LINK_LIBRARIES(SalomeAppImpl ${_link_LIBRARIES}) + +ADD_LIBRARY(SalomeApp SalomeApp_Application_Entry.cxx) +TARGET_LINK_LIBRARIES(SalomeApp SalomeAppImpl) + +ADD_LIBRARY(SalomeAppSL SalomeApp_Application_SL_Entry.cxx) +TARGET_LINK_LIBRARIES(SalomeAppSL SalomeAppImpl) + +INSTALL(TARGETS SalomeAppImpl SalomeApp SalomeAppSL EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${SalomeApp_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index bfb209efa..b02c12a7a 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -110,6 +110,8 @@ #include +std::unique_ptr SalomeApp_Application::_ns; + /*!Internal class that updates object browser item properties */ // temporary commented /*class SalomeApp_Updater : public OB_Updater @@ -173,18 +175,13 @@ namespace }; } -/*!Create new instance of SalomeApp_Application.*/ -extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication() -{ - return new SalomeApp_Application(); -} - /*!Constructor.*/ SalomeApp_Application::SalomeApp_Application() : LightApp_Application(), myIsCloseFromExit( false ), myToIgnoreMessages( false ) { + _ns.reset(new SALOME_NamingService(orb())); } /*!Destructor. @@ -1368,10 +1365,9 @@ _PTR(Study) SalomeApp_Application::getStudy() } /*!Create and return SALOME_NamingService.*/ -SALOME_NamingService* SalomeApp_Application::namingService() +SALOME_NamingService_Abstract *SalomeApp_Application::namingService() { - static SALOME_NamingService _ns(orb()); - return &_ns; + return _ns.get(); } /*!Create and return SALOME_LifeCycleCORBA.*/ diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index 5f4da65f0..165c6fb3b 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -44,6 +44,8 @@ #include +#include + class LightApp_Preferences; class SalomeApp_Study; #ifndef DISABLE_PYCONSOLE @@ -97,7 +99,7 @@ public: static CORBA::ORB_var orb(); static _PTR(Study) getStudy(); - static SALOME_NamingService* namingService(); + static SALOME_NamingService_Abstract* namingService(); static SALOME_LifeCycleCORBA* lcc(); SUIT_ViewManager* newViewManager(const QString&); @@ -210,6 +212,8 @@ signals: bool theIsStudySaved ); void notebookVarUpdated( QString theVarName ); void objectDoubleClicked( SUIT_DataObject* ); +protected: + static std::unique_ptr _ns; }; #ifdef WIN32 diff --git a/src/SalomeApp/SalomeApp_Application_Entry.cxx b/src/SalomeApp/SalomeApp_Application_Entry.cxx new file mode 100644 index 000000000..4af758f7c --- /dev/null +++ b/src/SalomeApp/SalomeApp_Application_Entry.cxx @@ -0,0 +1,26 @@ +// Copyright (C) 2021 CEA/DEN, EDF 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, or (at your option) any later version. +// +// 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 "SalomeApp_Application.h" + +/*!Create new instance of SalomeApp_Application.*/ +extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication() +{ + return new SalomeApp_Application; +} diff --git a/src/SalomeApp/SalomeApp_Application_SL.cxx b/src/SalomeApp/SalomeApp_Application_SL.cxx new file mode 100644 index 000000000..eebf34bdd --- /dev/null +++ b/src/SalomeApp/SalomeApp_Application_SL.cxx @@ -0,0 +1,27 @@ +// Copyright (C) 2021 CEA/DEN, EDF 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, or (at your option) any later version. +// +// 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 "SalomeApp_Application_SL.h" + +#include "SALOME_Fake_NamingService.hxx" + +SalomeApp_Application_SL::SalomeApp_Application_SL() +{ + _ns.reset( new SALOME_Fake_NamingService ); +} diff --git a/src/SalomeApp/SalomeApp_Application_SL.h b/src/SalomeApp/SalomeApp_Application_SL.h new file mode 100644 index 000000000..9d9b735ac --- /dev/null +++ b/src/SalomeApp/SalomeApp_Application_SL.h @@ -0,0 +1,28 @@ +// Copyright (C) 2021 CEA/DEN, EDF 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, or (at your option) any later version. +// +// 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 +// + +#pragma once + +#include "SalomeApp_Application.h" + +class SALOMEAPP_EXPORT SalomeApp_Application_SL : public SalomeApp_Application +{ +public: + SalomeApp_Application_SL(); +}; diff --git a/src/SalomeApp/SalomeApp_Application_SL_Entry.cxx b/src/SalomeApp/SalomeApp_Application_SL_Entry.cxx new file mode 100644 index 000000000..9094003cd --- /dev/null +++ b/src/SalomeApp/SalomeApp_Application_SL_Entry.cxx @@ -0,0 +1,26 @@ +// Copyright (C) 2021 CEA/DEN, EDF 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, or (at your option) any later version. +// +// 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 "SalomeApp_Application_SL.h" + +/*!Create new instance of SalomeApp_Application.*/ +extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication() +{ + return new SalomeApp_Application_SL; +} diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 1c2dbd3ed..b5d97f672 100644 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -722,7 +722,7 @@ int AbstractGUIApp::main(int argc, char **argv) // Load SalomeApp dynamic library MESSAGE("creation SUIT_Application"); - SUIT_Application *aGUIApp = aGUISession->startApplication("SalomeApp", 0, 0); + SUIT_Application *aGUIApp = aGUISession->startApplication(NamingServiceImplementation::LibName, 0, 0); if (aGUIApp) { #ifdef USE_SALOME_STYLE diff --git a/src/Session/Session_NS_wrapper.cxx b/src/Session/Session_NS_wrapper.cxx index 0b3c545ad..cbd4b5974 100644 --- a/src/Session/Session_NS_wrapper.cxx +++ b/src/Session/Session_NS_wrapper.cxx @@ -28,6 +28,9 @@ #include "Session_Promises.hxx" #include "utilities.h" +const char OldStyleNS::LibName[]="SalomeApp"; +const char NewStyleNS::LibName[]="SalomeAppSL"; + void CommonActivateSession(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex *GUIMutex, QWaitCondition *GUILauncher, SALOME_NamingService_Abstract *ns, int argc, char ** argv) { try { diff --git a/src/Session/Session_NS_wrapper.hxx b/src/Session/Session_NS_wrapper.hxx index 835814129..96c929b4e 100644 --- a/src/Session/Session_NS_wrapper.hxx +++ b/src/Session/Session_NS_wrapper.hxx @@ -43,6 +43,7 @@ public: static void activateSALOMEDS(CORBA::ORB_var orb, PortableServer::POA_var poa); static CORBA::Object_var forServerChecker(const char *NSName, int argc, char **argv); static CosNaming::NamingContext_var checkTrueNamingServiceIfExpected(int argc, char **argv, bool& forceOK); + static const char LibName[]; private: RealNS _NS; }; @@ -64,6 +65,7 @@ public: static void activateSALOMEDS(CORBA::ORB_var orb, PortableServer::POA_var poa); static CORBA::Object_var forServerChecker(const char *NSName, int argc, char **argv); static CosNaming::NamingContext_var checkTrueNamingServiceIfExpected(int argc, char **argv, bool& forceOK); + static const char LibName[]; private: RealNS _NS; };