1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : InquireServersQThread.h
20 // Author : Vasily RUSYAEV
25 #include <qguardedptr.h>
28 #include <SALOME_WNT.hxx>
30 #define SALOME_WNT_EXPORT
35 Contains QCustomEvents for posting to InquireServersQThread
37 class SALOME_WNT_EXPORT InquireEvent : public QCustomEvent
41 enum myCustomEvents{ ProgressEvent = QEvent::User + 10, ProgressEventLabel, ProgressEventError };
43 InquireEvent( QEvent::Type type , void* data = 0 )
44 : QCustomEvent( type, data ) {}
47 type() == (QEvent::Type)ProgressEvent ?
48 delete ( int* )data() : delete ( QString* )data();
52 class InquireServersGUI;
54 class SALOME_WNT_EXPORT InquireServersQThread : public QThread
57 InquireServersQThread( InquireServersGUI* r );
58 virtual ~InquireServersQThread();
60 //the main loop of this thread
64 //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
65 int getExitStatus() { return myExitStatus;}
66 //return count of inquired servers
67 int getInquiredServers() { return myServersCount; }
73 bool AskServer(int iteration, QString ** message);
74 bool pingServer(int iteration, QString& errMessage);
78 QGuardedPtr<InquireServersGUI> receiver;
81 //this variable is true if we are checking servers
83 //count of inquired servers
85 //how many times we should repeat attempt to get response from all needed for launching SALOME servers
87 //define delay time between two attempts in microseconds
89 //this strings' array contains messages for each server (e.g. "Loading: SALOMEDS_Server")
90 QString myMessages[8];
91 //exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
99 class SALOME_WNT_EXPORT InquireServersGUI : public QVBox
104 InquireServersGUI() ;
105 ~InquireServersGUI();
107 //returns arguments of QApplication
108 //they are needed for CORBA servers initialization
109 void getArgs( int& _argc, char *** _argv);
110 //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
113 // bool withGUI() { return myGUI; }
114 // void withGUI(bool gui) { myGUI = gui; }
116 void setPixmap( QPixmap );
119 virtual void customEvent( QCustomEvent* );
122 InquireServersQThread* myThread;
123 QProgressBar* myPrgBar;
124 //this string contains description of currently asked server
127 QFrame* mySplashFrame;
132 void ClickOnCancel();