From: vsr Date: Fri, 22 Jun 2007 14:14:36 +0000 (+0000) Subject: Porting to Qt 4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ea9d54d2c54ee72ef97529a16bd4d1059ca554fa;p=modules%2Fgui.git Porting to Qt 4 --- diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am b/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am index cf5e4c998..6d7757c58 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am @@ -22,25 +22,15 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -# Sip flags -SIP_FLAGS = -t WS_X11 -t $(QT_VERS) $(PYQT_SIPFLAGS) -s ".cc" -c . -I $(PYQT_SIPS) - ###################### # Library target lib_LTLIBRARIES= libSalomePyQtGUI.la - -# Sip sources -if IS_SIP_V4 SIP_SRC = sipSalomePyQtGUIcmodule.cc SIP_FILES = SALOME_PYQT_GUI.sip -else !IS_SIP_V4 -SIP_SRC = SalomePyQtGUIcmodule.cc -SIP_FILES = SALOME_PYQT_GUI.sip -endif -EXTRA_DIST+= $(SIP_FILES) +EXTRA_DIST += $(SIP_FILES) salomeinclude_HEADERS = \ SALOME_PYQT_GUI.h \ @@ -72,7 +62,7 @@ libSalomePyQtGUI_la_LIBADD= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) # Custom build step: generate C++ wrapping according to $(SIP_FILES) $(SIP_SRC): $(SIP_FILES) - $(SIP) $(SIP_FLAGS) $< + $(SIP) $(PYQT_SIPFLAGS) $< $(dist_libSalomePyQtGUI_la_SOURCES): $(SIP_SRC) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 048145b73..4d48c40e5 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -40,9 +40,6 @@ #include #include -#ifndef WIN32 -#include "SALOME_PYQT_SipDefs.h" -#endif #include "sipAPISalomePyQtGUI.h" #include "sipqtQWidget.h" @@ -116,17 +113,12 @@ private: // While the SalomePyQtGUI library is not imported in Python it's initialization function // should be called manually (and only once) in order to initialize global sip data // and to get C API from sip : sipBuildResult for example -#if defined(SIP_VERS_v4_old) || defined(SIP_VERS_v4_new) #define INIT_FUNCTION initSalomePyQtGUI #if defined(SIP_STATIC_MODULE) extern "C" void INIT_FUNCTION(); #else PyMODINIT_FUNC INIT_FUNCTION(); #endif -#else -#define INIT_FUNCTION initlibSalomePyQtGUIc -extern "C" void INIT_FUNCTION(); -#endif /*! * This function creates an instance of SALOME_PYQT_Module object by request diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_SipDefs.h.in b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_SipDefs.h.in deleted file mode 100644 index 2a427ce4c..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_SipDefs.h.in +++ /dev/null @@ -1 +0,0 @@ -#define SIP_VERS_@SIP_VERS@ diff --git a/src/SALOME_PYQT/SalomePyQt/Makefile.am b/src/SALOME_PYQT/SalomePyQt/Makefile.am index 50ee57d5c..1ae7eee2c 100644 --- a/src/SALOME_PYQT/SalomePyQt/Makefile.am +++ b/src/SALOME_PYQT/SalomePyQt/Makefile.am @@ -22,47 +22,19 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -# Sip flags -SIP_FLAGS = -t WS_X11 -t $(QT_VERS) $(PYQT_SIPFLAGS) -s ".cc" -c . -I $(PYQT_SIPS) - # Sip common sources -SIP_SRC = sipSalomePyQtSalomePyQt.cc \ - sipSalomePyQtSALOME_Selection.cc \ - sipSalomePyQtQtxAction.cc - -# Sip version-specific sources -if IS_SIP_V4 -SIP_SRC += sipSalomePyQtcmodule.cc -else !IS_SIP_V4 -SIP_SRC += SalomePyQtcmodule.cc -endif +SIP_SRC = sipSalomePyQtSalomePyQt.cc \ + sipSalomePyQtSALOME_Selection.cc \ + sipSalomePyQtQtxAction.cc \ + sipSalomePyQtcmodule.cc -# Sip/moc sources and Sip definition files -if IS_SIP_V4 -if IS_SIP_NEW -MOC_SRC = -MOC_H = -SIP_FILES = SalomePyQt_v4.sip -else !IS_SIP_NEW -MOC_SRC = sipSalomePyQtcmodule_moc.cxx -MOC_H = sipSalomePyQtcmodule.h -SIP_FILES = SalomePyQt_v4.sip -endif -else !IS_SIP_V4 +# Sip definition file SIP_FILES = SalomePyQt.sip -if IS_SIP_NEW -MOC_SRC = SalomePyQtcmodule_moc.cxx -MOC_H = SalomePyQtcmodule.h -else !IS_SIP_NEW -MOC_SRC = sipSalomePyQtProxySalomePyQt_moc.cxx -MOC_H = sipSalomePyQtProxySalomePyQt.h -endif -endif -EXTRA_DIST+= SalomePyQt.sip SalomePyQt_v4.sip +EXTRA_DIST += SalomePyQt.sip # Libraries targets -MOC_FILES= SalomePyQt_moc.cxx +MOC_FILES = SalomePyQt_moc.cxx COMMON_CPP_FLAGS=$(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \ $(CAS_CPPFLAGS) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) \ @@ -84,44 +56,16 @@ COMMON_LIBS=$(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) \ ../../VTKViewer/libVTKViewer.la ../../TOOLSGUI/libToolsGUI.la \ ../SALOME_PYQT_GUI/libSalomePyQtGUI.la -if IS_SIP_V4 - lib_LTLIBRARIES = libSalomePyQt.la dist_libSalomePyQt_la_SOURCES= SalomePyQt.cxx -nodist_libSalomePyQt_la_SOURCES= $(MOC_FILES) $(SIP_SRC) $(MOC_SRC) +nodist_libSalomePyQt_la_SOURCES= $(MOC_FILES) $(SIP_SRC) libSalomePyQt_la_CPPFLAGS = $(COMMON_CPP_FLAGS) libSalomePyQt_la_LIBADD = $(COMMON_LIBS) -else !IS_SIP_V4 - -lib_LTLIBRARIES = libSalomePyQtcmodule.la -dist_libSalomePyQtcmodule_la_SOURCES= SalomePyQt.cxx -nodist_libSalomePyQtcmodule_la_SOURCES= $(MOC_FILES) $(SIP_SRC) $(MOC_SRC) -libSalomePyQtcmodule_la_CPPFLAGS = $(MY_CPP_FLAGS) -libSalomePyQtcmodule_la_LIBADD = $(COMMON_LIBS) - -endif - -if IS_SIP_V4 -else -nodist_sharedpkgpython_PYTHON= SalomePyQt.py -endif - # Custom build step: generate C++ wrapping according to $(SIP_FILES) $(SIP_SRC): $(SIP_FILES) - $(SIP) $(SIP_FLAGS) $< - -$(MOC_H): $(SIP_FILES) - $(SIP) $(SIP_FLAGS) $< + $(SIP) $(PYQT_SIPFLAGS) $< -if IS_SIP_V4 install-exec-hook: $(libdir)/SalomePyQt.so $(libdir)/SalomePyQt.so: (cd $(libdir); ln -s libSalomePyQt.so SalomePyQt.so;) -else !IS_SIP_V4 -install-exec-hook: $(libdir)/SalomePyQtcmodule.so -$(libdir)/SalomePyQt.so: - (cd $(libdir); ln -sf libSalomePyQtcmodule.so SalomePyQt.so;) -endif - -$(SIP_SRC): $(MOC_SRC) diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip deleted file mode 100644 index c550e2409..000000000 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip +++ /dev/null @@ -1,171 +0,0 @@ -//============================================================================= -// File : SalomePyQt_v4.sip -// Created : 25/04/05 -// Author : Vadim SANDLER -// Project : SALOME -// Copyright : 2003-2005 CEA/DEN, EDF R&D -// $Header : $ -//============================================================================= - -%Module SalomePyQt - -%Import qtmod.sip - -class SALOME_Selection : QObject -{ -%TypeHeaderCode -#include -%End - -public: - void Clear() /ReleaseGIL/ ; - void ClearIObjects() /ReleaseGIL/ ; - void ClearFilters() /ReleaseGIL/ ; - -private: - SALOME_Selection( QObject* /TransferThis/ ); - -signals: - void currentSelectionChanged(); -}; - -enum MenuName { - File = 1, - View = 2, - Edit = 3, - Preferences = 4, - Tools = 5, - Window = 6, - Help = 7 -}; - -enum WindowType { - WT_ObjectBrowser, - WT_PyConsole, - WT_LogWindow, - WT_User -}; - -enum PrefType { - PT_Space, - PT_Bool, - PT_Color, - PT_String, - PT_Selector, - PT_DblSpin, - PT_IntSpin, - PT_Double, - PT_Integer, - PT_GroupBox, - PT_Font, - PT_DirList, - PT_File, - PT_User -}; - -class QtxAction : QAction -{ -%TypeHeaderCode -#include -%End - -private: - QtxAction(const QtxAction &); -}; - -class SalomePyQt -{ -%TypeHeaderCode -#include -%End - -public: - static QWidget* getDesktop() /ReleaseGIL/ ; - static QWidget* getMainFrame() /ReleaseGIL/ ; - static QMenuBar* getMainMenuBar() /ReleaseGIL/ ; - static QPopupMenu* getPopupMenu( const MenuName ) /ReleaseGIL/ ; - static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ; - static int getStudyId() /ReleaseGIL/ ; - static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ; - static const QString getActiveComponent() /ReleaseGIL/ ; - static void updateObjBrowser( const int = 0, bool = true ) /ReleaseGIL/ ; - - static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ; - static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ; - static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ; - - static void helpContext( const QString&, const QString& ) /ReleaseGIL/ ; - - static bool dumpView( const QString& ) /ReleaseGIL/ ; - - static int defaultMenuGroup() /ReleaseGIL/ ; - - static int createTool( const QString& ) /ReleaseGIL/ ; - static int createTool( const int, const int, const int = -1 ) /ReleaseGIL/ ; - static int createTool( const int, const QString&, const int = -1 ) /ReleaseGIL/ ; - static int createTool( QtxAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ; - - static int createMenu( const QString&, const int, - const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( const QString&, const QString&, - const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( const int, const int, - const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( const int, const QString&, - const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( QtxAction*, const int, const int = -1, - const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( QtxAction*, const QString&, const int = -1, - const int = -1, const int = -1 ) /ReleaseGIL/ ; - static QtxAction* createSeparator() /ReleaseGIL/ ; - - static QtxAction* createAction( const int, const QString&, - const QString& = QString::null, const QString& = QString::null, - const QString& = QString::null, const int = 0, const bool = false ) /ReleaseGIL/ ; - - static QtxAction* action( const int ) /ReleaseGIL/ ; - static int actionId( const QtxAction* ) /ReleaseGIL/ ; - - static bool clearMenu( const int = 0, const int = 0, - const bool = true ) /ReleaseGIL/ ; - - static void addSetting ( const QString&, const QString&, const double ) /ReleaseGIL/ ; - static void addSetting ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ; - static void addSetting ( const QString&, const QString&, const bool, const int ) /ReleaseGIL/ ; - static void addSetting ( const QString&, const QString&, const QString& ) /ReleaseGIL/ ; - static void addSetting ( const QString&, const QString&, const QColor& ) /ReleaseGIL/ ; - static int integerSetting( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ; - static double doubleSetting ( const QString&, const QString&, const double = 0 ) /ReleaseGIL/ ; - static bool boolSetting ( const QString&, const QString&, const bool = false ) /ReleaseGIL/ ; - static QString stringSetting ( const QString&, const QString&, const QString& = QString("") ) /ReleaseGIL/ ; - static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ) /ReleaseGIL/ ; - static void removeSetting ( const QString&, const QString& ) /ReleaseGIL/ ; - static bool hasSetting ( const QString&, const QString& ) /ReleaseGIL/ ; - -// obsolete - static void addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ; - static void addIntSetting ( const QString&, const int, bool = true ) /ReleaseGIL/ ; - static void addDoubleSetting( const QString&, const double, bool = true ) /ReleaseGIL/ ; - static void addBoolSetting ( const QString&, const bool, bool = true ) /ReleaseGIL/ ; - static void removeSettings ( const QString& ) /ReleaseGIL/ ; - static QString getSetting ( const QString& ) /ReleaseGIL/ ; - - static int addGlobalPreference( const QString& ) /ReleaseGIL/ ; - static int addPreference( const QString& ) /ReleaseGIL/ ; - static int addPreference( const QString&, - const int, const int = -1, - const QString& = QString::null, - const QString& = QString::null ) /ReleaseGIL/ ; - static QVariant preferenceProperty( const int, const QString& ) /ReleaseGIL/ ; - static void setPreferenceProperty( const int, - const QString&, - const QVariant& ) /ReleaseGIL/ ; - static void addPreferenceProperty( const int, - const QString&, - const int, - const QVariant& ) /ReleaseGIL/ ; - - static void message( const QString&, bool = true ) /ReleaseGIL/ ; - static void clearMessages() /ReleaseGIL/ ; -};