]> SALOME platform Git repositories - modules/gui.git/blob - src/Session/InquireServersQThread.h
Salome HOME
ptv, do not send mouse release event just after mouse double click
[modules/gui.git] / src / Session / InquireServersQThread.h
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : InquireServersQThread.h
6 //  Author : Vasily RUSYAEV
7 //  Module : SALOME
8 //  $Header$
9
10 #include <qthread.h> 
11 #include <qvbox.h> 
12 #include <qguardedptr.h> 
13
14 /**********************************************************
15 **  Class:   InquireEvent
16 **  Descr:   Contains QCustomEvents for posting to InquireServersQThread
17 **  Level:   Private
18 ***********************************************************/
19 class InquireEvent : public QCustomEvent
20 {
21 public:
22
23   enum myCustomEvents{ ProgressEvent = QEvent::User + 10, ProgressEventLabel, ProgressEventError };
24   
25   InquireEvent( QEvent::Type type , void* data = 0 )
26         : QCustomEvent( type, data ) {}
27   ~InquireEvent() 
28       {
29         type() == (QEvent::Type)ProgressEvent ?
30           delete ( int* )data() : delete ( QString* )data();
31       }
32 };
33
34 class InquireServersGUI;
35
36 class InquireServersQThread : public QThread
37 {
38 public:
39   InquireServersQThread( InquireServersGUI* r );
40   virtual ~InquireServersQThread();
41
42   //the main loop of this thread
43   virtual void run() ;
44   //stop to ask servers
45   void stop(); 
46   //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button) 
47   int getExitStatus() { return myExitStatus;}
48   //return count of inquired servers
49   int getInquiredServers() { return myServersCount; }
50
51 private:
52
53 //functions:
54
55   bool AskServer(int iteration, QString ** message);
56   bool pingServer(int iteration, QString& errMessage);
57
58 //variables:
59
60   QGuardedPtr<InquireServersGUI> receiver;
61   int _argc ;
62   char ** _argv;
63   //this variable is true if we are checking servers
64   bool IsChecking;
65   //count of inquired servers
66   int myServersCount;
67   //how many times we should repeat attempt to get response from all needed for launching SALOME servers
68   int myRepeat;
69   //define delay time between two attempts in microseconds
70   int myDelay;
71   //this strings' array contains messages for each server (e.g. "Loading: SALOMEDS_Server") 
72   QString myMessages[8];
73   //exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button) 
74   int myExitStatus;
75
76 } ;
77
78 class QLabel;
79 class QFrame;
80 class QProgressBar;
81 class InquireServersGUI : public QVBox
82 {
83     Q_OBJECT
84
85 public:
86   InquireServersGUI() ;
87   ~InquireServersGUI();
88
89   //returns arguments of QApplication
90   //they are needed for CORBA servers initialization
91   void getArgs(  int& _argc, char *** _argv);
92   //return exit status: 0 - OK, >0 - BAD (some servers doesn't exists or user click cancel button) 
93   int getExitStatus();
94   //launch IAPP
95   //  bool withGUI() { return myGUI; }
96   //  void withGUI(bool gui) { myGUI = gui; }
97
98   void setPixmap( QPixmap );
99
100 protected:
101   virtual void customEvent( QCustomEvent* ); 
102
103 private:
104   InquireServersQThread* myThread;
105   QProgressBar* myPrgBar;
106   //this string contains description of currently asked server
107   QLabel* myLabel;
108   QLabel* mySplash;
109   QFrame* mySplashFrame;
110   //  bool myGUI;
111
112 private slots:
113
114     void ClickOnCancel();
115 } ;