36 #include <QApplication> 38 #include <QtCore/QHash> 40 #include <QtCore/QRegExp> 41 #include <QtCore/QTextStream> 42 #include <QtCore/QThread> 44 #include <QtCore/QTime> 53 _currentScreen(nullptr),
56 _keyTranslator(nullptr),
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());
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 );
347 if ( entry ==
nullptr || entry[0] !=
length )
353 if ( entry[
i+1] != unicodePoints[
i] )
383 ushort* buffer =
new ushort[
length+1];
386 buffer[
i+1] = unicodePoints[
i];
418 while ( iter.hasNext() )
421 delete[] iter.value();
ushort extendedCharHash(ushort *unicodePoints, ushort length) const
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.
std::string hash(hash_fptr hash_fcn, const std::string &str, int result_buf_len)
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.
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 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.
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.
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...
numeric fields are padded if necessary Padding is with zeros by default
void Return()
Moves the cursor to the beginning of the current line.
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
void NewLine()
Moves the cursor down one line, if the MODE_NewLine mode flag is enabled then the cursor is returned ...
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
bool extendedCharMatch(ushort hash, ushort *unicodePoints, ushort length) const
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.
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.
const QTextCodec * codec()
Returns the codec used to decode incoming characters.
bool programUsesMouse() const
Returns true if the active terminal program wants mouse input events.
ExtendedCharTable()
Constructs a new character table.
void stateSet(int state)
Emitted when the activity state of the emulation is set.
const QTextCodec * _codec
nd deftypefn *std::string name
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.
The emulation is currently receiving user input.
The terminal program has triggered a bell event to get the user's attention.
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.
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.
const KeyboardTranslator * _keyTranslator
const HistoryType & getScroll()
Returns the type of storage used to keep lines in the history.
The emulation is currently receiving data from its terminal input.
void setCodec(const QTextCodec *)
Sets the codec used to decode incoming characters.
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.
virtual char getErase() const
TODO Document me.
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.
QString name() const
Returns the name of this keyboard translator.
void usesMouseChanged(bool usesMouse)