From: mkr Date: Tue, 19 Jun 2007 11:15:41 +0000 (+0000) Subject: Porting to Qt4. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a27dd7f298732b6d296b9f895ce7f6613db31d59;p=modules%2Fgui.git Porting to Qt4. --- diff --git a/src/LightApp/LightApp.pro b/src/LightApp/LightApp.pro new file mode 100644 index 000000000..2e7d75a87 --- /dev/null +++ b/src/LightApp/LightApp.pro @@ -0,0 +1,233 @@ +TEMPLATE = lib +TARGET = LightApp +DESTDIR = ../../lib +MOC_DIR = ../../moc +OBJECTS_DIR = ../../obj/$$TARGET + +PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 + +QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml + +CASROOT = $$(CASROOT) +CAS_CPPFLAGS = $${CASROOT}/inc + +HDF5_INCLUDES = $$(HDF5HOME)/include + +KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome + +VTK_INCLUDES = $$(VTKHOME)/include/vtk + +QWT_INCLUDES = $$(QWTHOME)/include + +PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 + +INCLUDEPATH += $${PYTHON_INCLUDES} $${QT_INCLUDES} $${CAS_CPPFLAGS} $${HDF5_INCLUDES} $${KERNEL_CXXFLAGS} ../SUIT ../STD ../CAM ../LogWindow ../Prs ../Qtx ../Event #../ObjBrowser + +#if ENABLE_VTKVIEWER + INCLUDEPATH += $${VTK_INCLUDES} ../VTKViewer +#else +# DEFINES += DISABLE_VTKVIEWER +#endif + +#if ENABLE_PLOT2DVIEWER + INCLUDEPATH += $${QWT_INCLUDES} ../Plot2d +#else +# DEFINES += DISABLE_PLOT2DVIEWER +#endif + +#if ENABLE_OCCVIEWER + INCLUDEPATH += ../OCCViewer +#else !ENABLE_OCCVIEWER +# DEFINES += DISABLE_OCCVIEWER +#endif + +#if ENABLE_PYCONSOLE + INCLUDEPATH += $${PYTHON_INCLUDES} ../PyConsole ../PyInterp +#else !ENABLE_PYCONSOLE +# DEFINES += DISABLE_PYCONSOLE +#endif + +#if ENABLE_GLVIEWER + INCLUDEPATH += ../GLViewer +#else !ENABLE_GLVIEWER +# DEFINES += DISABLE_GLVIEWER +#endif + +#if ENABLE_SUPERVGRAPHVIEWER +# INCLUDEPATH += ../SUPERVGraph +#else !ENABLE_SUPERVGRAPHVIEWER +# DEFINES += DISABLE_SUPERVGRAPHVIEWER +#endif + +#if ENABLE_SALOMEOBJECT + + INCLUDEPATH += ../OBJECT +#if ENABLE_PLOT2DVIEWER + INCLUDEPATH += ../SPlot2d +#endif + +#if ENABLE_OCCVIEWER + INCLUDEPATH += ../SOCC +#endif + +#if ENABLE_VTKVIEWER + INCLUDEPATH += ../SVTK +#endif + +#else !ENABLE_SALOMEOBJECT +# DEFINES += DISABLE_SALOMEOBJECT + +#endif + +QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL + +CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel + +HDF5_LIBS = -L$$(HDF5HOME)/lib -lhdf5 + +KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome + +PYTHON_LIBS = -L$$(PYTHONHOME)/lib/python2.4/config -lpython2.4 -ldl -lutil + +LIBS += $${QT_MT_LIBS} -L../../lib -lsuit -lstd -lCAM -lLogWindow $${CAS_KERNEL} -lSalomePrs $${HDF5_LIBS} $${KERNEL_LDFLAGS} -lSalomeHDFPersist #-lObjBrowser + +#if ENABLE_PYCONSOLE + LIBS += $${PYTHON_LIBS} +#endif + +#if ENABLE_SALOMEOBJECT + LIBS += -lSalomeObject +#endif + +#if ENABLE_VTKVIEWER + LIBS += -lVTKViewer +#if ENABLE_SALOMEOBJECT + LIBS += -lSVTK +#endif +#endif + +#if ENABLE_OCCVIEWER + LIBS += -lOCCViewer +#if ENABLE_SALOMEOBJECT + LIBS += -lSOCC +#endif +#endif + +#if ENABLE_GLVIEWER + LIBS += -lGLViewer +#endif + +#if ENABLE_PLOT2DVIEWER + LIBS += -lPlot2d +#if ENABLE_SALOMEOBJECT + LIBS += -lSPlot2d +#endif +#endif + +#if ENABLE_PYCONSOLE + LIBS += -lPyInterp -lPyConsole +#endif + +#if ENABLE_SUPERVGRAPHVIEWER +# LIBS += -lSUPERVGraph +#endif + +CONFIG -= debug release debug_and_release +CONFIG += qt thread debug dll shared + +win32:DEFINES += WIN32 +DEFINES += LIGHTAPP_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS + +HEADERS = LightApp.h +HEADERS += LightApp_AboutDlg.h +HEADERS += LightApp_Application.h +HEADERS += LightApp_DataModel.h +HEADERS += LightApp_DataObject.h +HEADERS += LightApp_DataOwner.h +HEADERS += LightApp_DataSubOwner.h +HEADERS += LightApp_Dialog.h +HEADERS += LightApp_Displayer.h +HEADERS += LightApp_Driver.h +HEADERS += LightApp_EventFilter.h +HEADERS += LightApp_HDFDriver.h +HEADERS += LightApp_Module.h +HEADERS += LightApp_ModuleAction.h +HEADERS += LightApp_ModuleDlg.h +HEADERS += LightApp_NameDlg.h +#HEADERS += LightApp_OBFilter.h +HEADERS += LightApp_OBSelector.h +HEADERS += LightApp_Operation.h +HEADERS += LightApp_Selection.h +HEADERS += LightApp_SelectionMgr.h +HEADERS += LightApp_ShowHideOp.h +HEADERS += LightApp_Study.h +HEADERS += LightApp_SwitchOp.h +HEADERS += LightApp_Preferences.h +HEADERS += LightApp_PreferencesDlg.h +HEADERS += LightApp_RootObject.h +HEADERS += LightApp_UpdateFlags.h +HEADERS += LightApp_WidgetContainer.h + +#if ENABLE_VTKVIEWER +#if ENABLE_SALOMEOBJECT + HEADERS += LightApp_VTKSelector.h +#endif +#endif +#if ENABLE_OCCVIEWER + HEADERS += LightApp_OCCSelector.h +#endif +#if ENABLE_GLVIEWER + HEADERS += LightApp_GLSelector.h +#endif + +SOURCES = LightApp_AboutDlg.cxx +SOURCES += LightApp_Application.cxx +SOURCES += LightApp_DataModel.cxx +SOURCES += LightApp_DataObject.cxx +SOURCES += LightApp_DataOwner.cxx +SOURCES += LightApp_DataSubOwner.cxx +SOURCES += LightApp_Dialog.cxx +SOURCES += LightApp_Displayer.cxx +SOURCES += LightApp_Driver.cxx +SOURCES += LightApp_EventFilter.cxx +SOURCES += LightApp_HDFDriver.cxx +SOURCES += LightApp_Module.cxx +SOURCES += LightApp_ModuleAction.cxx +SOURCES += LightApp_ModuleDlg.cxx +SOURCES += LightApp_NameDlg.cxx +#SOURCES += LightApp_OBFilter.cxx +SOURCES += LightApp_OBSelector.cxx +SOURCES += LightApp_Operation.cxx +SOURCES += LightApp_Selection.cxx +SOURCES += LightApp_SelectionMgr.cxx +SOURCES += LightApp_ShowHideOp.cxx +SOURCES += LightApp_Study.cxx +SOURCES += LightApp_SwitchOp.cxx +SOURCES += LightApp_Preferences.cxx +SOURCES += LightApp_PreferencesDlg.cxx +SOURCES += LightApp_WidgetContainer.cxx + +#if ENABLE_VTKVIEWER +#if ENABLE_SALOMEOBJECT + SOURCES += LightApp_VTKSelector.cxx +#endif +#endif +#if ENABLE_OCCVIEWER + SOURCES += LightApp_OCCSelector.cxx +#endif +#if ENABLE_GLVIEWER + SOURCES += LightApp_GLSelector.cxx +#endif + +TRANSLATIONS = resources/LightApp_images.ts \ + resources/LightApp_msg_en.ts + +ICONS = resources/*.png + +includes.files = $$HEADERS +includes.path = ../../include + +resources.files = $$ICONS resources/*.qm +resources.path = ../../resources + +INSTALLS += includes resources diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index d0558c041..0cf3629c8 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -35,8 +35,10 @@ #include "LightApp_PreferencesDlg.h" #include "LightApp_ModuleDlg.h" #include "LightApp_AboutDlg.h" +#include "LightApp_ModuleAction.h" -#include "LightApp_OBFilter.h" +// temporary commented +//#include "LightApp_OBFilter.h" #include "LightApp_EventFilter.h" @@ -539,34 +541,13 @@ void LightApp_Application::createActions() if( modList.count()>1 ) { - QToolBar* modTBar = new QtxToolBar( true, desk ); - modTBar->setObjectName( "ModuleToolBar" ); - modTBar->setWindowTitle( tr( "INF_TOOLBAR_MODULES" ) ); - - QActionGroup* modGroup = new QActionGroup( this ); - modGroup->setExclusive( true ); - //modGroup->setUsesDropDown( true ); // to use a new class for this purpose - - a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ), - tr( "PRP_APP_MODULE" ), 0, desk, true ); - modGroup->addAction( a ); - myActions.insert( QString(), a ); + myModuleAction = new LightApp_ModuleAction( tr( "APP_NAME" ), defIcon, desk ); QMap iconMap; moduleIconNames( iconMap ); const int iconSize = 20; - modTBar->addActions(modGroup->actions()); - QList l = modTBar->findChildren(); - QListIterator oit( l ); - while ( oit.hasNext() ) { - QComboBox* cb = oit.next(); - if ( cb ) cb->setFocusPolicy( Qt::NoFocus ); - } - - modTBar->addSeparator(); - for ( it = modList.begin(); it != modList.end(); ++it ) { if ( !isLibExists( *it ) ) @@ -588,16 +569,11 @@ void LightApp_Application::createActions() } icon.fromImage( icon.toImage().scaled( iconSize, iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); - - QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true ); - modTBar->addAction( a ); - modGroup->addAction( a ); - - myActions.insert( *it, a ); + + myModuleAction->insertModule( *it, icon ); } - SUIT_Tools::simplifySeparators( modTBar ); - connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) ); + connect( myModuleAction, SIGNAL( moduleActivated( const QString& ) ), this, SLOT( onModuleActivation( const QString& ) ) ); } // New window @@ -636,15 +612,8 @@ void LightApp_Application::createActions() } /*!On module activation action.*/ -void LightApp_Application::onModuleActivation( QAction* a ) +void LightApp_Application::onModuleActivation( const QString& modName ) { - if ( !a ) - return; - - QString modName = a->text(); - if ( modName == tr( "APP_NAME" ) ) - modName = QString::null; - // Force user to create/open a study before module activation QMap iconMap; moduleIconNames( iconMap ); @@ -670,7 +639,7 @@ void LightApp_Application::onModuleActivation( QAction* a ) case 0: default: putInfo( tr("INF_CANCELLED") ); - myActions[QString()]->setChecked( true ); + myModuleAction->setActiveModule( QString() ); cancelled = true; } } @@ -1202,8 +1171,9 @@ bool LightApp_Application::isWindowVisible( const int type ) const bool res = false; if ( myWindows.contains( type ) ) { - SUIT_Desktop* desk = ((LightApp_Application*)this)->desktop(); + //SUIT_Desktop* desk = ((LightApp_Application*)this)->desktop(); //res = desk && desk->appropriate( myWindows[type] ); + res = myWindows[type]->isVisible(); } return res; } @@ -2129,8 +2099,7 @@ void LightApp_Application::updateModuleActions() if ( activeModule() ) modName = activeModule()->moduleName(); - if ( myActions.contains( modName ) ) - myActions[modName]->setChecked( true ); + myModuleAction->setActiveModule( modName ); } /*! diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index e357f0580..085142010 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -41,6 +41,7 @@ class LightApp_WidgetContainer; class LightApp_Preferences; class LightApp_SelectionMgr; class LightApp_DataObject; +class LightApp_ModuleAction; class SUIT_Study; class SUIT_Accel; class CAM_Module; @@ -200,7 +201,7 @@ protected slots: virtual void onDesktopActivated(); void onNewWindow(); - void onModuleActivation( QAction* ); + void onModuleActivation( const QString& ); void onCloseView( SUIT_ViewManager* ); void onStudyCreated( SUIT_Study* ); @@ -238,14 +239,13 @@ protected: bool isLibExists( const QString& ) const; protected: - typedef QMap ActionMap; typedef QMap WindowMap; typedef QMap WindowVisibilityMap; protected: LightApp_Preferences* myPrefs; LightApp_SelectionMgr* mySelMgr; - ActionMap myActions; + LightApp_ModuleAction* myModuleAction; WindowMap myWindows; WindowVisibilityMap myWindowsVisible; diff --git a/src/LightApp/Makefile.am b/src/LightApp/Makefile.am index 756247679..6c69a32e6 100755 --- a/src/LightApp/Makefile.am +++ b/src/LightApp/Makefile.am @@ -39,6 +39,7 @@ salomeinclude_HEADERS= \ LightApp_EventFilter.h \ LightApp_HDFDriver.h \ LightApp_Module.h \ + LightApp_ModuleAction.h \ LightApp_ModuleDlg.h \ LightApp_NameDlg.h \ LightApp_OBFilter.h \ @@ -80,6 +81,7 @@ dist_libLightApp_la_SOURCES= \ LightApp_EventFilter.cxx \ LightApp_HDFDriver.cxx \ LightApp_Module.cxx \ + LightApp_ModuleAction.cxx \ LightApp_ModuleDlg.cxx \ LightApp_NameDlg.cxx \ LightApp_OBFilter.cxx \ @@ -114,6 +116,7 @@ MOC_FILES= \ LightApp_OBSelector_moc.cxx \ LightApp_Operation_moc.cxx \ LightApp_Module_moc.cxx \ + LightApp_ModuleAction_moc.cxx \ LightApp_ModuleDlg_moc.cxx \ LightApp_NameDlg_moc.cxx \ LightApp_SelectionMgr_moc.cxx \