GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
A convertor which maps between key sequences pressed by the user and the character strings which should be sent to the terminal and commands which should be invoked when those character sequences are pressed. More...
#include "KeyboardTranslator.h"
Classes | |
class | Entry |
Represents an association between a key sequence pressed by the user and the character sequence and commands associated with it for a particular KeyboardTranslator. More... |
Public Types | |
enum | Command { NoCommand = 0, SendCommand = 1, ScrollPageUpCommand = 2, ScrollPageDownCommand = 4, ScrollLineUpCommand = 8, ScrollLineDownCommand = 16, ScrollLockCommand = 32, EraseCommand = 64 } |
This enum describes commands which are associated with particular key sequences. More... | |
enum | State { NoState = 0, NewLineState = 1, AnsiState = 2, CursorKeysState = 4, AlternateScreenState = 8, AnyModifierState = 16 } |
The meaning of a particular key sequence may depend upon the state which the terminal emulation is in. More... |
Public Member Functions | |
KeyboardTranslator (const QString &name) | |
Constructs a new keyboard translator with the given name . | |
void | addEntry (const Entry &entry) |
Adds an entry to this keyboard translator's table. | |
QString | description () const |
Returns the descriptive name of this keyboard translator. | |
QList< Entry > | entries () const |
Returns a list of all entries in the translator. | |
Entry | findEntry (int keyCode, Qt::KeyboardModifiers modifiers, States state=NoState) const |
Looks for an entry in this keyboard translator which matches the given key code, keyboard modifiers and state flags. | |
QString | name () const |
Returns the name of this keyboard translator. | |
void | removeEntry (const Entry &entry) |
Removes an entry from the table. | |
void | replaceEntry (const Entry &existing, const Entry &replacement) |
Replaces an entry in the translator. | |
void | setDescription (const QString &description) |
Sets the descriptive name of this keyboard translator. | |
void | setName (const QString &name) |
Sets the name of this keyboard translator. |
Private Attributes | |
QString | _description |
QHash< int, Entry > | _entries |
QString | _name |
A convertor which maps between key sequences pressed by the user and the character strings which should be sent to the terminal and commands which should be invoked when those character sequences are pressed.
Konsole supports multiple keyboard translators, allowing the user to specify the character sequences which are sent to the terminal when particular key sequences are pressed.
A key sequence is defined as a key code, associated keyboard modifiers (Shift,Ctrl,Alt,Meta etc.) and state flags which indicate the state which the terminal must be in for the key sequence to apply.
Definition at line 126 of file KeyboardTranslator.h.
This enum describes commands which are associated with particular key sequences.
Definition at line 167 of file KeyboardTranslator.h.
The meaning of a particular key sequence may depend upon the state which the terminal emulation is in.
Therefore findEntry() may return a different Entry depending upon the state flags supplied.
This enum describes the states which may be associated with with a particular entry in the keyboard translation entry.
Definition at line 137 of file KeyboardTranslator.h.
KeyboardTranslator::KeyboardTranslator | ( | const QString & | name | ) |
Constructs a new keyboard translator with the given name
.
Definition at line 794 of file KeyboardTranslator.cpp.
Adds an entry to this keyboard translator's table.
Entries can be looked up according to their key sequence using findEntry()
Definition at line 821 of file KeyboardTranslator.cpp.
References _entries, and KeyboardTranslator::Entry::keyCode().
Referenced by KeyboardTranslatorManager::loadTranslator().
QString KeyboardTranslator::description | ( | ) | const |
Returns the descriptive name of this keyboard translator.
Definition at line 803 of file KeyboardTranslator.cpp.
References _description.
Referenced by KeyboardTranslatorManager::saveTranslator(), and setDescription().
QList< KeyboardTranslator::Entry > KeyboardTranslator::entries | ( | ) | const |
Returns a list of all entries in the translator.
Definition at line 816 of file KeyboardTranslator.cpp.
References _entries.
Referenced by KeyboardTranslatorManager::saveTranslator().
KeyboardTranslator::Entry KeyboardTranslator::findEntry | ( | int | keyCode, |
Qt::KeyboardModifiers | modifiers, | ||
States | state = NoState |
||
) | const |
Looks for an entry in this keyboard translator which matches the given key code, keyboard modifiers and state flags.
Returns the matching entry if found or a null Entry otherwise ( ie. entry.isNull() will return true )
keyCode | A key code from the Qt::Key enum |
modifiers | A combination of modifiers |
state | Optional flags which specify the current state of the terminal |
Definition at line 836 of file KeyboardTranslator.cpp.
References _entries, KeyboardTranslator::Entry::matches(), and next.
Referenced by Vt102Emulation::getErase(), and Vt102Emulation::sendKeyEvent().
QString KeyboardTranslator::name | ( | void | ) | const |
Returns the name of this keyboard translator.
Definition at line 811 of file KeyboardTranslator.cpp.
References _name.
Referenced by KeyboardTranslatorManager::addTranslator(), Emulation::keyBindings(), and setName().
Removes an entry from the table.
Definition at line 832 of file KeyboardTranslator.cpp.
References _entries, and KeyboardTranslator::Entry::keyCode().
Replaces an entry in the translator.
If the existing
entry is null, then this is equivalent to calling addEntry(replacement
)
Definition at line 826 of file KeyboardTranslator.cpp.
References _entries, KeyboardTranslator::Entry::isNull(), and KeyboardTranslator::Entry::keyCode().
void KeyboardTranslator::setDescription | ( | const QString & | description | ) |
Sets the descriptive name of this keyboard translator.
Definition at line 799 of file KeyboardTranslator.cpp.
References _description, and description().
Referenced by KeyboardTranslatorManager::loadTranslator().
void KeyboardTranslator::setName | ( | const QString & | name | ) |
Sets the name of this keyboard translator.
Definition at line 807 of file KeyboardTranslator.cpp.
|
private |
Definition at line 388 of file KeyboardTranslator.h.
Referenced by description(), and setDescription().
Definition at line 384 of file KeyboardTranslator.h.
Referenced by addEntry(), entries(), findEntry(), removeEntry(), and replaceEntry().
|
private |
Definition at line 387 of file KeyboardTranslator.h.