1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : InquireServersQThread.h
6 // Author : Vasily RUSYAEV
10 #include <qapplication.h>
13 #include <qprogressbar.h>
16 /**********************************************************
17 ** Class: InquireEvent
18 ** Descr: Contains QCustomEvents for posting to InquireServersQThread
20 ***********************************************************/
22 class InquireEvent : public QCustomEvent
26 enum myCustomEvents{ ProgressEvent = QEvent::User + 10, ProgressEventLabel, ProgressEventError };
28 InquireEvent( QEvent::Type type , void* data = 0 )
29 : QCustomEvent( type, data ) {}
32 type() == (QEvent::Type)ProgressEvent ?
33 delete ( int* )data() : delete ( QString* )data();
37 class InquireServersGUI;
39 class InquireServersQThread : public QThread
42 InquireServersQThread( InquireServersGUI* r );
44 //the main loop of this thread
52 //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
53 int getExitStatus() { return myExitStatus;}
54 //return count of inquired servers
55 int getInquiredServers() { return myServersCount; }
61 bool AskServer(int iteration, QString ** message);
62 bool pingServer(int iteration, QString& errMessage);
66 InquireServersGUI* receiver;
69 //this variable is true if we are checking servers
71 //count of inquired servers
73 //how many times we should repeat attempt to get response from all needed for launching SALOME servers
75 //define delay time between two attempts in microseconds
77 //this strings' array contains messages for each server (e.g. "Loading: SALOMEDS_Server")
78 QString myMessages[8];
79 //exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
84 class InquireServersGUI : public QVBox
92 //returns arguments of QApplication
93 //they are needed for CORBA servers initialization
94 void getArgs( int& _argc, char *** _argv);
95 //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button)
98 bool withGUI() { return myGUI; }
99 void withGUI(bool gui) { myGUI = gui; }
102 virtual void customEvent( QCustomEvent* );
103 virtual void closeEvent ( QCloseEvent * );
106 InquireServersQThread* myThread;
107 QProgressBar* myPrgBar;
108 //this string contains description of currently asked server
114 void ClickOnCancel();