Extend copyright to 2018.
[kdbg.git] / kdbg / ttywnd.h
bloba12a9809ad2bedde79957d2ee02b08f0bafceeb1
1 /*
2 * Copyright Johannes Sixt
3 * This file is licensed under the GNU General Public License Version 2.
4 * See the file COPYING in the toplevel directory of the source directory.
5 */
7 #ifndef TTYWND_H
8 #define TTYWND_H
10 #include <QPlainTextEdit>
12 class QSocketNotifier;
14 /**
15 * This class is cortesy Judin Max <novaprint@mtu-net.ru>.
17 * The master side of the TTY is the emulator.
19 * The slave side is where a client process can write output and can read
20 * input. For this purpose, it must open the file (terminal device) whose
21 * name is returned by @ref slaveTTY for both reading and writing. To
22 * establish the stdin, stdout, and stderr channels the file descriptor
23 * obtained by this must be dup'd to file descriptors 0, 1, and 2, resp.
25 class STTY : public QObject
27 Q_OBJECT
28 public:
29 STTY();
30 ~STTY();
32 QString slaveTTY(){ return m_slavetty; };
34 protected slots:
35 void outReceived(int);
37 signals:
38 void output(char* buffer, int charlen);
40 protected:
41 int m_masterfd;
42 int m_slavefd;
43 QSocketNotifier* m_outNotifier;
44 QString m_slavetty;
45 bool findTTY();
48 class TTYWindow : public QPlainTextEdit
50 Q_OBJECT
51 public:
52 TTYWindow(QWidget* parent);
53 ~TTYWindow();
55 QString activate();
56 void deactivate();
58 protected:
59 STTY* m_tty;
60 QTextCursor m_pos; //!< tracks horizontal cursor position
61 virtual void contextMenuEvent(QContextMenuEvent*);
63 protected slots:
64 void slotAppend(char* buffer, int count);
65 void slotClear();
68 #endif // TTYWND_H