Teach the output window about '\r' and '\n'.
[kdbg.git] / kdbg / ttywnd.h
blob741a468e6914fea87ba1121d8bb756ff9df27f32
1 // $Id$
3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
6 #ifndef TTYWND_H
7 #define TTYWND_H
9 #include <qtextedit.h>
11 class QSocketNotifier;
12 class QPopupMenu;
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 QTextEdit
50 Q_OBJECT
51 public:
52 TTYWindow(QWidget* parent, const char* name);
53 ~TTYWindow();
55 QString activate();
56 void deactivate();
58 protected:
59 STTY* m_tty;
60 virtual QPopupMenu* createPopupMenu(const QPoint& pos);
61 int m_hPos; //!< tracks horizontal cursor position
63 protected slots:
64 void slotAppend(char* buffer, int count);
65 void slotClear();
68 #endif // TTYWND_H