36 #include <QApplication>
38 #include <QtCore/QHash>
40 #include <QtCore/QRegExp>
41 #include <QtCore/QTextStream>
42 #include <QtCore/QThread>
44 #include <QtCore/QTime>
89 connect(window , SIGNAL(selectionChanged()),
93 window , SLOT(notifyOutputChanged()) );
102 QListIterator<ScreenWindow*> windowIter(
_windows);
104 while (windowIter.hasNext())
106 delete windowIter.next();
126 QListIterator<ScreenWindow*> windowIter(
_windows);
127 while ( windowIter.hasNext() )
164 setCodec( QTextCodec::codecForName(
"utf8") );
166 setCodec( QTextCodec::codecForLocale() );
222 if (!ev->text().isEmpty())
228 emit
sendData(ev->text().toUtf8(),ev->text().length());
255 QString unicodeText =
_decoder->toUnicode(text,length);
258 for (
int i=0;i<unicodeText.length();i++)
281 #define BULK_TIMEOUT1 10
282 #define BULK_TIMEOUT2 40
316 Q_ASSERT( lines > 0 );
317 Q_ASSERT( columns > 0 );
335 for ( ushort i = 0 ; i <
length ; i++ )
337 hash = 31*hash + unicodePoints[i];
347 if ( entry == 0 || entry[0] != length )
351 for (
int i = 0 ; i <
length ; i++ )
353 if ( entry[i+1] != unicodePoints[i] )
383 ushort* buffer =
new ushort[length+1];
385 for (
int i = 0 ; i <
length ; i++ )
386 buffer[i+1] = unicodePoints[i];
418 while ( iter.hasNext() )
421 delete[] iter.value();
The terminal program has triggered a bell event to get the user's attention.
void resetScrolledLines()
Resets the count of the number of lines that the image has been scrolled up or down by...
Provides a window onto a section of a terminal screen.
void setScroll(const HistoryType &, bool copyPreviousScroll=true)
Sets the type of storage used to keep lines in the history.
void outputChanged()
Emitted when the contents of the screen image change.
void setScreen(Screen *screen)
Sets the screen which this window looks onto.
void setScreen(int index)
Sets the active screen.
void Tabulate(int n=1)
Moves the cursor n tab-stops to the right.
void bufferedUpdate()
Schedules an update of attached views.
An image of characters with associated attributes.
int getLines()
Return the number of lines.
int getColumns()
Return the number of columns.
ushort extendedCharHash(ushort *unicodePoints, ushort length) const
QList< ScreenWindow * > _windows
virtual void setImageSize(int lines, int columns)
Change the size of the emulation's image.
QSize imageSize()
Returns the size of the screen image which the emulation produces.
The emulation is currently receiving data from its terminal input.
void sendData(const char *data, int len)
Emitted when a buffer of data is ready to send to the standard input of the terminal.
void BackSpace()
Moves the cursor one column to the left and erases the character at the new cursor position...
int lineCount()
Returns the total number of lines, including those stored in the history.
ushort createExtendedChar(ushort *unicodePoints, ushort length)
Adds a sequences of unicode characters to the table and returns a hash code which can be used later t...
void Return()
Moves the cursor to the beginning of the current line.
void NewLine()
Moves the cursor down one line, if the MODE_NewLine mode flag is enabled then the cursor is returned ...
QHash< ushort, ushort * > extendedCharTable
virtual void writeToStream(TerminalCharacterDecoder *decoder, int startLine, int endLine)
Copies the output history from startLine to endLine into stream, using decoder to convert the termina...
void resizeImage(int new_lines, int new_columns)
Resizes the image to a new fixed size of new_lines by new_columns.
bool programUsesMouse() const
Returns true if the active terminal program wants mouse input events.
void programUsesMouseChanged(bool usesMouse)
This is emitted when the program running in the shell indicates whether or not it is interested in mo...
QString keyBindings()
Returns the name of the emulation's current key bindings.
const KeyboardTranslator * findTranslator(const QString &name)
Returns the keyboard translator with the given name or 0 if no translator with that name exists...
void useUtf8Request(bool)
Requests that the pty used by the terminal process be set to UTF 8 mode.
ExtendedCharTable()
Constructs a new character table.
void stateSet(int state)
Emitted when the activity state of the emulation is set.
const QTextCodec * _codec
void clearHistory()
Clears the history scroll.
virtual void sendKeyEvent(QKeyEvent *)
Interprets a key press event and emits the sendData() signal with the resulting character stream...
A table which stores sequences of unicode characters, referenced by hash keys.
virtual void receiveChar(int ch)
Processes an incoming character.
void writeToStream(TerminalCharacterDecoder *decoder, int from, int to)
Copies part of the output to a stream.
virtual char getErase() const
TODO Document me.
bool extendedCharMatch(ushort hash, ushort *unicodePoints, ushort length) const
Emulation()
Constructs a new terminal emulation.
const HistoryType & history()
Returns the history store used by this emulation.
virtual void sendMouseEvent(int buttons, int column, int line, int eventType)
Converts information about a mouse event into an xterm-compatible escape sequence and emits the chara...
static KeyboardTranslatorManager * instance()
Returns the global KeyboardTranslatorManager instance.
ushort * lookupExtendedChar(ushort hash, ushort &length) const
Looks up and returns a pointer to a sequence of unicode characters which was added to the table using...
void resetDroppedLines()
Resets the count of the number of lines dropped from the history.
void setBusySelecting(bool busy)
virtual void sendString(const char *string, int length=-1)=0
Sends a string of characters to the foreground terminal process.
ScreenWindow * createWindow()
Creates a new window onto the output from this emulation.
Base class for terminal character decoders.
QString name() const
Returns the name of this keyboard translator.
const KeyboardTranslator * _keyTranslator
const HistoryType & getScroll()
Returns the type of storage used to keep lines in the history.
void setCodec(const QTextCodec *)
Sets the codec used to decode incoming characters.
The emulation is currently receiving user input.
void imageSizeChanged(int lineCount, int columnCount)
Emitted when the program running in the terminal changes the screen size.
static ExtendedCharTable instance
The global ExtendedCharTable instance.
void receiveData(const char *buffer, int len)
Processes an incoming stream of characters.
void setHistory(const HistoryType &)
Sets the history store used by this emulation.
void setKeyBindings(const QString &name)
Sets the key bindings used to key events ( received through sendKeyEvent() ) into character streams t...
bool utf8()
Convenience method.
void ShowCharacter(unsigned short c)
Displays a new character at the current cursor position.
int getHistLines()
Return the number of lines in the history buffer.
void usesMouseChanged(bool usesMouse)