]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Porting to Qt4
authorvsr <vsr@opencascade.com>
Mon, 14 May 2007 11:50:32 +0000 (11:50 +0000)
committervsr <vsr@opencascade.com>
Mon, 14 May 2007 11:50:32 +0000 (11:50 +0000)
src/SUIT/Makefile.am
src/SUIT/SUIT.h
src/SUIT/SUIT.pro [new file with mode: 0644]
src/SUIT/SUIT_Accel.cxx
src/SUIT/SUIT_Accel.h
src/SUIT/SUIT_ActionOperation.cxx
src/SUIT/SUIT_ActionOperation.h

index a87d39fae4ece68b9c4f4216076279d5993fb63c..f9181622624ac5b2d6a741ff0dee0f189baf6061 100755 (executable)
@@ -25,94 +25,103 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 lib_LTLIBRARIES = libsuit.la
 
-salomeinclude_HEADERS= \
-       SUIT.h \
-       SUIT_ActionOperation.h \
-       SUIT_Application.h \
-       SUIT_Convertor.h \
-       SUIT_DataObject.h \
-       SUIT_DataObjectIterator.h \
-       SUIT_DataObjectKey.h \
-       SUIT_DataOwner.h \
-       SUIT_Desktop.h \
-       SUIT_ExceptionHandler.h \
-       SUIT_FileDlg.h \
-       SUIT_FileValidator.h \
-       SUIT_MessageBox.h \
-       SUIT_Operation.h \
-       SUIT_OverrideCursor.h \
-       SUIT_ParserSettings.h \
-       SUIT_PopupClient.h \
-       SUIT_ResourceMgr.h \
-       SUIT_SelectionMgr.h \
-       SUIT_Selector.h \
-       SUIT_Session.h \
-       SUIT_SmartPtr.h \
-       SUIT_Study.h \
-       SUIT_ToolButton.h \
-       SUIT_Tools.h \
-       SUIT_ViewManager.h \
-       SUIT_ViewModel.h \
-       SUIT_ViewWindow.h \
-       SUIT_SelectionFilter.h \
-       SUIT_Accel.h \
-       SUIT_TreeSync.h
+#VSR: already migrated to Qt4 files
+salomeinclude_HEADERS=                 \
+       SUIT.h                          \
+       SUIT_Accel.h                    \
+       SUIT_ActionOperation.h          \
+       SUIT_Application.h              \
+       SUIT_DataObject.h               \
+       SUIT_DataObjectIterator.h       \
+       SUIT_DataObjectKey.h            \
+       SUIT_DataOwner.h                \
+       SUIT_Desktop.h                  \
+       SUIT_ExceptionHandler.h         \
+       SUIT_FileDlg.h                  \
+       SUIT_FileValidator.h            \
+       SUIT_MessageBox.h               \
+       SUIT_Operation.h                \
+       SUIT_OverrideCursor.h           \
+       SUIT_PopupClient.h              \
+       SUIT_ResourceMgr.h              \
+       SUIT_SelectionFilter.h          \
+       SUIT_SelectionMgr.h             \
+       SUIT_Selector.h                 \
+       SUIT_Session.h                  \
+       SUIT_SmartPtr.h                 \
+       SUIT_Study.h                    \
+       SUIT_ToolButton.h               \
+       SUIT_Tools.h                    \
+       SUIT_TreeSync.h                 \
+       SUIT_ViewManager.h              \
+       SUIT_ViewModel.h                \
+       SUIT_ViewWindow.h
 
-dist_libsuit_la_SOURCES= \
-       SUIT_ActionOperation.cxx \
-       SUIT_Application.cxx \
-       SUIT_DataObject.cxx \
-       SUIT_DataObjectIterator.cxx \
-       SUIT_DataObjectKey.cxx \
-       SUIT_DataOwner.cxx \
-       SUIT_Desktop.cxx \
-       SUIT_ExceptionHandler.cxx \
-       SUIT_FileDlg.cxx \
-       SUIT_FileValidator.cxx \
-       SUIT_MessageBox.cxx \
-       SUIT_Operation.cxx \
-       SUIT_OverrideCursor.cxx \
-       SUIT_ParserSettings.cxx \
-       SUIT_PopupClient.cxx \
-       SUIT_ResourceMgr.cxx \
-       SUIT_SelectionMgr.cxx \
-       SUIT_Selector.cxx \
-       SUIT_Session.cxx \
-       SUIT_Study.cxx \
-       SUIT_ToolButton.cxx \
-       SUIT_Tools.cxx \
-       SUIT_ViewManager.cxx \
-       SUIT_ViewModel.cxx \
-       SUIT_ViewWindow.cxx \
-       SUIT_SelectionFilter.cxx \
-       SUIT_Accel.cxx
+#VSR: not yet migrated to Qt4 files
+#                                      \
+       SUIT_Convertor.h                \
+       SUIT_ParserSettings.h
+
+#VSR: already migrated to Qt4 files
+dist_libsuit_la_SOURCES=               \
+       SUIT_Accel.cxx                  \
+       SUIT_ActionOperation.cxx        \
+       SUIT_Application.cxx            \
+       SUIT_DataObject.cxx             \
+       SUIT_DataObjectIterator.cxx     \
+       SUIT_DataObjectKey.cxx          \
+       SUIT_DataOwner.cxx              \
+       SUIT_Desktop.cxx                \
+       SUIT_ExceptionHandler.cxx       \
+       SUIT_FileDlg.cxx                \
+       SUIT_FileValidator.cxx          \
+       SUIT_MessageBox.cxx             \
+       SUIT_Operation.cxx              \
+       SUIT_OverrideCursor.cxx         \
+       SUIT_PopupClient.cxx            \
+       SUIT_ResourceMgr.cxx            \
+       SUIT_SelectionFilter.cxx        \
+       SUIT_SelectionMgr.cxx           \
+       SUIT_Selector.cxx               \
+       SUIT_Session.cxx                \
+       SUIT_Study.cxx                  \
+       SUIT_ToolButton.cxx             \
+       SUIT_Tools.cxx                  \
+       SUIT_ViewManager.cxx            \
+       SUIT_ViewModel.cxx              \
+       SUIT_ViewWindow.cxx
+
+#VSR: not yet migrated to Qt4 files
+#                                      \
+       SUIT_ParserSettings.cxx 
+
+MOC_FILES=                             \
+       SUIT_Accel_moc.cxx              \
+       SUIT_ActionOperation_moc.cxx    \
+       SUIT_Application_moc.cxx        \
+       SUIT_DataObject_moc.cxx         \
+       SUIT_Desktop_moc.cxx            \
+       SUIT_FileDlg_moc.cxx            \
+       SUIT_Operation_moc.cxx          \
+       SUIT_PopupClient_moc.cxx        \
+       SUIT_SelectionMgr_moc.cxx       \
+       SUIT_Selector_moc.cxx           \
+       SUIT_Session_moc.cxx            \
+       SUIT_Study_moc.cxx              \
+       SUIT_ToolButton_moc.cxx         \
+       SUIT_ViewManager_moc.cxx        \
+       SUIT_ViewModel_moc.cxx          \
+       SUIT_ViewWindow_moc.cxx
 
-MOC_FILES= \
-       SUIT_ActionOperation_moc.cxx \
-       SUIT_Application_moc.cxx \
-       SUIT_DataObject_moc.cxx \
-       SUIT_Desktop_moc.cxx \
-       SUIT_FileDlg_moc.cxx \
-       SUIT_Operation_moc.cxx \
-       SUIT_PopupClient_moc.cxx \
-       SUIT_Session_moc.cxx \
-       SUIT_Study_moc.cxx \
-       SUIT_ToolButton_moc.cxx \
-       SUIT_ViewModel_moc.cxx \
-       SUIT_ViewWindow_moc.cxx \
-       SUIT_ViewManager_moc.cxx \
-       SUIT_SelectionMgr_moc.cxx \
-       SUIT_Selector_moc.cxx \
-       SUIT_Accel_moc.cxx
 nodist_libsuit_la_SOURCES=$(MOC_FILES)
 
-dist_salomeres_DATA = \
-       resources/cascade.png \
-       resources/htile.png \
+dist_salomeres_DATA =                  \
+       resources/cascade.png           \
+       resources/htile.png             \
        resources/vtile.png
 
-nodist_salomeres_DATA = \
-       SUIT_images.qm \
+nodist_salomeres_DATA =                        \
+       SUIT_images.qm                  \
        SUIT_msg_en.qm
 
 libsuit_la_CPPFLAGS=$(QT_INCLUDES) -I$(srcdir)/../Qtx
index 82940286ad934effc76e4d8aa5a8b7de6a85d692..151fba4d1796ccaa854b4719a71633845464dbad 100755 (executable)
 #define SUIT_H
 
 #if defined SUIT_EXPORTS
-#if defined WNT
+#if defined WIN32
 #define SUIT_EXPORT __declspec( dllexport )
 #else
 #define SUIT_EXPORT
 #endif
 #else
-#if defined WNT
+#if defined WIN32
 #define SUIT_EXPORT __declspec( dllimport )
 #else
 #define SUIT_EXPORT
@@ -39,7 +39,7 @@
 #define true  1
 #endif
 
-#if defined WNT
+#if defined WIN32
 #pragma warning ( disable: 4251 )
 #endif
 
diff --git a/src/SUIT/SUIT.pro b/src/SUIT/SUIT.pro
new file mode 100644 (file)
index 0000000..34eb8aa
--- /dev/null
@@ -0,0 +1,87 @@
+TEMPLATE = lib
+TARGET = suit
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+INCLUDEPATH += ../../include ../Qtx
+LIBS += -L../../lib -lqtx
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += SUIT_EXPORTS
+
+HEADERS  = SUIT.h
+HEADERS += SUIT_Accel.h
+HEADERS += SUIT_ActionOperation.h
+HEADERS += SUIT_Application.h
+HEADERS += SUIT_DataObject.h
+HEADERS += SUIT_DataObjectIterator.h
+HEADERS += SUIT_DataObjectKey.h
+HEADERS += SUIT_DataOwner.h
+HEADERS += SUIT_Desktop.h
+HEADERS += SUIT_ExceptionHandler.h
+HEADERS += SUIT_FileDlg.h
+HEADERS += SUIT_FileValidator.h
+HEADERS += SUIT_MessageBox.h
+HEADERS += SUIT_Operation.h
+HEADERS += SUIT_OverrideCursor.h
+HEADERS += SUIT_PopupClient.h
+HEADERS += SUIT_ResourceMgr.h
+HEADERS += SUIT_SelectionFilter.h
+HEADERS += SUIT_SelectionMgr.h
+HEADERS += SUIT_Selector.h
+HEADERS += SUIT_Session.h
+HEADERS += SUIT_SmartPtr.h
+HEADERS += SUIT_Study.h
+HEADERS += SUIT_ToolButton.h
+HEADERS += SUIT_Tools.h
+HEADERS += SUIT_TreeSync.h
+HEADERS += SUIT_ViewManager.h
+HEADERS += SUIT_ViewModel.h
+HEADERS += SUIT_ViewWindow.h
+#HEADERS += SUIT_Convertor.h
+#HEADERS += SUIT_ParserSettings.h
+
+SOURCES  = SUIT_Accel.cxx
+SOURCES += SUIT_ActionOperation.cxx
+SOURCES += SUIT_Application.cxx
+SOURCES += SUIT_DataObject.cxx
+SOURCES += SUIT_DataObjectIterator.cxx
+SOURCES += SUIT_DataObjectKey.cxx
+SOURCES += SUIT_DataOwner.cxx
+SOURCES += SUIT_Desktop.cxx
+SOURCES += SUIT_ExceptionHandler.cxx
+SOURCES += SUIT_FileDlg.cxx
+SOURCES += SUIT_FileValidator.cxx
+SOURCES += SUIT_MessageBox.cxx
+SOURCES += SUIT_Operation.cxx
+SOURCES += SUIT_OverrideCursor.cxx
+SOURCES += SUIT_PopupClient.cxx
+SOURCES += SUIT_ResourceMgr.cxx
+SOURCES += SUIT_SelectionFilter.cxx
+SOURCES += SUIT_SelectionMgr.cxx
+SOURCES += SUIT_Selector.cxx
+SOURCES += SUIT_Session.cxx
+SOURCES += SUIT_Study.cxx
+SOURCES += SUIT_ToolButton.cxx
+SOURCES += SUIT_Tools.cxx
+SOURCES += SUIT_ViewManager.cxx
+SOURCES += SUIT_ViewModel.cxx
+SOURCES += SUIT_ViewWindow.cxx
+#SOURCES += SUIT_ParserSettings.cxx
+
+TRANSLATIONS = resources/SUIT_images.ts \
+               resources/SUIT_msg_en.ts
+
+ICONS   = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.qm
+resources.path = ../../resources
+
+INSTALLS += includes resources
index 7bc7b5167d5a6865851fd0ba03efe82c1228df94..28dd85e9ebb65f47b5b2823dffbdb58ed6c8dc9d 100644 (file)
 // SUIT_Accel.cxx: implementation of the SUIT_Accel class.
 
 #include "SUIT_Accel.h"
+
 #include "SUIT_ViewWindow.h"
 #include "SUIT_ViewManager.h"
 #include "SUIT_ViewModel.h"
 
-#include <qobjectlist.h>
-#include <qapplication.h>
-#include <qnamespace.h>
+#include <QCoreApplication>
+#include <QEvent>
+#include <QKeyEvent>
 
+/*!
+  \class SUIT_Accel
+  \brief Manager of keyboard accelerator bindings.
+*/
 
 SUIT_Accel* SUIT_Accel::myself = 0;
 
 /*! Constructor [private].*/
 SUIT_Accel::SUIT_Accel()
-  : QObject( qApp, "SUIT_Accel" )
+: QObject( QCoreApplication::instance() )
 {
-  qApp->installEventFilter( this );
+  QCoreApplication::instance()->installEventFilter( this );
 }
 
 /*! getAccel() : public interface for SUIT_Accel object.  Only one instance is created and returned. */
@@ -61,10 +66,12 @@ void SUIT_Accel::setActionKey( const int action, const int key, const QString& t
 /*! unsetActionKey() : unregister a certain key accelerator */
 void SUIT_Accel::unsetActionKey( const int key, const QString& type )
 {
-  if ( myMap.contains( type ) ) {
+  if ( myMap.contains( type ) )
+  {
     IdActionMap idActionMap = myMap[type];
-    if ( idActionMap.contains( key ) ) {
-      idActionMap.erase( key );
+    if ( idActionMap.contains( key ) )
+    {
+      idActionMap.remove( key );
       myMap[type] = idActionMap;
     }
   }
@@ -73,7 +80,8 @@ void SUIT_Accel::unsetActionKey( const int key, const QString& type )
 /*! getParentViewWindow() : returns given object or any of its parents-grandparents-.. if it is a SUIT_ViewWindow */ 
 SUIT_ViewWindow* getParentViewWindow( const QObject* obj )
 {
-  if ( obj ) {
+  if ( obj )
+  {
     if ( obj->inherits( "SUIT_ViewWindow" ) )
       return (SUIT_ViewWindow*)obj;
     else
@@ -83,22 +91,25 @@ SUIT_ViewWindow* getParentViewWindow( const QObject* obj )
 }
 
 /*! getKey() : returns integer key code (with modifiers) made of key pressed 'inside' given event */
-int getKey( QKeyEvent *keyEvent )
+int getKey( QKeyEventkeyEvent )
 {
-  int key = keyEvent->key(), 
-    state = keyEvent->state();
-  if ( state & Qt::ShiftButton )   
+  int key = keyEvent->key(), state = keyEvent->modifiers();
+  if ( state & Qt::ShiftModifier )   
     key += Qt::SHIFT;
-  if ( state & Qt::ControlButton ) 
+  if ( state & Qt::ControlModifier )
     key += Qt::CTRL;
-  if ( state & Qt::AltButton )     
+  if ( state & Qt::AltModifier )
     key += Qt::ALT;
-  if ( state & Qt::MetaButton )    
+  if ( state & Qt::MetaModifier )
     key += Qt::META;
   return key;
 }
 
-/*! getAccelKey() : returns key pressed if 1) event was KeyPress 2) pressed key is a registered accelerator */ 
+/*! 
+  Returns key pressed if 
+  -# event was KeyPress 
+  -# pressed key is a registered accelerator
+*/
 int SUIT_Accel::getAccelKey( QEvent *event )
 {
   if ( event && event->type() == QEvent::KeyPress ) {
index fdc9cd384c97bc4055bdb29243d26817ef395845..ed7dd4671b955e5d2a0e4a8d895c69d37ed5776e 100644 (file)
 //
 // SUIT_Accel.h: interface for the SUIT_Accel class.
 
-#ifndef SUIT_Accel_h 
-#define SUIT_Accel_h
+#ifndef SUIT_ACELL_H
+#define SUIT_ACELL_H
 
 #include "SUIT.h"
 
-#include <qobject.h>
-#include <qstring.h>
-#include <qmap.h>
+#include <QMap>
+#include <QObject>
+#include <QString>
 
-/*!
-  \class SUIT_Accel
-  Manager of keyboard accelerator bindings
-*/
 class SUIT_EXPORT SUIT_Accel: public QObject
 {
   Q_OBJECT
@@ -63,15 +59,16 @@ protected:
 private:
   SUIT_Accel();
 
-  int getAccelKey( QEvent* ); // returns key pressed if 1) event was KeyPress 
-                              // 2) pressed key is a registered accelerator 
+  int getAccelKey( QEvent* );
 
-  typedef QMap<int, int> IdActionMap; // key - to - action_id map
-  typedef QMap<QString, IdActionMap> ViewerTypeIdActionMap; // viewer_type - to - IdActionMap
-  ViewerTypeIdActionMap myMap;
+  typedef QMap<int, int> IdActionMap; //!< maps key to action id
+  typedef QMap<QString, IdActionMap> 
+               ViewerTypeIdActionMap; //!< maps viewer type to IdActionMap
+  ViewerTypeIdActionMap myMap;        //!< viewer actions map
 
-  QMap<int, bool> myOptMap; // key - to - <not_used> map, used for optimazation.  all registered keys (accelerators)
-                            // are stored in this map.
+  //! Maps key to <not_used> flag map, used for optimization.
+  //! All registered keys (accelerators) are stored in this map.
+  QMap<int, bool> myOptMap;
 
   static SUIT_Accel* myself;
 };
index d56f01705fc1310dbb6a30be466f4511aef82b18..5c7b4711bf94d392250b7dd562739dfae2ffb517 100644 (file)
@@ -49,20 +49,20 @@ QtxAction* SUIT_ActionOperation::action() const
 /*!Set action.
  * Create new instance of QtxAction and set.
  */
-void SUIT_ActionOperation::setAction( const QString& text, const QIconSet& icon,
-                                     const QString& menuText, QKeySequence accel,
-                                      QObject* parent, const char* name, bool toggle )
+void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon,
+                                                             const QString& menuText, QKeySequence accel,
+                                      QObject* parent, bool toggle )
 {
-  setAction( new QtxAction( text, icon, menuText, accel, parent, name, toggle ) );
+  setAction( new QtxAction( text, icon, menuText, accel, parent, 0, toggle ) );
 }
 
 /*!Set action.
  * Create new instance of QtxAction and set.
  */
 void SUIT_ActionOperation::setAction( const QString& text, const QString& menuText,
-                                     QKeySequence accel, QObject* parent, const char* name, bool toggle )
+                                                             QKeySequence accel, QObject* parent, bool toggle )
 {
-  setAction( new QtxAction(text, menuText, accel, parent, name, toggle ) );
+  setAction( new QtxAction( text, menuText, accel, parent, 0, toggle ) );
 }
 
 /*!Set action.
index bed11e318b3be184d977bf49295a4afe7dc10153..89d9b1f25423c6b13917a34396a5eb45453db04f 100644 (file)
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #ifndef SUIT_ACTIONOPERATION_H
 #define SUIT_ACTIONOPERATION_H
 
 #include "SUIT_Operation.h"
 
-class QtxAction;
+#include <QKeySequence>
+
+class QIcon;
 class QString;
-class QIconSet;
-class QKeySequence;
 class QWidget;
 
+class QtxAction;
+
 /*!Provide support QtxAction*/
 class SUIT_EXPORT SUIT_ActionOperation : public SUIT_Operation
 {
        Q_OBJECT
 
 public:
-       SUIT_ActionOperation( SUIT_Application* theApp );
+       SUIT_ActionOperation( SUIT_Application* );
        virtual ~SUIT_ActionOperation();
 
        QtxAction*   action() const;
 
        /** @name GUI management*/
        //@{
-       virtual void setAction( const QString& text, const QIconSet& icon, const QString& menuText,
-                               QKeySequence accel, QObject* parent, const char* name = 0, bool toggle = false );
+       virtual void setAction( const QString& text, const QIcon& icon, const QString& menuText,
+                                                 QKeySequence accel, QObject* parent, bool toggle = false );
 
-       virtual void setAction( const QString& text, const QString& menuText, QKeySequence accel,
-                               QObject* parent, const char* name = 0, bool toggle = false );
+       virtual void setAction( const QString& text, const QString& menuText,
+                          QKeySequence accel, QObject* parent, bool toggle = false );
        virtual void setAction( QtxAction* theAction );
        
        bool         addTo( QWidget* theWidget );
        bool         addTo( QWidget* theWidget, int thePos );
-       
+
        void         setStatusTip( const QString& theTip );
        //@}
-       
+
 private:
        QtxAction*   myAction;