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...
#include "KeyboardTranslator.h"
Public Member Functions | |
Entry () | |
Constructs a new entry for a keyboard translator. More... | |
Command | command () const |
Returns the commands associated with this entry. More... | |
QString | conditionToString () const |
Returns the key code and modifiers associated with this entry as a QKeySequence. More... | |
QByteArray | escapedText (bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const |
Returns the character sequence associated with this entry, with any non-printable characters replaced with escape sequences. More... | |
bool | isNull () const |
Returns true if this entry is null. More... | |
int | keyCode () const |
Returns the character code ( from the Qt::Key enum ) associated with this entry. More... | |
bool | matches (int keyCode, Qt::KeyboardModifiers modifiers, States flags) const |
Returns true if this entry matches the given key sequence, specified as a combination of keyCode , modifiers and state . More... | |
Qt::KeyboardModifiers | modifierMask () const |
Returns the keyboard modifiers which are valid in this entry. More... | |
Qt::KeyboardModifiers | modifiers () const |
Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry. More... | |
bool | operator== (const Entry &rhs) const |
QString | resultToString (bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const |
Returns this entry's result ( ie. More... | |
void | setCommand (Command command) |
Sets the command associated with this entry. More... | |
void | setKeyCode (int keyCode) |
Sets the character code associated with this entry. More... | |
void | setModifierMask (Qt::KeyboardModifiers modifiers) |
See modifierMask() and modifiers() More... | |
void | setModifiers (Qt::KeyboardModifiers modifiers) |
See modifiers() More... | |
void | setState (States state) |
See state() More... | |
void | setStateMask (States mask) |
See stateMask() More... | |
void | setText (const QByteArray &text) |
Sets the character sequence associated with this entry. More... | |
States | state () const |
Returns a bitwise-OR of the enabled state flags associated with this entry. More... | |
States | stateMask () const |
Returns the state flags which are valid in this entry. More... | |
QByteArray | text (bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const |
Returns the character sequence associated with this entry, optionally replacing wildcard '*' characters with numbers to indicate the keyboard modifiers being pressed. More... | |
Private Member Functions | |
void | insertModifier (QString &item, int modifier) const |
void | insertState (QString &item, int state) const |
QByteArray | unescape (const QByteArray &text) const |
Private Attributes | |
Command | _command |
int | _keyCode |
Qt::KeyboardModifiers | _modifierMask |
Qt::KeyboardModifiers | _modifiers |
States | _state |
States | _stateMask |
QByteArray | _text |
Represents an association between a key sequence pressed by the user and the character sequence and commands associated with it for a particular KeyboardTranslator.
Definition at line 196 of file KeyboardTranslator.h.
KeyboardTranslator::Entry::Entry | ( | ) |
Constructs a new entry for a keyboard translator.
Definition at line 576 of file KeyboardTranslator.cpp.
|
inline |
Returns the commands associated with this entry.
Definition at line 608 of file KeyboardTranslator.h.
Referenced by Vt102Emulation::sendKeyEvent(), and KeyboardTranslatorWriter::writeEntry().
QString KeyboardTranslator::Entry::conditionToString | ( | ) | const |
Returns the key code and modifiers associated with this entry as a QKeySequence.
Returns this entry's conditions ( ie. its key code, modifier and state criteria ) as a string.
Definition at line 782 of file KeyboardTranslator.cpp.
References KeyboardTranslator::AlternateScreenState, KeyboardTranslator::AnsiState, KeyboardTranslator::AnyModifierState, KeyboardTranslator::CursorKeysState, and KeyboardTranslator::NewLineState.
Referenced by KeyboardTranslatorWriter::writeEntry().
QByteArray KeyboardTranslator::Entry::escapedText | ( | bool | expandWildCards = false , |
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) | const |
Returns the character sequence associated with this entry, with any non-printable characters replaced with escape sequences.
eg. \E for Escape, \t for tab, \n for new line.
Definition at line 630 of file KeyboardTranslator.cpp.
|
private |
Definition at line 721 of file KeyboardTranslator.cpp.
|
private |
Definition at line 742 of file KeyboardTranslator.cpp.
References KeyboardTranslator::AlternateScreenState, KeyboardTranslator::AnsiState, KeyboardTranslator::AnyModifierState, KeyboardTranslator::CursorKeysState, KeyboardTranslator::NewLineState, and octave::state.
|
inline |
Returns true if this entry is null.
This is true for newly constructed entries which have no properties set.
Definition at line 599 of file KeyboardTranslator.h.
Referenced by KeyboardTranslator::replaceEntry().
|
inline |
Returns the character code ( from the Qt::Key enum ) associated with this entry.
Definition at line 584 of file KeyboardTranslator.h.
References _keyCode.
Referenced by KeyboardTranslator::addEntry(), KeyboardTranslator::removeEntry(), and KeyboardTranslator::replaceEntry().
bool KeyboardTranslator::Entry::matches | ( | int | keyCode, |
Qt::KeyboardModifiers | modifiers, | ||
States | flags | ||
) | const |
Returns true if this entry matches the given key sequence, specified as a combination of keyCode
, modifiers
and state
.
Definition at line 597 of file KeyboardTranslator.cpp.
References KeyboardTranslator::AnyModifierState, and octave::state.
|
inline |
Returns the keyboard modifiers which are valid in this entry.
See modifiers()
Definition at line 597 of file KeyboardTranslator.h.
Referenced by Vt102Emulation::sendKeyEvent().
|
inline |
Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry.
If a modifier is set in modifierMask() but not in modifiers(), this means that the entry only matches when that modifier is NOT pressed.
If a modifier is not set in modifierMask() then the entry matches whether the modifier is pressed or not.
Definition at line 591 of file KeyboardTranslator.h.
Referenced by Vt102Emulation::sendKeyEvent().
bool KeyboardTranslator::Entry::operator== | ( | const Entry & | rhs | ) | const |
Definition at line 586 of file KeyboardTranslator.cpp.
References _command, _keyCode, _modifierMask, _modifiers, _state, _stateMask, and _text.
QString KeyboardTranslator::Entry::resultToString | ( | bool | expandWildCards = false , |
Qt::KeyboardModifiers | modifiers = Qt::NoModifier |
||
) | const |
Returns this entry's result ( ie.
its command or character sequence ) as a string.
Definition at line 763 of file KeyboardTranslator.cpp.
References KeyboardTranslator::EraseCommand, KeyboardTranslator::ScrollLineDownCommand, KeyboardTranslator::ScrollLineUpCommand, KeyboardTranslator::ScrollLockCommand, KeyboardTranslator::ScrollPageDownCommand, and KeyboardTranslator::ScrollPageUpCommand.
Referenced by KeyboardTranslatorWriter::writeEntry().
|
inline |
Sets the command associated with this entry.
Definition at line 604 of file KeyboardTranslator.h.
Referenced by KeyboardTranslatorReader::readNext().
|
inline |
Sets the character code associated with this entry.
Definition at line 585 of file KeyboardTranslator.h.
Referenced by KeyboardTranslatorReader::readNext().
|
inline |
See modifierMask() and modifiers()
Definition at line 593 of file KeyboardTranslator.h.
Referenced by KeyboardTranslatorReader::readNext().
|
inline |
See modifiers()
Definition at line 587 of file KeyboardTranslator.h.
Referenced by KeyboardTranslatorReader::readNext().
|
inline |
See state()
Definition at line 639 of file KeyboardTranslator.h.
References octave::state.
Referenced by KeyboardTranslatorReader::readNext().
|
inline |
See stateMask()
Definition at line 645 of file KeyboardTranslator.h.
Referenced by KeyboardTranslatorReader::readNext().
|
inline |
Sets the character sequence associated with this entry.
Definition at line 610 of file KeyboardTranslator.h.
Referenced by KeyboardTranslatorReader::readNext().
|
inline |
Returns a bitwise-OR of the enabled state flags associated with this entry.
If flag is set in stateMask() but not in state(), this means that the entry only matches when the terminal is NOT in that state.
If a state is not set in stateMask() then the entry matches whether the terminal is in that state or not.
Definition at line 643 of file KeyboardTranslator.h.
Referenced by Vt102Emulation::sendKeyEvent().
|
inline |
Returns the state flags which are valid in this entry.
See state()
Definition at line 649 of file KeyboardTranslator.h.
Referenced by Vt102Emulation::sendKeyEvent().
|
inline |
Returns the character sequence associated with this entry, optionally replacing wildcard '*' characters with numbers to indicate the keyboard modifiers being pressed.
TODO: The numbers used to replace '*' characters are taken from the Konsole/KDE 3 code. Document them.
expandWildCards | Specifies whether wild cards (occurrences of the '*' character) in the entry should be replaced with a number to indicate the modifier keys being pressed. |
modifiers | The keyboard modifiers being pressed. |
Definition at line 618 of file KeyboardTranslator.h.
References oneOrZero().
Referenced by Vt102Emulation::getErase(), and Vt102Emulation::sendKeyEvent().
|
private |
Definition at line 667 of file KeyboardTranslator.cpp.
|
private |
Definition at line 329 of file KeyboardTranslator.h.
Referenced by operator==().
|
private |
Definition at line 323 of file KeyboardTranslator.h.
Referenced by keyCode(), and operator==().
|
private |
Definition at line 325 of file KeyboardTranslator.h.
Referenced by operator==().
|
private |
Definition at line 324 of file KeyboardTranslator.h.
Referenced by operator==().
|
private |
Definition at line 326 of file KeyboardTranslator.h.
Referenced by operator==().
|
private |
Definition at line 327 of file KeyboardTranslator.h.
Referenced by operator==().
|
private |
Definition at line 330 of file KeyboardTranslator.h.
Referenced by operator==().