Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TEmulation Class Reference

Mediator between TEWidget and TEScreen. More...

#include </home/clem/local/src/opie/core/apps/embeddedkonsole/TEmulation.h>

Inheritance diagram for TEmulation:

Inheritance graph
[legend]
Collaboration diagram for TEmulation:

Collaboration graph
[legend]
List of all members.

Public Slots

virtual void onImageSizeChange (int lines, int columns)
virtual void onHistoryCursorChange (int cursor)
virtual void onHorzCursorChange (int cursor)
virtual void onKeyPress (QKeyEvent *)
virtual void clearSelection ()
virtual void onSelectionBegin (const int x, const int y)
virtual void onSelectionExtend (const int x, const int y)
virtual void setSelection (const BOOL preserve_line_breaks)
void onRcvBlock (const char *txt, int len)
virtual void onImageSizeChange (int lines, int columns)
virtual void onHistoryCursorChange (int cursor)
virtual void onKeyPress (QKeyEvent *)
virtual void clearSelection ()
virtual void onSelectionBegin (const int x, const int y)
virtual void onSelectionExtend (const int x, const int y)
virtual void setSelection (const BOOL preserve_line_breaks)
void onRcvBlock (const char *txt, int len)

Signals

void sndBlock (const char *txt, int len)
void ImageSizeChanged (int lines, int columns)
void changeColumns (int columns)
void changeTitle (int arg, const char *str)
void sndBlock (const char *txt, int len)
void ImageSizeChanged (int lines, int columns)
void changeColumns (int columns)
void changeTitle (int arg, const char *str)

Public Member Functions

 TEmulation (TEWidget *gui)
 ~TEmulation ()
virtual void setHistory (bool on)
virtual bool history ()
virtual void onRcvChar (int)
virtual void setMode (int)=0
virtual void resetMode (int)=0
virtual void sendString (const char *)=0
virtual void setConnect (bool r)
void setColumns (int columns)
void setKeytrans (int no)
void setKeytrans (const char *no)
 TEmulation (TEWidget *gui)
 ~TEmulation ()
virtual void setHistory (bool on)
virtual bool history ()
virtual void streamHistory (QTextStream *)
virtual void onRcvChar (int)
virtual void setMode (int)=0
virtual void resetMode (int)=0
virtual void sendString (const char *)=0
virtual void setConnect (bool r)
void setColumns (int columns)
void setKeytrans (int no)
void setKeytrans (const char *no)

Protected Member Functions

void setScreen (int n)
void setCodec (int c)
void setScreen (int n)
void setCodec (int c)

Protected Attributes

TEWidgetgui
TEScreenscr
TEScreenscreen [2]
bool connected
QTextCodeccodec
QTextCodeclocaleCodec
QTextDecoderdecoder
KeyTranskeytrans
TEWidgetgui
TEScreenscr
TEScreenscreen [2]
QTextCodeccodec
QTextCodeclocaleCodec
QTextDecoderdecoder
KeyTranskeytrans

Private Slots

void showBulk ()
void showBulk ()

Private Member Functions

void bulkNewline ()
void bulkStart ()
void bulkEnd ()
void bulkNewline ()
void bulkStart ()
void bulkEnd ()

Private Attributes

QTimer bulk_timer
int bulk_nlcnt
char * SelectedText
int bulk_incnt
char * SelectedText

Detailed Description

Mediator between TEWidget and TEScreen.

This class is responsible to scan the escapes sequences of the terminal emulation and to map it to their corresponding semantic complements. Thus this module knows mainly about decoding escapes sequences and is a stateless device w.r.t. the semantics.

It is also responsible to refresh the TEWidget by certain rules.

See also:
TEWidget

TEScreen

A note on refreshing
Although the modifications to the current screen image could immediately be propagated via `TEWidget' to the graphical surface, we have chosen another way here.

The reason for doing so is twofold.

First, experiments show that directly displaying the operation results in slowing down the overall performance of emulations. Displaying individual characters using X11 creates a lot of overhead.

Second, by using the following refreshing method, the screen operations can be completely separated from the displaying. This greatly simplifies the programmer's task of coding and maintaining the screen operations, since one need not worry about differential modifications on the display affecting the operation of concern.

We use a refreshing algorithm here that has been adoped from rxvt/kvt.

By this, refreshing is driven by a timer, which is (re)started whenever a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger refresh. This rule suits both bulk display operation as done by curses as well as individual characters typed. (BULK_TIMEOUT < 1000 / max characters received from keyboard per second).

Additionally, we trigger refreshing by newlines comming in to make visual snapshots of lists as produced by `cat', `ls' and likely programs, thereby producing the illusion of a permanent and immediate display operation.

As a sort of catch-all needed for cases where none of the above conditions catch, the screen refresh is also triggered by a count of incoming bulks (`bulk_incnt').

Definition at line 29 of file TEmulation.h.


Constructor & Destructor Documentation

TEmulation::TEmulation TEWidget gui  ) 
 

Definition at line 89 of file TEmulation.cpp.

References bulk_incnt, bulk_nlcnt, bulk_timer, clearSelection(), TEWidget::Columns(), connected, FALSE, TEWidget::Lines(), onHistoryCursorChange(), onHorzCursorChange(), onImageSizeChange(), onKeyPress(), onSelectionBegin(), onSelectionExtend(), scr, screen, setSelection(), and showBulk().

TEmulation::~TEmulation  ) 
 

Definition at line 132 of file TEmulation.cpp.

References bulk_timer, and screen.

TEmulation::TEmulation TEWidget gui  ) 
 

TEmulation::~TEmulation  ) 
 


Member Function Documentation

void TEmulation::bulkEnd  )  [private]
 

void TEmulation::bulkEnd  )  [private]
 

Definition at line 322 of file TEmulation.cpp.

References bulk_incnt, bulk_nlcnt, BULK_TIMEOUT, bulk_timer, gui, TEWidget::Lines(), showBulk(), and TRUE.

Referenced by onRcvBlock().

void TEmulation::bulkNewline  )  [private]
 

void TEmulation::bulkNewline  )  [private]
 

called when
comes in. Evtl. triggers showBulk at endBulk

Definition at line 290 of file TEmulation.cpp.

References bulk_incnt, and bulk_nlcnt.

Referenced by onRcvBlock().

void TEmulation::bulkStart  )  [private]
 

void TEmulation::bulkStart  )  [private]
 

Definition at line 317 of file TEmulation.cpp.

References bulk_timer.

Referenced by onRcvBlock().

void TEmulation::changeColumns int  columns  )  [signal]
 

void TEmulation::changeColumns int  columns  )  [signal]
 

Referenced by setColumns().

void TEmulation::changeTitle int  arg,
const char *  str
[signal]
 

void TEmulation::changeTitle int  arg,
const char *  str
[signal]
 

virtual void TEmulation::clearSelection  )  [virtual, slot]
 

void TEmulation::clearSelection  )  [virtual, slot]
 

Definition at line 276 of file TEmulation.cpp.

References TEScreen::clearSelection(), connected, scr, and showBulk().

Referenced by TEmulation().

virtual bool TEmulation::history  )  [virtual]
 

bool TEmulation::history  )  [virtual]
 

Definition at line 154 of file TEmulation.cpp.

References TEScreen::hasScroll(), and screen.

Referenced by TESession::history().

void TEmulation::ImageSizeChanged int  lines,
int  columns
[signal]
 

void TEmulation::ImageSizeChanged int  lines,
int  columns
[signal]
 

Referenced by onImageSizeChange().

virtual void TEmulation::onHistoryCursorChange int  cursor  )  [virtual, slot]
 

void TEmulation::onHistoryCursorChange int  cursor  )  [virtual, slot]
 

Definition at line 360 of file TEmulation.cpp.

References connected, scr, TEScreen::setHistCursor(), and showBulk().

Referenced by TEmulation().

void TEmulation::onHorzCursorChange int  cursor  )  [virtual, slot]
 

Definition at line 366 of file TEmulation.cpp.

References connected, scr, TEScreen::setHorzCursor(), and showBulk().

Referenced by TEmulation().

virtual void TEmulation::onImageSizeChange int  lines,
int  columns
[virtual, slot]
 

void TEmulation::onImageSizeChange int  lines,
int  columns
[virtual, slot]
 

triggered by image size change of the TEWidget `gui'.

This event is simply propagated to the attached screens and to the related serial line.

Definition at line 352 of file TEmulation.cpp.

References connected, ImageSizeChanged(), TEScreen::resizeImage(), screen, and showBulk().

Referenced by setConnect(), and TEmulation().

virtual void TEmulation::onKeyPress QKeyEvent *   )  [virtual, slot]
 

Reimplemented in TEmuVt102, and TEmuVt102.

void TEmulation::onKeyPress QKeyEvent *   )  [virtual, slot]
 

Reimplemented in TEmuVt102, and TEmuVt102.

Definition at line 216 of file TEmulation.cpp.

References connected, TEScreen::getHistCursor(), TEScreen::getHistLines(), scr, TEScreen::setHistCursor(), and sndBlock().

Referenced by TEmulation().

void TEmulation::onRcvBlock const char *  txt,
int  len
[slot]
 

void TEmulation::onRcvBlock const char *  txt,
int  len
[slot]
 

Definition at line 241 of file TEmulation.cpp.

References bulk_incnt, bulkEnd(), bulkNewline(), bulkStart(), decoder, i, QString::length(), onRcvChar(), and QTextDecoder::toUnicode().

Referenced by EmulationHandler::recv().

virtual void TEmulation::onRcvChar int   )  [virtual]
 

Reimplemented in TEmuVt102, and TEmuVt102.

void TEmulation::onRcvChar int   )  [virtual]
 

Reimplemented in TEmuVt102, and TEmuVt102.

Definition at line 190 of file TEmulation.cpp.

References TEScreen::BackSpace(), TEWidget::Bell(), gui, TEScreen::NewLine(), TEScreen::Return(), scr, TEScreen::ShowCharacter(), and TEScreen::Tabulate().

Referenced by onRcvBlock().

virtual void TEmulation::onSelectionBegin const int  x,
const int  y
[virtual, slot]
 

void TEmulation::onSelectionBegin const int  x,
const int  y
[virtual, slot]
 

Definition at line 258 of file TEmulation.cpp.

References connected, scr, TEScreen::setSelBeginXY(), and showBulk().

Referenced by TEmulation().

virtual void TEmulation::onSelectionExtend const int  x,
const int  y
[virtual, slot]
 

void TEmulation::onSelectionExtend const int  x,
const int  y
[virtual, slot]
 

Definition at line 264 of file TEmulation.cpp.

References connected, scr, TEScreen::setSelExtentXY(), and showBulk().

Referenced by TEmulation().

virtual void TEmulation::resetMode int   )  [pure virtual]
 

Implemented in TEmuVt102, and TEmuVt102.

virtual void TEmulation::resetMode int   )  [pure virtual]
 

Implemented in TEmuVt102, and TEmuVt102.

virtual void TEmulation::sendString const char *   )  [pure virtual]
 

Implemented in TEmuVt102, and TEmuVt102.

virtual void TEmulation::sendString const char *   )  [pure virtual]
 

Implemented in TEmuVt102, and TEmuVt102.

void TEmulation::setCodec int  c  )  [protected]
 

void TEmulation::setCodec int  c  )  [protected]
 

Definition at line 159 of file TEmulation.cpp.

References codec, QTextCodec::codecForLocale(), QTextCodec::codecForName(), decoder, and QTextCodec::makeDecoder().

Referenced by TEmuVt102::reset(), and TEmuVt102::tau().

void TEmulation::setColumns int  columns  ) 
 

void TEmulation::setColumns int  columns  ) 
 

Definition at line 372 of file TEmulation.cpp.

References changeColumns().

Referenced by TEmuVt102::tau().

virtual void TEmulation::setConnect bool  r  )  [virtual]
 

Reimplemented in TEmuVt102, and TEmuVt102.

void TEmulation::setConnect bool  r  )  [virtual]
 

Reimplemented in TEmuVt102, and TEmuVt102.

Definition at line 330 of file TEmulation.cpp.

References TEScreen::clearSelection(), TEWidget::Columns(), connected, gui, TEWidget::Lines(), onImageSizeChange(), scr, and showBulk().

Referenced by EmulationHandler::EmulationHandler(), TEmuVt102::setConnect(), and TESession::setConnect().

virtual void TEmulation::setHistory bool  on  )  [virtual]
 

void TEmulation::setHistory bool  on  )  [virtual]
 

Definition at line 147 of file TEmulation.cpp.

References connected, screen, TEScreen::setScroll(), and showBulk().

Referenced by EmulationHandler::EmulationHandler(), and TESession::setHistory().

void TEmulation::setKeytrans const char *  no  ) 
 

void TEmulation::setKeytrans int  no  ) 
 

void TEmulation::setKeytrans const char *  no  ) 
 

Definition at line 173 of file TEmulation.cpp.

References KeyTrans::find(), and keytrans.

void TEmulation::setKeytrans int  no  ) 
 

Definition at line 168 of file TEmulation.cpp.

References KeyTrans::find(), and keytrans.

Referenced by EmulationHandler::load(), TEmuVt102::reset(), and TESession::setKeymapNo().

virtual void TEmulation::setMode int   )  [pure virtual]
 

Implemented in TEmuVt102, and TEmuVt102.

virtual void TEmulation::setMode int   )  [pure virtual]
 

Implemented in TEmuVt102, and TEmuVt102.

void TEmulation::setScreen int  n  )  [protected]
 

void TEmulation::setScreen int  n  )  [protected]
 

change between primary and alternate screen

Definition at line 142 of file TEmulation.cpp.

References scr, and screen.

Referenced by TEmuVt102::resetMode(), and TEmuVt102::setMode().

virtual void TEmulation::setSelection const BOOL  preserve_line_breaks  )  [virtual, slot]
 

void TEmulation::setSelection const BOOL  preserve_line_breaks  )  [virtual, slot]
 

Definition at line 270 of file TEmulation.cpp.

References connected, TEScreen::getSelText(), gui, QString::isNull(), scr, TEWidget::setSelection(), and t.

Referenced by TEmulation().

void TEmulation::showBulk  )  [private, slot]
 

void TEmulation::showBulk  )  [private, slot]
 

Definition at line 299 of file TEmulation.cpp.

References bulk_incnt, bulk_nlcnt, connected, TEScreen::getColumns(), TEScreen::getCookedImage(), TEScreen::getHistCursor(), TEScreen::getHistLines(), TEScreen::getLines(), gui, image, scr, TEWidget::setImage(), and TEWidget::setScroll().

Referenced by bulkEnd(), clearSelection(), onHistoryCursorChange(), onHorzCursorChange(), onImageSizeChange(), onSelectionBegin(), onSelectionExtend(), setConnect(), setHistory(), and TEmulation().

void TEmulation::sndBlock const char *  txt,
int  len
[signal]
 

void TEmulation::sndBlock const char *  txt,
int  len
[signal]
 

Referenced by TEmuVt102::onKeyPress(), onKeyPress(), and TEmuVt102::sendString().

void TEmulation::streamHistory QTextStream  )  [virtual]
 

Definition at line 272 of file TEmulation.cpp.

References TEScreen::getHistory(), and scr.


Member Data Documentation

int TEmulation::bulk_incnt [private]
 

Definition at line 117 of file TEmulation.h.

Referenced by bulkEnd(), bulkNewline(), onRcvBlock(), showBulk(), and TEmulation().

int TEmulation::bulk_nlcnt [private]
 

Definition at line 115 of file TEmulation.h.

Referenced by bulkEnd(), bulkNewline(), showBulk(), and TEmulation().

QTimer TEmulation::bulk_timer [private]
 

Definition at line 114 of file TEmulation.h.

Referenced by bulkEnd(), bulkStart(), TEmulation(), and ~TEmulation().

QTextCodec* TEmulation::codec [protected]
 

Definition at line 94 of file TEmulation.h.

QTextCodec* TEmulation::codec [protected]
 

Definition at line 90 of file TEmulation.h.

Referenced by TEmuVt102::onKeyPress(), and setCodec().

bool TEmulation::connected [protected]
 

Definition at line 90 of file TEmulation.h.

Referenced by clearSelection(), onHistoryCursorChange(), onHorzCursorChange(), onImageSizeChange(), TEmuVt102::onKeyPress(), onKeyPress(), TEmuVt102::onMouse(), onSelectionBegin(), onSelectionExtend(), setConnect(), setHistory(), setSelection(), showBulk(), and TEmulation().

QTextDecoder* TEmulation::decoder [protected]
 

Definition at line 96 of file TEmulation.h.

QTextDecoder* TEmulation::decoder [protected]
 

Definition at line 92 of file TEmulation.h.

Referenced by onRcvBlock(), and setCodec().

TEWidget* TEmulation::gui [protected]
 

Definition at line 85 of file TEmulation.h.

TEWidget* TEmulation::gui [protected]
 

Definition at line 81 of file TEmulation.h.

Referenced by bulkEnd(), TEmuVt102::onKeyPress(), onRcvChar(), TEmuVt102::resetMode(), setConnect(), TEmuVt102::setMode(), setSelection(), showBulk(), and TEmuVt102::tau().

KeyTrans* TEmulation::keytrans [protected]
 

Definition at line 98 of file TEmulation.h.

KeyTrans* TEmulation::keytrans [protected]
 

Definition at line 94 of file TEmulation.h.

Referenced by TEmuVt102::onKeyPress(), and setKeytrans().

QTextCodec* TEmulation::localeCodec [protected]
 

Definition at line 95 of file TEmulation.h.

QTextCodec* TEmulation::localeCodec [protected]
 

Definition at line 91 of file TEmulation.h.

TEScreen* TEmulation::scr [protected]
 

Definition at line 86 of file TEmulation.h.

TEScreen* TEmulation::scr [protected]
 

Definition at line 82 of file TEmulation.h.

Referenced by clearSelection(), onHistoryCursorChange(), onHorzCursorChange(), TEmuVt102::onKeyPress(), onKeyPress(), onRcvChar(), onSelectionBegin(), onSelectionExtend(), TEmuVt102::reportCursorPosition(), TEmuVt102::restoreCursor(), TEmuVt102::saveCursor(), setConnect(), setScreen(), setSelection(), showBulk(), streamHistory(), TEmuVt102::tau(), and TEmulation().

TEScreen* TEmulation::screen[2] [protected]
 

Definition at line 87 of file TEmulation.h.

TEScreen* TEmulation::screen[2] [protected]
 

Definition at line 83 of file TEmulation.h.

Referenced by history(), onImageSizeChange(), TEmuVt102::reset(), TEmuVt102::resetMode(), setHistory(), TEmuVt102::setMode(), setScreen(), TEmulation(), and ~TEmulation().

char* TEmulation::SelectedText [private]
 

Definition at line 116 of file TEmulation.h.

char* TEmulation::SelectedText [private]
 

Definition at line 112 of file TEmulation.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:53:30 2005 for OPIE by  doxygen 1.4.2