]> git.lyx.org Git - features.git/blob - development/lyxserver/server_monitor.h
Add a Qt version of the LyX server monitor program.
[features.git] / development / lyxserver / server_monitor.h
1 /**
2  * \file server_monitor.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Enrico Forestieri
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #ifndef SERVER_MONITOR_H
12 #define SERVER_MONITOR_H
13
14 #include <errno.h>
15 #include <fcntl.h>
16
17 #include <QDialog>
18 #include <QFile>
19 #include <QLineEdit>
20
21 #ifdef _WIN32
22 #include <windows.h>
23 #ifdef _MSC_VER
24 #include <io.h>
25 #define open _open
26 #define close _close
27 #define read _read
28 #define write _write
29 #define snprintf _snprintf
30 #define O_RDONLY _O_RDONLY
31 #define O_WRONLY _O_WRONLY
32 #endif
33 #endif
34
35 class QGroupBox;
36 class QLabel;
37 class QPushButton;
38 class ReadPipe;
39
40 class LyXServerMonitor : public QDialog
41 {
42         Q_OBJECT
43
44         enum { BUFSIZE = 512 };
45
46 public:
47         LyXServerMonitor();
48         ///
49         ~LyXServerMonitor();
50         ///
51         void readPipe();
52         ///
53         QString inPipeName() { return pipeNameLE->text() + ".in"; }
54         ///
55         QString outPipeName() { return pipeNameLE->text() + ".out"; }
56
57 public Q_SLOTS:
58         void openPipes();
59         void closePipes();
60         void submitCommand();
61
62 private:
63         void createCmdsGroupBox();
64         void createGridGroupBox();
65         bool event(QEvent *);
66
67         QGroupBox * horizontalGB;
68         QGroupBox * gridGB;
69         QLabel * labels[6];
70         QLineEdit * pipeNameLE;
71         QLineEdit * clientNameLE;
72         QLineEdit * commandLE;
73         QLineEdit * argumentLE;
74         QLabel * infoLB;
75         QLabel * notifyLB;
76         QPushButton * openPipesPB;
77         QPushButton * closePipesPB;
78         QPushButton * submitCommandPB;
79         QPushButton * donePB;
80
81         int pipein;
82         int pipeout;
83         bool thread_exit;
84         bool lyx_listen;
85         char buffer[BUFSIZE];
86         char pipedata[BUFSIZE];
87         ReadPipe * pipethread;
88 };
89
90 #endif