Diffstat (limited to 'noncore/apps/opie-console/emulation_layer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/emulation_layer.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp index 6c420e0..5baf05c 100644 --- a/noncore/apps/opie-console/emulation_layer.cpp +++ b/noncore/apps/opie-console/emulation_layer.cpp | |||
@@ -73,13 +73,13 @@ | |||
73 | 73 | ||
74 | /* FIXME | 74 | /* FIXME |
75 | - evtl. the bulk operations could be made more transparent. | 75 | - evtl. the bulk operations could be made more transparent. |
76 | */ | 76 | */ |
77 | 77 | ||
78 | #include "emulation_layer.h" | 78 | #include "emulation_layer.h" |
79 | #include "widget.h" | 79 | #include "widget_layer.h" |
80 | #include "screen.h" | 80 | #include "screen.h" |
81 | #include <stdio.h> | 81 | #include <stdio.h> |
82 | #include <stdlib.h> | 82 | #include <stdlib.h> |
83 | #include <unistd.h> | 83 | #include <unistd.h> |
84 | #include <qkeycode.h> | 84 | #include <qkeycode.h> |
85 | 85 | ||
@@ -92,40 +92,40 @@ | |||
92 | 92 | ||
93 | #define CNTL(c) ((c)-'@') | 93 | #define CNTL(c) ((c)-'@') |
94 | 94 | ||
95 | /*! | 95 | /*! |
96 | */ | 96 | */ |
97 | 97 | ||
98 | EmulationLayer::EmulationLayer(Widget* gui) | 98 | EmulationLayer::EmulationLayer( WidgetLayer* gui ) |
99 | : decoder((QTextDecoder*)NULL) | 99 | : decoder((QTextDecoder*)NULL) |
100 | { | 100 | { |
101 | this->gui = gui; | 101 | this->gui = gui; |
102 | 102 | ||
103 | screen[0] = new Screen(gui->Lines(),gui->Columns()); | 103 | screen[0] = new Screen(gui->lines(),gui->columns()); |
104 | screen[1] = new Screen(gui->Lines(),gui->Columns()); | 104 | screen[1] = new Screen(gui->lines(),gui->columns()); |
105 | scr = screen[0]; | 105 | scr = screen[0]; |
106 | 106 | ||
107 | bulk_nlcnt = 0; // reset bulk newline counter | 107 | bulk_nlcnt = 0; // reset bulk newline counter |
108 | bulk_incnt = 0; // reset bulk counter | 108 | bulk_incnt = 0; // reset bulk counter |
109 | connected = FALSE; | 109 | connected = FALSE; |
110 | 110 | ||
111 | QObject::connect(&bulk_timer, SIGNAL(timeout()), this, SLOT(showBulk()) ); | 111 | QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); |
112 | QObject::connect(gui,SIGNAL(changedImageSizeSignal(int,int)), | 112 | QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), |
113 | this,SLOT(onImageSizeChange(int,int))); | 113 | this,SLOT( onImageSizeChange( int, int ) ) ); |
114 | QObject::connect(gui,SIGNAL(changedHistoryCursor(int)), | 114 | QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), |
115 | this,SLOT(onHistoryCursorChange(int))); | 115 | this,SLOT( historyCursorChange( int ) ) ); |
116 | QObject::connect(gui,SIGNAL(keyPressedSignal(QKeyEvent*)), | 116 | QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ), |
117 | this,SLOT(onKeyPress(QKeyEvent*))); | 117 | this,SLOT( onKeyPress( QKeyEvent* ) ) ); |
118 | QObject::connect(gui,SIGNAL(beginSelectionSignal(const int,const int)), | 118 | QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ), |
119 | this,SLOT(onSelectionBegin(const int,const int)) ); | 119 | this,SLOT( onSelectionBegin( const int, const int ) ) ); |
120 | QObject::connect(gui,SIGNAL(extendSelectionSignal(const int,const int)), | 120 | QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ), |
121 | this,SLOT(onSelectionExtend(const int,const int)) ); | 121 | this,SLOT( onSelectionExtend( const int,const int ) ) ); |
122 | QObject::connect(gui,SIGNAL(endSelectionSignal(const BOOL)), | 122 | QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ), |
123 | this,SLOT(setSelection(const BOOL)) ); | 123 | this,SLOT( setSelection( const bool ) ) ); |
124 | QObject::connect(gui,SIGNAL(clearSelectionSignal()), | 124 | QObject::connect(gui,SIGNAL( selectionCleared() ), |
125 | this,SLOT(clearSelection()) ); | 125 | this,SLOT( clearSelection() ) ); |
126 | } | 126 | } |
127 | 127 | ||
128 | /*! | 128 | /*! |
129 | */ | 129 | */ |
130 | 130 | ||
131 | EmulationLayer::~EmulationLayer() | 131 | EmulationLayer::~EmulationLayer() |
@@ -194,13 +194,13 @@ void EmulationLayer::onRcvChar(int c) | |||
194 | switch (c) | 194 | switch (c) |
195 | { | 195 | { |
196 | case '\b' : scr->BackSpace(); break; | 196 | case '\b' : scr->BackSpace(); break; |
197 | case '\t' : scr->Tabulate(); break; | 197 | case '\t' : scr->Tabulate(); break; |
198 | case '\n' : scr->NewLine(); break; | 198 | case '\n' : scr->NewLine(); break; |
199 | case '\r' : scr->Return(); break; | 199 | case '\r' : scr->Return(); break; |
200 | case 0x07 : gui->Bell(); break; | 200 | case 0x07 : gui->bell(); break; |
201 | default : scr->ShowCharacter(c); break; | 201 | default : scr->ShowCharacter(c); break; |
202 | }; | 202 | }; |
203 | } | 203 | } |
204 | 204 | ||
205 | /* ------------------------------------------------------------------------- */ | 205 | /* ------------------------------------------------------------------------- */ |
206 | /* */ | 206 | /* */ |
@@ -300,41 +300,41 @@ void EmulationLayer::bulkNewline() | |||
300 | void EmulationLayer::showBulk() | 300 | void EmulationLayer::showBulk() |
301 | { | 301 | { |
302 | bulk_nlcnt = 0; // reset bulk newline counter | 302 | bulk_nlcnt = 0; // reset bulk newline counter |
303 | bulk_incnt = 0; // reset bulk counter | 303 | bulk_incnt = 0; // reset bulk counter |
304 | if (connected) | 304 | if (connected) |
305 | { | 305 | { |
306 | Character* image = scr->getCookedImage(); // get the image | 306 | QArray<Character> image = scr->getCookedImage(); // get the image |
307 | gui->setImage(image, | 307 | gui->setImage(image, |
308 | scr->getLines(), | 308 | scr->getLines(), |
309 | scr->getColumns()); // actual refresh | 309 | scr->getColumns()); // actual refresh |
310 | free(image); | 310 | delete image; |
311 | //FIXME: check that we do not trigger other draw event here. | 311 | //FIXME: check that we do not trigger other draw event here. |
312 | gui->setScroll(scr->getHistCursor(),scr->getHistLines()); | 312 | gui->setScroll(scr->getHistCursor(),scr->getHistLines()); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | void EmulationLayer::bulkStart() | 316 | void EmulationLayer::bulkStart() |
317 | { | 317 | { |
318 | if (bulk_timer.isActive()) bulk_timer.stop(); | 318 | if (bulk_timer.isActive()) bulk_timer.stop(); |
319 | } | 319 | } |
320 | 320 | ||
321 | void EmulationLayer::bulkEnd() | 321 | void EmulationLayer::bulkEnd() |
322 | { | 322 | { |
323 | if ( bulk_nlcnt > gui->Lines() || bulk_incnt > 20 ) | 323 | if ( bulk_nlcnt > gui->lines() || bulk_incnt > 20 ) |
324 | showBulk(); // resets bulk_??cnt to 0, too. | 324 | showBulk(); // resets bulk_??cnt to 0, too. |
325 | else | 325 | else |
326 | bulk_timer.start(BULK_TIMEOUT,TRUE); | 326 | bulk_timer.start(BULK_TIMEOUT,TRUE); |
327 | } | 327 | } |
328 | 328 | ||
329 | void EmulationLayer::setConnect(bool c) | 329 | void EmulationLayer::setConnect(bool c) |
330 | { | 330 | { |
331 | connected = c; | 331 | connected = c; |
332 | if ( connected) | 332 | if ( connected) |
333 | { | 333 | { |
334 | onImageSizeChange(gui->Lines(), gui->Columns()); | 334 | onImageSizeChange(gui->lines(), gui->columns()); |
335 | showBulk(); | 335 | showBulk(); |
336 | } | 336 | } |
337 | else | 337 | else |
338 | { | 338 | { |
339 | scr->clearSelection(); | 339 | scr->clearSelection(); |
340 | } | 340 | } |