From: vsr Date: Tue, 28 Nov 2006 15:05:07 +0000 (+0000) Subject: Improvement PAL14013: send a message to the GUI from the container to emit signal X-Git-Tag: V3_2_4pre1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=424158bd1456509406836563f23ad325da38b014;p=modules%2Fgui.git Improvement PAL14013: send a message to the GUI from the container to emit signal --- diff --git a/src/SUIT/SUIT_Desktop.cxx b/src/SUIT/SUIT_Desktop.cxx index 8d75c7174..8b2c63202 100755 --- a/src/SUIT/SUIT_Desktop.cxx +++ b/src/SUIT/SUIT_Desktop.cxx @@ -178,3 +178,11 @@ void SUIT_Desktop::emitActivated() { emit activated(); } + +/*! + Emits message signal +*/ +void SUIT_Desktop::emitMessage( const QString& theMessage ) +{ + emit message( theMessage ); +} diff --git a/src/SUIT/SUIT_Desktop.h b/src/SUIT/SUIT_Desktop.h index a346d0ca4..e3acceb62 100755 --- a/src/SUIT/SUIT_Desktop.h +++ b/src/SUIT/SUIT_Desktop.h @@ -60,12 +60,14 @@ public: void logoInsert( const QString&, const QPixmap&, const int = -1 ); void emitActivated(); + void emitMessage( const QString& ); signals: void activated(); void deactivated(); void windowActivated( SUIT_ViewWindow* ); void closing( SUIT_Desktop*, QCloseEvent* ); + void message( const QString& ); protected: virtual bool event( QEvent* ); diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index ee239674e..81787737e 100755 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -35,6 +35,7 @@ #include "SUIT_Session.h" #include "SUIT_Application.h" +#include "SUIT_Desktop.h" #include @@ -221,3 +222,30 @@ bool SALOME_Session_i::restoreVisualState(CORBA::Long theSavePoint) return false; } + +void SALOME_Session_i::emitMessage(const char* theMessage) +{ + class TEvent: public SALOME_Event { + public: + TEvent(const char * msg) { + _msg = msg; + } + virtual void Execute() { + SUIT_Session::session()->activeApplication()->desktop()->emitMessage(_msg); + } + private: + const char* _msg; + }; + if ( SUIT_Session::session() ) { + if ( SUIT_Session::session()->activeApplication() ) { + if ( SUIT_Session::session()->activeApplication()->desktop() ) { + ProcessVoidEvent( new TEvent(theMessage) ); + } + } + } +} + +void SALOME_Session_i::emitMessageOneWay(const char* theMessage) +{ + emitMessage(theMessage); +} diff --git a/src/Session/Session_Session_i.hxx b/src/Session/Session_Session_i.hxx index 18d2caf84..17663b933 100755 --- a/src/Session/Session_Session_i.hxx +++ b/src/Session/Session_Session_i.hxx @@ -70,6 +70,10 @@ public: //! Restors a visual state of the study at theSavePoint bool restoreVisualState(CORBA::Long theSavePoint); + //! Emit a qt signal from the session GUI desktop window. + void emitMessage(const char* theMessage); + void emitMessageOneWay(const char* theMessage); + protected: //! Naming service interface