summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/emulation_layer.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/emulation_layer.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_layer.h146
1 files changed, 146 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/emulation_layer.h b/noncore/apps/opie-console/emulation_layer.h
new file mode 100644
index 0000000..0f54331
--- a/dev/null
+++ b/noncore/apps/opie-console/emulation_layer.h
@@ -0,0 +1,146 @@
1/* -------------------------------------------------------------------------- */
2/* */
3/* [emulation.h] Fundamental Terminal Emulation */
4/* */
5/* -------------------------------------------------------------------------- */
6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */
9/* This file is part of Konsole - an X terminal for KDE */
10/* */
11/* -------------------------------------------------------------------------- */
12 /* */
13/* Ported Konsole to Qt/Embedded */
14 /* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16 /* */
17/* -------------------------------------------------------------------------- */
18/* -------------------------------------------------------------------------- */
19 /* */
20/* made to a layer between io_layer and widget */
21 /* */
22/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */
23 /* */
24/* -------------------------------------------------------------------------- */
25
26#ifndef EMULATION_LAYER_H
27#define EMULATION_LAYER_H
28
29#include "widget.h"
30#include "screen.h"
31#include <qtimer.h>
32#include <stdio.h>
33#include <qtextcodec.h>
34#include "keytrans.h"
35
36class EmulationLayer : public QObject
37{ Q_OBJECT
38
39public:
40
41 EmulationLayer(Widget* gui);
42 ~EmulationLayer();
43
44public:
45 virtual void setHistory(bool on);
46 virtual bool history();
47
48public slots: // signals incoming from Widget
49
50 virtual void onImageSizeChange(int lines, int columns);
51 virtual void onHistoryCursorChange(int cursor);
52 virtual void onKeyPress(QKeyEvent*);
53
54 virtual void clearSelection();
55 virtual void onSelectionBegin(const int x, const int y);
56 virtual void onSelectionExtend(const int x, const int y);
57 virtual void setSelection(const BOOL preserve_line_breaks);
58
59public slots: // signals incoming from data source
60
61 /**
62 * to be called, when new data arrives
63 */
64 void onRcvBlock(const QByteArray&);
65
66signals:
67
68 /**
69 * will send data, encoded to suit emulation
70 */
71 void sndBlock(const QByteArray&);
72
73 void ImageSizeChanged(int lines, int columns);
74
75 void changeColumns(int columns);
76
77 void changeTitle(int arg, const char* str);
78
79
80public:
81
82 /**
83 * process single char (decode)
84 */
85 virtual void onRcvChar(int);
86
87 virtual void setMode (int) = 0;
88 virtual void resetMode(int) = 0;
89
90 /**
91 * @deprecated use qbytearray instead
92 */
93 virtual void sendString(const char*) = 0;
94
95 /**
96 * sends a string to IOLayer
97 * encodes to suit emulation before
98 */
99 virtual void sendString(const QByteArray&) = 0;
100
101 virtual void setConnect(bool r);
102 void setColumns(int columns);
103
104 void setKeytrans(int no);
105 void setKeytrans(const char * no);
106
107protected:
108
109 Widget* gui;
110 Screen* scr; // referes to one `screen'
111 Screen* screen[2]; // 0 = primary, 1 = alternate
112 void setScreen(int n); // set `scr' to `screen[n]'
113
114 bool connected; // communicate with widget
115
116 void setCodec(int c); // codec number, 0 = locale, 1=utf8
117
118 QTextCodec* codec;
119 QTextCodec* localeCodec;
120 QTextDecoder* decoder;
121
122 KeyTrans* keytrans;
123
124// refreshing related material.
125// this is localized in the class.
126private slots: // triggered by timer
127
128 void showBulk();
129
130private:
131
132 void bulkNewline();
133 void bulkStart();
134 void bulkEnd();
135
136private:
137
138 QTimer bulk_timer;
139 int bulk_nlcnt; // bulk newline counter
140 char* SelectedText;
141 int bulk_incnt; // bulk counter
142
143
144};
145
146#endif // ifndef EMULATION_H