|
Q3270
A Qt-based 3270 Terminal Emulator
|
Keyboard::Keyboard - Keyboard input processing. More...
#include <Keyboard.h>
Public Slots | |
| void | setConnected (bool state) |
| Keyboard::setConnected - invoked when connection status changes. | |
| void | setMap (const KeyboardMap &kmap) |
| Keyboard::setMap - set a keyboard map. | |
Public Member Functions | |
| Keyboard () | |
| Keyboard::Keyboard - constructor. | |
| bool | processKey () |
| Keyboard::processKey. | |
| void | invoke (const QString &functionName) |
| void | setLocked (const bool locked) |
Static Public Member Functions | |
| static QStringList | allFunctionNames () |
| Keyboard::allFunctionNames - return a list of all function names. | |
Protected Member Functions | |
| bool | eventFilter (QObject *dist, QEvent *event) |
| Keyboard::eventFilter - process keyboard events. | |
Keyboard::Keyboard - Keyboard input processing.
The Keyboard class is how the keyboard is mapped to various 3270 and Q3270 functions. Each function has a name, and can be mapped to a key. There are 4 maps defined, one for normal, one for Shift, one for Ctrl and one for Alt (or Meta, depending). Keyboards can be mapped through the KeyboardTheme class to store user-defined maps. An internal Factory map which is set in here is the default and cannot be updated by the user.
Keyboard also handles type-ahead for when the host is still busy, but the user wants to continue typing to fill in the next field or enter the next command etc.
The Keyboard function map is held as a QMap with the name of the Qt key ("Enter", etc) and the target routine (Keyboard::enter, for example). If a key is pressed that doesn't generate a normal character, the function map is searched for a matching entry, and if found, called.
| Keyboard::Keyboard | ( | ) |
Keyboard::Keyboard - constructor.
Keyboard initializes the keyboard state, and sets the default keyboard map to the factory map.
|
static |
Keyboard::allFunctionNames - return a list of all function names.
Keyboard::allFunctionNames returns a list of all function names. This is used to populate the list of functions that can be mapped in the keyboard mapping dialog.
|
protected |
Keyboard::eventFilter - process keyboard events.
| dist | |
| event |
The eventFilter is used to handle keyboard events. Depending on the key being pressed, the event can be processed immediately (as in the case of a normal character) or it may be deferred until the key is released (as in the case of, say, CTRL).
CTRL needs to be deferred because it may be used as the mapping for Enter, as well as being used for Copy (CTRL-C).
| bool Keyboard::processKey | ( | ) |
processKey determines whether the current keyboard buffer position contains a key that doesn't need to be mapped (as in the case of a standard character key) or whether it is mapped to a Q3270 function, and whether they key must be mapped for it to make sense.
If the keyboard map contains a mapping for the key, the target function of the key is stored in the keyboard buffer, to be processed later by nextKey().
Eg, if the Home key is pressed, that must be mapped to a Q3270 function for it to be processed, but if it isn't mapped, the key is ignored.
The key is stored in the keyboard buffer, and if the key can be processed immediately, nextKey is called, but if the keyboard is locked, the current buffer position is incremented so that the next key can be stored.
The buffer is a wrap-around buffer.
If the key is processed or stored in the buffer, processKey returns true, otherwise it returns false.
|
slot |
Keyboard::setConnected - invoked when connection status changes.
| state | - true for connected, false for not |
setConnected is triggered when the connection is opened or closed so Keyboard knows when to process keys.
|
slot |
Keyboard::setMap - set a keyboard map.
| kmap | - the keyboard map |
setTheme takes a keyboard map and sets up the mappings of keys to functions. Keyboard maps are defined as QMap<QString, QStringList>; each function can have multiple keys assigned to it (e.g. F8 and PgDown are both defined to call F8 by default).