--- /dev/null
+# SALOME Utils : general SALOME's definitions and tools
+#
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Marc Tajchman (CEA)
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= \
+ SALOME_Event.hxx
+
+EXPORT_PYSCRIPTS =
+# Libraries targets
+
+LIB = libEvent.la
+LIB_SRC = SALOME_Event.cxx
+
+CPPFLAGS+=$(QT_INCLUDES)
+LDFLAGS+=$(QT_MT_LIBS)
+
+@CONCLUDE@
+
+
--- /dev/null
+// File: SALOME_Event.cxx
+// Created: Tue Mar 30 15:06:32 2004
+// Author: Sergey ANIKIN
+// <san@startrex.nnov.opencascade.com>
+
+
+#include "SALOME_Event.hxx"
+
+#include "utilities.h"
+
+//===========================================================================
+// ~SALOME_Semaphore
+//===========================================================================
+SALOME_Semaphore::~SALOME_Semaphore()
+{
+}
+
+//===========================================================================
+// SALOME_Event
+//===========================================================================
+SALOME_Event::SALOME_Event( int salomeEventType, SALOME_Semaphore* s )
+: QCustomEvent( (QEvent::Type)(QEvent::User + 1), (void*)s ),
+ myType( salomeEventType )
+{
+ MESSAGE( "SALOME_Event::SALOME_Event(): type = " << myType << ", semaphore = " << s );
+ if ( s ) {
+ MESSAGE( "SALOME_Event::SALOME_Event(): available = " << s->available() );
+ ASSERT( s->available() == 1 );
+ s->operator++( 1 );
+ }
+}
+
+//===========================================================================
+// processed
+//===========================================================================
+void SALOME_Event::processed()
+{
+ MESSAGE( "SALOME_Event::processed()" );
+ if ( getSemaphore() && !getSemaphore()->available() ) {
+ MESSAGE( "SALOME_Event::SALOME_Event(): available = " << getSemaphore()->available() );
+ getSemaphore()->operator--( 1 );
+ }
+}
+
+
+
--- /dev/null
+// File: SALOME_Event.hxx
+// Created: Mon Mar 29 16:36:52 2004
+// Author: Sergey ANIKIN
+// <san@startrex.nnov.opencascade.com>
+
+
+#ifndef SALOME_Event_HeaderFile
+#define SALOME_Event_HeaderFile
+
+#include <qevent.h>
+#include <qsemaphore.h>
+
+class SALOME_Semaphore : public QSemaphore
+{
+public:
+ SALOME_Semaphore() : QSemaphore( 1 ) {}
+ virtual ~SALOME_Semaphore();
+};
+
+class SALOME_Event : public QCustomEvent
+{
+public:
+ SALOME_Event( int salomeEventType, SALOME_Semaphore* s = 0 );
+
+ int getType() const { return myType; }
+ void processed();
+
+private:
+ SALOME_Semaphore* getSemaphore() { return (SALOME_Semaphore*)data(); }
+
+private:
+ int myType;
+};
+
+#endif
@COMMENCE@
-SUBDIRS = MSG2QM SALOMELocalTrace Logger SALOMELogger Utils PatchQt \
+SUBDIRS = MSG2QM Event SALOMELocalTrace Logger SALOMELogger Utils PatchQt \
GenericObj NamingService Registry \
ModuleCatalog DataTypeCatalog RessourcesCatalog \
Notification NOTIFICATION_SWIG \
SALOMEGUI_NameDlg.h \
SALOMEGUI_SetValueDlg.h \
SALOMEGUI_SetupCurveDlg.h \
- SALOMEGUI_CloseDlg.h \
- SALOME_Event.hxx
-
+ SALOMEGUI_CloseDlg.h
# .po files to transform in .qm
PO_FILES = \
SALOME_Exception.idl
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject
+LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent
LIBS+= $(PYTHON_LIBS)
#include <qlineedit.h>
#include <qdatetime.h>
#include <qthread.h>
-#include <qwaitcondition.h>
#if QT_VERSION > 300
#include <qlistbox.h>
SALOME_Event* aSE = (SALOME_Event*)e;
MESSAGE( "QAD_Desktop::eventFilter - SALOME_Event handling - 1 : o = " << o << ", e = " << e);
// here we do the job...
- for ( int i = 0; i < 100000; i++ ) {
- }
+ sleep( 5 );
MESSAGE( "QAD_Desktop::eventFilter - SALOME_Event handling - 2" );
- if ( aSE->getWaitCondition() )
- aSE->getWaitCondition()->wakeAll();
+ aSE->processed();
MESSAGE( "QAD_Desktop::eventFilter - SALOME_Event handling - 3" );
return TRUE;
}
+++ /dev/null
-// File: SALOME_Event.hxx
-// Created: Mon Mar 29 16:36:52 2004
-// Author: Sergey ANIKIN
-// <san@startrex.nnov.opencascade.com>
-
-
-#ifndef SALOME_Event_HeaderFile
-#define SALOME_Event_HeaderFile
-
-#include <qevent.h>
-
-class QWaitCondition;
-
-class SALOME_Event : public QCustomEvent
-{
-public:
- SALOME_Event( QWaitCondition* wc = 0 ) : QCustomEvent( (QEvent::Type)(QEvent::User + 1), (void*)wc ) {};
-
- QWaitCondition* getWaitCondition() { return (QWaitCondition*)data(); }
-
-};
-
-#endif