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, 36 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp
index 5baf05c..265c11f 100644
--- a/noncore/apps/opie-console/emulation_layer.cpp
+++ b/noncore/apps/opie-console/emulation_layer.cpp
@@ -107,6 +107,7 @@ EmulationLayer::EmulationLayer( WidgetLayer* gui )
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;
110 111
111 QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); 112 QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) );
112 QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), 113 QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ),
@@ -132,6 +133,8 @@ EmulationLayer::~EmulationLayer()
132{ 133{
133 delete screen[0]; 134 delete screen[0];
134 delete screen[1]; 135 delete screen[1];
136 if (isRecording())
137 clearScript();
135 bulk_timer.stop(); 138 bulk_timer.stop();
136} 139}
137 140
@@ -228,6 +231,10 @@ void EmulationLayer::onKeyPress( QKeyEvent* ev )
228 QByteArray c = QByteArray( 1 ); 231 QByteArray c = QByteArray( 1 );
229 c.at( 0 ) = ev->ascii(); 232 c.at( 0 ) = ev->ascii();
230 // ibot: qbytearray is emited not char* 233 // ibot: qbytearray is emited not char*
234
235 /* Are we currently recording a script? If so, store the typed character */
236 if (isRecording())
237 m_script->appendString(ev->text());
231 emit sndBlock( (QByteArray) c ); 238 emit sndBlock( (QByteArray) c );
232 } 239 }
233} 240}
@@ -254,6 +261,35 @@ void EmulationLayer::onRcvBlock(const QByteArray &s )
254 bulkEnd(); 261 bulkEnd();
255} 262}
256 263
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
257// Selection --------------------------------------------------------------- -- 293// Selection --------------------------------------------------------------- --
258 294
259void EmulationLayer::onSelectionBegin(const int x, const int y) { 295void EmulationLayer::onSelectionBegin(const int x, const int y) {