summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/emulation_layer.cpp
Unidiff
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.cpp36
1 files changed, 1 insertions, 35 deletions
diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp
index 265c11f..6a2679e 100644
--- a/noncore/apps/opie-console/emulation_layer.cpp
+++ b/noncore/apps/opie-console/emulation_layer.cpp
@@ -104,13 +104,12 @@ EmulationLayer::EmulationLayer( WidgetLayer* gui )
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 m_script = 0;
111 110
112 QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); 111 QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) );
113 QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), 112 QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ),
114 this,SLOT( onImageSizeChange( int, int ) ) ); 113 this,SLOT( onImageSizeChange( int, int ) ) );
115 QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), 114 QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ),
116 this,SLOT( historyCursorChange( int ) ) ); 115 this,SLOT( historyCursorChange( int ) ) );
@@ -130,14 +129,12 @@ EmulationLayer::EmulationLayer( WidgetLayer* gui )
130*/ 129*/
131 130
132EmulationLayer::~EmulationLayer() 131EmulationLayer::~EmulationLayer()
133{ 132{
134 delete screen[0]; 133 delete screen[0];
135 delete screen[1]; 134 delete screen[1];
136 if (isRecording())
137 clearScript();
138 bulk_timer.stop(); 135 bulk_timer.stop();
139} 136}
140 137
141/*! change between primary and alternate screen 138/*! change between primary and alternate screen
142*/ 139*/
143 140
@@ -229,15 +226,12 @@ void EmulationLayer::onKeyPress( QKeyEvent* ev )
229 else if (ev->ascii()>0) 226 else if (ev->ascii()>0)
230 { 227 {
231 QByteArray c = QByteArray( 1 ); 228 QByteArray c = QByteArray( 1 );
232 c.at( 0 ) = ev->ascii(); 229 c.at( 0 ) = ev->ascii();
233 // ibot: qbytearray is emited not char* 230 // ibot: qbytearray is emited not char*
234 231
235 /* Are we currently recording a script? If so, store the typed character */
236 if (isRecording())
237 m_script->appendString(ev->text());
238 emit sndBlock( (QByteArray) c ); 232 emit sndBlock( (QByteArray) c );
239 } 233 }
240} 234}
241 235
242// Unblocking, Byte to Unicode translation --------------------------------- -- 236// Unblocking, Byte to Unicode translation --------------------------------- --
243 237
@@ -258,41 +252,12 @@ void EmulationLayer::onRcvBlock(const QByteArray &s )
258 onRcvChar(result[j].unicode()); 252 onRcvChar(result[j].unicode());
259 if (s[i] == '\n') bulkNewline(); 253 if (s[i] == '\n') bulkNewline();
260 } 254 }
261 bulkEnd(); 255 bulkEnd();
262} 256}
263 257
264// Scripts ----------------------------------------------------------------- --
265
266
267Script *EmulationLayer::script() {
268 return m_script;
269}
270
271bool EmulationLayer::isRecording() {
272 return (m_script != 0);
273}
274
275void EmulationLayer::startRecording() {
276 if (!isRecording())
277 m_script = new Script();
278}
279
280void EmulationLayer::clearScript() {
281 if (isRecording()) {
282
283 }
284}
285
286void EmulationLayer::runScript(const Script *script) {
287 QByteArray a = QByteArray();
288 QString str = script->script();
289 a.setRawData(str.ascii(), str.length());
290 emit sndBlock(a);
291}
292
293// Selection --------------------------------------------------------------- -- 258// Selection --------------------------------------------------------------- --
294 259
295void EmulationLayer::onSelectionBegin(const int x, const int y) { 260void EmulationLayer::onSelectionBegin(const int x, const int y) {
296 if (!connected) return; 261 if (!connected) return;
297 scr->setSelBeginXY(x,y); 262 scr->setSelBeginXY(x,y);
298 showBulk(); 263 showBulk();
@@ -403,6 +368,7 @@ void EmulationLayer::onHistoryCursorChange(int cursor)
403void EmulationLayer::setColumns(int columns) 368void EmulationLayer::setColumns(int columns)
404{ 369{
405 //FIXME: this goes strange ways. 370 //FIXME: this goes strange ways.
406 // Can we put this straight or explain it at least? 371 // Can we put this straight or explain it at least?
407 emit changeColumns(columns); 372 emit changeColumns(columns);
408} 373}
374