00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __EVENTS_H__
00019 #define __EVENTS_H__
00020
00021 #include <qmainwindow.h>
00022 #include <qevent.h>
00023 #include <qprogressdialog.h>
00024
00025 #include <string>
00026 using namespace std;
00027
00028
00029 #include "MonitorWindow.h"
00030
00031
00032 const int SHOW_MESSAGE_EVENT = QEvent::User + 1;
00033 const int PROGRESS_STATUS_EVENT = QEvent::User + 2;
00034 const int WINDOW_CLOSED_EVENT = QEvent::User + 3;
00035 const int WINDOW_OPENED_EVENT = QEvent::User + 4;
00036 const int WINDOW_CONNECTION_LOST_EVENT = QEvent::User + 5;
00037 const int CLIENT_LIST_EVENT = QEvent::User + 6;
00038 const int SEARCH_LOGS_EVENT = QEvent::User + 7;
00039 const int CONNECT_EVENT = 1;
00040 const int UPDATE_QUEUE_EVENT = 2;
00041 const int DISCONNECT_EVENT = 3;
00042 const int STORAGE_LIST_EVENT = CLIENT_LIST_EVENT + 4;
00043 const int ADD_NODE_EVENT = 1;
00044 const int ADD_DISK_EVENT = 2;
00045 const int UPDATE_DISK_QUEUE_EVENT = 3;
00046
00047
00048
00049
00050
00051 class WindowClosedEvent : public QCustomEvent
00052 {
00053 public:
00054 WindowClosedEvent( QMainWindow * );
00055
00056 QMainWindow *getWindow( void );
00057
00058 private:
00059 QMainWindow *window;
00060 };
00061
00062
00063
00064
00065 class WindowOpenedEvent : public QCustomEvent
00066 {
00067 public:
00068 WindowOpenedEvent( void );
00069 };
00070
00071
00072
00073
00074 class ShowMessageEvent : public QCustomEvent
00075 {
00076 public:
00077 ShowMessageEvent( int, string, string );
00078 ShowMessageEvent( int, string );
00079
00080 void init( int, string, string );
00081 string getMessage( void );
00082 int getType( void );
00083 string getTitle( void );
00084 int getResult( void );
00085 void setResult( int );
00086
00087
00088 static const int ERROR = 0;
00089 static const int INFO = 1;
00090 static const int QUESTION = 2;
00091 static const int WARNING = 3;
00092
00093 private:
00094 string title;
00095 string message;
00096 int msg_type;
00097 int result;
00098 };
00099
00100
00101
00102
00103 class ProgressStatusEvent : public QCustomEvent
00104 {
00105 public:
00106 ProgressStatusEvent( QLabel *,
00107 QString ,
00108 QProgressBar *,
00109 int ,
00110 QProgressBar *,
00111 int );
00112
00113 void updateProgress( void );
00114
00115 private:
00116 QLabel *lbl_current_file;
00117 QString current_file;
00118
00119 QProgressBar *pb_current_file;
00120 int current_file_progress;
00121
00122 QProgressBar *pb_overall;
00123 int overall_progress;
00124 };
00125
00126
00127
00128
00129 class WindowConnectionLostEvent : public QCustomEvent
00130 {
00131 public:
00132 WindowConnectionLostEvent( QMainWindow * );
00133
00134 QMainWindow *getWindow( void );
00135
00136 private:
00137 QMainWindow *window;
00138 };
00139
00140
00141
00142
00143 class ClientListEvent : public QCustomEvent
00144 {
00145 char *ip;
00146 int port;
00147 public:
00148 ClientListEvent( char *ip, int port, int value = 0 );
00149 ~ClientListEvent();
00150 char *getIP();
00151 int getPort();
00152 };
00153
00154 class ConnectEvent : public ClientListEvent
00155 {
00156 char *video;
00157 public:
00158 ConnectEvent( char *ip, int port, char *video );
00159 ~ConnectEvent();
00160 char *getVideo();
00161 };
00162
00163 class UpdateQueueEvent : public ClientListEvent
00164 {
00165 int value;
00166 public:
00167 UpdateQueueEvent( char *ip, int port, int value );
00168 int getValue();
00169 };
00170
00171 class DisconnectEvent : public ClientListEvent
00172 {
00173 char *video;
00174 public:
00175 DisconnectEvent( char *ip, int port, char *video );
00176 ~DisconnectEvent();
00177 char *getVideo();
00178 };
00179
00180 class StorageListEvent : public QCustomEvent
00181 {
00182 char *nodename;
00183 public:
00184 StorageListEvent( char *nodename, int value = 0 );
00185 ~StorageListEvent();
00186 char *getNodeName();
00187 };
00188
00189 class AddNodeEvent : public StorageListEvent
00190 {
00191 char *ip;
00192 public:
00193 AddNodeEvent( char *nodename, char *ip );
00194 ~AddNodeEvent();
00195 char *getIP();
00196 };
00197
00198 class AddDiskEvent : public StorageListEvent
00199 {
00200 char *diskname;
00201 public:
00202 AddDiskEvent( char *nodename, char *diskname );
00203 ~AddDiskEvent();
00204 char *getDiskName();
00205 };
00206
00207 class UpdateDiskQueueEvent : public StorageListEvent
00208 {
00209 char *diskname;
00210 int queue;
00211 public:
00212 UpdateDiskQueueEvent( char *nodename, char *diskname, int queue );
00213 ~UpdateDiskQueueEvent();
00214 char *getDiskName();
00215 int getQueue();
00216 };
00217
00218
00219
00220
00221
00222 class SearchLogsEvent : public QCustomEvent
00223 {
00224 MonitorWindow *m_MonitorWindow;
00225 char *m_ResultFileName;
00226 int m_SearchType;
00227 int m_SearchResult;
00228 public:
00229 SearchLogsEvent( MonitorWindow *Monitor, char *ResultFileName,
00230 int SearchType, int SearchResult );
00231 ~SearchLogsEvent();
00232 MonitorWindow *getMonitorWindow( void );
00233 char *getResultFileName( void );
00234 int getSearchType( void );
00235 int getSearchResult( void );
00236 };
00237
00238 #endif